card changes, logging around images

This commit is contained in:
Violet Caulfield
2024-11-29 15:47:02 -06:00
parent 0b74166415
commit 89ccdc0127
4 changed files with 20 additions and 4 deletions

View File

@@ -8,6 +8,7 @@ export function fetchItemImage(api: Api, itemId: string, imageType?: ImageType,
return getImageApi(api).getItemImage({ itemId, imageType: imageType ? imageType : ImageType.Primary })
.then((response) => {
console.log(response);
convertFileToBase64((response.data as File))
.then((encode) => {
console.log(encode);

View File

@@ -7,7 +7,13 @@ import { cardDimensions } from "./component.config";
import { useItemImage } from "../../api/queries/image";
import { Colors } from "../../enums/colors";
export enum CardType {
Artist = "ARTIST",
Album = "ALBUM"
}
interface CardProps extends TamaguiCardProps {
cardType?: CardType;
children?: string;
itemId: string;
footer?: ReactNode;
@@ -18,6 +24,8 @@ export function Card(props: CardProps) {
const { apiClient } = useApiClientContext();
const { data, isPending } = useItemImage(apiClient!, props.itemId)
const dimensions = props.cardType === CardType.Artist ? cardDimensions.artist : cardDimensions.album;
return (
<TamaguiCard
elevate
@@ -26,7 +34,7 @@ export function Card(props: CardProps) {
hoverStyle={props.onPress ? { scale: 0.925 } : {}}
pressStyle={props.onPress ? { scale: 0.875 } : {}}
borderRadius={25}
{...cardDimensions}
{...dimensions}
{...props}
>
<TamaguiCard.Header padded>

View File

@@ -1,4 +1,10 @@
export const cardDimensions = {
width: 200,
height: 250
artist: {
width: 150,
height: 200
},
album: {
width: 150,
height: 150
}
}

View File

@@ -4,7 +4,7 @@ import { useHomeContext } from "../provider";
import { H2 } from "../../Global/text";
import { ProvidedHomeProps } from "../types";
import { FlatList } from "react-native";
import { Card } from "../../Global/card";
import { Card, CardType } from "../../Global/card";
export default function RecentArtists({ navigation }: ProvidedHomeProps): React.JSX.Element {
@@ -24,6 +24,7 @@ export default function RecentArtists({ navigation }: ProvidedHomeProps): React.
renderItem={({ item: recentArtist}) => {
return (
<Card
cardType={CardType.Artist}
itemId={recentArtist.Id!}
onPress={() => {
navigation.navigate('Artist',