Conversation
Summary of ChangesHello @AndyH0ng, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! 이 PR은 Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
이번 PR은 react-router-dom을 사용한 라우팅 설정, 헤더 레이아웃 리팩토링, 네비게이션 상수 중앙 관리 등 중요한 개선 사항을 포함하고 있습니다. 전반적으로 코드 구조가 명확해지고 확장성이 좋아졌습니다. 다만, 일부 코드에서 유지보수성을 더욱 향상시킬 수 있는 부분이 있어 몇 가지 제안을 드립니다. src/main.tsx에서 라우팅 설정을 동적으로 생성하고, src/App.tsx에서 UI 요소를 컴포넌트로 분리하면 코드가 더욱 견고하고 재사용 가능해질 것입니다. 자세한 내용은 아래의 개별 댓글을 참고해주세요.
| const router = createBrowserRouter([ | ||
| { | ||
| path: '/', | ||
| element: <App />, | ||
| children: [ | ||
| { index: true, element: <SlidePage /> }, // DEFAULT_TAB 변경 시 동기화 필요 | ||
| { path: 'slide', element: <SlidePage /> }, | ||
| { path: 'video', element: <VideoPage /> }, | ||
| { path: 'insight', element: <InsightPage /> }, | ||
| ], | ||
| }, | ||
| ]); |
There was a problem hiding this comment.
라우팅 설정이 src/constants/navigation.ts에 정의된 TABS 배열과 동기화되지 않고 하드코딩되어 있습니다. 이로 인해 TABS가 변경될 때마다 라우트 설정을 수동으로 업데이트해야 하며, 이는 유지보수성을 저해하고 잠재적인 버그를 유발할 수 있습니다. (// DEFAULT_TAB 변경 시 동기화 필요 주석 참고)
TABS와 DEFAULT_TAB 상수를 사용하여 라우트를 동적으로 생성하면 이 문제를 해결하고 코드를 더 견고하게 만들 수 있습니다.
아래 제안을 적용하기 전에 파일 상단에 다음 import 구문을 추가하거나 수정해주세요.
import { StrictMode, type ReactElement } from 'react';
import { TABS, DEFAULT_TAB, type Tab } from './constants/navigation';| const router = createBrowserRouter([ | |
| { | |
| path: '/', | |
| element: <App />, | |
| children: [ | |
| { index: true, element: <SlidePage /> }, // DEFAULT_TAB 변경 시 동기화 필요 | |
| { path: 'slide', element: <SlidePage /> }, | |
| { path: 'video', element: <VideoPage /> }, | |
| { path: 'insight', element: <InsightPage /> }, | |
| ], | |
| }, | |
| ]); | |
| const pageComponentMap: Record<Tab, ReactElement> = { | |
| slide: <SlidePage />, | |
| video: <VideoPage />, | |
| insight: <InsightPage />, | |
| }; | |
| const router = createBrowserRouter([ | |
| { | |
| path: '/', | |
| element: <App />, | |
| children: [ | |
| { index: true, element: pageComponentMap[DEFAULT_TAB] }, | |
| ...TABS.map((tab) => ({ | |
| path: tab.path.substring(1), | |
| element: pageComponentMap[tab.key], | |
| })), | |
| ], | |
| }, | |
| ]); |
There was a problem hiding this comment.
동적으로 만들어봤자 TABS랑 pageComponentMap을 건드려야 합니다.
TABS랑 children을 수정해야 하는 현행과 크게 다를 바 없으며,
라우팅이 명시적으로 보이지 않아서 가독성도 떨어집니다.
이에 현행으로 유지합니다.
| headerLeft={<div>로고</div>} | ||
| headerCenter={<Gnb activeTab={activeTab} />} | ||
| headerRight={<div>로그인</div>} |
There was a problem hiding this comment.
로고와 공유, 로그인 버튼은 추후 추가될 예정이므로 현행을 유지합니다.
📌 관련 이슈
✨ 변경 내용
GNB컴포넌트를Gnb로 renamepath속성 및PATH_TO_TAB,DEFAULT_TAB중앙 관리react-router-dom을 사용한 라우팅 구현💡 참고 사항
스크린샷, 참고 링크, 추가 설명 등 (없으면 생략 가능)