From 81255ce1f426604b0ab6bc0f06049084c60434c4 Mon Sep 17 00:00:00 2001 From: Shaochang Tan <478710209@qq.com> Date: Fri, 26 Apr 2024 23:00:54 +0200 Subject: [PATCH] M3 fast fix; 1.audio recorder playback 2.disable put room in lobby 3.change index title --- public/index.html | 2 +- src/components/ui/AudioRecorder.tsx | 12 +++++++++--- src/components/views/Lobby.tsx | 10 +++++----- src/helpers/getDomain.js | 1 + 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/public/index.html b/public/index.html index 6d80583..efefe27 100644 --- a/public/index.html +++ b/public/index.html @@ -21,7 +21,7 @@ Learn how to configure a non-root public URL by running `npm run build` or have a look at the documentation https://create-react-app.dev/docs/using-the-public-folder/. --> - SoPra FS24 - Group XX + SoPra FS24 - Group 09 diff --git a/src/components/ui/AudioRecorder.tsx b/src/components/ui/AudioRecorder.tsx index 804fcde..e766cb4 100644 --- a/src/components/ui/AudioRecorder.tsx +++ b/src/components/ui/AudioRecorder.tsx @@ -367,9 +367,15 @@ export const AudioRecorder = React.forwardRef((props,ref) => { disabled = {props.disabled || !waveAvailable} className="audio-recorder button-container playback-rate-dropdown" onChange={(e) => { - const rate = parseFloat(e.target.value); - setPlaybackRate(rate); - wavesurfer.current?.setPlaybackRate(rate, true); + try { + // console.warn("e", e); + const rate = parseFloat(e); + setPlaybackRate(rate); + wavesurfer.current?.setPlaybackRate(rate, true); + } + catch (error) { + console.error("Failed to set playback rate", error); + } }} defaultValue={playbackRate} options={[ diff --git a/src/components/views/Lobby.tsx b/src/components/views/Lobby.tsx index b192d00..809b6b1 100644 --- a/src/components/views/Lobby.tsx +++ b/src/components/views/Lobby.tsx @@ -314,7 +314,7 @@ const Lobby = () => { async function enterRoom(roomId, userId) { try { const requestBody = JSON.stringify({ id: userId }); - await api.put(`/games/${roomId}`, requestBody); + // await api.put(`/games/${roomId}`, requestBody); } catch (error) { handleError(error); @@ -561,11 +561,11 @@ const Lobby = () => { placeholder="2" value={numRounds} onChange={e => { - const value = parseInt(e.target.value, 10); - setNumRounds(value >= 2 && value <= 10 ? value : ""); + const value = parseInt(e.target.value, 3); + setNumRounds(value >= 2 && value <= 3 ? value : ""); }} min={2} - max={10} + max={3} /> { onChange={(value) => setRoomTheme(value)} />
-
diff --git a/src/helpers/getDomain.js b/src/helpers/getDomain.js index ecca1c4..85fd488 100644 --- a/src/helpers/getDomain.js +++ b/src/helpers/getDomain.js @@ -8,6 +8,7 @@ import { isProduction } from "./isProduction" */ export const getDomain = () => { const prodUrl = "https://sopra-fs24-group-09-server.oa.r.appspot.com/" // TODO: insert your prod url for server (once deployed) + // const devUrl = "https://sopra-fs24-group-09-server.oa.r.appspot.com/" // TODO: insert your prod url for server (once deployed) const devUrl = "http://localhost:8080" return isProduction() ? prodUrl : devUrl