From f5c0d6967b67075331141eb0e98a0b433a237e3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Fri, 17 Nov 2023 10:42:21 +0100 Subject: [PATCH] Removed pianomsgs --- front/views/PlayView.tsx | 37 +------------------------------------ 1 file changed, 1 insertion(+), 36 deletions(-) diff --git a/front/views/PlayView.tsx b/front/views/PlayView.tsx index 648fbff..141d19e 100644 --- a/front/views/PlayView.tsx +++ b/front/views/PlayView.tsx @@ -132,13 +132,6 @@ const PlayView = ({ songId, type, route }: RouteProps) => { const [midiKeyboardFound, setMidiKeyboardFound] = useState(); // first number is the note, the other is the time when pressed on release the key is removed const [pressedKeys, setPressedKeys] = useState>(new Map()); // [note, time] - const [pianoMsgs, setPianoMsgs] = useReducer( - (state: PianoCanvasMsg[], action: PianoCanvasMsg) => { - state.push(action); - return state; - }, - [] - ); const [streak, setStreak] = useState(0); const scoreMessageScale = useSharedValue(0); // this style should bounce in on enter and fade away @@ -230,17 +223,9 @@ const PlayView = ({ songId, type, route }: RouteProps) => { return; } - const currentStreak = data.info.current_streak; const points = data.info.score; const maxPoints = data.info.max_score || 1; - if (currentStreak !== undefined && points !== undefined) { - setPianoMsgs({ - type: 'scoreInfo', - data: { streak: currentStreak, score: points }, - }); - } - setScore(Math.floor((Math.max(points, 0) * 100) / maxPoints)); let formattedMessage = ''; @@ -248,45 +233,25 @@ const PlayView = ({ songId, type, route }: RouteProps) => { if (data.type == 'miss') { formattedMessage = translate('missed'); - setPianoMsgs({ - type: 'noteTiming', - data: NoteTiming.Missed, - }); messageColor = 'white'; } else if (data.type == 'timing' || data.type == 'duration') { formattedMessage = translate(data[data.type]); switch (data[data.type]) { case 'perfect': messageColor = 'green'; - setPianoMsgs({ - type: 'noteTiming', - data: NoteTiming.Perfect, - }); break; case 'great': messageColor = 'blue'; - setPianoMsgs({ - type: 'noteTiming', - data: NoteTiming.Great, - }); break; case 'short': case 'long': case 'good': messageColor = 'lightBlue'; - setPianoMsgs({ - type: 'noteTiming', - data: NoteTiming.Good, - }); break; case 'too short': case 'too long': case 'wrong': messageColor = 'trueGray'; - setPianoMsgs({ - type: 'noteTiming', - data: NoteTiming.Wrong, - }); break; default: break; @@ -482,7 +447,7 @@ const PlayView = ({ songId, type, route }: RouteProps) => { value={{ pressedKeys: pressedKeys, timestamp: time, - messages: pianoMsgs, + messages: [], }} >