From 6f13c85652992435bc58db29689feb31176c0028 Mon Sep 17 00:00:00 2001 From: yoouung Date: Tue, 24 Dec 2024 02:01:10 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20=EC=BD=94=EC=8A=A4=20=ED=94=8C?= =?UTF-8?q?=EB=9E=9C=20=EC=88=98=EC=A0=95=20=ED=8E=98=EC=9D=B4=EC=A7=80=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/schedules/[id]/update/page.tsx | 133 ++++++++++++++++++++++++- 1 file changed, 132 insertions(+), 1 deletion(-) diff --git a/src/app/schedules/[id]/update/page.tsx b/src/app/schedules/[id]/update/page.tsx index c174313..e351cd2 100644 --- a/src/app/schedules/[id]/update/page.tsx +++ b/src/app/schedules/[id]/update/page.tsx @@ -1,3 +1,134 @@ +'use client' + +import { ArrowLeftOutlined } from '@ant-design/icons' +import { useRouter } from 'next/navigation' +import getData from '../../getData' +import KakaoMap from '@/app/components/KakaoMap' +import { DatePicker, Drawer } from 'antd' +import SearchPlace, { Place } from '@/app/components/SearchPlace' +import { useState } from 'react' +import { closestCenter, DndContext } from '@dnd-kit/core' +import { + arrayMove, + SortableContext, + verticalListSortingStrategy, +} from '@dnd-kit/sortable' +import SortableItem from '@/app/components/SortableItem' +import dayjs from 'dayjs' +import customParseFormat from 'dayjs/plugin/customParseFormat' + export default function Page() { - return null + const router = useRouter() + const data = getData().courses[0] + const [places, setPlaces] = useState(data.places) + const [date, setDate] = useState('2024-12-25') + const [open, setOpen] = useState(false) + + dayjs.extend(customParseFormat) + const dateFormat = 'YYYY-MM-DD' + + const onClose = () => { + setOpen(false) + } + + const onChangePlaces = (place: Place) => { + setPlaces((prevPlaces) => [...prevPlaces, place]) + } + + const handleDelete = (id: string) => { + setPlaces((prevPlaces) => prevPlaces.filter((place) => place.id !== id)) + } + + const handleDragEnd = (event: any) => { + const { active, over } = event + + if (active.id !== over.id) { + setPlaces((items) => { + const oldIndex = items.findIndex((item) => item.id === active.id) + const newIndex = items.findIndex((item) => item.id === over.id) + return arrayMove(items, oldIndex, newIndex) + }) + } + } + + const placesWithId = places.map((place) => ({ ...place })) + + const submitPlan = () => { + router.push('/schedules') + } + + return ( +
+
+ router.back()} + /> +

{data.location} 코스 플랜

+
+ + + +
+ | 장소 추가 + + + {places.map((place) => ( + + ))} + + + +
+ +
+ setDate(String(dateString))} + /> + +
+ + + + +
+ ) } From c3fdc8afa3fc6e2f0a426fd2f7b4d37995f67671 Mon Sep 17 00:00:00 2001 From: yoouung Date: Thu, 26 Dec 2024 17:17:29 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20=EC=88=AB=EC=9E=90=EB=B3=80=ED=99=98?= =?UTF-8?q?=20=EB=B0=A9=EC=8B=9D=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/app/schedules/[id]/update/page.tsx | 2 +- src/app/schedules/components/CourseCard.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/app/schedules/[id]/update/page.tsx b/src/app/schedules/[id]/update/page.tsx index e351cd2..8c9bf9f 100644 --- a/src/app/schedules/[id]/update/page.tsx +++ b/src/app/schedules/[id]/update/page.tsx @@ -67,7 +67,7 @@ export default function Page() {

{data.location} 코스 플랜

- +
| 장소 추가 diff --git a/src/app/schedules/components/CourseCard.tsx b/src/app/schedules/components/CourseCard.tsx index a005dbe..02f4306 100644 --- a/src/app/schedules/components/CourseCard.tsx +++ b/src/app/schedules/components/CourseCard.tsx @@ -40,7 +40,7 @@ export default function CourseCard({ courseData }: { courseData: Course }) { - +