diff --git a/app/components/items/cards/item-card.tsx b/app/components/items/cards/item-card.tsx index 9ac25e69..bb785501 100644 --- a/app/components/items/cards/item-card.tsx +++ b/app/components/items/cards/item-card.tsx @@ -1,10 +1,11 @@ 'use client' -import { ItemImage, ItemName, ItemArtists } from '../misc' +import { ItemArtists, ItemImage, ItemName } from '../misc' -import { Card } from '@app/components/ui/card' -import { SpotifyLink } from '@app/components/common' import type { AlbumEntity, ArtistEntity, TrackEntity } from '@app/api/types' +import { SpotifyLink } from '@app/components/common' +import { Card } from '@app/components/ui/card' +import { cn } from '@app/utils/cn' interface ItemCardAlbum extends Pick { @@ -46,27 +47,35 @@ function ItemCard({ -
+
-
-
+ {album ?? albumType ? ( +
{albumType && ( - <> +
{new Date(releaseDate).getFullYear()} •  {albumType} - +
)} -
- {album && } + {album && ( +
+ +
+ )} + {(album ?? artists) && } +
+ ) : ( -
+ )}
) diff --git a/app/components/items/list/items-list.skeleton.tsx b/app/components/items/list/items-list.skeleton.tsx index 32be45a6..c763b459 100644 --- a/app/components/items/list/items-list.skeleton.tsx +++ b/app/components/items/list/items-list.skeleton.tsx @@ -24,7 +24,7 @@ function ItemsListSkeleton({ }: ItemsListSkeleton.Props) { return (
- {view === View.CARD && ( + {view === View.TOP && ( <>
@@ -84,6 +84,21 @@ function ItemsListSkeleton({ ))}
)} + + {view === View.CARD && ( +
+ {Array.from({ length: 10 }) + .fill(0) + .map((_, index) => ( + + ))} +
+ )}
) } diff --git a/app/components/items/list/items-list.stories.tsx b/app/components/items/list/items-list.stories.tsx index 846199d0..f8fa1c81 100644 --- a/app/components/items/list/items-list.stories.tsx +++ b/app/components/items/list/items-list.stories.tsx @@ -120,7 +120,7 @@ export const Skeleton: ItemsListStory = { } export const SkeletonWithTop: ItemsListStory = { - render: () => , + render: () => , } export const SkeletonWithArtists: ItemsListStory = { diff --git a/app/components/items/list/items-list.tsx b/app/components/items/list/items-list.tsx index f797ad19..7bb91c55 100644 --- a/app/components/items/list/items-list.tsx +++ b/app/components/items/list/items-list.tsx @@ -1,6 +1,6 @@ 'use client' -import { ItemTopCard } from '../cards' +import { ItemCard, ItemTopCard } from '../cards' import type { ItemPosition } from '../misc' import { ItemsListElement } from './items-list-element' @@ -20,6 +20,7 @@ import { CarouselPrevious, } from '@app/components/ui/carousel' import { Separator } from '@app/components/ui/separator' +import { cn } from '@app/utils/cn' namespace ItemsList { export interface Props { @@ -28,6 +29,7 @@ namespace ItemsList { | TrackEntity[] | RigtchStatsResponse isTop?: boolean + isCard?: boolean positionSize?: ItemPosition.Props['size'] positionClassName?: string lastItemSeparator?: boolean @@ -37,6 +39,7 @@ namespace ItemsList { function ItemsList({ items, isTop, + isCard, positionSize, positionClassName, lastItemSeparator = false, @@ -112,17 +115,27 @@ function ItemsList({ )} -
+
{sortedItems.slice(isTop ? 3 : 0).map((item, index, items) => (
- {/* @ts-expect-error: conditional types are already handled */} - + {isCard ? ( + + ) : ( + /* @ts-expect-error: conditional types are already handled */ + + )} - {items.length === index + 1 ? ( + {isCard ? null : items.length === index + 1 ? ( lastItemSeparator ? ( ) : null diff --git a/app/components/items/misc/item-artists.tsx b/app/components/items/misc/item-artists.tsx index da4d6cbe..13e425c6 100644 --- a/app/components/items/misc/item-artists.tsx +++ b/app/components/items/misc/item-artists.tsx @@ -1,8 +1,8 @@ 'use client' +import type { ArtistEntity } from '@app/api/types' import { LinkButton } from '@app/components/common/buttons' import { cn } from '@app/utils/cn' -import type { ArtistEntity } from '@app/api/types' namespace ItemArtists { export interface Props extends Pick { @@ -12,7 +12,7 @@ namespace ItemArtists { function ItemArtists({ artists, className }: ItemArtists.Props) { return ( - <> + {artists.map(({ name, id }, index) => ( , } ))} - + ) } diff --git a/app/profile/components/common/selects/select-view.tsx b/app/profile/components/common/selects/select-view.tsx index f944b364..427d645e 100644 --- a/app/profile/components/common/selects/select-view.tsx +++ b/app/profile/components/common/selects/select-view.tsx @@ -1,33 +1,38 @@ 'use client' -import { LuLayers, LuList } from 'react-icons/lu' import { usePathname, useRouter, useSearchParams } from 'next/navigation' +import { LuLayers, LuList, LuStar } from 'react-icons/lu' import type { ProfileSelectProps } from './props' +import { TooltipInfo } from '@app/components/common' import { Select, + SelectContent, SelectItem, SelectTrigger, - SelectContent, SelectValue, } from '@app/components/ui/select' import { View } from '@app/profile/enums' import { formatSearchParams } from '@app/utils/formatters' -import { TooltipInfo } from '@app/components/common' export function SelectView({ initialValue }: ProfileSelectProps) { const viewOptions = [ { - icon: , - value: View.CARD, - label: 'Card', + icon: , + value: View.TOP, + label: 'Top', }, { icon: , value: View.LIST, label: 'List', }, + { + icon: , + value: View.CARD, + label: 'Card', + }, ] const pathname = usePathname() diff --git a/app/profile/enums/view.ts b/app/profile/enums/view.ts index 26b6e304..dc2245ca 100644 --- a/app/profile/enums/view.ts +++ b/app/profile/enums/view.ts @@ -1,4 +1,5 @@ export enum View { LIST = 'list', + TOP = 'TOP', CARD = 'card', } diff --git a/app/profile/sections/items-section.tsx b/app/profile/sections/items-section.tsx index ec3ceba5..58bb93cc 100644 --- a/app/profile/sections/items-section.tsx +++ b/app/profile/sections/items-section.tsx @@ -1,6 +1,5 @@ import { NoDataAlert } from '../components/common' -import { DefaultSection } from '@app/sections' import type { AlbumEntity, ArtistEntity, @@ -9,6 +8,7 @@ import type { } from '@app/api/types' import { ItemsList } from '@app/components/items/list' import { View } from '@app/profile/enums' +import { DefaultSection } from '@app/sections' namespace ItemsSection { export type Props = DefaultSection.Props & { @@ -29,7 +29,11 @@ function ItemsSection({ return ( {items.length > 0 && ( - + )} {items.length === 0 && }