Skip to content

Commit

Permalink
[C-2821] Add hidden dog tag to mobile card (#3701)
Browse files Browse the repository at this point in the history
  • Loading branch information
dylanjeffers authored Jul 5, 2023
1 parent 61927c4 commit 4059fe8
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
5 changes: 5 additions & 0 deletions packages/mobile/src/components/card/Card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ import { flexRowCentered, makeStyles } from 'app/styles'
import type { ImageProps } from '../image/FastImage'
import { CollectionDownloadStatusIndicator } from '../offline-downloads/CollectionDownloadStatusIndicator'

import { CollectionDogEar } from './CollectionDogEar'

export type CardType = 'user' | 'collection'

const useStyles = makeStyles(({ palette, typography, spacing }) => ({
Expand Down Expand Up @@ -102,6 +104,9 @@ export const Card = (props: CardProps) => {
styles={{ root: style, content: styles.cardContent }}
{...TileProps}
>
{props.type === 'collection' ? (
<CollectionDogEar collectionId={props.id} />
) : null}
{renderImage({
style: [styles.cardImage, props.type === 'user' && styles.userImage]
})}
Expand Down
27 changes: 27 additions & 0 deletions packages/mobile/src/components/card/CollectionDogEar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
import type { ID } from '@audius/common'
import { cacheCollectionsSelectors } from '@audius/common'
import { useSelector } from 'react-redux'

import { DogEar, DogEarType } from '../core'

const { getCollection } = cacheCollectionsSelectors

type CollectionDogEarProps = {
collectionId: ID
}

export const CollectionDogEar = (props: CollectionDogEarProps) => {
const { collectionId } = props

const isPrivate = useSelector(
(state) => getCollection(state, { id: collectionId })?.is_private
)

const dogEarType = isPrivate ? DogEarType.HIDDEN : null

if (dogEarType) {
return <DogEar type={dogEarType} />
}

return null
}

0 comments on commit 4059fe8

Please sign in to comment.