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

[PAY-2681] Artist dashboard album support #8136

Merged
merged 9 commits into from
Apr 22, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 8 additions & 0 deletions packages/common/src/store/account/selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,14 @@ export const getAccountWithAlbums = createSelector(
}
)

export const getAccountAlbums = createSelector(
dharit-tan marked this conversation as resolved.
Show resolved Hide resolved
[getAccountWithCollections],
(account) => {
if (!account) return undefined
return account.collections.filter((c) => c.is_album)
}
)

export const getAccountWithNameSortedPlaylistsAndAlbums = createSelector(
[getAccountWithCollections],
(account) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,11 @@ export const TextInput = forwardRef<HTMLInputElement, TextInputProps>(
)}
>
{StartIcon ? (
<StartIcon size='m' color='subdued' {...IconProps} />
<StartIcon
size={size === TextInputSize.SMALL ? 's' : 'm'}
color='subdued'
{...IconProps}
/>
) : null}
<Flex direction='column' gap='xs' justifyContent='center' w='100%'>
{shouldShowLabel ? (
Expand Down
15 changes: 14 additions & 1 deletion packages/web/src/pages/dashboard-page/DashboardPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { useState, Suspense, ReactNode, useEffect, useCallback } from 'react'

import { Status, Track } from '@audius/common/models'
import { FeatureFlags } from '@audius/common/services'
import { themeSelectors } from '@audius/common/store'
import { formatCount } from '@audius/common/utils'
import cn from 'classnames'
Expand All @@ -12,10 +13,12 @@ import Header from 'components/header/desktop/Header'
import LoadingSpinner from 'components/loading-spinner/LoadingSpinner'
import Page from 'components/page/Page'
import { useGoToRoute } from 'hooks/useGoToRoute'
import { useFlag } from 'hooks/useRemoteConfig'
import lazyWithPreload from 'utils/lazyWithPreload'

import styles from './DashboardPage.module.css'
import { ArtistCard } from './components/ArtistCard'
import { ArtistContentSection } from './components/ArtistContentSection'
import {
TracksTableContainer,
DataSourceTrack,
Expand Down Expand Up @@ -67,6 +70,9 @@ const StatTile = (props: { title: string; value: any }) => {
export const DashboardPage = () => {
const goToRoute = useGoToRoute()
const dispatch = useDispatch()
const { isEnabled: isPremiumAlbumsEnabled } = useFlag(
FeatureFlags.PREMIUM_ALBUMS_ENABLED
)
const [selectedTrack, setSelectedTrack] = useState(-1)
const { account, tracks, stats } = useSelector(makeGetDashboard())
const listenData = useSelector(getDashboardListenData)
Expand Down Expand Up @@ -194,7 +200,14 @@ export const DashboardPage = () => {
<div className={styles.sectionContainer}>
{renderChart()}
{renderStats()}
{renderTable()}
{isPremiumAlbumsEnabled ? (
<ArtistContentSection
tracks={formatMetadata(tracks)}
account={account}
/>
) : (
renderTable()
)}
</div>
</>
)}
Expand Down