From fd50b2268b9d1b8044793d83121e8c15e88241e0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Sun, 26 Nov 2023 23:18:47 +0100 Subject: [PATCH] Cleanup of the control bar code in the PLayview --- front/components/Play/PlayViewControlBar.tsx | 33 ++-- front/views/PlayView.tsx | 159 +------------------ 2 files changed, 23 insertions(+), 169 deletions(-) diff --git a/front/components/Play/PlayViewControlBar.tsx b/front/components/Play/PlayViewControlBar.tsx index aca7c6d..926b0c3 100644 --- a/front/components/Play/PlayViewControlBar.tsx +++ b/front/components/Play/PlayViewControlBar.tsx @@ -14,6 +14,7 @@ type PlayViewControlBarProps = { time: number; paused: boolean; score: number; + disabled: boolean; onResume: () => void; onPause: () => void; onEnd: () => void; @@ -24,6 +25,7 @@ const PlayViewControlBar = ({ time, paused, score, + disabled, onResume, onPause, onEnd, @@ -112,6 +114,7 @@ const PlayViewControlBar = ({ - {true && ( - <> - } - onPress={() => { - onEnd(); - }} - /> - - )} + } + onPress={() => { + onEnd(); + }} + /> {time < 0 ? paused @@ -180,4 +180,11 @@ const PlayViewControlBar = ({ ); }; +PlayViewControlBar.defaultProps = { + onResume: () => {}, + onPause: () => {}, + onEnd: () => {}, + disabled: false, +}; + export default PlayViewControlBar; diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index 7d9179e..d08fada 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -487,163 +487,10 @@ const PlayView = ({ songId, route }: RouteProps) => { time={time} paused={paused} song={song.data} - onEnd={() => {}} - onPause={() => {}} - onResume={() => {}} + onEnd={onEnd} + onPause={onPause} + onResume={onResume} /> - - {/* - - - cover - - - {song.data.name} - - - {song.data.artistId} - - - - - - - } - onPress={() => { - if (paused) { - onResume(); - } else { - onPause(); - } - }} - /> - {midiKeyboardFound && ( - <> - } - onPress={() => { - onEnd(); - }} - /> - - )} - - {time < 0 - ? paused - ? '0:00' - : Math.floor((time % 60000) / 1000) - .toFixed(0) - .toString() - : `${Math.floor(time / 60000)}:${Math.floor((time % 60000) / 1000) - .toFixed(0) - .toString() - .padStart(2, '0')}`} - - - - - - - */} {colorScheme === 'dark' && (