Skip to content
This repository has been archived by the owner on Oct 4, 2023. It is now read-only.

Commit

Permalink
Fix mobile deleted track tile (#4051)
Browse files Browse the repository at this point in the history
Co-authored-by: Saliou Diallo <saliou@audius.co>
  • Loading branch information
sddioulde and Saliou Diallo authored Sep 8, 2023
1 parent 27089bd commit 8f20bdb
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 88 deletions.
184 changes: 97 additions & 87 deletions packages/mobile/src/components/details-tile/DetailsTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -360,94 +360,104 @@ export const DetailsTile = ({
</TouchableOpacity>
) : null}
</View>
{isLongFormContent && isNewPodcastControlsEnabled ? (
<DetailsProgressInfo track={track} />
) : null}
<View style={styles.buttonSection}>
{!doesUserHaveAccess && !isOwner && premiumConditions && trackId ? (
<DetailsTileNoAccess
trackId={trackId}
premiumConditions={premiumConditions}
/>
) : null}
{doesUserHaveAccess || isOwner ? (
<Button
styles={{
text: styles.playButtonText,
icon: styles.playButtonIcon
}}
title={isPlayingFullAccess ? messages.pause : playText}
size='large'
iconPosition='left'
icon={isPlayingFullAccess ? IconPause : PlayIcon}
onPress={handlePressPlay}
disabled={!isPlayable}
fullWidth
/>
) : null}
{(doesUserHaveAccess || isOwner) && premiumConditions ? (
<DetailsTileHasAccess
premiumConditions={premiumConditions}
isOwner={isOwner}
trackArtist={user}
/>
) : null}
{showPreviewButton ? <PreviewButton /> : null}
<DetailsTileActionButtons
hasReposted={!!hasReposted}
hasSaved={!!hasSaved}
hideFavorite={hideFavorite}
hideOverflow={hideOverflow}
hideRepost={hideRepost}
hideShare={hideShare}
isOwner={isOwner}
isPlaylist={isPlaylist}
collectionId={collectionId}
isPublished={isPublished}
onPressEdit={onPressEdit}
onPressOverflow={onPressOverflow}
onPressRepost={onPressRepost}
onPressSave={onPressSave}
onPressShare={onPressShare}
onPressPublish={onPressPublish}
/>
</View>
{isAiGeneratedTracksEnabled && aiAttributionUserId ? (
<DetailsTileAiAttribution userId={aiAttributionUserId} />
) : null}
{!isPublished ? null : (
<DetailsTileStats
favoriteCount={saveCount}
hideFavoriteCount={hideFavoriteCount}
hideListenCount={hideListenCount}
hideRepostCount={hideRepostCount}
onPressFavorites={onPressFavorites}
onPressReposts={onPressReposts}
playCount={playCount}
repostCount={repostCount}
/>
{track?.is_delete ? (
// This is to introduce a gap
<View />
) : (
<>
{isLongFormContent && isNewPodcastControlsEnabled ? (
<DetailsProgressInfo track={track} />
) : null}
<View style={styles.buttonSection}>
{!doesUserHaveAccess &&
!isOwner &&
premiumConditions &&
trackId ? (
<DetailsTileNoAccess
trackId={trackId}
premiumConditions={premiumConditions}
/>
) : null}
{doesUserHaveAccess || isOwner ? (
<Button
styles={{
text: styles.playButtonText,
icon: styles.playButtonIcon
}}
title={isPlayingFullAccess ? messages.pause : playText}
size='large'
iconPosition='left'
icon={isPlayingFullAccess ? IconPause : PlayIcon}
onPress={handlePressPlay}
disabled={!isPlayable}
fullWidth
/>
) : null}
{(doesUserHaveAccess || isOwner) && premiumConditions ? (
<DetailsTileHasAccess
premiumConditions={premiumConditions}
isOwner={isOwner}
trackArtist={user}
/>
) : null}
{showPreviewButton ? <PreviewButton /> : null}
<DetailsTileActionButtons
hasReposted={!!hasReposted}
hasSaved={!!hasSaved}
hideFavorite={hideFavorite}
hideOverflow={hideOverflow}
hideRepost={hideRepost}
hideShare={hideShare}
isOwner={isOwner}
isPlaylist={isPlaylist}
collectionId={collectionId}
isPublished={isPublished}
onPressEdit={onPressEdit}
onPressOverflow={onPressOverflow}
onPressRepost={onPressRepost}
onPressSave={onPressSave}
onPressShare={onPressShare}
onPressPublish={onPressPublish}
/>
</View>
{isAiGeneratedTracksEnabled && aiAttributionUserId ? (
<DetailsTileAiAttribution userId={aiAttributionUserId} />
) : null}
{!isPublished ? null : (
<DetailsTileStats
favoriteCount={saveCount}
hideFavoriteCount={hideFavoriteCount}
hideListenCount={hideListenCount}
hideRepostCount={hideRepostCount}
onPressFavorites={onPressFavorites}
onPressReposts={onPressReposts}
playCount={playCount}
repostCount={repostCount}
/>
)}
<View style={styles.descriptionContainer}>
{description ? (
<Hyperlink
source={descriptionLinkPressSource}
style={styles.description}
linkStyle={styles.link}
text={squashNewLines(description)}
/>
) : null}
</View>
<View
style={[
styles.infoSection,
hideFavoriteCount &&
hideListenCount &&
hideRepostCount &&
styles.noStats
]}
>
{renderDetailLabels()}
</View>
</>
)}
<View style={styles.descriptionContainer}>
{description ? (
<Hyperlink
source={descriptionLinkPressSource}
style={styles.description}
linkStyle={styles.link}
text={squashNewLines(description)}
/>
) : null}
</View>
<View
style={[
styles.infoSection,
hideFavoriteCount &&
hideListenCount &&
hideRepostCount &&
styles.noStats
]}
>
{renderDetailLabels()}
</View>
</View>
</View>
{renderBottomContent?.()}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ const messages = {
collectibleGated: 'collectible gated',
specialAccess: 'special access',
usdcPurchase: 'premium track',
generatedWithAi: 'generated with ai'
generatedWithAi: 'generated with ai',
trackDeleted: 'track [deleted by artist]'
}

type TrackScreenDetailsTileProps = {
Expand Down Expand Up @@ -234,6 +235,7 @@ export const TrackScreenDetailsTile = ({
has_current_user_reposted,
has_current_user_saved,
is_unlisted,
is_delete,
is_premium: isPremium,
mood,
owner_id,
Expand Down Expand Up @@ -480,6 +482,23 @@ export const TrackScreenDetailsTile = ({
}

const renderHeader = () => {
if (is_delete) {
return (
<View style={styles.headerContainer}>
<View style={styles.headerRow}>
<Text
style={styles.headerText}
weight='medium'
fontSize='xs'
color={getDownloadTextColor()}
>
{messages.trackDeleted}
</Text>
</View>
</View>
)
}

return is_unlisted ? (
<View style={styles.hiddenDetailsTileWrapper}>
<IconHidden fill={neutralLight4} />
Expand Down

0 comments on commit 8f20bdb

Please sign in to comment.