diff --git a/frontend/src/components/Header/components/HeaderInstructorControls.tsx b/frontend/src/components/Header/components/HeaderInstructorControls.tsx index a946332..1e847b6 100644 --- a/frontend/src/components/Header/components/HeaderInstructorControls.tsx +++ b/frontend/src/components/Header/components/HeaderInstructorControls.tsx @@ -1,7 +1,7 @@ import { useState, useRef, useEffect } from "react"; import { useRecoilValue, useSetRecoilState } from "recoil"; import { Socket, Manager } from "socket.io-client"; -import { useLocation } from "react-router-dom"; +import { useNavigate, useLocation } from "react-router-dom"; import VolumeMeter from "./VolumeMeter"; @@ -31,6 +31,8 @@ const HeaderInstructorControls = () => { const selectedMicrophone = useRecoilValue(selectedMicrophoneState); const inputMicVolume = useRecoilValue(micVolmeState); const setInputMicVolumeState = useSetRecoilState(micVolmeState); + const setInstructorSocket = useSetRecoilState(instructorSocketState); + const navigate = useNavigate(); const showToast = useToast(); const canvasRef = useRecoilValue(canvasRefState); @@ -38,22 +40,16 @@ const HeaderInstructorControls = () => { const timerIdRef = useRef(null); // 경과 시간 표시 타이머 id const onFrameIdRef = useRef(null); // 마이크 볼륨 측정 타이머 id - const managerRef = useRef(); const socketRef = useRef(); const socketRef2 = useRef(); - - const setInstructorSocket = useSetRecoilState(instructorSocketState); - const pcRef = useRef(); const mediaStreamRef = useRef(); const updatedStreamRef = useRef(); const inputMicVolumeRef = useRef(0); const prevInputMicVolumeRef = useRef(0); - const roomid = new URLSearchParams(useLocation().search).get("roomid") || "999999"; - const sampleAccessToken = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJlbWFpbCI6InBsYXRpbm91c3NAZ21haWwuY29tIiwiaWF0IjoxNzAxNjY0NTc4LCJleHAiOjE3MDI3MDEzNzh9.e2ikfmTsFCoVNxenHpAh__hLhoJnUPWSf-FmFSPo_RA"; @@ -114,6 +110,7 @@ const HeaderInstructorControls = () => { setIsCloseModalOpen(false); showToast({ message: "강의가 종료되었습니다.", type: "alert" }); + navigate("/lecture-end"); }; const initConnection = async () => { @@ -121,7 +118,7 @@ const HeaderInstructorControls = () => { // 0. 소켓 연결 managerRef.current = new Manager(import.meta.env.VITE_MEDIA_SERVER_URL); - + socketRef.current = managerRef.current.socket("/create-room", { auth: { accessToken: sampleAccessToken, @@ -370,14 +367,14 @@ const HeaderInstructorControls = () => { const isCanvasDataChanged = canvasData.canvasJSON !== newJSONData; const isViewportChanged = JSON.stringify(canvasData.viewport) !== JSON.stringify(newViewport); - const isSizeChanged = canvasData.width !== newWidth || canvasData.height !== newHegiht; + const isSizeChanged = canvasData.width !== newWidth || canvasData.height !== newHeight; if (isCanvasDataChanged || isViewportChanged || isSizeChanged) { canvasData.canvasJSON = newJSONData; canvasData.viewport = newViewport; canvasData.eventTime = Date.now() - startTime; canvasData.width = newWidth; - canvasData.height = newHegiht; + canvasData.height = newHeight; submitData(canvasData); } } diff --git a/frontend/src/components/Header/components/HeaderParticipantControls.tsx b/frontend/src/components/Header/components/HeaderParticipantControls.tsx index 3edacd1..816914f 100644 --- a/frontend/src/components/Header/components/HeaderParticipantControls.tsx +++ b/frontend/src/components/Header/components/HeaderParticipantControls.tsx @@ -11,11 +11,9 @@ import SmallButton from "@/components/SmallButton/SmallButton"; import Modal from "@/components/Modal/Modal"; import { useToast } from "@/components/Toast/useToast"; -import selectedSpeakerState from "../../../stores/stateSelectedSpeaker"; -import speakerVolmeState from "../../../stores/stateSpeakerVolume"; - +import selectedSpeakerState from "@/stores/stateSelectedSpeaker"; +import speakerVolmeState from "@/stores/stateSpeakerVolume"; import participantCavasInstanceState from "@/stores/stateParticipantCanvasInstance"; - import participantSocketRefState from "@/stores/stateParticipantSocketRef"; const HeaderParticipantControls = () => { @@ -104,6 +102,7 @@ const HeaderParticipantControls = () => { }); socketRef2.current.on("ended", () => { showToast({ message: "강의가 종료되었습니다.", type: "alert" }); + leaveLecture(); }); interface ICanvasData { @@ -192,7 +191,7 @@ const HeaderParticipantControls = () => { if (mediaStreamRef.current) mediaStreamRef.current.getTracks().forEach((track) => track.stop()); // 미디어 트랙 중지 setIsModalOpen(false); - navigate("/"); + navigate("/lecture-end"); }; const initConnection = async () => { diff --git a/frontend/src/pages/Participant/Participant.tsx b/frontend/src/pages/Participant/Participant.tsx index e171406..9f09d25 100644 --- a/frontend/src/pages/Participant/Participant.tsx +++ b/frontend/src/pages/Participant/Participant.tsx @@ -4,7 +4,9 @@ import { fabric } from "fabric"; import Header from "@/components/Header/Header"; import participantCavasInstanceState from "@/stores/stateParticipantCanvasInstance"; -import QuestionLogButton from "./components/QuestionLogButton"; +import CloseIcon from "@/assets/svgs/close.svg?react"; +import QuestionIcon from "@/assets/svgs/whiteboard/question.svg?react"; +import LogToggleButton from "@/components/Button/LogToggleButton"; import LogContainer from "@/components/LogContainer/LogContainer"; import isQuestionLogOpenState from "@/stores/stateIsQuestionLogOpen"; @@ -49,8 +51,8 @@ const Participant = () => { return ( <>
-
- +
+ { <>
- +
diff --git a/frontend/src/pages/Test/components/CanvasSection.tsx b/frontend/src/pages/Test/components/CanvasSection.tsx index 8ea3e90..6f46124 100644 --- a/frontend/src/pages/Test/components/CanvasSection.tsx +++ b/frontend/src/pages/Test/components/CanvasSection.tsx @@ -99,7 +99,7 @@ const CanvasSection = () => { }, []); return ( -
+