Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

M3 intergration PR #85

Merged
merged 99 commits into from
Apr 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
bd162db
Update Contribution.md
Haaaan1 Apr 14, 2024
0eb7cf4
Update Contribution.md
petertheprocess Apr 16, 2024
29511b0
Update Contribution.md
petertheprocess Apr 17, 2024
a509214
Update Contribution.md
petertheprocess Apr 17, 2024
5d89b6c
Update Contribution.md
petertheprocess Apr 17, 2024
ba16c67
Merge pull request #74 from sopra-fs24-group-09/feature/lobby-ui
Haaaan1 Apr 20, 2024
811978c
Revert "Feature/lobby UI"
Haaaan1 Apr 20, 2024
21c920e
Merge pull request #75 from sopra-fs24-group-09/revert-74-feature/lob…
Haaaan1 Apr 20, 2024
1072dd0
Update build_test_before_pr.yml
petertheprocess Apr 20, 2024
83b221c
Update main.yml, add PR deploy for main branch
petertheprocess Apr 20, 2024
c675bf9
fix createRoom func
petertheprocess Apr 22, 2024
4c89a02
Merge pull request #81 from sopra-fs24-group-09/dev
zihanltesla Apr 22, 2024
2a87a78
04-22 21:15
Zehao-Zhang Apr 22, 2024
091e7c9
[fix] userId and roomId to be string
yixuan-zhou-uzh Apr 22, 2024
e1037b9
[feat] upload and leave room button added
yixuan-zhou-uzh Apr 22, 2024
87cc6e1
correct url to /app/message
Zehao-Zhang Apr 22, 2024
45bbaf8
[feat] roomOwner showing the start button
yixuan-zhou-uzh Apr 23, 2024
5eaede8
Merge remote-tracking branch 'origin/M3-intergration-test' into M3-in…
yixuan-zhou-uzh Apr 23, 2024
f61a4e7
Fix edit profile and avatar bugs
Haaaan1 Apr 23, 2024
e2aadba
Updated roomId for distinguish Chanels
zihanltesla Apr 23, 2024
16cf458
Fix waveplayer no audio animation
petertheprocess Apr 23, 2024
6017a40
Put VolumeBar ui in header, also update gameroom layout
petertheprocess Apr 23, 2024
c89accc
[feature] add Volume tunning function. fix #66 #49
petertheprocess Apr 24, 2024
1d556d4
For enteroom and exitroom
zihanltesla Apr 24, 2024
b6973e1
Modify fetching room player lists data
Haaaan1 Apr 24, 2024
d095814
Fixed unready
zihanltesla Apr 24, 2024
a4023d4
Merge branch 'M3-intergration-test' of github.com:sopra-fs24-group-09…
zihanltesla Apr 24, 2024
c032861
[fix] player info updated
yixuan-zhou-uzh Apr 24, 2024
61d6aca
Merge pull request #53 from sopra-fs24-group-09/Volume-widget-dev
petertheprocess Apr 24, 2024
1d5a94f
fix gameroom playercontainer ui
petertheprocess Apr 24, 2024
65328d3
[fix] fix audio upload func
petertheprocess Apr 24, 2024
6ee2163
[feat] counter implemented fix #5
yixuan-zhou-uzh Apr 25, 2024
efd9b44
[fix] leave room button and upload button changed to based on round s…
yixuan-zhou-uzh Apr 25, 2024
ccd310f
[fix] add share button and remove default input
yixuan-zhou-uzh Apr 25, 2024
7d61a2e
[fix] add loading page, fix render logic
petertheprocess Apr 25, 2024
327f5e6
remove mockUp initial value for Gameroom, and add render gaurd for
petertheprocess Apr 25, 2024
0b12cb0
[fix] fix gameInfo field typo
petertheprocess Apr 25, 2024
575cea5
update stomp_types.ts; change xxid's type from number to string
petertheprocess Apr 25, 2024
8ef2412
[fix]upload blob's reversed version
petertheprocess Apr 25, 2024
04aeccc
Fix dropdown bug; Adjust lobby UI and create room function
Haaaan1 Apr 25, 2024
2d0d046
disable create btn when roomTheme is not selected
petertheprocess Apr 25, 2024
097325e
[fix] 1.fix eslint err 2.remove npm run test in github action
petertheprocess Apr 25, 2024
d663197
1.add emplty string as promp option for Dropdown widegt
petertheprocess Apr 25, 2024
5b9ca84
[fix] counter fixed
yixuan-zhou-uzh Apr 25, 2024
7c903e1
Merge remote-tracking branch 'origin/M3-intergration-test' into M3-in…
yixuan-zhou-uzh Apr 25, 2024
697e454
Update profile display
Haaaan1 Apr 25, 2024
a8fd72b
Merge branch 'M3-intergration-test' of https://github.com/sopra-fs24-…
Haaaan1 Apr 25, 2024
598486a
[fix] fix warning about default value for input and dropdown
petertheprocess Apr 25, 2024
fe7cd06
[fix] roundFinishsed to show if disabled
yixuan-zhou-uzh Apr 25, 2024
12e5874
Merge remote-tracking branch 'origin/M3-intergration-test' into M3-in…
yixuan-zhou-uzh Apr 25, 2024
8ff8ff1
[fix] counter !== none
yixuan-zhou-uzh Apr 25, 2024
7a8a36c
[fix] counter moved to a component to avoid side effect
yixuan-zhou-uzh Apr 25, 2024
6fe3694
[bug] comment the disabled for now
yixuan-zhou-uzh Apr 25, 2024
be5dd01
Modify create room
Haaaan1 Apr 25, 2024
3ce5b49
Merge branch 'M3-intergration-test' of https://github.com/sopra-fs24-…
Haaaan1 Apr 25, 2024
7dbccf8
1.move the CounterDown component outside
petertheprocess Apr 25, 2024
8ea421f
eslint fixed and some debug-logging commented
petertheprocess Apr 25, 2024
95229d1
[sonar] remove all test related configs to avoid sonar test scanning
petertheprocess Apr 25, 2024
dd0117a
[feat] game over player list modified
yixuan-zhou-uzh Apr 25, 2024
b776c06
[feat] submit disabled after validation correctly
yixuan-zhou-uzh Apr 25, 2024
7e33f69
[fix] alert removed
yixuan-zhou-uzh Apr 25, 2024
1aaf657
[fix] lint
yixuan-zhou-uzh Apr 25, 2024
1e55f91
[fix] roomOwner leaves
yixuan-zhou-uzh Apr 25, 2024
a3725bc
[feat] theme showing
yixuan-zhou-uzh Apr 25, 2024
2aed3ce
[fix] rm the waveplayer when reveal for now
yixuan-zhou-uzh Apr 25, 2024
e5583d6
Modify lobby UI and add Intro
Haaaan1 Apr 25, 2024
aa79263
1. remove contribuion.md
petertheprocess Apr 25, 2024
ce2f0c8
Merge remote-tracking branch 'origin/main' into M3-intergration-test
petertheprocess Apr 25, 2024
6d205e0
fix roomName display
petertheprocess Apr 25, 2024
3a9c770
Modify intro
Haaaan1 Apr 25, 2024
01b173a
Add room players checking for enter room
Haaaan1 Apr 25, 2024
d92d033
Modify enter room
Haaaan1 Apr 25, 2024
fc4f639
getDomain based on build for ws connect url
petertheprocess Apr 25, 2024
e98685f
Merge branch 'M3-intergration-test' of github.com:sopra-fs24-group-09…
petertheprocess Apr 25, 2024
a758c94
[fix] fix answer submit always disabled bug
petertheprocess Apr 25, 2024
1390724
Delete mock player default value
Haaaan1 Apr 26, 2024
052cb7e
[fix] the room theme to be loading
yixuan-zhou-uzh Apr 26, 2024
b11632f
Move all function component defination outside of the Gameroom.
petertheprocess Apr 26, 2024
8b01aaa
[fix] the leaderboard not changing after user quitting
yixuan-zhou-uzh Apr 26, 2024
7d8fbf0
[fix] the room theme to be loading
yixuan-zhou-uzh Apr 26, 2024
03fe5b0
[fix] the leaderboard not changing after user quitting
yixuan-zhou-uzh Apr 26, 2024
c59e0dd
Merge branch 'M3-ui-modify' of github.com:sopra-fs24-group-09/sopra-f…
petertheprocess Apr 26, 2024
c4f1d61
comment debug log
petertheprocess Apr 26, 2024
1d496fa
Merge pull request #91 from sopra-fs24-group-09/M3-ui-modify
petertheprocess Apr 26, 2024
feed3cd
Volume tuning by useImperativeHandle rather than props,
petertheprocess Apr 26, 2024
ed4f404
[fix] lift volume state outside, fix mute behavior
petertheprocess Apr 26, 2024
57e9b82
Merge pull request #92 from sopra-fs24-group-09/M3-volume-tuning
petertheprocess Apr 26, 2024
d195885
Add manually reload rooms function
Haaaan1 Apr 26, 2024
b0237d5
Merge pull request #93 from sopra-fs24-group-09/feature-relaod-rooms
petertheprocess Apr 26, 2024
c909188
Prevent unsupported broswer play game. fix #94
petertheprocess Apr 26, 2024
e7ab79f
websocket forward error message
zihanltesla Apr 26, 2024
8fce7d5
Add nav to lobby
zihanltesla Apr 26, 2024
367d12c
Merge pull request #96 from sopra-fs24-group-09/feature/chrome-only-c…
petertheprocess Apr 26, 2024
757c8b0
Merge pull request #97 from sopra-fs24-group-09/M3-integration-test-a…
petertheprocess Apr 26, 2024
62c36c5
Fetch the latest roomlist before enter room action. fix #98
petertheprocess Apr 26, 2024
5e9ce4d
Merge pull request #100 from sopra-fs24-group-09/M3-check-roomlist-be…
petertheprocess Apr 26, 2024
77a14c9
If lose connection (network err or ws disconnected) with server, clea…
petertheprocess Apr 26, 2024
bdaeeaf
Merge pull request #104 from sopra-fs24-group-09/M3-lobby-request-exc…
petertheprocess Apr 26, 2024
7186cf2
fix lint
petertheprocess Apr 26, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions .github/workflows/build_test_before_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,3 @@ jobs:
node-version: "20.x"
- run: npm install
- run: npm run build

