From cff91442258f7af16239d0994080bae0f1484076 Mon Sep 17 00:00:00 2001 From: platinouss Date: Sat, 17 Aug 2024 22:54:20 +0900 Subject: [PATCH 1/2] =?UTF-8?q?[BBB-124]=20=E2=9C=A8Feat:=20=EA=B8=B0?= =?UTF-8?q?=EC=88=A0=20=EC=84=9C=EC=A0=81=20=EC=8A=A4=ED=84=B0=EB=94=94=20?= =?UTF-8?q?=EA=B3=BC=EC=A0=9C=20=ED=88=AC=ED=91=9C=EC=A7=80=20=EB=B0=8F=20?= =?UTF-8?q?=ED=88=AC=ED=91=9C=20=EB=AA=A8=EB=8B=AC=20=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/study/[id]/page.tsx | 76 +++++--- components/study/dashboard/about.tsx | 14 +- .../study/task/book-study-task-form.tsx | 89 +++++++++ .../study/task/book-study-task-list-modal.tsx | 165 ++++++++++++++++ .../study/task/book-study-task-vote-modal.tsx | 119 ++++++++++++ components/ui/button/button.tsx | 2 +- components/ui/icon/icon.tsx | 21 +++ components/ui/switch/switch.tsx | 29 +++ package-lock.json | 176 +++++++++++++++++- package.json | 3 +- public/placeholder.svg | 1 + types/study/book-task-form.ts | 23 +++ types/study/book-task-vote.ts | 4 + 13 files changed, 687 insertions(+), 35 deletions(-) create mode 100644 components/study/task/book-study-task-form.tsx create mode 100644 components/study/task/book-study-task-list-modal.tsx create mode 100644 components/study/task/book-study-task-vote-modal.tsx create mode 100644 components/ui/switch/switch.tsx create mode 100644 public/placeholder.svg create mode 100644 types/study/book-task-form.ts create mode 100644 types/study/book-task-vote.ts diff --git a/app/study/[id]/page.tsx b/app/study/[id]/page.tsx index 0a45d5b..cb8f4cb 100644 --- a/app/study/[id]/page.tsx +++ b/app/study/[id]/page.tsx @@ -15,6 +15,8 @@ import { userState } from '@/recoil/userAtom'; import { Round, StudyDetails, StudyStatus } from '@/types/study/study-detail'; import { toast } from 'react-toastify'; import { useRecoilState } from 'recoil'; +import { BookStudyTaskListModal } from '@/components/study/task/book-study-task-list-modal'; +import { BookStudyTaskVoteModal } from '@/components/study/task/book-study-task-vote-modal'; export default function StudyPage() { const params = useParams(); @@ -28,6 +30,10 @@ export default function StudyPage() { const [myData, setMyData] = useRecoilState(userState); const [trigger, setTrigger] = useState(Date.now()); const [showPostBoard, setShowPostBoard] = useState(false); + const [showBookStudyTaskListModal, setShowBookStudyTaskListModal] = + useState(false); + const [showBookStudyTaskVoteModal, setShowBookStudyTaskVoteModal] = + useState(false); const handleStart = async () => { try { @@ -77,40 +83,52 @@ export default function StudyPage() { } return ( -
- {showPostBoard ? ( - - ) : ( - - )} -
- {isParticipant ? ( - canStart ? ( - - ) : ( - '' - ) + <> +
+ {showPostBoard ? ( + ) : ( - )} - +
+ {isParticipant ? ( + canStart ? ( + + ) : ( + '' + ) + ) : ( + + )} + +
-
+ + + ); } diff --git a/components/study/dashboard/about.tsx b/components/study/dashboard/about.tsx index 73c597f..7b9d0f8 100644 --- a/components/study/dashboard/about.tsx +++ b/components/study/dashboard/about.tsx @@ -16,12 +16,16 @@ export default function StudyAbout({ details, users, showPostBoard, - setShowPostBoard + setShowPostBoard, + setShowBookStudyTaskListModal, + setShowBookStudyTaskVoteModal }: { details: StudyDetails; users: { [userId: number]: StudyMemberInfo }; showPostBoard: boolean; setShowPostBoard: (arg0: boolean) => void; + setShowBookStudyTaskListModal: (value: boolean) => void; + setShowBookStudyTaskVoteModal: (value: boolean) => void; }) { const endDate = new Date(details.startDate); endDate.setDate(endDate.getDate() + details.weeks * 7); @@ -100,7 +104,9 @@ export default function StudyAbout({ className="group w-fit hover:text-gray-900 text-blue-600 flex items-center space-x-2" > - 과제 선택지 수정 + setShowBookStudyTaskListModal(true)}> + 과제 선택지 수정{' '} +
- 과제 투표 + setShowBookStudyTaskVoteModal(true)}> + 과제 투표{' '} +
)} diff --git a/components/study/task/book-study-task-form.tsx b/components/study/task/book-study-task-form.tsx new file mode 100644 index 0000000..ef4f7cf --- /dev/null +++ b/components/study/task/book-study-task-form.tsx @@ -0,0 +1,89 @@ +'use client'; + +import { Input } from '@/components/ui/input/input'; +import { Label } from '@/components/ui/label/label'; +import { Textarea } from '@/components/ui/textarea/textarea'; +import { Button } from '@/components/ui/button/button'; +import { CheckIcon, FilePenIcon, TrashIcon } from '@/components/ui/icon/icon'; +import React from 'react'; +import { BookTaskForm } from '@/types/study/book-task-form'; + +export function BookStudyTaskForm({ + key, + assignment, + index, + editingIndex, + handleSaveAssignment, + setEditingIndex +}: BookTaskForm) { + return ( +
+
+
+ {editingIndex === index ? ( +
+
Title
+ +
+
+ + +
+
+ + +
+
+
+ +