Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -224,8 +224,12 @@ const CollectionPage = ({ type }: CollectionPageProps) => {

const isPlayable = !areAllTracksDeleted && numTracks > 0

// Handle deleted collections
if ((metadata?.is_delete || metadata?._marked_deleted) && user) {
// Handle deleted or unavailable collections
if (
metadata &&
user &&
(metadata.is_delete || metadata._marked_deleted || user.is_deactivated)
) {
return (
<DeletedPage
title={title ?? ''}
Expand All @@ -237,6 +241,7 @@ const CollectionPage = ({ type }: CollectionPageProps) => {
type: metadata?.is_album ? PlayableType.ALBUM : PlayableType.PLAYLIST
}}
user={user}
deletedByArtist={!user?.is_deactivated}
/>
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,12 @@ const CollectionPage = ({ type }: CollectionPageProps) => {
const areAllTracksDeleted = trackList.every((track) => track.isDeleted)
const isPlayable = !areAllTracksDeleted && numTracks > 0

// Handle deleted collections
if ((metadata?.is_delete || metadata?._marked_deleted) && user) {
// Handle deleted or unavailable collections
if (
metadata &&
user &&
(metadata.is_delete || metadata._marked_deleted || user.is_deactivated)
) {
return (
<DeletedPage
title={title ?? ''}
Expand All @@ -206,6 +210,7 @@ const CollectionPage = ({ type }: CollectionPageProps) => {
type: metadata?.is_album ? PlayableType.ALBUM : PlayableType.PLAYLIST
}}
user={user}
deletedByArtist={!user?.is_deactivated}
/>
)
}
Expand Down
9 changes: 1 addition & 8 deletions packages/web/src/pages/collection-page/useCollectionPage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ import {
UserListEntityType
} from 'store/application/ui/userListModal/types'
import { replace } from 'utils/navigation'
import { getPathname, collectionPage, profilePage } from 'utils/route'
import { getPathname, collectionPage } from 'utils/route'
import { parseCollectionRoute } from 'utils/route/collectionRouteParser'

const { NOT_FOUND_PAGE, REPOSTING_USERS_ROUTE, FAVORITING_USERS_ROUTE } = route
Expand Down Expand Up @@ -240,13 +240,6 @@ export const useCollectionPage = (
}
}, [status, params, playlistId, collection, accountUserId, navigate])

// Redirect if user deactivated
useEffect(() => {
if (user?.is_deactivated) {
navigate(profilePage(user.handle))
}
}, [user, navigate])

// Handle collection moved
useEffect(() => {
if (!collection || updatingRoute || !collection._moved) return
Expand Down
15 changes: 13 additions & 2 deletions packages/web/src/pages/deleted-page/DeletedPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@ import { useIsMobile } from 'hooks/useIsMobile'
import DeletedPageDesktopContent from './components/desktop/DeletedPage'
import DeletedPageMobileContent from './components/mobile/DeletedPage'

export type DeletedPageHelpLink = {
href: string
text: string
}

type DeletedPageProps = {
title: string
description: string
Expand All @@ -13,6 +18,8 @@ type DeletedPageProps = {
playable: Playable
user: User
deletedByArtist?: boolean
helpLink?: DeletedPageHelpLink
secondaryHelpLink?: DeletedPageHelpLink
}

const DeletedPage = ({
Expand All @@ -22,7 +29,9 @@ const DeletedPage = ({
structuredData,
playable,
user,
deletedByArtist = true
deletedByArtist = true,
helpLink,
secondaryHelpLink
}: DeletedPageProps) => {
const isMobile = useIsMobile()

Expand All @@ -33,7 +42,9 @@ const DeletedPage = ({
structuredData,
playable,
user,
deletedByArtist
deletedByArtist,
helpLink,
secondaryHelpLink
}

return isMobile ? (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@
.rightSide {
display: flex;
flex-direction: column;
justify-content: space-between;
justify-content: flex-start;
gap: 10px;
padding: 24px;
flex-grow: 1;
}
Expand All @@ -50,14 +51,14 @@

user-select: none;
text-transform: uppercase;
margin-bottom: 24px;
margin-bottom: 0;
}

.title {
color: var(--harmony-neutral);
font-size: 38px;
font-weight: bold;
margin-bottom: 12px;
margin-bottom: 0;
width: 100%;
position: relative;
min-height: 38px;
Expand All @@ -75,7 +76,7 @@
align-items: center;
width: 100%;
position: relative;
margin-bottom: 24px;
margin-bottom: 0;
}

.artistWrapper :global(.artistPopover) {
Expand Down Expand Up @@ -117,3 +118,10 @@
.verified {
margin-left: 4px;
}

.helpLinks {
display: flex;
flex-direction: column;
gap: 8px;
margin-top: 4px;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
playerSelectors
} from '@audius/common/store'
import { route, NestedNonNullable } from '@audius/common/utils'
import { Button, IconUser, Flex } from '@audius/harmony'
import { Flex, TextLink } from '@audius/harmony'
import { useDispatch, useSelector } from 'react-redux'

import { ArtistPopover } from 'components/artist/ArtistPopover'
Expand Down Expand Up @@ -44,11 +44,13 @@ const { makeGetLineupMetadatas } = lineupSelectors

const messages = {
trackDeleted: 'Track [Deleted]',
trackDeletedByArtist: 'Track [Deleted By Artist]',
playlistDeleted: 'Playlist [Deleted by Artist]',
albumDeleted: 'Album [Deleted By Artist]',
checkOut: (name: string) => `Check out more by ${name}`,
moreBy: (name: string) => `More by ${name}`
trackDeletedByArtist: 'Track [Removed By User]',
playlistDeleted: 'Playlist [Deleted]',
playlistDeletedByArtist: 'Playlist [Removed By User]',
albumDeleted: 'Album [Deleted]',
albumDeletedByArtist: 'Album [Removed By User]',
moreBy: (name: string) => `More by ${name}`,
helpCenter: 'Visit Audius Help Center'
}

const TrackArt = ({ trackId }: { trackId: ID }) => {
Expand All @@ -75,6 +77,8 @@ export type DeletedPageProps = {
deletedByArtist: boolean
playable: Playable
user: User
helpLink?: { href: string; text: string }
secondaryHelpLink?: { href: string; text: string }
}

const g = withNullGuard(
Expand All @@ -95,7 +99,9 @@ const DeletedPage = g(
structuredData,
playable,
user,
deletedByArtist = true
deletedByArtist = true,
helpLink,
secondaryHelpLink
}) => {
const dispatch = useDispatch()
const currentTrack = useCurrentTrack()
Expand Down Expand Up @@ -147,8 +153,12 @@ const DeletedPage = g(

const headingText = isPlaylist
? isAlbum
? messages.albumDeleted
: messages.playlistDeleted
? deletedByArtist
? messages.albumDeletedByArtist
: messages.albumDeleted
: deletedByArtist
? messages.playlistDeletedByArtist
: messages.playlistDeleted
: deletedByArtist
? messages.trackDeletedByArtist
: messages.trackDeleted
Expand Down Expand Up @@ -185,15 +195,18 @@ const DeletedPage = g(
</h2>
</ArtistPopover>
</div>
<div>
<Button
variant='secondary'
iconLeft={IconUser}
onClick={goToArtistPage}
>
{messages.checkOut(user.name)}
</Button>
</div>
{helpLink ? (
<div className={styles.helpLinks}>
<TextLink href={helpLink.href} isExternal>
{helpLink.text || messages.helpCenter}
</TextLink>
{secondaryHelpLink ? (
<TextLink href={secondaryHelpLink.href} isExternal>
{secondaryHelpLink.text}
</TextLink>
) : null}
</div>
) : null}
</div>
</div>
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
font-weight: var(--harmony-font-bold);
width: 100%;
position: relative;
margin-bottom: 24px;
margin-bottom: 10px;
}

.artistWrapper :global(.artistPopover) {
Expand Down Expand Up @@ -107,3 +107,10 @@
.verified {
margin-left: 4px;
}

.helpLinks {
display: flex;
flex-direction: column;
gap: 8px;
margin-top: 0;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
playerSelectors
} from '@audius/common/store'
import { route, NestedNonNullable } from '@audius/common/utils'
import { Button, IconUser } from '@audius/harmony'
import { TextLink } from '@audius/harmony'
import { useDispatch, useSelector } from 'react-redux'

import { ArtistPopover } from 'components/artist/ArtistPopover'
Expand All @@ -40,11 +40,13 @@ const { makeGetLineupMetadatas } = lineupSelectors

const messages = {
trackDeleted: 'Track [Deleted]',
trackDeletedByArtist: 'Track [Deleted By Artist]',
playlistDeleted: 'Playlist [Deleted by Artist]',
albumDeleted: 'Album [Deleted By Artist]',
checkOut: (name: string) => `Check out more by ${name}`,
moreBy: (name: string) => `More by ${name}`
trackDeletedByArtist: 'Track [Removed By User]',
playlistDeleted: 'Playlist [Deleted]',
playlistDeletedByArtist: 'Playlist [Removed By User]',
albumDeleted: 'Album [Deleted]',
albumDeletedByArtist: 'Album [Removed By User]',
moreBy: (name: string) => `More by ${name}`,
helpCenter: 'Visit Audius Help Center'
}

const TrackArt = ({ trackId }: { trackId: ID }) => {
Expand All @@ -71,6 +73,8 @@ export type DeletedPageProps = {
deletedByArtist: boolean
playable: Playable
user: User
helpLink?: { href: string; text: string }
secondaryHelpLink?: { href: string; text: string }
}

const g = withNullGuard(
Expand All @@ -87,6 +91,8 @@ const DeletedPage = g(
structuredData,
playable,
deletedByArtist = true,
helpLink,
secondaryHelpLink,
user
}) => {
const dispatch = useDispatch()
Expand Down Expand Up @@ -139,8 +145,12 @@ const DeletedPage = g(

const headingText = isPlaylist
? isAlbum
? messages.albumDeleted
: messages.playlistDeleted
? deletedByArtist
? messages.albumDeletedByArtist
: messages.albumDeleted
: deletedByArtist
? messages.playlistDeletedByArtist
: messages.playlistDeleted
: deletedByArtist
? messages.trackDeletedByArtist
: messages.trackDeleted
Expand Down Expand Up @@ -176,13 +186,18 @@ const DeletedPage = g(
</h2>
</ArtistPopover>
</div>
<Button
variant='secondary'
iconLeft={IconUser}
onClick={goToArtistPage}
>
{messages.checkOut(user.name)}
</Button>
{helpLink ? (
<div className={styles.helpLinks}>
<TextLink href={helpLink.href} isExternal>
{helpLink.text || messages.helpCenter}
</TextLink>
{secondaryHelpLink ? (
<TextLink href={secondaryHelpLink.href} isExternal>
{secondaryHelpLink.text}
</TextLink>
) : null}
</div>
) : null}
</div>
)
}
Expand Down
Loading
Loading