Skip to content
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

Add text link for track tile genre and mood info #8811

Merged
merged 2 commits into from
Jun 13, 2024
Merged
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
27 changes: 25 additions & 2 deletions packages/web/src/components/track/GiantTrackTile.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ import { Mood } from '@audius/sdk'
import cn from 'classnames'
import dayjs from 'dayjs'
import { useDispatch, shallowEqual, useSelector } from 'react-redux'
import { generatePath } from 'react-router-dom'

import { TextLink, UserLink } from 'components/link'
import Menu from 'components/menu/Menu'
Expand All @@ -58,6 +59,7 @@ import { ComponentPlacement } from 'components/types'
import { UserGeneratedText } from 'components/user-generated-text'
import { getFeatureEnabled } from 'services/remote-config/featureFlagHelpers'
import { moodMap } from 'utils/Moods'
import { SEARCH_PAGE } from 'utils/route'
import { trpc } from 'utils/trpcClientWeb'

import { AiTrackSection } from './AiTrackSection'
Expand Down Expand Up @@ -367,7 +369,16 @@ export const GiantTrackTile = ({
mood && (
<InfoLabel
labelName='mood'
labelValue={mood in moodMap ? moodMap[mood as Mood] : mood}
labelValue={
<TextLink
to={{
pathname: generatePath(SEARCH_PAGE, { category: 'tracks' }),
search: new URLSearchParams({ mood }).toString()
}}
>
{mood in moodMap ? moodMap[mood as Mood] : mood}
</TextLink>
}
/>
)
)
Expand All @@ -378,7 +389,19 @@ export const GiantTrackTile = ({

return (
shouldShow && (
<InfoLabel labelName='genre' labelValue={getCanonicalName(genre)} />
<InfoLabel
labelName='genre'
labelValue={
<TextLink
to={{
pathname: generatePath(SEARCH_PAGE, { category: 'tracks' }),
search: new URLSearchParams({ genre }).toString()
}}
>
{getCanonicalName(genre)}
</TextLink>
}
/>
)
)
}
Expand Down