From e90c7f05a819dc2a8d86bb55ca2f07b462afed8e Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Tue, 19 Dec 2023 11:48:47 +0100 Subject: [PATCH] Front: Remove use of external images for placeholders --- front/components/ArtistCard.tsx | 10 ++-------- front/components/GenreCard.tsx | 7 +------ front/components/SearchResult.tsx | 2 +- front/views/GoogleView.tsx | 3 +-- 4 files changed, 5 insertions(+), 17 deletions(-) diff --git a/front/components/ArtistCard.tsx b/front/components/ArtistCard.tsx index 83f021b..76c6931 100644 --- a/front/components/ArtistCard.tsx +++ b/front/components/ArtistCard.tsx @@ -3,7 +3,7 @@ import Card, { CardBorderRadius } from './Card'; import { VStack, Text, Image } from 'native-base'; type ArtistCardProps = { - image: string; + image?: string; name: string; id: number; onPress: () => void; @@ -18,6 +18,7 @@ const ArtistCard = (props: ArtistCardProps) => { {name} @@ -30,11 +31,4 @@ const ArtistCard = (props: ArtistCardProps) => { ); }; -ArtistCard.defaultProps = { - image: 'https://picsum.photos/200', - name: 'Artist', - id: 0, - onPress: () => {}, -}; - export default ArtistCard; diff --git a/front/components/GenreCard.tsx b/front/components/GenreCard.tsx index 70b3011..6ad067f 100644 --- a/front/components/GenreCard.tsx +++ b/front/components/GenreCard.tsx @@ -30,6 +30,7 @@ const GenreCard = (props: GenreCardProps) => { source={{ uri: image, }} + fallbackSource={{ uri: require('../assets/icon.jpg') }} size="md" /> @@ -43,10 +44,4 @@ const GenreCard = (props: GenreCardProps) => { ); }; -GenreCard.defaultProps = { - icon: 'https://picsum.photos/200', - name: 'Genre', - onPress: () => {}, -}; - export default GenreCard; diff --git a/front/components/SearchResult.tsx b/front/components/SearchResult.tsx index f313721..0c7e679 100644 --- a/front/components/SearchResult.tsx +++ b/front/components/SearchResult.tsx @@ -29,7 +29,7 @@ const swaToSongCardProps = (song: Song) => ({ songId: song.id, name: song.name, artistName: song.artist!.name, - cover: song.cover ?? 'https://picsum.photos/200', + cover: song.cover }); const HomeSearchComponent = () => { diff --git a/front/views/GoogleView.tsx b/front/views/GoogleView.tsx index 5163ca9..f45aaf8 100644 --- a/front/views/GoogleView.tsx +++ b/front/views/GoogleView.tsx @@ -2,7 +2,6 @@ import { useEffect } from 'react'; import { useDispatch } from 'react-redux'; import API from '../API'; import { setAccessToken } from '../state/UserSlice'; -import { Text } from 'native-base'; import { useRoute } from '@react-navigation/native'; import { AccessTokenResponseHandler } from '../models/AccessTokenResponse'; import { Translate } from '../i18n/i18n'; @@ -26,7 +25,7 @@ const GoogleView = () => { run(); }, []); - return ; + return ; }; export default GoogleView;