-
Notifications
You must be signed in to change notification settings - Fork 111
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PAY-2786] Clean up skeletons for collection page #8427
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -100,7 +100,6 @@ export const CollectionHeader = (props: CollectionHeaderProps) => { | |
type, | ||
title, | ||
coverArtSizes, | ||
artistName, | ||
description, | ||
isOwner, | ||
releaseDate, | ||
|
@@ -161,7 +160,7 @@ export const CollectionHeader = (props: CollectionHeaderProps) => { | |
}, [onOpen, collectionId]) | ||
|
||
const renderStatsRow = (isLoading: boolean) => { | ||
if (isLoading) return null | ||
if (isLoading) return <Skeleton height='20px' width='120px' /> | ||
return ( | ||
<RepostsFavoritesStats | ||
isUnlisted={false} | ||
|
@@ -175,45 +174,46 @@ export const CollectionHeader = (props: CollectionHeaderProps) => { | |
|
||
const isLoading = !isSsrEnabled && (loading || artworkLoading) | ||
|
||
const fadeIn = { | ||
[styles.show]: !isLoading, | ||
[styles.hide]: isLoading | ||
} | ||
|
||
const isPremium = | ||
isStreamGated && isContentUSDCPurchaseGated(streamConditions) | ||
|
||
const topSection = ( | ||
<Flex gap='xl' p='l' backgroundColor='white'> | ||
{coverArtSizes || gradient || icon ? ( | ||
<Artwork | ||
collectionId={collectionId} | ||
coverArtSizes={coverArtSizes} | ||
callback={handleLoadArtwork} | ||
gradient={gradient} | ||
icon={icon} | ||
imageOverride={imageOverride} | ||
isOwner={isOwner} | ||
/> | ||
) : null} | ||
<Flex direction='column' justifyContent='space-between'> | ||
<Artwork | ||
collectionId={collectionId} | ||
coverArtSizes={coverArtSizes} | ||
callback={handleLoadArtwork} | ||
gradient={gradient} | ||
icon={icon} | ||
imageOverride={imageOverride} | ||
isOwner={isOwner} | ||
/> | ||
<Flex | ||
direction='column' | ||
justifyContent='space-between' | ||
css={{ minWidth: 400 }} | ||
> | ||
<Flex direction='column' gap='xl'> | ||
<Flex className={cn(fadeIn)} gap='s' mt='s' alignItems='center'> | ||
{!isPublished ? ( | ||
<IconVisibilityHidden color='subdued' aria-label='hidden' /> | ||
) : null} | ||
{isPremium ? <IconCart size='s' color='subdued' /> : null} | ||
<Text | ||
variant='label' | ||
color='subdued' | ||
css={{ letterSpacing: '2px' }} | ||
> | ||
{isPremium ? `${messages.premiumLabel} ` : ''} | ||
{type === 'playlist' && !isPublished | ||
? messages.hiddenPlaylistLabel | ||
: type} | ||
</Text> | ||
</Flex> | ||
{isLoading ? ( | ||
<Skeleton height='24px' width='200px' /> | ||
) : ( | ||
<Flex gap='s' mt='s' alignItems='center'> | ||
{!isPublished ? ( | ||
<IconVisibilityHidden color='subdued' aria-label='hidden' /> | ||
) : null} | ||
{isPremium ? <IconCart size='s' color='subdued' /> : null} | ||
<Text | ||
variant='label' | ||
color='subdued' | ||
css={{ letterSpacing: '2px' }} | ||
> | ||
{isPremium ? `${messages.premiumLabel} ` : ''} | ||
{type === 'playlist' && !isPublished | ||
? messages.hiddenPlaylistLabel | ||
: type} | ||
</Text> | ||
</Flex> | ||
)} | ||
<Flex direction='column' gap='s'> | ||
<Flex | ||
as={isOwner ? 'button' : 'span'} | ||
|
@@ -225,57 +225,57 @@ export const CollectionHeader = (props: CollectionHeaderProps) => { | |
})} | ||
onClick={isOwner ? handleClickEditTitle : undefined} | ||
> | ||
<Text | ||
variant='heading' | ||
size='xl' | ||
className={cn(styles.titleHeader, fadeIn)} | ||
textAlign='left' | ||
> | ||
{title} | ||
</Text> | ||
<ClientOnly> | ||
{isOwner ? ( | ||
<IconPencil className={styles.editIcon} color='subdued' /> | ||
) : null} | ||
</ClientOnly> | ||
{isLoading ? ( | ||
<Skeleton css={{ position: 'absolute', top: 0 }} /> | ||
) : null} | ||
<Skeleton height='48px' width='300px' /> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. seems like it might be better to just have one whole There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yeah I was wondering the same. This was sort of easier cause it ensures parity with the layout, and I've seen them drift before, but I'm open to either |
||
) : ( | ||
<> | ||
<Text | ||
variant='heading' | ||
size='xl' | ||
className={cn(styles.titleHeader)} | ||
textAlign='left' | ||
> | ||
{title} | ||
</Text> | ||
<ClientOnly> | ||
{!isLoading && isOwner ? ( | ||
<IconPencil className={styles.editIcon} color='subdued' /> | ||
) : null} | ||
</ClientOnly> | ||
</> | ||
)} | ||
</Flex> | ||
{artistName ? ( | ||
<Text | ||
variant='title' | ||
strength='weak' | ||
tag='h2' | ||
className={cn(fadeIn)} | ||
textAlign='left' | ||
> | ||
{isLoading ? ( | ||
<Skeleton height='24px' width='150px' /> | ||
) : ( | ||
<Text variant='title' strength='weak' tag='h2' textAlign='left'> | ||
<Text color='subdued'>{messages.by}</Text> | ||
{userId !== null ? ( | ||
<UserLink userId={userId} popover variant='visible' /> | ||
) : null} | ||
</Text> | ||
) : null} | ||
)} | ||
</Flex> | ||
{isLoading ? ( | ||
<Skeleton css={{ position: 'absolute', top: 0 }} width='60%' /> | ||
) : null} | ||
<div>{renderStatsRow(isLoading)}</div> | ||
</Flex> | ||
<ClientOnly> | ||
<CollectionActionButtons | ||
variant={variant} | ||
userId={userId} | ||
collectionId={collectionId} | ||
isPlayable={isPlayable} | ||
isPlaying={playing} | ||
isPreviewing={previewing} | ||
isPremium={isPremium} | ||
isOwner={isOwner} | ||
tracksLoading={tracksLoading} | ||
onPlay={onPlay} | ||
onPreview={onPreview} | ||
/> | ||
{isLoading ? ( | ||
<Skeleton height='64px' width='100%' /> | ||
) : ( | ||
<CollectionActionButtons | ||
variant={variant} | ||
userId={userId} | ||
collectionId={collectionId} | ||
isPlayable={isPlayable} | ||
isPlaying={playing} | ||
isPreviewing={previewing} | ||
isPremium={isPremium} | ||
isOwner={isOwner} | ||
tracksLoading={tracksLoading} | ||
onPlay={onPlay} | ||
onPreview={onPreview} | ||
/> | ||
)} | ||
</ClientOnly> | ||
</Flex> | ||
{onFilterChange ? ( | ||
|
@@ -327,28 +327,31 @@ export const CollectionHeader = (props: CollectionHeaderProps) => { | |
/> | ||
) : null} | ||
|
||
<Flex className={cn(fadeIn)} gap='l' direction='column'> | ||
{description ? ( | ||
<UserGeneratedText | ||
size='s' | ||
className={cn(fadeIn)} | ||
linkSource='collection page' | ||
css={{ textAlign: 'left' }} | ||
> | ||
{description} | ||
</UserGeneratedText> | ||
) : null} | ||
<AlbumDetailsText | ||
duration={duration} | ||
lastModifiedDate={lastModifiedDate} | ||
numTracks={numTracks} | ||
releaseDate={releaseDate} | ||
/> | ||
</Flex> | ||
{isLoading ? ( | ||
<Skeleton height='40px' width='100%' /> | ||
) : ( | ||
<Flex gap='l' direction='column'> | ||
{description ? ( | ||
<UserGeneratedText | ||
size='s' | ||
linkSource='collection page' | ||
css={{ textAlign: 'left' }} | ||
> | ||
{description} | ||
</UserGeneratedText> | ||
) : null} | ||
<AlbumDetailsText | ||
duration={duration} | ||
lastModifiedDate={lastModifiedDate} | ||
numTracks={numTracks} | ||
releaseDate={releaseDate} | ||
/> | ||
</Flex> | ||
)} | ||
</Flex> | ||
) | ||
return ( | ||
<Flex direction='column'> | ||
<Flex direction='column' h='100%'> | ||
{topSection} | ||
{descriptionSection} | ||
</Flex> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: harmony unit vars?