mirror of
https://github.com/Jellify-Music/App.git
synced 2026-01-08 03:49:59 -06:00
card changes, logging around images
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -1,4 +1,10 @@
|
||||
export const cardDimensions = {
|
||||
width: 200,
|
||||
height: 250
|
||||
artist: {
|
||||
width: 150,
|
||||
height: 200
|
||||
},
|
||||
album: {
|
||||
width: 150,
|
||||
height: 150
|
||||
}
|
||||
}
|
||||
@@ -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',
|
||||
|
||||
Reference in New Issue
Block a user