clean code + search history handler fix
This commit is contained in:
@@ -2,7 +2,7 @@ import Model, { ModelValidator } from './Model';
|
|||||||
import * as yup from 'yup';
|
import * as yup from 'yup';
|
||||||
import ResponseHandler from './ResponseHandler';
|
import ResponseHandler from './ResponseHandler';
|
||||||
|
|
||||||
export const SearchType = ['song', 'artist', 'album'] as const;
|
export const SearchType = ['song', 'artist', 'album', 'genre'] as const;
|
||||||
export type SearchType = (typeof SearchType)[number];
|
export type SearchType = (typeof SearchType)[number];
|
||||||
|
|
||||||
const SearchHistoryValidator = yup
|
const SearchHistoryValidator = yup
|
||||||
|
|||||||
@@ -10,31 +10,12 @@ import CardGridCustom from '../components/CardGridCustom';
|
|||||||
import { translate } from '../i18n/i18n';
|
import { translate } from '../i18n/i18n';
|
||||||
|
|
||||||
const colorRange = ['#364fc7', '#5c940d', '#c92a2a', '#d6336c', '#20c997'];
|
const colorRange = ['#364fc7', '#5c940d', '#c92a2a', '#d6336c', '#20c997'];
|
||||||
// {
|
|
||||||
// code: '#364fc7',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// code: '#5c940d',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// code: '#c92a2a',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// code: '#d6336c',
|
|
||||||
// },
|
|
||||||
// {
|
|
||||||
// code: '#20c997'
|
|
||||||
// }
|
|
||||||
// ]
|
|
||||||
|
|
||||||
type GenreDetailsViewProps = {
|
type GenreDetailsViewProps = {
|
||||||
genreId: number;
|
genreId: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
const rockArtists: any[] = [];
|
|
||||||
|
|
||||||
const GenreDetailsView = ({ genreId }: RouteProps<GenreDetailsViewProps>) => {
|
const GenreDetailsView = ({ genreId }: RouteProps<GenreDetailsViewProps>) => {
|
||||||
// const { isLoading: isLoadingGenre, data: genreData, error: isErrorGenre } = useQuery(API.getArtist(genreId));
|
|
||||||
const genreQuery = useQuery(API.getGenre(genreId))
|
const genreQuery = useQuery(API.getGenre(genreId))
|
||||||
const songsQuery = useQuery(API.getSongsByGenre(genreId))
|
const songsQuery = useQuery(API.getSongsByGenre(genreId))
|
||||||
const screenSize = useBreakpointValue({ base: "small", md: "big" });
|
const screenSize = useBreakpointValue({ base: "small", md: "big" });
|
||||||
@@ -69,7 +50,6 @@ const GenreDetailsView = ({ genreId }: RouteProps<GenreDetailsViewProps>) => {
|
|||||||
justifyContent={['flex-start']}
|
justifyContent={['flex-start']}
|
||||||
mt={4}
|
mt={4}
|
||||||
>
|
>
|
||||||
<Box>
|
|
||||||
<CardGridCustom
|
<CardGridCustom
|
||||||
content={songsQuery.data.slice(0, songsQuery.data.length).map((songData) => ({
|
content={songsQuery.data.slice(0, songsQuery.data.length).map((songData) => ({
|
||||||
image: API.getArtistIllustration(songData.id),
|
image: API.getArtistIllustration(songData.id),
|
||||||
@@ -82,10 +62,6 @@ const GenreDetailsView = ({ genreId }: RouteProps<GenreDetailsViewProps>) => {
|
|||||||
}))}
|
}))}
|
||||||
cardComponent={ArtistCard}
|
cardComponent={ArtistCard}
|
||||||
/>
|
/>
|
||||||
</Box>
|
|
||||||
<Box>
|
|
||||||
|
|
||||||
</Box>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</ScrollView>
|
</ScrollView>
|
||||||
);
|
);
|
||||||
|
|||||||
Reference in New Issue
Block a user