- name: Test
run: npm test
19 changes: 0 additions & 19 deletions Contribution.md

This file was deleted.

6 changes: 0 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,11 @@
"build": "react-scripts build",
"gcp-build": "",
"eject": "react-scripts eject",
"test": "react-scripts test --env=jsdom",
"lint": "eslint --fix src/**/*.ts src/**/*.tsx src/**/*.js"
},
"eslintConfig": {
"extends": "react-app"
},
"jest": {
"moduleNameMapper": {
"^axios$": "axios/dist/node/axios.cjs"
}
},
"engines": {
"node": "20.11.0"
},
Expand Down
17 changes: 0 additions & 17 deletions src/App.test.js

This file was deleted.

6 changes: 3 additions & 3 deletions src/components/routing/routeProtectors/LobbyGuard.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ import PropTypes from "prop-types";
* @param props
*/
export const LobbyGuard = () => {
if (localStorage.getItem("token")) {
if (sessionStorage.getItem("token")) {

return <Outlet />;
}
// Debugging

return <Outlet />;
//return <Navigate to="/login" replace />;
// return <Outlet />;
return <Navigate to="/login" replace />;
};

LobbyGuard.propTypes = {
Expand Down
2 changes: 1 addition & 1 deletion src/components/routing/routeProtectors/LoginGuard.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import PropTypes from "prop-types";
* instead of 'export default' at the end of the file.
*/
export const LoginGuard = () => {
if (!localStorage.getItem("token")) {
if (!sessionStorage.getItem("token")) {

return <Outlet />;
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/routing/routers/AppRouter.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ const AppRouter = () => {

{/* no guard for gameroom page now*/}
{/* the parameter name should match with the useParam in the Gameroom */}
<Route path="/rooms/:currentRoomID" element={<Gameroom/>} />
<Route path="/rooms/:currentRoomID/:currentRoomName" element={<Gameroom/>} />

<Route path="/editprofile" element={<LobbyGuard />}>
<Route index element={<EditProfile />} />
Expand Down
21 changes: 11 additions & 10 deletions src/components/ui/AudioRecorder.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -214,15 +214,18 @@ export const AudioRecorder = React.forwardRef((props,ref) => {
console.warn("record-end", blob);
// save audio to local storage as encoded base64 string
const reader = new FileReader();
reader.onloadend = () => {
reader.onloadend = async () =>{
const base64data = reader.result as Base64audio;
sessionStorage.setItem(cachedName, base64data);
reverseAudioByFFmpegAndCacheIt(base64data);
await reverseAudioByFFmpegAndCacheIt(base64data);
compressAudioByFFmpegAndCacheIt(base64data);
console.log(`[${props.audioName}]`,"save audio to local storage");
// set isReverse to false
setIsReversed(false);
sessionStorage.setItem(cachedIsReversedName, "false");
// pass audio to parent component
props.handleReversedAudioChange && props.handleReversedAudioChange(audioReversedBlobRef.current);
console.log(`[${props.audioName}]`,"reversed audio passing to parent", audioReversedBlobRef.current);
};
reader.readAsDataURL(blob);
});
Expand Down Expand Up @@ -291,7 +294,7 @@ export const AudioRecorder = React.forwardRef((props,ref) => {
// load audio, layoutEffect is used to make sure the wavesurfer is initialized before loading audio
useLayoutEffect(() => {
initializeWaveSurferWithRecorder();
loadCachedAudio();
// loadCachedAudio();

return () => {
// // clean up wavesurfer
Expand Down Expand Up @@ -323,15 +326,13 @@ export const AudioRecorder = React.forwardRef((props,ref) => {
};

useImperativeHandle(ref, () => ({
clearAudio: clearAudio
clearAudio: clearAudio,
setVolume: (volume: number) => {
wavesurfer.current?.setVolume(volume);
console.log(`[${props.audioName}]`,"set volume to", volume);
}
}),[]);

// pass reversed audio to parent component
useEffect(() => {
props.handleReversedAudioChange && props.handleReversedAudioChange(audioReversedBlobRef.current);
console.log(`[${props.audioName}]`,"reversed audio changed", audioReversedBlobRef.current);
}, [audioReversedBlobRef.current]);

return (
<div className={`audio-recorder ${props.className}`}>
<div ref={waveformRef} className="audio-recorder wave-frame" />
Expand Down
5 changes: 4 additions & 1 deletion src/components/ui/ButtonPlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "../../styles/ui/ButtonPlayer.scss";
type ButtonPlayerProps = {
audioURL: string;
className?: string;
volume: number;
};

export const ButtonPlayer = (props: ButtonPlayerProps) => {
Expand All @@ -35,13 +36,15 @@ export const ButtonPlayer = (props: ButtonPlayerProps) => {
audio.addEventListener("ended", () => {
setIsPlaying(false);
});
audio.volume = props.volume;
console.log(`[ButtonPlayer-${props.className}]`, "audio volume set to", props.volume);

return () => {
audio.removeEventListener("ended", () => {
setIsPlaying(false);
});
};
}, []);
}, [props.volume]);

return (
<div className={`btn-player ${props.className}`}>
Expand Down
42 changes: 42 additions & 0 deletions src/components/ui/CounterDown.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import React, { useState, useLayoutEffect } from "react";

type CounterDownProps = {
endTimeString: string;
};

export const CounterDown: React.FC<CounterDownProps> = ({ endTimeString }) => {
const [timeLeft, setTimeLeft] = useState<number>();

useLayoutEffect(() => {
// const now = Date.now();
// console.log(`[debug][${now}-countdown-useLayoutEffect]endTimeString`, endTimeString);
if (endTimeString === null || endTimeString === "") {
return;
}
const updateCountdown= () => {
const cleanedEndTimeString = endTimeString.replace("[UTC]", "").trim();
const endTime = new Date(cleanedEndTimeString).getTime();
const now = Date.now();
// console.log(`[debug][${now}-countdown-interval]`, endTimeString);
const leftTimeSeconds = Math.max(0, Math.floor((endTime - now) / 1000));
setTimeLeft(leftTimeSeconds);
}
updateCountdown();
const intervalId = setInterval(updateCountdown, 1000);

return () => {
clearInterval(intervalId);
};
}, [endTimeString]);

return (
<>
<div className="gameroom counterdiv">
<i className={"twa twa-stopwatch"} style={{ fontSize: "2.6rem" }} />
<span className="gameroom counternum">{timeLeft}</span>
</div>
</>
);
};

export default CounterDown;
12 changes: 9 additions & 3 deletions src/components/ui/Dropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,21 @@ import PropTypes from "prop-types";
import "../../styles/ui/Dropdown.scss";

export const Dropdown = (props) => {

const handleChange = (event) => {
// Call the passed onChange function with the selected option's value
props.onChange(event.target.value);
};

return (
<div className={`primary-dropdown ${props.className}`}
style={props.style}>
<select
disabled={props.disabled}
style={props.style}
onChange={props.onChange}
defaultValue={props.defaultValue}>
{props.prompt && <option hidden disabled selected value>{props.prompt}</option>}
onChange={handleChange}
defaultValue={props.defaultValue? props.defaultValue : ""}>
{props.prompt && <option hidden disabled value="">{props.prompt}</option>}
{props.options.map((option, index) => (
<option key={index} value={option.value}>
{option.label}
Expand Down
28 changes: 11 additions & 17 deletions src/components/ui/VolumeBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,23 +5,14 @@ import { IoMdVolumeOff, IoMdVolumeHigh} from "react-icons/io";
import "../../styles/ui/VolumeBar.scss";

export const VolumeBar = props => {
const [volume, setVolume] = useState(props.volume);
const volumeBeforeMute = useRef(0);


return (
<div className="volume-bar">
{/* toggle mute or not*/}
<Button onClick={() => {
if (volume === 0) {
setVolume(volumeBeforeMute.current);
} else {
volumeBeforeMute.current = volume;
setVolume(0);
}
}}
className = "volume-bar toggle-mute"
<Button onClick={props.onClickMute}
className = "volume-bar toggle-mute"
>
{volume === 0 ? <IoMdVolumeOff /> : <IoMdVolumeHigh />}
{props.volume === 0 ? <IoMdVolumeOff /> : <IoMdVolumeHigh />}
</Button>
{/* volume slider */}
<input
Expand All @@ -30,10 +21,11 @@ export const VolumeBar = props => {
min="0"
max="1"
step="0.01"
value={volume}
onChange={e => {
setVolume(e.target.value);
}}
value={props.volume}
// onChange={e => {
// setVolume(e.target.value);
// }}
onChange={props.onChange}
/>

</div>
Expand All @@ -42,6 +34,8 @@ export const VolumeBar = props => {

VolumeBar.propTypes = {
volume: Proptypes.number,
onChange: Proptypes.func,
onClickMute: Proptypes.func,
};


22 changes: 15 additions & 7 deletions src/components/ui/WavePlayer.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React, {useEffect, useState, useRef} from "react";
import React, {useEffect, useState, useRef, useImperativeHandle } from "react";
import WaveSurfer from "wavesurfer.js";
import propTypes from "prop-types";
import { Button } from "./Button";
import "styles/ui/WavePlayer.scss";

const WavePlayer = props => {
export const WavePlayer = React.forwardRef((props,ref) => {
const waveformRef = useRef<HTMLDivElement>(null);
const wavesurfer = useRef<WaveSurfer | null>(null);
const [playbackRate, setPlaybackRate] = useState(1);
Expand Down Expand Up @@ -42,7 +42,6 @@ const WavePlayer = props => {
// setIsPlaying(prev => !prev);
}
);

};

useEffect(() => {
Expand All @@ -62,14 +61,21 @@ const WavePlayer = props => {
}
, [props.audioURL]);

useImperativeHandle(ref, () => ({
setVolume: (volume:number) => {
wavesurfer.current?.setVolume(volume);
console.log(`[${props.className}]`,"WaveSurfer set volume to", volume);
}
}), []);

return (
<div className={`wave-player ${props.className}`}>
<div className="waveform" ref={waveformRef}/>
<div className="no-audio-placeholder" style={{display: props.audioURL ? "none" : "block"}}>
........is recording......
<div className="no-audio-placeholder" style={{display: props.audioURL ? "none":"block"}}>
........No Audio Uploaded......
</div>
<div className="btn-group"
style={{display: props.audioURL ? "flex" : "none"}}>
style={{display: props.audioURL ? "flex":"none"}}>
<Button
className={"x0.5"}
onClick={() => {
Expand Down Expand Up @@ -116,7 +122,9 @@ const WavePlayer = props => {
</div>
);

}
});

WavePlayer.displayName = "WavePlayer";

WavePlayer.propTypes = {
className: propTypes.string,
Expand Down
Loading
Loading