diff --git a/src/renderer/components/card/album-card.tsx b/src/renderer/components/card/album-card.tsx index b0a82ce6..3be8e3e9 100644 --- a/src/renderer/components/card/album-card.tsx +++ b/src/renderer/components/card/album-card.tsx @@ -1,15 +1,14 @@ -import React, { useCallback } from 'react'; +import { useCallback } from 'react'; import { Center } from '@mantine/core'; import { RiAlbumFill } from 'react-icons/ri'; import { generatePath, useNavigate } from 'react-router'; -import { Link } from 'react-router-dom'; import { SimpleImg } from 'react-simple-img'; import styled from 'styled-components'; -import { Text } from '/@/renderer/components/text'; import type { CardRow, CardRoute, Play, PlayQueueAddOptions } from '/@/renderer/types'; import { Skeleton } from '/@/renderer/components/skeleton'; import { CardControls } from '/@/renderer/components/card/card-controls'; -import { Album, LibraryItem } from '/@/renderer/api/types'; +import { Album, AlbumArtist, Artist, LibraryItem } from '/@/renderer/api/types'; +import { CardRows } from '/@/renderer/components/card/card-rows'; const CardWrapper = styled.div<{ link?: boolean; @@ -103,7 +102,7 @@ const Row = styled.div<{ $secondary?: boolean }>` interface BaseGridCardProps { controls: { - cardRows: CardRow[]; + cardRows: CardRow[]; itemType: LibraryItem; playButtonBehavior: Play; route: CardRoute; @@ -179,104 +178,10 @@ export const AlbumCard = ({ - {cardRows.map((row: CardRow, index: number) => { - if (row.arrayProperty && row.route) { - return ( - 0} - > - {data[row.property].map((item: any, itemIndex: number) => ( - - {itemIndex > 0 && ( - - , - - )}{' '} - 0} - component={Link} - overflow="hidden" - size={index > 0 ? 'xs' : 'md'} - to={generatePath( - row.route!.route, - row.route!.slugs?.reduce((acc, slug) => { - return { - ...acc, - [slug.slugProperty]: data[slug.idProperty], - }; - }, {}), - )} - onClick={(e) => e.stopPropagation()} - > - {row.arrayProperty && item[row.arrayProperty]} - - - ))} - - ); - } - - if (row.arrayProperty) { - return ( - - {data[row.property].map((item: any) => ( - 0} - overflow="hidden" - size={index > 0 ? 'xs' : 'md'} - > - {row.arrayProperty && item[row.arrayProperty]} - - ))} - - ); - } - - return ( - - {row.route ? ( - { - return { - ...acc, - [slug.slugProperty]: data[slug.idProperty], - }; - }, {}), - )} - onClick={(e) => e.stopPropagation()} - > - {data && data[row.property]} - - ) : ( - 0} - overflow="hidden" - size={index > 0 ? 'xs' : 'md'} - > - {data && data[row.property]} - - )} - - ); - })} +