From 030cbfc786a0d0f0bd62105a06e8f60324462c77 Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Fri, 28 Apr 2023 13:56:50 +0100 Subject: [PATCH 1/4] Front: Navigation: Prevent Back action in home and score view --- front/Navigation.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/Navigation.tsx b/front/Navigation.tsx index 0a0f167..bfffd2f 100644 --- a/front/Navigation.tsx +++ b/front/Navigation.tsx @@ -21,11 +21,11 @@ import { Button, Center, VStack } from 'native-base'; const protectedRoutes = () => ({ - Home: { component: HomeView, options: { title: translate('welcome') } }, + Home: { component: HomeView, options: { title: translate('welcome'), headerLeft: null } }, Settings: { component: SetttingsNavigator, options: { title: 'Settings' } }, Song: { component: SongLobbyView, options: { title: translate('play') } }, Play: { component: PlayView, options: { title: translate('play') } }, - Score: { component: ScoreView, options: { title: translate('score') } }, + Score: { component: ScoreView, options: { title: translate('score'), headerLeft: null } }, Search: { component: SearchView, options: { title: translate('search') } }, User: { component: ProfileView, options: { title: translate('user') } }, }) as const; From e0bdd5fd8f073fc4af5c34eb1f5526922b017c91 Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Fri, 28 Apr 2023 13:57:08 +0100 Subject: [PATCH 2/4] Front: Hide Stop Button while game has not started --- front/views/PlayView.tsx | 10 +++++----- front/views/ScoreView.tsx | 11 +++++++---- 2 files changed, 12 insertions(+), 9 deletions(-) diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index 11d7552..908e0e5 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -50,6 +50,7 @@ const PlayView = ({ songId, type, route }: RouteProps) => { const [isVirtualPianoVisible, setVirtualPianoVisible] = useState(false); const [time, setTime] = useState(0); const [score, setScore] = useState(0); // Between 0 and 100 + const [midiKeyboardFound, setMidiKeyboardFound] = useState(); const partitionRessources = useQuery(["partition", songId], () => API.getPartitionRessources(songId) ); @@ -94,7 +95,7 @@ const PlayView = ({ songId, type, route }: RouteProps) => { toast.show({ description: 'No MIDI Keyboard found' }); return; } - toast.show({ description: `MIDI ready!`, placement: 'top' }); + setMidiKeyboardFound(true); let inputIndex = 0; webSocket.current = new WebSocket(scoroBaseApiUrl); webSocket.current.onopen = () => { @@ -254,9 +255,7 @@ const PlayView = ({ songId, type, route }: RouteProps) => { Rolling in the Deep - - }/> + {midiKeyboardFound && <> } onPress={() => { @@ -273,12 +272,13 @@ const PlayView = ({ songId, type, route }: RouteProps) => { setVirtualPianoVisible(!isVirtualPianoVisible); }}/> {Math.floor(time / 60000)}:{Math.floor((time % 60000) / 1000).toFixed(0).toString().padStart(2, '0')} - } onPress={() => { onEnd(); navigation.navigate('Score', { songId: song.data.id }); }}/> + } diff --git a/front/views/ScoreView.tsx b/front/views/ScoreView.tsx index 1cb16ac..d5280a7 100644 --- a/front/views/ScoreView.tsx +++ b/front/views/ScoreView.tsx @@ -18,14 +18,17 @@ const ScoreView = ({ songId, route }: RouteProps) => { () => API.getArtist(songQuery.data!.artistId!), { enabled: songQuery.data != undefined } ); - const songScoreQuery = useQuery(["score", songId], () => API.getUserPlayHistory() - .then((history) => history.find((h) => h.songID == songId )!)); + const songHistoryQuery = useQuery(["song", "history"], () => API.getUserPlayHistory()); // const perfoamnceRecommandationsQuery = useQuery(['song', props.songId, 'score', 'latest', 'recommendations'], () => API.getLastSongPerformanceScore(props.songId)); const recommendations = useQuery(['song', 'recommendations'], () => API.getUserRecommendations()); - if (!recommendations.data || !songScoreQuery.data || !songQuery.data || (songQuery.data.artistId && !artistQuery.data)) { + if (!recommendations.data || !songHistoryQuery.data || !songQuery.data || (songQuery.data.artistId && !artistQuery.data)) { return ; } + const songScore = songHistoryQuery.data.find((history) => history.songID == songId); + if (!songScore) { + return
; + } return {songQuery.data.name} @@ -54,7 +57,7 @@ const ScoreView = ({ songId, route }: RouteProps) => { t + ' : '}/> - {songScoreQuery.data.score + "pts"} + {songScore.score + "pts"} From cbe8d291dd0dd8d77cb4551601404d1167f2d19a Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Fri, 28 Apr 2023 14:23:06 +0100 Subject: [PATCH 3/4] Front: Remove unused expo configuration files --- .expo/README.md | 15 --------------- .expo/settings.json | 8 -------- 2 files changed, 23 deletions(-) delete mode 100644 .expo/README.md delete mode 100644 .expo/settings.json diff --git a/.expo/README.md b/.expo/README.md deleted file mode 100644 index fd146b4..0000000 --- a/.expo/README.md +++ /dev/null @@ -1,15 +0,0 @@ -> Why do I have a folder named ".expo" in my project? - -The ".expo" folder is created when an Expo project is started using "expo start" command. - -> What do the files contain? - -- "devices.json": contains information about devices that have recently opened this project. This is used to populate the "Development sessions" list in your development builds. -- "packager-info.json": contains port numbers and process PIDs that are used to serve the application to the mobile device/simulator. -- "settings.json": contains the server configuration that is used to serve the application manifest. - -> Should I commit the ".expo" folder? - -No, you should not share the ".expo" folder. It does not contain any information that is relevant for other developers working on the project, it is specific to your machine. - -Upon project creation, the ".expo" folder is already added to your ".gitignore" file. diff --git a/.expo/settings.json b/.expo/settings.json deleted file mode 100644 index 92bc513..0000000 --- a/.expo/settings.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "hostType": "lan", - "lanType": "ip", - "dev": true, - "minify": false, - "urlRandomness": null, - "https": false -} From 2db657dd59617db44634dbaf2b8d74322113ba45 Mon Sep 17 00:00:00 2001 From: Arthur Jamet Date: Fri, 28 Apr 2023 13:23:09 +0100 Subject: [PATCH 4/4] Front: Home View: Fix Overlap when empty card grid --- front/views/HomeView.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/front/views/HomeView.tsx b/front/views/HomeView.tsx index 3ec391b..db84211 100644 --- a/front/views/HomeView.tsx +++ b/front/views/HomeView.tsx @@ -68,13 +68,13 @@ const HomeView = () => { } /> - + - + } songs={songHistory