Skip to content

Commit 4de149f

Browse files
authored
[C-4897] Improve empty edit collection page (#9346)
1 parent 67cbdfe commit 4de149f

File tree

3 files changed

+32
-20
lines changed

3 files changed

+32
-20
lines changed

packages/web/src/components/collection/desktop/OwnerActionButtons.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,11 @@ export const OwnerActionButtons = (props: OwnerActionButtonProps) => {
2222

2323
const isDisabled = !track_count || track_count === 0
2424

25-
return collection ? (
25+
if (!collection) return null
26+
27+
return (
2628
<>
27-
{!ddex_app && <EditButton collectionId={collectionId} />}
29+
{ddex_app ? null : <EditButton collectionId={collectionId} />}
2830
<ShareButton
2931
collectionId={collectionId}
3032
disabled={isDisabled}
@@ -36,9 +38,7 @@ export const OwnerActionButtons = (props: OwnerActionButtonProps) => {
3638
/>
3739
{is_private ? <PublishButton collectionId={collectionId} /> : null}
3840

39-
{!is_private ? (
40-
<OverflowMenuButton collectionId={collectionId} isOwner />
41-
) : null}
41+
<OverflowMenuButton collectionId={collectionId} isOwner />
4242
</>
43-
) : null
43+
)
4444
}

packages/web/src/pages/collection-page/CollectionPageProvider.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -746,7 +746,8 @@ class CollectionPage extends Component<
746746
tracks,
747747
userId,
748748
userPlaylists,
749-
smartCollection
749+
smartCollection,
750+
trackCount
750751
} = this.props
751752
const { allowReordering } = this.state
752753
const { playlistId } = this.props
@@ -803,7 +804,8 @@ class CollectionPage extends Component<
803804
onClickReposts: this.onClickReposts,
804805
onFollow: this.onFollow,
805806
onUnfollow: this.onUnfollow,
806-
refresh: this.refreshCollection
807+
refresh: this.refreshCollection,
808+
trackCount
807809
}
808810

809811
if ((metadata?.is_delete || metadata?._marked_deleted) && user) {

packages/web/src/pages/collection-page/components/desktop/CollectionPage.tsx

Lines changed: 22 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import {
1919
PurchaseableContentType
2020
} from '@audius/common/store'
2121
import { getDogEarType, removeNullable } from '@audius/common/utils'
22+
import { Flex, Text } from '@audius/harmony'
2223

2324
import {
2425
CollectiblesPlaylistTableColumn,
@@ -38,7 +39,8 @@ import styles from './CollectionPage.module.css'
3839

3940
const getMessages = (collectionType: 'album' | 'playlist') => ({
4041
emptyPage: {
41-
owner: `This ${collectionType} is empty. Start adding tracks to share it or make it public.`,
42+
ownerTitle: 'Nothing here yet',
43+
ownerCta: 'Start adding tracks',
4244
visitor: `This ${collectionType} is empty...`
4345
},
4446
type: {
@@ -48,19 +50,24 @@ const getMessages = (collectionType: 'album' | 'playlist') => ({
4850
remove: 'Remove from this'
4951
})
5052

51-
const EmptyPage = (props: {
53+
type EmptyPageProps = {
5254
text?: string | null
5355
isOwner: boolean
5456
isAlbum: boolean
55-
}) => {
56-
const messages = getMessages(props.isAlbum ? 'album' : 'playlist')
57-
const text =
58-
props.text ||
59-
(props.isOwner ? messages.emptyPage.owner : messages.emptyPage.visitor)
57+
}
58+
59+
const EmptyPage = (props: EmptyPageProps) => {
60+
const { isAlbum, isOwner, text: textProp } = props
61+
const messages = getMessages(isAlbum ? 'album' : 'playlist')
6062
return (
61-
<div className={styles.emptyWrapper}>
62-
<p className={styles.emptyText}>{text}</p>
63-
</div>
63+
<Flex p='2xl' alignItems='center' direction='column' gap='s'>
64+
<Text variant='title' size='l'>
65+
{textProp ?? isOwner
66+
? messages.emptyPage.ownerTitle
67+
: messages.emptyPage.visitor}
68+
</Text>
69+
{isOwner ? <Text size='l'>{messages.emptyPage.ownerCta}</Text> : null}
70+
</Flex>
6471
)
6572
}
6673

@@ -107,6 +114,7 @@ export type CollectionPageProps = {
107114
) => void
108115
onClickReposts?: () => void
109116
onClickFavorites?: () => void
117+
trackCount: number
110118
}
111119

112120
const CollectionPage = ({
@@ -134,7 +142,8 @@ const CollectionPage = ({
134142
onReorderTracks,
135143
onClickRemove,
136144
onClickReposts,
137-
onClickFavorites
145+
onClickFavorites,
146+
trackCount
138147
}: CollectionPageProps) => {
139148
const { status, metadata, user } = collection
140149

@@ -147,7 +156,8 @@ const CollectionPage = ({
147156
const queuedAndPlaying = playing && isQueued()
148157
const queuedAndPreviewing = previewing && isQueued()
149158
const tracksLoading =
150-
tracks.status === Status.LOADING || tracks.status === Status.IDLE
159+
trackCount > 0 &&
160+
(tracks.status === Status.LOADING || tracks.status === Status.IDLE)
151161

152162
const coverArtSizes =
153163
metadata && metadata?.variant !== Variant.SMART

0 commit comments

Comments
 (0)