|
1 | 1 | 'use client'; |
2 | 2 |
|
3 | | -import { useState } from 'react'; |
4 | | -import Card from './Card'; |
5 | | -import CheckList from './CheckList'; |
6 | | -import { Todo } from '@/services/home/todoService.service'; |
| 3 | +import TodayPlanContainer from './TodayPlanContainer'; |
| 4 | +import UpcomingPlanContainer from '@/components/home/UpcomingPlanContainer'; |
| 5 | +import type { PlanItem } from '@/services/plans/planManageService.service'; |
| 6 | +import { useUpcomingPlanItems } from '@/hooks/useUpcomingPlanItems'; |
7 | 7 |
|
8 | 8 | interface BottomSectionProps { |
| 9 | + uid: string; |
9 | 10 | className?: string; |
10 | | - todos: Todo[]; |
11 | | - onToggleTodo: (id: string, currentStatus: boolean) => void; |
| 11 | + items: PlanItem[]; |
| 12 | + loading: boolean; |
| 13 | + error: string | null; |
| 14 | + onToggle: (id: string, checked: boolean) => void; |
| 15 | + todoTotal: number; |
12 | 16 | } |
13 | 17 |
|
14 | | -// const TODAY_DUMMY = [ |
15 | | -// { id: 't1', text: 'React Hooks 정리', isChecked: false }, |
16 | | -// { id: 't2', text: 'GSAP ScrollTrigger 복습', isChecked: true }, |
17 | | -// { id: 't3', text: '알고리즘 1문제 풀기', isChecked: false }, |
18 | | -// ]; |
19 | | - |
20 | | -// const UPCOMING_DUMMY = [ |
21 | | -// { id: 'u1', text: 'Next.js App Router 정리', isChecked: false }, |
22 | | -// { id: 'u2', text: '포트폴리오 리팩토링', isChecked: false }, |
23 | | -// ]; |
24 | | - |
25 | 18 | export default function BottomSection({ |
| 19 | + uid, |
26 | 20 | className, |
27 | | - todos, |
28 | | - onToggleTodo, |
| 21 | + items, |
| 22 | + loading, |
| 23 | + error, |
| 24 | + onToggle, |
| 25 | + todoTotal, |
29 | 26 | }: BottomSectionProps) { |
30 | | - // const [today, setToday] = useState<ChecklistItem[]>(TODAY_DUMMY); |
31 | | - // const [upcoming, setUpcoming] = useState<ChecklistItem[]>(UPCOMING_DUMMY); |
32 | | - |
33 | | - // const toggleToday = (id: string) => { |
34 | | - // setToday((prev) => |
35 | | - // prev.map((it) => |
36 | | - // it.id === id ? { ...it, isChecked: !it.isChecked } : it |
37 | | - // ) |
38 | | - // ); |
39 | | - // }; |
40 | | - |
41 | | - // const toggleUpcoming = (id: string) => { |
42 | | - // setUpcoming((prev) => |
43 | | - // prev.map((it) => |
44 | | - // it.id === id ? { ...it, isChecked: !it.isChecked } : it |
45 | | - // ) |
46 | | - // ); |
47 | | - // }; |
| 27 | + const upcoming = useUpcomingPlanItems(uid); |
48 | 28 |
|
49 | 29 | return ( |
50 | 30 | <div className={className}> |
51 | | - <Card title="오늘 할 일"> |
52 | | - <CheckList |
53 | | - items={todos} |
54 | | - onToggleTodo={onToggleTodo} |
55 | | - emptyText="오늘 할 일이 없습니다" |
56 | | - /> |
57 | | - </Card> |
58 | | - |
59 | | - {/* <Card title="다가오는 일정"> |
60 | | - <CheckList |
61 | | - items={upcoming} |
62 | | - onToggle={toggleUpcoming} |
63 | | - emptyText="다가오는 일정이 없습니다" |
64 | | - /> |
65 | | - </Card> */} |
| 31 | + {/* 오늘의 목표 */} |
| 32 | + <TodayPlanContainer |
| 33 | + items={items} |
| 34 | + loading={loading} |
| 35 | + error={error} |
| 36 | + onToggle={onToggle} |
| 37 | + ></TodayPlanContainer> |
| 38 | + |
| 39 | + {/* 다가오는 일정 */} |
| 40 | + <UpcomingPlanContainer |
| 41 | + items={upcoming.items} |
| 42 | + loading={upcoming.loading} |
| 43 | + error={upcoming.error} |
| 44 | + limit={todoTotal} |
| 45 | + /> |
66 | 46 | </div> |
67 | 47 | ); |
68 | 48 | } |
0 commit comments