From b27d3101dea88ad9bf7773698bfd5d7f37cc893d Mon Sep 17 00:00:00 2001 From: Violet Caulfield Date: Sun, 29 Dec 2024 09:42:19 -0600 Subject: [PATCH] making artist cards hotter --- api/queries/query.config.ts | 5 +++ components/Global/card.tsx | 40 ++++++++++++---------- components/Home/helpers/recent-artists.tsx | 3 +- 3 files changed, 28 insertions(+), 20 deletions(-) diff --git a/api/queries/query.config.ts b/api/queries/query.config.ts index 1c9f044b..c12e3705 100644 --- a/api/queries/query.config.ts +++ b/api/queries/query.config.ts @@ -8,5 +8,10 @@ export const queryConfig = { fillHeight: 300, fillWidth: 300, format: ImageFormat.Jpg + }, + logos: { + fillHeight: 100, + fillWidth: 100, + format: ImageFormat.Jpg } } \ No newline at end of file diff --git a/components/Global/card.tsx b/components/Global/card.tsx index 1b7e3db6..36447c20 100644 --- a/components/Global/card.tsx +++ b/components/Global/card.tsx @@ -10,13 +10,13 @@ import invert from "invert-color" import { Blurhash } from "react-native-blurhash" import { queryConfig } from "../../api/queries/query.config"; import { Text } from "./text"; +import { isEmpty } from "lodash"; interface CardProps extends TamaguiCardProps { artistName?: string; blurhash?: string; caption?: string | null | undefined; subCaption?: string | null | undefined; - children?: string; itemId: string; footer?: ReactNode; cornered?: boolean; @@ -26,11 +26,12 @@ export function Card(props: CardProps) { const { apiClient } = useApiClientContext(); - const [imageLoaded, setImageLoaded] = useState(false); - const dimensions = props.artistName ? cardDimensions.artist : cardDimensions.album; + const dimensions = props.width && typeof(props.width) === "number" ? { width: props.width, height: props.width } : { width: 150, height: 150 }; const cardTextColor = props.blurhash ? invert(Blurhash.getAverageColor(props.blurhash)!, true) : undefined; + const cardLogoSource = getImageApi(apiClient!).getItemImageUrlById(props.itemId, ImageType.Logo); + return ( - { props.children && ( -

{ props.children }

- )} + + +
{ props.footer && ( @@ -55,13 +67,6 @@ export function Card(props: CardProps) { )} - {props.blurhash && !imageLoaded && ( - - )} - setImageLoaded(true)} - /> + />
{ props.caption && ( diff --git a/components/Home/helpers/recent-artists.tsx b/components/Home/helpers/recent-artists.tsx index b4febbd7..0509b605 100644 --- a/components/Home/helpers/recent-artists.tsx +++ b/components/Home/helpers/recent-artists.tsx @@ -23,13 +23,13 @@ export default function RecentArtists({ navigation }: ProvidedHomeProps): React. { - return ( { navigation.navigate('Artist', { @@ -38,7 +38,6 @@ export default function RecentArtists({ navigation }: ProvidedHomeProps): React. } )} }> - {recentArtist.Name ?? "Unknown Artist"} ) }}