-
Notifications
You must be signed in to change notification settings - Fork 4
[Refactor] 세션 페이지 컴포넌트 분리, 커스텀 훅 분리, UI 개선, 화상 회의 도중 미디어 장치 변경 가능하도록 수정 #63
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
[Refactor] 세션 페이지 컴포넌트 분리, 커스텀 훅 분리, UI 개선, 화상 회의 도중 미디어 장치 변경 가능하도록 수정 #63
Conversation
- 스트림을 얻어오는 로직 분리 - 사용자 미디어 장치 관련 로직 분리 - mediaDevices 관련 로직 분리
blu3fishez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pretendard 폰트를 직접 가져오시는데 혹시 CDN 활용해보시는건 어떨까요??? (살려줘요..)
리팩토링 너무 잘 된 것 같습니다!! 따봉 5개 드리겠씁니다 ^__^ bbbbb
| interface Props { | ||
| handleVideoToggle: () => void; | ||
| handleMicToggle: () => void; | ||
| userVideoDevices: MediaDeviceInfo[]; | ||
| userAudioDevices: MediaDeviceInfo[]; | ||
| setSelectedVideoDeviceId: (deviceId: string) => void; | ||
| setSelectedAudioDeviceId: (deviceId: string) => void; | ||
| isVideoOn: boolean; | ||
| isMicOn: boolean; | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
인터페이스 구성 좋습니다!
제가 예엣날에 프론트 선배님(?)께 배운 방식은 컴포넌트Props 로 별도로 명세해서 추가적으로 어떤 프로퍼티인지 알려주는 식으로 구성하긴 했어요
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
이 컴포넌트를 예시로 들 경우 SessionToolbarProps 와 같은 형식이에용
| try { | ||
| const devices = await navigator.mediaDevices.enumerateDevices(); | ||
| const audioDevices = devices.filter( | ||
| (device) => device.kind === "audioinput" | ||
| ); | ||
| const videoDevices = devices.filter( | ||
| (device) => device.kind === "videoinput" | ||
| ); | ||
|
|
||
| setUserAudioDevices(audioDevices); | ||
| setUserVideoDevices(videoDevices); | ||
| } catch (error) { | ||
| console.error("미디어 기기를 찾는데 문제가 발생했습니다.", error); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
try - catch 문 사용 너무 좋습니다!
문제가 발생했을 때 유저에게 어떤 변화를 줄 지도 추후에 생각해보는 식으로 확장해나가면 좋겠네요!
| useEffect(() => { | ||
| const newSocket = io(socketURL || "http://localhost:3000"); | ||
|
|
||
| newSocket.on("connect_error", socketErrorHandler); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
함수로 따로 빼주신 것 좋습니다!
yiseungyun
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
오 리팩토링 하고 싶다 생각했었는데, 너무 좋습니다. 👍☃️👍
pretendard는 제가 디자인 작업하면서 @import url('https://cdn.jsdelivr.net/gh/orioncactus/pretendard/dist/web/static/pretendard.css');으로 가져오고 있어서 폰트 파일은 없어도 될거 같습니다!
진짜 수고 많으셨어요. ☃️
|
프로젝트에 따라 컴포넌트를 어떻게 분리하고 폴더 구조를 어떻게 설정할지는 정답이 다 다르다 생각하는데, [React] 실무용 폴더구조 container / presenter 글처럼 데이터 처리와 UI를 분리하는 걸 시도해보는 건 어떨까요? |
twalla26
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
전체적인 리팩토링 작업을 하셨군요! LGTM!
ee147b0
blu3fishez
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
흠.. 이렇게 된거 main 브랜치로 가는 것만 전원이 리뷰하도록 만드는 것도 좋을 것 같네요
Note
작성자: 서정우
작성 날짜: 2024.11.10
화상 통화 페이지의 구현을 우선하여 개발했기 때문에 리팩토링 작업을 진행했습니다. 컴포넌트로 분리하거나 커스텀 훅으로 분리하는 등의 작업을 진행했습니다. 리팩토링 위주이기 때문에 약간의 스타일 디테일과 기능 향상을 목적으로 작업했습니다.
해당 작업을 통해 SessionPage 코드의 길이를 25% 줄일 수 있었습니다. 아직 더 개선의 여지가 있습니다.
관련 이슈 번호
#11
✅ 체크리스트
🧩 작업 내용
📝 작업 상세 내역
컴포넌트 분리 및 커스텀 훅 구현
useSocket
useMediaDevices
미디어 장치 변경 기능 개선
UI/UX 개선
📌 테스트 및 검증 결과
💬 다음 작업 또는 논의 사항
🐥 리뷰 받고 싶은 포인트