-
Notifications
You must be signed in to change notification settings - Fork 0
Feature/counsel apply #7
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
base: main
Are you sure you want to change the base?
Conversation
community publishing
feat: alarm page publishing
Walkthrough이 변경사항은 라우팅 구조의 확장과 커뮤니티, 알림, 상담 신청 등 다양한 신규 페이지 및 컴포넌트의 도입을 포함합니다. 주요 컴포넌트와 페이지가 추가 및 리팩토링되었으며, 디렉터리 구조와 import 경로가 정비되었습니다. 일부 스타일 및 네비게이션 기능도 개선되었습니다. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant App
participant Router
participant Page
User->>App: 브라우저에서 접속
App->>Router: 라우팅 설정
Router->>ScrollToTop: 라우트 변경 감지
ScrollToTop->>Browser: window.scrollTo(0,0)
Router->>Page: 해당 경로의 컴포넌트 렌더링
Page-->>User: UI 표시 및 상호작용
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20–25 minutes Possibly related PRs
Suggested reviewers
Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. ✨ Finishing Touches
🧪 Generate unit tests
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Actionable comments posted: 13
🧹 Nitpick comments (20)
src/components/community/NameBar.tsx (1)
12-23: 뷰포트 너비 사용을 개선하세요.
width: 100vw사용은 일부 디바이스에서 수평 스크롤바로 인한 레이아웃 문제를 야기할 수 있습니다.다음과 같이 수정하는 것을 권장합니다:
const Bar = styled.div` - width: 100vw; + width: 100%; height: 52px; padding-left: 12px; display: flex; justify-content: flex-start; align-items: center; border-bottom: 1px solid ${theme.color.gray[3]}; font-size: 15px; font-weight: 700; color: black; `;src/components/community/BoardHeader.tsx (1)
20-22: 뒤로가기 링크를 더 유연하게 만드세요.하드코딩된 라우트 경로는 컴포넌트의 재사용성을 제한합니다.
백 링크를 prop으로 받도록 개선하는 것을 권장합니다:
interface Prop { community: string; title: string; author: string; date: string; views: number; + backLink?: string; } -const BoardHeader = ({ community, title, author, date, views }: Prop) => { +const BoardHeader = ({ community, title, author, date, views, backLink = "/wee-community" }: Prop) => { return ( <Container> <TopSection> - <Link to="/wee-community"> + <Link to={backLink}> <img src={arrow} alt="뒤로 가기" /> </Link>src/components/community/Comment.tsx (1)
16-19: 좋아요 기능 추가를 고려하세요.하트 아이콘이 있지만 클릭 이벤트가 없어 사용자가 실제로 좋아요를 누를 수 없습니다.
인터랙티브한 좋아요 기능이 필요하다면 다음과 같이 개선하세요:
interface Prop { userName: string; comment: string; likes: number; + onLike?: () => void; + isLiked?: boolean; } -const Comment = ({ userName, comment, likes }: Prop) => { +const Comment = ({ userName, comment, likes, onLike, isLiked }: Prop) => { return ( <CommentContainer> <p>{userName}</p> <div>{comment}</div> - <Like> + <Like onClick={onLike} style={{ cursor: onLike ? 'pointer' : 'default' }}> <img src={blankHeart} alt="" /> {likes} </Like> </CommentContainer> ); };src/components/TimeBox.tsx (1)
42-61: 접근성 개선을 위한 ARIA 속성 추가를 고려하세요.시간 슬롯 버튼에 접근성을 위한 ARIA 속성을 추가하면 스크린 리더 사용자에게 더 나은 경험을 제공할 수 있습니다.
<TimeSlotButton key={slot.id} onClick={() => handleSlotClick(slot.id, slot.available)} disabled={!slot.available} selected={selectedSlot === slot.id} available={slot.available} + aria-label={`${slot.startTime}부터 ${slot.endTime}까지${!slot.available ? ' (예약 불가)' : ''}${selectedSlot === slot.id ? ' (선택됨)' : ''}`} + role="button" >src/components/community/Post.tsx (2)
8-8: 인터페이스 이름을 더 명확하게 변경하세요.
Prop보다는PostProps와 같이 더 명확한 이름을 사용하는 것이 좋습니다.-interface Prop { +interface PostProps {-const Post = ({ title, views, likes, comments, author, timeAgo }: Prop) => { +const Post = ({ title, views, likes, comments, author, timeAgo }: PostProps) => {
37-37: 점 아이콘에 의미있는 alt 텍스트를 추가하세요.빈 alt 속성보다는 의미를 나타내는 텍스트나
alt="구분자"를 사용하는 것이 좋습니다.-<img src={dot} alt="" /> +<img src={dot} alt="구분자" />src/components/alarm/AlarmItem.tsx (1)
18-22: 고정 너비 대신 반응형 디자인을 고려하세요.Content 컴포넌트의 고정 너비(232px)는 다양한 화면 크기에서 문제를 일으킬 수 있습니다.
const Content = styled.div` - width: 232px; + flex: 1; + max-width: 232px; font-size: 15px; font-weight: 400; `;src/components/community/CreatePost.tsx (1)
5-12: 접근성과 시맨틱 HTML을 개선하세요.현재 div로 구현된 버튼을 의미적으로 올바른 button 요소로 변경하고 접근성을 개선하는 것을 권장합니다.
const CreatePost = () => { return ( - <Container> + <Container as="button" type="button" aria-label="새 게시물 작성"> <img src={createPost} alt="게시물 작성" /> <p>글쓰기</p> </Container> ); };Container 스타일에도 button 관련 스타일을 추가하세요:
const Container = styled.div` width: 60px; height: 60px; background-color: ${theme.color.main}; - border: none; + border: none; + outline: none; border-radius: 100px; display: flex; flex-direction: column; align-items: center; justify-content: center; font-size: 12px; font-weight: 600; color: white; position: fixed; right: 32px; bottom: 32px; cursor: pointer; + + &:hover { + opacity: 0.9; + } + + &:focus { + box-shadow: 0 0 0 2px rgba(0, 201, 81, 0.3); + } `;src/page/community/WeeCommunity.tsx (2)
46-64: 중복된 더미 데이터 제거 필요5번째와 6번째 게시물이 완전히 동일합니다. 중복된 데이터를 제거하거나 다른 내용으로 변경해주세요.
{ id: 6, - title: "하마쌤 레전드 어록 정리ㅋㅋ", - views: 120, - likes: 99, - comments: 58, - author: "유머천재", - timeAgo: "5시간 전", + title: "동아리 모집 공고 - 코딩 스터디", + views: 75, + likes: 32, + comments: 15, + author: "스터디장", + timeAgo: "6시간 전", },
73-87: 동적 라우팅 구현 고려모든 게시물이 동일한
/wee-detail경로로 연결되어 있습니다. 게시물 ID를 포함한 동적 라우팅을 구현하는 것을 고려해보세요.<Link key={post.id} - to="/wee-detail" + to={`/wee-detail/${post.id}`} style={{ textDecoration: "none", color: "black" }} >src/page/CounselApply.tsx (3)
4-4: 사용하지 않는 import 제거
Banner컴포넌트를 import했지만 사용하지 않고 있습니다. 빌드 검증에서도 이를 지적하고 있습니다.- import Banner from "../components/system/Banner";
56-56: 빈 submit 핸들러 구현 필요
handleSubmit함수가 비어있습니다. 상담 신청 로직을 구현하거나 TODO 주석을 추가해주세요.- const handleSubmit = () => {}; + const handleSubmit = () => { + // TODO: 상담 신청 API 호출 구현 + console.log('Selected time slot:', selectedTimeSlot); + console.log('Selected consultation type:', selectedConsultationType); + };상담 신청 API 연동 로직을 구현하는데 도움이 필요하시면 알려주세요.
110-261: 반응형 디자인 고려사항모든 요소가 절대 위치(absolute positioning)로 배치되어 있어 다양한 화면 크기에서 레이아웃이 깨질 수 있습니다. 반응형 디자인을 위해 상대적 위치 또는 Flexbox/Grid 레이아웃 사용을 고려해보세요.
src/page/alarm/AlarmPage.tsx (3)
1-1: 사용하지 않는 React import 제거React 18+에서는 JSX 변환이 자동으로 처리되므로 React를 명시적으로 import할 필요가 없습니다.
- import React from "react";
7-7: 사용하지 않는 AlarmItem import 제거
AlarmItem컴포넌트를 import했지만 사용하지 않고 있습니다.- import AlarmItem from "../../components/alarm/AlarmItem";
13-15: 하드코딩된 뒤로가기 경로 개선뒤로가기 버튼이 특정 경로(
/wee-community)로 하드코딩되어 있습니다. 더 유연한 네비게이션을 위해useNavigate(-1)사용을 고려해보세요.+ import { useNavigate } from "react-router-dom"; + + const AlarmPage = () => { + const navigate = useNavigate(); + + const handleBack = () => { + navigate(-1); + }; + return ( <Container> <TopSection> - <Link to="/wee-community"> - <img src={arrow} alt="뒤로 가기" /> - </Link> + <img src={arrow} alt="뒤로 가기" onClick={handleBack} style={{cursor: 'pointer'}} />src/page/community/WeeDetail.tsx (1)
33-64: 다양한 더미 댓글 데이터 추가모든 댓글이 동일한 작성자와 내용("감사합니다")으로 구성되어 있어 비현실적입니다. 더 다양한 댓글 데이터를 추가해주세요.
const CommentDummy = [ { id: 1, userName: "주문하신 하마", comment: "감사합니다", likes: 63, }, { id: 2, - userName: "주문하신 하마", - comment: "감사합니다", - likes: 63, + userName: "코딩소녀", + comment: "정말 유용한 정보네요!", + likes: 42, }, { id: 3, - userName: "주문하신 하마", - comment: "감사합니다", - likes: 63, + userName: "똑순이", + comment: "저도 이런 팁이 필요했어요", + likes: 28, }, // ... 나머지 댓글들도 다양하게 수정src/page/community/WritePost.tsx (1)
32-32: 게시하기 버튼 기능 구현 필요게시하기 버튼에 실제 게시 로직이 구현되어 있지 않습니다. 폼 데이터 수집 및 제출 기능을 추가해야 합니다.
+ const [title, setTitle] = useState(''); + const [content, setContent] = useState(''); + + const handlePost = () => { + if (!title.trim() || !content.trim()) { + alert('제목과 내용을 모두 입력해주세요.'); + return; + } + // TODO: 게시물 등록 API 호출 + console.log('Title:', title); + console.log('Content:', content); + }; - <PostButton>게시하기</PostButton> + <PostButton onClick={handlePost}>게시하기</PostButton>게시물 등록 API 연동 및 폼 유효성 검사 로직 구현에 도움이 필요하시면 알려주세요.
src/page/community/Community.tsx (1)
9-64: 프로덕션 환경을 위해 API 연동을 고려하세요.현재 하드코딩된 더미 데이터를 사용하고 있습니다. 실제 서비스에서는 API를 통해 게시물 데이터를 가져오는 것을 고려해 주세요.
API 연동 로직 구현에 도움이 필요하시면 알려주세요.
src/components/Button.tsx (1)
121-123: 선택 상태에 따른 Description 색상을 차별화하세요.현재 선택된 상태와 선택되지 않은 상태 모두 같은 색상(
theme.color.gray[2])을 사용하고 있습니다. 사용자 경험 개선을 위해 차별화를 고려해 보세요.color: ${(props) => - props.selected ? theme.color.gray[2] : theme.color.gray[2]}; + props.selected ? theme.color.gray[1] : theme.color.gray[2]};
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
⛔ Files ignored due to path filters (2)
src/assets/create-post.svgis excluded by!**/*.svgsrc/assets/dot-gray.svgis excluded by!**/*.svg
📒 Files selected for processing (22)
src/App.tsx(1 hunks)src/components/Button.tsx(1 hunks)src/components/ScrollToTop.tsx(1 hunks)src/components/TimeBox.tsx(1 hunks)src/components/alarm/AlarmContainer.tsx(1 hunks)src/components/alarm/AlarmItem.tsx(1 hunks)src/components/community/BoardHeader.tsx(1 hunks)src/components/community/Comment.tsx(1 hunks)src/components/community/CreatePost.tsx(1 hunks)src/components/community/NameBar.tsx(1 hunks)src/components/community/Post.tsx(1 hunks)src/components/system/Banner.tsx(1 hunks)src/components/system/BottomInput.tsx(1 hunks)src/components/system/NavBar.tsx(3 hunks)src/main.tsx(1 hunks)src/page/CounselApply.tsx(1 hunks)src/page/HomePage.tsx(1 hunks)src/page/alarm/AlarmPage.tsx(1 hunks)src/page/community/Community.tsx(1 hunks)src/page/community/WeeCommunity.tsx(1 hunks)src/page/community/WeeDetail.tsx(1 hunks)src/page/community/WritePost.tsx(1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (14)
src/components/community/NameBar.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/alarm/AlarmContainer.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/system/BottomInput.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/alarm/AlarmItem.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/community/BoardHeader.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/TimeBox.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/community/Comment.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/Button.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/page/CounselApply.tsx (3)
src/components/TimeBox.tsx (1)
TimeSlotBox(28-66)src/components/Button.tsx (1)
ConsultationTypeSelector(29-59)src/style/theme.tsx (1)
theme(1-14)
src/page/alarm/AlarmPage.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/community/CreatePost.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/page/community/WeeDetail.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/components/community/Post.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
src/page/community/WritePost.tsx (1)
src/style/theme.tsx (1)
theme(1-14)
🪛 GitHub Check: Build Verification
src/components/TimeBox.tsx
[failure] 3-3:
'useState' is declared but its value is never read.
src/components/Button.tsx
[failure] 3-3:
'useState' is declared but its value is never read.
src/page/CounselApply.tsx
[failure] 4-4:
'Banner' is declared but its value is never read.
src/page/alarm/AlarmPage.tsx
[failure] 7-7:
'AlarmItem' is declared but its value is never read.
[failure] 1-1:
'React' is declared but its value is never read.
🪛 GitHub Actions: NANUCLOUD(R) Production Deploy
src/components/Button.tsx
[error] 3-3: TypeScript error TS6133: 'useState' is declared but its value is never read.
🔇 Additional comments (21)
src/components/ScrollToTop.tsx (1)
4-12: LGTM! 표준적인 스크롤 복원 구현입니다.라우트 변경 시 페이지 상단으로 스크롤하는 표준적인 패턴을 올바르게 구현했습니다.
useLocation훅과useEffect를 적절히 사용하고 있으며, 의존성 배열도 정확합니다.src/components/community/BoardHeader.tsx (1)
16-41: LGTM! 잘 구성된 헤더 컴포넌트입니다.컴포넌트 구조가 명확하고 스타일링이 적절하며, TypeScript 인터페이스와 테마 시스템을 올바르게 사용하고 있습니다. 플렉스박스 레이아웃도 적절히 구현되었습니다.
src/components/community/Comment.tsx (1)
11-22: LGTM! 깔끔한 댓글 표시 컴포넌트입니다.컴포넌트 구조가 명확하고 스타일링이 일관성 있게 잘 구현되었습니다. 사용자명, 댓글 내용, 좋아요 수를 적절히 표시하고 있습니다.
src/components/TimeBox.tsx (1)
68-74: 절대 위치 지정으로 인한 레이아웃 문제를 검토하세요.
position: absolute와 하드코딩된top,left값을 사용하면 다양한 화면 크기나 콘텐츠 높이에서 레이아웃이 깨질 수 있습니다.부모 컴포넌트에서 이 컴포넌트가 어떻게 사용되는지 확인하여 상대적 위치 지정이나 플렉스 레이아웃으로 변경 가능한지 검토해주세요.
src/components/community/Post.tsx (1)
77-77: 레이아웃 오버플로우 가능성을 검토하세요.
width: 100vw를 사용하면 뷰포트 너비보다 넓어져 가로 스크롤이 발생할 수 있습니다. 특히 패딩이 추가되어 있어 더욱 그렇습니다.부모 컨테이너의 레이아웃을 확인하여
width: 100%나 다른 적절한 너비 설정으로 변경할 수 있는지 검토해주세요.src/page/HomePage.tsx (1)
3-4: 컴포넌트 디렉터리 구조 정리가 잘 되었습니다.시스템 레벨 컴포넌트들을
system폴더로 이동시키고 import 경로를 업데이트한 것이 코드베이스 구조를 더 명확하게 만듭니다.src/main.tsx (1)
7-9: StrictMode 추가가 좋습니다.React의 StrictMode를 추가하여 개발 중 잠재적 문제를 감지할 수 있게 된 것은 좋은 개선입니다.
src/components/system/Banner.tsx (1)
2-3: import 경로 업데이트가 올바르게 적용되었습니다.시스템 폴더로 이동에 따른 상대 경로 업데이트가 정확하게 이루어졌습니다.
src/components/alarm/AlarmContainer.tsx (1)
25-33: 스타일 컴포넌트 구조가 잘 정의되어 있습니다.컨테이너의 레이아웃과 스타일링이 적절하게 구현되었으며, 테마 시스템을 올바르게 활용하고 있습니다.
src/App.tsx (2)
14-26: 라우팅 구조 개선이 잘 구현되었습니다.BrowserRouter 래퍼와 ScrollToTop 컴포넌트 추가로 라우팅 기능이 향상되었습니다. 새로운 라우트들도 적절히 구성되어 있습니다.
23-23: 라우트 경로에 누락된 슬래시를 추가하세요.
counsel-apply라우트 경로 앞에 슬래시가 누락되었습니다. 이는 라우팅 오류를 발생시킬 수 있습니다.- <Route path="counsel-apply" element={<CounselApply />} /> + <Route path="/counsel-apply" element={<CounselApply />} />Likely an incorrect or invalid review comment.
src/components/system/NavBar.tsx (2)
40-43: 알림 아이콘에 Link 추가가 잘 구현되었습니다.벨 아이콘을 클릭 가능한 링크로 만든 것이 사용자 경험을 향상시킵니다.
51-59: 네비게이션 링크 구조가 잘 개선되었습니다.문자열 배열에서 객체 배열로 변경하고 Link 컴포넌트를 추가한 것이 라우팅 기능을 올바르게 구현했습니다.
src/page/community/WeeCommunity.tsx (1)
95-99: LGTM!컨테이너 스타일링이 적절하고 전체 뷰포트 너비를 사용하는 flex 레이아웃이 올바르게 구현되었습니다.
src/page/alarm/AlarmPage.tsx (1)
53-58: LGTM!컨테이너 레이아웃과 스타일링이 적절하게 구현되었습니다. 전체 뷰포트를 활용하는 flex 컬럼 레이아웃이 올바릅니다.
src/page/community/WeeDetail.tsx (2)
79-85: LGTM!게시물 내용의 줄바꿈 처리가 적절하게 구현되었습니다.
split("\n")과React.Fragment를 사용한 방식이 올바릅니다.
135-172: LGTM!스타일 컴포넌트들이 일관성 있게 구현되었고, 테마 색상을 적절히 활용하고 있습니다. 레이아웃 구조도 명확합니다.
src/page/community/WritePost.tsx (2)
14-26: LGTM!Textarea 자동 높이 조절 기능이 올바르게 구현되었습니다.
useRef와useEffect를 적절히 활용하여 초기 렌더링과 내용 변경 시 모두 처리하고 있습니다.
48-67: LGTM!Textarea 스타일링이 적절합니다.
resize: none과overflow: hidden을 통해 수동 크기 조절을 방지하고, 동적 높이 조절만 허용하는 것이 올바른 접근입니다.src/page/community/Community.tsx (1)
66-93: 컴포넌트 구조가 깔끔합니다.React 함수형 컴포넌트의 구조가 잘 구성되어 있고, React Router의 Link 컴포넌트를 적절히 사용하고 있습니다. 코드의 가독성도 좋습니다.
src/components/Button.tsx (1)
33-36: 토글 로직이 잘 구현되어 있습니다.선택 상태 토글 로직이 명확하고 효율적으로 구현되어 있습니다. 같은 타입을 다시 클릭하면 선택 해제되는 UX도 좋습니다.
| const AlarmContainer = () => { | ||
| return ( | ||
| <Container> | ||
| <Time>오늘</Time> | ||
| <ItemWrap> | ||
| <AlarmItem /> | ||
| <AlarmItem /> | ||
| </ItemWrap> | ||
| </Container> | ||
| ); | ||
| }; |
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.
🛠️ Refactor suggestion
하드코딩된 데이터를 동적 데이터로 개선하세요.
현재 AlarmItem 컴포넌트가 하드코딩되어 있습니다. 실제 알림 데이터를 props로 받아서 동적으로 렌더링하도록 개선하는 것을 권장합니다.
-const AlarmContainer = () => {
+interface AlarmData {
+ id: string;
+ message: string;
+ timestamp: string;
+ profileImage?: string;
+}
+
+interface AlarmContainerProps {
+ alarms: AlarmData[];
+ date: string;
+}
+
+const AlarmContainer = ({ alarms, date }: AlarmContainerProps) => {
return (
<Container>
- <Time>오늘</Time>
+ <Time>{date}</Time>
<ItemWrap>
- <AlarmItem />
- <AlarmItem />
+ {alarms.map((alarm) => (
+ <AlarmItem key={alarm.id} data={alarm} />
+ ))}
</ItemWrap>
</Container>
);
};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const AlarmContainer = () => { | |
| return ( | |
| <Container> | |
| <Time>오늘</Time> | |
| <ItemWrap> | |
| <AlarmItem /> | |
| <AlarmItem /> | |
| </ItemWrap> | |
| </Container> | |
| ); | |
| }; | |
| interface AlarmData { | |
| id: string; | |
| message: string; | |
| timestamp: string; | |
| profileImage?: string; | |
| } | |
| interface AlarmContainerProps { | |
| alarms: AlarmData[]; | |
| date: string; | |
| } | |
| const AlarmContainer = ({ alarms, date }: AlarmContainerProps) => { | |
| return ( | |
| <Container> | |
| <Time>{date}</Time> | |
| <ItemWrap> | |
| {alarms.map((alarm) => ( | |
| <AlarmItem key={alarm.id} data={alarm} /> | |
| ))} | |
| </ItemWrap> | |
| </Container> | |
| ); | |
| }; |
🤖 Prompt for AI Agents
In src/components/alarm/AlarmContainer.tsx around lines 5 to 15, the AlarmItem
components are hardcoded and not using dynamic data. Modify the AlarmContainer
to accept or fetch an array of alarm data and map over this array to render
AlarmItem components dynamically, passing the relevant data as props to each
AlarmItem.
| const AlarmItem = () => { | ||
| return ( | ||
| <Container> | ||
| <Profile> | ||
| <img src={logo} alt="프로필" /> | ||
| </Profile> | ||
| <Content> | ||
| <b>선생님</b>이 메시지를 보냈습니다: 무슨 일이니 친구야 | ||
| </Content> | ||
| </Container> | ||
| ); | ||
| }; |
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.
🛠️ Refactor suggestion
하드코딩된 컨텐츠를 동적 데이터로 변경하세요.
현재 프로필 이미지와 메시지가 하드코딩되어 있습니다. 재사용 가능한 컴포넌트로 만들기 위해 props를 통해 데이터를 받도록 개선해주세요.
+interface AlarmItemProps {
+ data: {
+ message: string;
+ profileImage?: string;
+ sender: string;
+ };
+}
+
-const AlarmItem = () => {
+const AlarmItem = ({ data }: AlarmItemProps) => {
return (
<Container>
<Profile>
- <img src={logo} alt="프로필" />
+ <img src={data.profileImage || logo} alt="프로필" />
</Profile>
<Content>
- <b>선생님</b>이 메시지를 보냈습니다: 무슨 일이니 친구야
+ <b>{data.sender}</b>이 메시지를 보냈습니다: {data.message}
</Content>
</Container>
);
};📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| const AlarmItem = () => { | |
| return ( | |
| <Container> | |
| <Profile> | |
| <img src={logo} alt="프로필" /> | |
| </Profile> | |
| <Content> | |
| <b>선생님</b>이 메시지를 보냈습니다: 무슨 일이니 친구야 | |
| </Content> | |
| </Container> | |
| ); | |
| }; | |
| interface AlarmItemProps { | |
| data: { | |
| message: string; | |
| profileImage?: string; | |
| sender: string; | |
| }; | |
| } | |
| const AlarmItem = ({ data }: AlarmItemProps) => { | |
| return ( | |
| <Container> | |
| <Profile> | |
| <img src={data.profileImage || logo} alt="프로필" /> | |
| </Profile> | |
| <Content> | |
| <b>{data.sender}</b>이 메시지를 보냈습니다: {data.message} | |
| </Content> | |
| </Container> | |
| ); | |
| }; |
🤖 Prompt for AI Agents
In src/components/alarm/AlarmItem.tsx around lines 5 to 16, the profile image
source and message content are hardcoded, limiting reusability. Modify the
AlarmItem component to accept props for the profile image URL, sender name, and
message text, then use these props to render the image src, alt text, and
message dynamically instead of fixed values.
| @@ -0,0 +1,125 @@ | |||
| import styled from "@emotion/styled"; | |||
| import { theme } from "../style/theme"; | |||
| import { useState } from "react"; | |||
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.
사용하지 않는 import를 제거하세요.
useState가 import되었지만 사용되지 않아서 빌드 오류가 발생하고 있습니다.
-import { useState } from "react";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { useState } from "react"; |
🧰 Tools
🪛 GitHub Check: Build Verification
[failure] 3-3:
'useState' is declared but its value is never read.
🪛 GitHub Actions: NANUCLOUD(R) Production Deploy
[error] 3-3: TypeScript error TS6133: 'useState' is declared but its value is never read.
🤖 Prompt for AI Agents
In src/components/Button.tsx at line 3, the import statement includes useState
which is not used anywhere in the file. Remove useState from the import
statement to fix the build error caused by the unused import.
| position: absolute; | ||
| top: 709px; | ||
| left: 24px; | ||
| width: calc(100% - 48px); | ||
| max-width: 354px; | ||
| `; |
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.
🛠️ Refactor suggestion
반응형 디자인을 위해 절대 위치 지정을 재검토하세요.
절대 위치 지정(position: absolute, 고정된 top, left 값)을 사용하면 다양한 화면 크기에서 레이아웃 문제가 발생할 수 있습니다. 상대적 위치 지정이나 flexbox 사용을 고려해 보세요.
🤖 Prompt for AI Agents
In src/components/Button.tsx around lines 62 to 67, the use of absolute
positioning with fixed top and left values can cause layout issues on different
screen sizes. Replace the absolute positioning with a more responsive layout
approach, such as using relative positioning combined with flexbox or grid, to
ensure the button adjusts properly across various device widths. Adjust width
and margin properties accordingly to maintain the intended design without fixed
pixel values.
| outline: none; | ||
| border-color: ${theme.color.main}; | ||
| `; |
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.
누락된 닫는 괄호를 추가하세요.
TypeButton 스타일드 컴포넌트의 닫는 괄호가 누락되어 있습니다.
&:focus {
outline: none;
border-color: ${theme.color.main};
+ }📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| `; | |
| &:focus { | |
| outline: none; | |
| border-color: ${theme.color.main}; | |
| } | |
| `; |
🤖 Prompt for AI Agents
In src/components/Button.tsx at line 98, the styled component TypeButton is
missing a closing parenthesis. Add the missing closing parenthesis at the end of
the styled component definition to properly close it.
| const timeSlots: TimeSlot[] = [ | ||
| { id: "1", startTime: "12:00", endTime: "12:30", available: true }, | ||
| { id: "2", startTime: "12:00", endTime: "12:30", available: false }, | ||
| { id: "3", startTime: "12:00", endTime: "12:30", available: true }, | ||
| { id: "4", startTime: "12:00", endTime: "12:30", available: true }, | ||
| { id: "5", startTime: "12:00", endTime: "12:30", available: true }, | ||
| { id: "6", startTime: "12:00", endTime: "12:30", available: true }, | ||
| { id: "7", startTime: "12:00", endTime: "12:30", available: false }, | ||
| { id: "8", startTime: "12:00", endTime: "12:30", available: true }, | ||
| ]; |
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.
🛠️ Refactor suggestion
하드코딩된 시간 슬롯 데이터를 개선하세요.
모든 시간 슬롯이 동일한 시간(12:00-12:30)으로 설정되어 있어 실제 사용에 적합하지 않습니다. 이는 테스트용 데이터로 보이며, 실제 다양한 시간대를 반영하거나 props로 전달받도록 개선이 필요합니다.
다음과 같이 props로 전달받도록 수정하는 것을 권장합니다:
+interface TimeSlotBoxProps {
+ timeSlots: TimeSlot[];
+ selectedSlot: string | null;
+ onSlotSelect: (slotId: string | null) => void;
+}
-const timeSlots: TimeSlot[] = [
- { id: "1", startTime: "12:00", endTime: "12:30", available: true },
- // ... rest of hardcoded data
-];
-export const TimeSlotBox = ({
+export const TimeSlotBox = ({
+ timeSlots,
selectedSlot,
onSlotSelect,
}: TimeSlotBoxProps) => {Committable suggestion skipped: line range outside the PR's diff.
🤖 Prompt for AI Agents
In src/components/TimeBox.tsx around lines 12 to 21, the timeSlots array is
hardcoded with identical time ranges, which is not practical for real use.
Refactor the component to accept timeSlots as a prop instead of using this fixed
array, allowing dynamic and varied time slot data to be passed in from the
parent component. Remove the hardcoded array and update the component to use the
passed-in prop for rendering time slots.
| @@ -1,9 +1,10 @@ | |||
| import { createRoot } from "react-dom/client"; | |||
| import App from "./App.tsx"; | |||
| import { BrowserRouter } from "react-router-dom"; | |||
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.
사용되지 않는 BrowserRouter import를 제거하세요.
BrowserRouter가 더 이상 사용되지 않으므로 import를 제거해야 합니다.
-import { BrowserRouter } from "react-router-dom";📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| import { BrowserRouter } from "react-router-dom"; |
🧰 Tools
🪛 GitHub Check: Build Verification
[failure] 3-3:
'BrowserRouter' is declared but its value is never read.
🤖 Prompt for AI Agents
In src/main.tsx at line 3, the BrowserRouter import from react-router-dom is no
longer used in the file. Remove this unused import statement to clean up the
code and avoid unnecessary imports.
| { | ||
| id: 6, | ||
| title: "하마쌤 레전드 어록 정리ㅋㅋ", | ||
| views: 120, | ||
| likes: 99, | ||
| comments: 58, | ||
| author: "유머천재", | ||
| timeAgo: "5시간 전", | ||
| }, |
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.
중복된 더미 데이터를 제거하세요.
dummyPosts 배열의 마지막 두 항목(id: 5, 6)이 동일한 내용을 가지고 있습니다. 중복 데이터를 제거해 주세요.
- {
- id: 6,
- title: "하마쌤 레전드 어록 정리ㅋㅋ",
- views: 120,
- likes: 99,
- comments: 58,
- author: "유머천재",
- timeAgo: "5시간 전",
- },📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| { | |
| id: 6, | |
| title: "하마쌤 레전드 어록 정리ㅋㅋ", | |
| views: 120, | |
| likes: 99, | |
| comments: 58, | |
| author: "유머천재", | |
| timeAgo: "5시간 전", | |
| }, |
🤖 Prompt for AI Agents
In src/page/community/Community.tsx between lines 55 and 63, the dummyPosts
array contains duplicate entries for id 5 and 6 with identical content. Remove
one of these duplicate objects to eliminate redundancy and keep the data clean.
| {dummyPosts.map((post) => ( | ||
| <Link | ||
| key={post.id} | ||
| to="/wee-detail" |
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.
🛠️ Refactor suggestion
동적 라우팅을 위해 게시물 ID를 사용하세요.
모든 게시물이 동일한 /wee-detail 경로로 연결되어 있습니다. 각 게시물의 상세 페이지를 구분하려면 게시물 ID를 URL에 포함해야 합니다.
- to="/wee-detail"
+ to={`/wee-detail/${post.id}`}📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| to="/wee-detail" | |
| to={`/wee-detail/${post.id}`} |
🤖 Prompt for AI Agents
In src/page/community/Community.tsx at line 75, the link's "to" attribute
currently points to a static path "/wee-detail" for all posts. To enable dynamic
routing and distinguish each post's detail page, modify the "to" attribute to
include the unique post ID in the URL, such as `/wee-detail/${post.id}` or the
appropriate variable representing the post ID.
| <img src={RightArrow} onClick={goToNextWeek} /> | ||
| </WeeklyCalendar> | ||
| </WeeklyCalendarContainer> | ||
| <ApplyDay>3월 4일</ApplyDay> |
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.
하드코딩된 날짜 표시 수정 필요
선택된 날짜와 관계없이 "3월 4일"로 고정 표시되고 있습니다. 실제 선택된 날짜를 동적으로 표시하도록 수정해야 합니다.
- <ApplyDay>3월 4일</ApplyDay>
+ <ApplyDay>
+ {currentWeek.getMonth() + 1}월 {currentWeek.getDate()}일
+ </ApplyDay>📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| <ApplyDay>3월 4일</ApplyDay> | |
| <ApplyDay> | |
| {currentWeek.getMonth() + 1}월 {currentWeek.getDate()}일 | |
| </ApplyDay> |
🤖 Prompt for AI Agents
In src/page/CounselApply.tsx at line 81, the date is hardcoded as "3월 4일" which
does not reflect the selected date dynamically. Replace the hardcoded string
with a dynamic expression that formats and displays the currently selected date
from the component's state or props, ensuring the displayed date updates
according to user selection.
Summary by CodeRabbit
신규 기능
버그 수정
리팩터