From cf3c9b8c86899a2a500a319af6bcd0e7af5200a5 Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Thu, 23 Mar 2023 11:03:19 +0000 Subject: [PATCH] Front: Score View: Responsivity --- front/views/ScoreView.tsx | 126 +++++++++++++++++++++----------------- 1 file changed, 69 insertions(+), 57 deletions(-) diff --git a/front/views/ScoreView.tsx b/front/views/ScoreView.tsx index b8c671d..a0e51ce 100644 --- a/front/views/ScoreView.tsx +++ b/front/views/ScoreView.tsx @@ -1,9 +1,12 @@ -import { Box, Button, Card, Column, Image, Progress, Row, Text, View, useTheme } from "native-base" +import { Card, Column, Image, Row, Text, useTheme, ScrollView, Center, VStack } from "native-base" import Translate from "../components/Translate"; import SongCardGrid from "../components/SongCardGrid"; import { useNavigation } from "@react-navigation/native"; import { CardBorderRadius } from "../components/Card"; import TextButton from "../components/TextButton"; +import API from '../API'; +import { useQuery } from "react-query"; +import LoadingComponent from "../components/Loading"; const ScoreView = (/*{ songId }, { songId: number }*/) => { const theme = useTheme(); @@ -11,63 +14,72 @@ const ScoreView = (/*{ songId }, { songId: number }*/) => { // const songQuery = useQuery(['song', props.songId], () => API.getSong(props.songId)); // const songScoreQuery = useQuery(['song', props.songId, 'score', 'latest'], () => API.getLastSongPerformanceScore(props.songId)); // const perfoamnceRecommandationsQuery = useQuery(['song', props.songId, 'score', 'latest', 'recommendations'], () => API.getLastSongPerformanceScore(props.songId)); - return - Rolling in the Deep - Adele - 3:45 - - - API.getUserRecommendations()); + + if (!recommendations.data) { + return
+ +
; + } + return + + Rolling in the Deep + Adele - 3:45 + + + + + + + + + 80 + + ' ' + t}/> + + + + 80 + + ' ' + t}/> + + + t + ' : '}/> + + {"80" + "%"} + + + + {/* Precision */} + + + + + } + songs={recommendations.data.map((i) => ({ + albumCover: i.cover, + songTitle: i.name , + artistName: "Artist", + songId: i.id + }))} + /> + + navigation.navigate('Home')} /> -
- - - - - 80 - - ' ' + t}/> - - - - 80 - - ' ' + t}/> - - - t + ' : '}/> - - {"80" + "%"} - - - - {/* Precision */} - -
- - - } - maxItemPerRow={5} - songs={Array.of(1, 2, 3, 4, 5).map((i) => ({ - albumCover: "", - songTitle: 'Song ' + i, - artistName: "Artist", - songId: i - }))} - /> - - navigation.navigate('Home')} - /> - navigation.navigate('Song', { songId: 1 })} - translate={{ translationKey: 'playAgain' }} - /> - -
+ navigation.navigate('Song', { songId: 1 })} + translate={{ translationKey: 'playAgain' }} + /> + + + } export default ScoreView;