-
Notifications
You must be signed in to change notification settings - Fork 2
[feat] 공지 작성/조회/수정 페이지 구현 #67
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
Merged
Merged
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
f7e7375
fix: 중첩 라우트에서 번들 경로 오류 수정
DongEun02 23c067e
style: text 컬러 white로 수정
DongEun02 e8589a1
fix: Button width 반응형으로 수정
DongEun02 0790739
feat: router에 경로 추가
DongEun02 7e7a0ee
feat: 이미지 추가 및 네이밍 변경
DongEun02 446c5c0
feat: camelCase로 수정
DongEun02 dda5272
feat: 공지 목록 페이지 구현
DongEun02 34ad22e
fix: 타입 오류 수정
DongEun02 a2dea89
Merge branch 'dev' into fe/feat/44-develop-notice-page
DongEun02 7756a47
style: fontStyle 수정 및 fontWeight 제거
DongEun02 c589bb6
feat: NoticeList 컴포넌트 경로 수정
DongEun02 7f39808
feat: 공지 작성 페이지 구현
DongEun02 90c053c
feat: 공지 수정 페이지 및 폼 컴포넌트 추가
DongEun02 88c257c
feat: 공지 상세 페이지 구현
DongEun02 f2ccb3c
feat: 공지 라우트 설정을 별도 파일로 분리
DongEun02 57ab67f
feat: 이미지 alt 속성 추가
DongEun02 ed8dc8a
feat: 공지 상세 페이지 및 목록 페이지 개선, 읽음 상태 표시 기능 추가
DongEun02 42b6088
fix: 불필요한 분기문 제거
DongEun02 e026dcd
Merge branch 'dev' into fe/feat/44-develop-notice-page
DongEun02 476205e
fix: url 경로 수정
DongEun02 dad1a66
fix: 중복된 alt 빈 문자열로 수정
DongEun02 801fe44
fix: 공지 목록에서 onSelect 제거 및 Link 컴포넌트로 변경
DongEun02 c4ddf74
fix: 읽기 진행 상태 업데이트 로직 수정 및 수정 경로 변경
DongEun02 335bf15
refactor: Main 컴포넌트 재사용
DongEun02 512dee9
style: 공용 컴포넌트 스타일 수정
DongEun02 1208944
refactor: 공지 관련 페이지 및 컴포넌트 리팩토링
DongEun02 af0442d
refactor: NoticeFormValues 인터페이스를 types.ts로 이동 및 경로 수정
DongEun02 1896dc8
style: 불필요한 marginBottom 제거
DongEun02 586fe94
feat: 공지 작성 버튼 클릭 핸들러 추가
DongEun02 cb0506b
feat: DateTimePicker에 id prop 추가 및 NoticeForm에서 사용
DongEun02 4f831d5
feat: 페이지 공용 레이아웃 컴포넌트 구현 후 적용
DongEun02 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
frontend/src/features/notice/components/LeaderNoticeList.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| import clock from '../../../shared/assets/clock-black.svg'; | ||
| import Badge from '../../../shared/ui/Badge'; | ||
| import NoticeList, { type NoticeListItem } from './NoticeList'; | ||
|
|
||
| interface LeaderNoticeListProps { | ||
| notices: NoticeListItem[]; | ||
| studyId: string; | ||
| } | ||
|
|
||
| export default function LeaderNoticeList({ notices, studyId }: LeaderNoticeListProps) { | ||
| return ( | ||
| <NoticeList notices={notices} studyId={studyId} detailSearch="?role=leader"> | ||
| {(notice) => ( | ||
| <> | ||
| <Badge variant="BrandOutline" size="Small"> | ||
| {notice.readCount}/{notice.totalCount} 읽음 | ||
| </Badge> | ||
| {notice.reminderText && ( | ||
| <Badge variant="NeutralSolid" size="Small"> | ||
| <img src={clock} alt="리마인드 시각" width={12} height={12} /> | ||
| {notice.reminderText} | ||
| </Badge> | ||
| )} | ||
| </> | ||
| )} | ||
| </NoticeList> | ||
| ); | ||
| } |
19 changes: 19 additions & 0 deletions
19
frontend/src/features/notice/components/MemberNoticeList.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| import Badge from '../../../shared/ui/Badge'; | ||
| import NoticeList, { type NoticeListItem } from './NoticeList'; | ||
|
|
||
| interface MemberNoticeListProps { | ||
| notices: NoticeListItem[]; | ||
| studyId: string; | ||
| } | ||
|
|
||
| export default function MemberNoticeList({ notices, studyId }: MemberNoticeListProps) { | ||
| return ( | ||
| <NoticeList notices={notices} studyId={studyId}> | ||
| {(notice) => ( | ||
| <Badge variant={notice.isRead ? 'BrandOutline' : 'BrandSolid'} size="Small"> | ||
| {notice.isRead ? '읽음' : '읽지 않음'} | ||
| </Badge> | ||
| )} | ||
| </NoticeList> | ||
| ); | ||
| } |
110 changes: 110 additions & 0 deletions
110
frontend/src/features/notice/components/MemberNoticeReadState.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,110 @@ | ||
| import type { CSSProperties } from 'react'; | ||
| import { useEffect, useState } from 'react'; | ||
| import checkIcon from '../../../shared/assets/check.svg'; | ||
| import circleCheckIcon from '../../../shared/assets/circle-check.svg'; | ||
| import { tokens, typography } from '../../../styles/global'; | ||
|
|
||
| interface MemberNoticeReadStateProps { | ||
| progress: number; | ||
| readAt?: string; | ||
| } | ||
|
|
||
| const footerStyle = { | ||
| position: 'sticky', | ||
| bottom: 0, | ||
| zIndex: 10, | ||
| display: 'flex', | ||
| minHeight: '85px', | ||
| alignItems: 'center', | ||
| justifyContent: 'center', | ||
| borderTop: tokens.border.neutral, | ||
| background: tokens.bg.default, | ||
| } satisfies CSSProperties; | ||
|
|
||
| const readingStyle = { | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| alignItems: 'center', | ||
| gap: tokens.spacing[1], | ||
| } satisfies CSSProperties; | ||
|
|
||
| const guideStyle = { | ||
| ...typography.subtitle, | ||
| color: tokens.text.brand, | ||
| } satisfies CSSProperties; | ||
|
|
||
| const progressStyle = { | ||
| ...typography.footnote, | ||
| color: tokens.text.muted, | ||
| } satisfies CSSProperties; | ||
|
|
||
| const completedStyle = { | ||
| ...typography.subtitle, | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| gap: tokens.spacing[1], | ||
| color: tokens.text.brand, | ||
| } satisfies CSSProperties; | ||
|
|
||
| const toastStyle = { | ||
| ...typography.body, | ||
| position: 'fixed', | ||
| right: tokens.layout.gutter, | ||
| bottom: `calc(100px + ${tokens.layout.safeBottom})`, | ||
| left: tokens.layout.gutter, | ||
| zIndex: 20, | ||
| display: 'flex', | ||
| maxWidth: '350px', | ||
| height: '48px', | ||
| margin: '0 auto', | ||
| padding: `0 ${tokens.spacing[4]}`, | ||
| alignItems: 'center', | ||
| gap: tokens.spacing[2], | ||
| borderRadius: tokens.radius.md, | ||
| background: tokens.bg.brand, | ||
| color: tokens.text.onBrand, | ||
| } satisfies CSSProperties; | ||
|
|
||
| export default function MemberNoticeReadState({ progress, readAt }: MemberNoticeReadStateProps) { | ||
| const isCompleted = progress >= 100; | ||
| const [isToastDismissed, setIsToastDismissed] = useState(false); | ||
|
|
||
| useEffect(() => { | ||
| if (!isCompleted) return; | ||
|
|
||
| const timeoutId = window.setTimeout(() => setIsToastDismissed(true), 2000); | ||
|
|
||
| return () => window.clearTimeout(timeoutId); | ||
| }, [isCompleted]); | ||
|
|
||
| return ( | ||
| <> | ||
| {isCompleted && !isToastDismissed && ( | ||
| <div css={toastStyle} role="status"> | ||
| <img | ||
| src={checkIcon} | ||
| alt="" | ||
| width={16} | ||
| height={16} | ||
| css={{ filter: 'brightness(0) invert(1)' }} | ||
| /> | ||
| 읽음으로 표시했어요 | ||
| </div> | ||
| )} | ||
|
|
||
| <footer css={footerStyle}> | ||
| {isCompleted ? ( | ||
| <div css={completedStyle}> | ||
| <img src={circleCheckIcon} alt="읽음 완료" width={22} height={22} /> | ||
| {readAt ? `${readAt}에 읽음` : '읽음 완료'} | ||
| </div> | ||
| ) : ( | ||
| <div css={readingStyle}> | ||
| <strong css={guideStyle}>끝까지 읽으면 읽음으로 표시돼요</strong> | ||
| <span css={progressStyle}>지금 {progress}% 읽었어요</span> | ||
| </div> | ||
| )} | ||
| </footer> | ||
| </> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,63 @@ | ||
| import type { CSSProperties } from 'react'; | ||
| import profileIcon from '../../../shared/assets/unknown-profile.svg'; | ||
| import { tokens, typography } from '../../../styles/global'; | ||
|
|
||
| interface NoticeArticleProps { | ||
| title: string; | ||
| author: string; | ||
| createdAt: string; | ||
| content: string; | ||
| hasTopMargin?: boolean; | ||
| } | ||
|
|
||
| const articleStyle = { | ||
| display: 'flex', | ||
| flexDirection: 'column', | ||
| marginTop: tokens.spacing[5], | ||
| } satisfies CSSProperties; | ||
|
|
||
| const titleStyle = { | ||
| ...typography.headline, | ||
| margin: 0, | ||
| color: tokens.text.primary, | ||
| } satisfies CSSProperties; | ||
|
|
||
| const authorRowStyle = { | ||
| display: 'flex', | ||
| alignItems: 'center', | ||
| gap: tokens.spacing[2], | ||
| marginTop: tokens.spacing[1], | ||
| } satisfies CSSProperties; | ||
|
|
||
| const authorStyle = { | ||
| ...typography.footnote, | ||
| color: tokens.text.muted, | ||
| } satisfies CSSProperties; | ||
|
|
||
| const contentStyle = { | ||
| ...typography.subtitle, | ||
| margin: `${tokens.spacing[4]} 0 0`, | ||
| color: tokens.text.secondary, | ||
| whiteSpace: 'pre-line', | ||
| } satisfies CSSProperties; | ||
|
|
||
| export default function NoticeArticle({ | ||
| title, | ||
| author, | ||
| createdAt, | ||
| content, | ||
| hasTopMargin = true, | ||
| }: NoticeArticleProps) { | ||
| return ( | ||
| <article css={{ ...articleStyle, marginTop: hasTopMargin ? articleStyle.marginTop : 0 }}> | ||
| <h2 css={titleStyle}>{title}</h2> | ||
| <div css={authorRowStyle}> | ||
| <img src={profileIcon} alt="" width={28} height={28} /> | ||
| <span css={authorStyle}> | ||
| {author} · {createdAt} | ||
| </span> | ||
| </div> | ||
| <p css={contentStyle}>{content}</p> | ||
| </article> | ||
| ); | ||
| } |
41 changes: 41 additions & 0 deletions
41
frontend/src/features/notice/components/NoticeDetailActions.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| import type { CSSProperties } from 'react'; | ||
| import deleteIcon from '../../../shared/assets/delete.svg'; | ||
| import modifyIcon from '../../../shared/assets/modify.svg'; | ||
| import Button from '../../../shared/ui/Button'; | ||
| import { tokens } from '../../../styles/global'; | ||
|
|
||
| interface NoticeDetailActionsProps { | ||
| onEdit: () => void; | ||
| onDelete: () => void; | ||
| } | ||
|
|
||
| const actionsStyle = { | ||
| display: 'flex', | ||
| gap: tokens.spacing[2], | ||
| marginTop: tokens.spacing[5], | ||
| } satisfies CSSProperties; | ||
|
|
||
| const buttonContentStyle = { | ||
| display: 'inline-flex', | ||
| alignItems: 'center', | ||
| gap: tokens.spacing[1], | ||
| } satisfies CSSProperties; | ||
|
|
||
| export default function NoticeDetailActions({ onEdit, onDelete }: NoticeDetailActionsProps) { | ||
| return ( | ||
| <div css={actionsStyle}> | ||
| <Button variant="neutralOutline" size="small" onClick={onEdit}> | ||
| <span css={{ ...buttonContentStyle, color: tokens.text.primary }}> | ||
| <img src={modifyIcon} alt="" width={18} height={18} /> | ||
| 수정 | ||
| </span> | ||
| </Button> | ||
| <Button variant="criticalOutline" size="small" onClick={onDelete}> | ||
| <span css={buttonContentStyle}> | ||
| <img src={deleteIcon} alt="" width={18} height={18} /> | ||
| 삭제 | ||
| </span> | ||
| </Button> | ||
|
coderabbitai[bot] marked this conversation as resolved.
|
||
| </div> | ||
| ); | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
이 액션 부분을 분리한 특별한 이유가 있을까요 ~ ?