-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] 개인회고 작성 및 조회 화면 구현 #101
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
13 commits
Select commit
Hold shift + click to select a range
3a308a6
feat: 개인 회고 작성 화면 구현 (#90)
choiyoungae 98b9265
feat: 개인 회고 전송 기능 구현 (#90)
choiyoungae 2245f54
feat: 개인회고 조회 화면 구현 (#90)
choiyoungae 1adae62
feat: 개인회고 삭제, 수정 구현 (#90)
choiyoungae 1c59fc4
chore 미사용 유틸리티 제거 (#90)
choiyoungae b5fb437
refactor: 코드 포매팅 (#90)
choiyoungae 43045c9
Merge branch 'develop' of https://github.com/fc-de/dokdok-client into…
choiyoungae d673113
fix: 코드리뷰 반영 (#90)
choiyoungae ed5d889
fix: 코드 리뷰 반영 (#90)
choiyoungae 929bf6e
refactor: 코드 포매팅 (#90)
choiyoungae 07ed504
refactor: 개인회고 폴더 정리 (#90)
choiyoungae 08d56b1
Merge branch 'develop' of https://github.com/fc-de/dokdok-client into…
choiyoungae bfef497
fix: 코드 리뷰 반영 (#90)
choiyoungae 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 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
104 changes: 104 additions & 0 deletions
104
src/features/retrospectives/personal/components/ChangedThoughtsSection.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,104 @@ | ||
| import { X } from 'lucide-react' | ||
|
|
||
| import { Container, Input, Textarea } from '@/shared/ui' | ||
|
|
||
| import type { UseChangedThoughtsReturn } from '../hooks/useChangedThoughts' | ||
| import type { PersonalRetrospectiveTopic } from '../personalRetrospective.types' | ||
|
|
||
| export interface ChangedThoughtsSectionProps { | ||
| topics: PersonalRetrospectiveTopic[] | ||
| form: UseChangedThoughtsReturn | ||
| onClose: () => void | ||
| } | ||
|
|
||
| /** | ||
| * 바뀐 나의 생각 섹션 | ||
| * | ||
| * @description | ||
| * 각 토픽별로 핵심 쟁점 요약, 모임 전/후 내 의견을 입력하는 폼 섹션입니다. | ||
| * 모임 전 의견은 읽기 전용으로 표시되고, 모임 후 의견은 직접 작성합니다. | ||
| * 에러 표시 및 스크롤 처리는 상위 컴포넌트에서 담당합니다. | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * <ChangedThoughtsSection topics={topics} form={changedThoughtsForm} onClose={handleClose} /> | ||
| * ``` | ||
| */ | ||
| export default function ChangedThoughtsSection({ | ||
| topics, | ||
| form, | ||
| onClose, | ||
| }: ChangedThoughtsSectionProps) { | ||
| const { formValues, updateField, getPreOpinion } = form | ||
|
|
||
| return ( | ||
| <section> | ||
| <div className="flex flex-col"> | ||
| <Container className="gap-0"> | ||
| <div className="flex justify-between items-center mb-large"> | ||
| <h3 className="text-black typo-heading3">바뀐 나의 생각</h3> | ||
| <button | ||
| type="button" | ||
| onClick={onClose} | ||
| className="text-grey-400 hover:text-black transition-colors" | ||
| aria-label="바뀐 나의 생각 섹션 닫기" | ||
| > | ||
| <X className="size-6 text-grey-600 cursor-pointer" /> | ||
| </button> | ||
| </div> | ||
| <div className="flex flex-col gap-xlarge"> | ||
| {formValues.map((item) => { | ||
| return ( | ||
| <div key={item.topicId}> | ||
| <p className="text-black typo-subtitle3 mb-small"> | ||
| {topics.find((t) => t.topicId === item.topicId)?.topicName} | ||
| </p> | ||
|
|
||
| <Input | ||
| placeholder="핵심 쟁점을 요약해주세요" | ||
| value={item.coreSummary} | ||
| onChange={(e) => updateField(item.topicId, 'coreSummary', e.target.value)} | ||
| className="mb-medium" | ||
| /> | ||
|
|
||
| {getPreOpinion(item.topicId) ? ( | ||
| <div className="grid grid-cols-2 gap-base"> | ||
| <div className="flex flex-col gap-tiny"> | ||
| <span className="text-grey-600 typo-body4">모임 전 내 의견</span> | ||
| <Textarea | ||
| value={getPreOpinion(item.topicId)} | ||
| disabled | ||
| height={160} | ||
| className="bg-grey-200 text-black" | ||
| /> | ||
| </div> | ||
| <div className="flex flex-col gap-tiny"> | ||
| <span className="text-grey-600 typo-body4">모임 후 내 의견</span> | ||
| <Textarea | ||
| placeholder="감상문을 입력해주세요" | ||
| value={item.postOpinion} | ||
| onChange={(e) => updateField(item.topicId, 'postOpinion', e.target.value)} | ||
| height={160} | ||
| /> | ||
| </div> | ||
| </div> | ||
| ) : ( | ||
| <div className="flex flex-col gap-xsmall"> | ||
| <span className="text-grey-600 typo-body4">변화된 나의 생각</span> | ||
| <Textarea | ||
| placeholder="감상문을 입력해주세요" | ||
| value={item.postOpinion} | ||
| onChange={(e) => updateField(item.topicId, 'postOpinion', e.target.value)} | ||
| height={104} | ||
| /> | ||
| </div> | ||
| )} | ||
| </div> | ||
| ) | ||
| })} | ||
| </div> | ||
| </Container> | ||
| </div> | ||
| </section> | ||
| ) | ||
| } | ||
97 changes: 97 additions & 0 deletions
97
src/features/retrospectives/personal/components/FreeRecordSection.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,97 @@ | ||
| import { Trash2, X } from 'lucide-react' | ||
|
|
||
| import { Button, Container, Input, Textarea } from '@/shared/ui' | ||
|
|
||
| import type { UseFreeRecordReturn } from '../hooks/useFreeRecord' | ||
|
|
||
| export interface FreeRecordSectionProps { | ||
| form: UseFreeRecordReturn | ||
| showErrors: boolean | ||
| onClose: () => void | ||
| } | ||
|
|
||
| /** | ||
| * 자유 기록 섹션 | ||
| * | ||
| * @description | ||
| * 자유롭게 기록을 남기는 동적 폼 섹션입니다. | ||
| * 제목+상세내용 항목을 동적으로 추가/삭제할 수 있습니다. | ||
| * | ||
| * @example | ||
| * ```tsx | ||
| * <FreeRecordSection form={freeRecordForm} showErrors={showErrors} /> | ||
| * ``` | ||
| */ | ||
| export default function FreeRecordSection({ form, showErrors, onClose }: FreeRecordSectionProps) { | ||
| const { entries, addEntry, removeEntry, updateEntry } = form | ||
|
|
||
| return ( | ||
| <section> | ||
| <Container className="gap-[19px]"> | ||
| <div className="flex justify-between items-center"> | ||
| <h3 className="text-black typo-heading3">자유 기록</h3> | ||
| <button | ||
| type="button" | ||
| onClick={onClose} | ||
| className="text-grey-400 hover:text-black transition-colors" | ||
| aria-label="자유 기록 섹션 닫기" | ||
| > | ||
| <X className="size-6 text-grey-600 cursor-pointer" /> | ||
| </button> | ||
| </div> | ||
| {entries.map((entry) => { | ||
| const isPartial = form.isEntryPartial(entry.id) | ||
| const titleError = showErrors && isPartial && entry.title.trim() === '' | ||
| const contentError = showErrors && isPartial && entry.content.trim() === '' | ||
|
|
||
| return ( | ||
| <div | ||
| key={entry.id} | ||
| className="flex flex-col gap-small rounded-small bg-grey-100 border border-grey-300 p-medium" | ||
| {...(showErrors && isPartial ? { 'data-field-error': '' } : {})} | ||
| > | ||
| <div className="flex flex-col gap-tiny"> | ||
| <span className="text-grey-600 typo-body4">제목</span> | ||
| <Input | ||
| placeholder="제목을 작성해주세요" | ||
| value={entry.title} | ||
| onChange={(e) => updateEntry(entry.id, 'title', e.target.value)} | ||
| error={titleError} | ||
| errorMessage={titleError ? '내용을 입력해주세요' : undefined} | ||
| /> | ||
choiyoungae marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| </div> | ||
| <div className="flex flex-col gap-tiny"> | ||
| <span className="text-grey-600 typo-body4">상세 내용</span> | ||
| <Textarea | ||
| placeholder="내용을 작성해주세요" | ||
| value={entry.content} | ||
| onChange={(e) => updateEntry(entry.id, 'content', e.target.value)} | ||
| height={104} | ||
| error={contentError} | ||
| errorMessage={contentError ? '내용을 입력해주세요' : undefined} | ||
| /> | ||
| </div> | ||
|
|
||
| <div className="flex justify-end"> | ||
| <button | ||
| type="button" | ||
| className="text-grey-400 hover:text-accent-300 transition-colors" | ||
| onClick={() => { | ||
| removeEntry(entry.id) | ||
| if (entries.length === 1) onClose() | ||
| }} | ||
| aria-label="항목 삭제" | ||
| > | ||
| <Trash2 className="size-5" /> | ||
| </button> | ||
| </div> | ||
| </div> | ||
| ) | ||
| })} | ||
| <Button variant="secondary" outline onClick={addEntry}> | ||
| + 항목 추가하기 | ||
| </Button> | ||
| </Container> | ||
| </section> | ||
| ) | ||
| } | ||
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.
Uh oh!
There was an error while loading. Please reload this page.