-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(member): 활동 그룹 관리 및 과제 제출 조회 및 피드백 생성 (#201)
* refactor(member): 활동 그룹 카테고리 상수화, 타입 수정 (#39) * refactor(member): 반복되는 요소 컴포넌트화 (#39) * feat(member): 활동 그룹 공지 관리 컴포넌트 생성 및 api 연동 (#39) * refactor(member): 게시판 관리 테이블 모든 카테고리에서 사용 가능하도록 변경 (#39) * feat(member): 주차별 활동 관리 api 연동 (#39) * feat(member): 과제 추가 컴포넌트 생성 (#39) * fix(member): 각 주차별 활동에 맞는 과제만 나타나도록 수정 (#39) * feat(member): 과제 첨부파일 조회 및 레이아웃 수정 (#39) * feat(member): 과제 제출 조회 확인 section 생성 (#39) * feat(member): 피드백 입력 모달 추가 (#39) * refactor(member): 멤버 활동 신청 컴포넌트 및 연동 리팩토링 (#39) * chore(member): change @clab/- to @clab-platforms (#39) * chore(member): change @clab/- to @clab-platforms (#39) * chore(member): change @clab/- to @clab-platforms (#39) * Delete .changeset/friendly-countries-love.md * Create early-crews-fly.md * refactor(member): props 이름 변경 및 Options Object Pattern으로 변경 * refactor(member): 활동 멤버 role, 활동 status 상수화 * refactor(member): 배열 생성 키워드 수정 * refactor(member): 멤버 상태 상수화 및 관련 상수명 수정 * feat(member): 활동 그룹 정보 수정 api 연동 * refactor(member): 신규 데이터 조회 관련 쿼리키 개선 * refactor(member): 사용 데이터 변경 * refactor(member): 게시판 타입 상수화 * refactor(member): 데이터 반환 수정, 쿼리키 수정 --------- Co-authored-by: GwanSik Kim <[email protected]>
- Loading branch information
Showing
36 changed files
with
1,399 additions
and
214 deletions.
There are no files selected for viewing
This file contains 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,5 @@ | ||
--- | ||
"@clab-platforms/member": minor | ||
--- | ||
|
||
feat(member): 활동 그룹 관리 및 과제 제출 조회 및 피드백 생성 |
This file contains 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
114 changes: 114 additions & 0 deletions
114
apps/member/src/components/group/ActivityAssignmentEditor/ActivityAssignmentEditor.tsx
This file contains 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,114 @@ | ||
import { useRef, useState } from 'react'; | ||
|
||
import { Button, Grid, Input } from '@clab-platforms/design-system'; | ||
|
||
import { Section } from '@components/common/Section'; | ||
import Textarea from '@components/common/Textarea/Textarea'; | ||
|
||
import { FORM_DATA_KEY } from '@constants/api'; | ||
import { ACTIVITY_BOARD_CATEGORY_STATE } from '@constants/state'; | ||
import useToast from '@hooks/common/useToast'; | ||
import { useActivityGroupBoardMutation, useMyProfile } from '@hooks/queries'; | ||
|
||
interface Props { | ||
parentId: number; | ||
activityGroupId: number; | ||
} | ||
|
||
const ActivityAssignmentEditor = ({ parentId, activityGroupId }: Props) => { | ||
const toast = useToast(); | ||
const [board, setBoard] = useState({ | ||
title: '', | ||
content: '', | ||
dueDateTime: '', | ||
fileUrls: [], | ||
}); | ||
|
||
const { data: myProfile } = useMyProfile(); | ||
|
||
const uploaderRef = useRef<HTMLInputElement>(null); | ||
const { activityGroupBoardMutate } = useActivityGroupBoardMutation(); | ||
|
||
const handlePostChange = ( | ||
e: React.ChangeEvent<HTMLInputElement | HTMLTextAreaElement>, | ||
) => { | ||
const { name, value } = e.target; | ||
setBoard((prev) => ({ ...prev, [name]: value })); | ||
}; | ||
const handleAddAssignmentClick = () => { | ||
const formData = new FormData(); | ||
const file = uploaderRef.current?.files?.[0]; | ||
|
||
if (!board.title || !board.content || !board.dueDateTime) | ||
return toast({ | ||
state: 'error', | ||
message: '제목, 내용, 종료 일시는 필수 입력 요소입니다.', | ||
}); | ||
if (file) { | ||
formData.append(FORM_DATA_KEY, file); | ||
} | ||
|
||
activityGroupBoardMutate({ | ||
parentId: parentId, | ||
activityGroupId: activityGroupId, | ||
memberId: myProfile.id, | ||
body: { | ||
category: ACTIVITY_BOARD_CATEGORY_STATE.ASSIGNMENT, | ||
...board, | ||
}, | ||
files: file ? formData : undefined, | ||
}); | ||
}; | ||
|
||
return ( | ||
<Section> | ||
<Section.Header title="과제 관리"> | ||
<div className="space-x-2"> | ||
<Button size="sm" onClick={handleAddAssignmentClick}> | ||
추가 | ||
</Button> | ||
</div> | ||
</Section.Header> | ||
<Section.Body className="space-y-4"> | ||
<div className="space-y-2"> | ||
<Input | ||
id="title" | ||
name="title" | ||
label="제목" | ||
placeholder="제목을 입력해주세요." | ||
value={board.title} | ||
onChange={handlePostChange} | ||
/> | ||
<Textarea | ||
id="content" | ||
name="content" | ||
label="내용" | ||
placeholder="내용을 입력해주세요." | ||
className="w-full" | ||
maxLength={200} | ||
value={board.content} | ||
onChange={handlePostChange} | ||
/> | ||
<Grid col="2" gap="md" className="items-center"> | ||
<Input | ||
label="종료 일시" | ||
type="datetime-local" | ||
id="dueDateTime" | ||
name="dueDateTime" | ||
value={board.dueDateTime} | ||
onChange={handlePostChange} | ||
/> | ||
<div className="flex flex-col"> | ||
<label htmlFor="fileUpload" className="mb-1 ml-1 text-xs"> | ||
첨부 파일 | ||
</label> | ||
<input ref={uploaderRef} id="fileUpload" type="file" /> | ||
</div> | ||
</Grid> | ||
</div> | ||
</Section.Body> | ||
</Section> | ||
); | ||
}; | ||
|
||
export default ActivityAssignmentEditor; |
Oops, something went wrong.