From c79ae7c6e8a502e89ade4013be3d0992a2257c98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Cl=C3=A9ment=20Le=20Bihan?= Date: Sun, 7 Jan 2024 16:59:22 +0100 Subject: [PATCH] fix message display and now using the API to get the correct melody url --- front/API.ts | 4 ++++ front/components/Play/PartitionMagic.tsx | 2 +- front/components/Play/PlayScore.tsx | 4 ++-- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/front/API.ts b/front/API.ts index af7597c..f2be7cf 100644 --- a/front/API.ts +++ b/front/API.ts @@ -779,4 +779,8 @@ export default class API { public static getPartitionSvgUrl(songId: number): string { return `${API.baseUrl}/song/${songId}/assets/partition`; } + + public static getPartitionMelodyUrl(songId: number): string { + return `${API.baseUrl}/song/${songId}/assets/melody`; + } } diff --git a/front/components/Play/PartitionMagic.tsx b/front/components/Play/PartitionMagic.tsx index f25e670..1ea08d1 100644 --- a/front/components/Play/PartitionMagic.tsx +++ b/front/components/Play/PartitionMagic.tsx @@ -77,7 +77,7 @@ const PartitionMagic = ({ React.useEffect(() => { if (!melodySound.current) { Audio.Sound.createAsync({ - uri: 'https://cdn.discordapp.com/attachments/717080637038788731/1192502931681984622/melody.mp3?ex=65a94fe6&is=6596dae6&hm=af0879593154fb54b78a9b49c77ae27da9f11d59e676f01fa9eb2a8d5a997708&', + uri: API.getPartitionMelodyUrl(songID), }).then(({ sound }) => { melodySound.current = sound; }); diff --git a/front/components/Play/PlayScore.tsx b/front/components/Play/PlayScore.tsx index afddc04..a911e21 100644 --- a/front/components/Play/PlayScore.tsx +++ b/front/components/Play/PlayScore.tsx @@ -14,7 +14,7 @@ import { ColorSchemeType } from 'native-base/lib/typescript/components/types'; export type ScoreMessage = { content: string; color?: ColorSchemeType; - id: number; + id: number; }; type PlayScoreProps = { @@ -90,7 +90,7 @@ export const PlayScore = ({ score, streak, message }: PlayScoreProps) => { }} > - {message} + {message.content} {streak > 0 && (