Skip to content

Commit 46994e5

Browse files
committed
refactor: 오늘 목표량 total을 prop으로 받아오도록 변경
1 parent 9541960 commit 46994e5

2 files changed

Lines changed: 5 additions & 3 deletions

File tree

app/(with-sidebar)/(home)/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ const Page = () => {
2323
error: planError,
2424
toggle,
2525
progressText,
26+
total,
2627
} = useTodayPlanItems(currentUser?.uid);
2728

2829
// 사용자가 존재하면 데이터 불러옴
@@ -82,6 +83,7 @@ const Page = () => {
8283
loading={planLoading}
8384
error={planError}
8485
onToggle={toggle}
86+
todoTotal={total}
8587
/>
8688

8789
{/* 3. ButtonSection */}

components/home/BottomSection.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import TodayPlanContainer from './TodayPlanContainer';
44
import UpcomingPlanContainer from '@/components/home/UpcomingPlanContainer';
55
import type { PlanItem } from '@/services/plans/planManageService.service';
6-
import { useTodayPlanItems } from '@/hooks/useTodayPlanItems';
76
import { useUpcomingPlanItems } from '@/hooks/useUpcomingPlanItems';
87

98
interface BottomSectionProps {
@@ -13,6 +12,7 @@ interface BottomSectionProps {
1312
loading: boolean;
1413
error: string | null;
1514
onToggle: (id: string, checked: boolean) => void;
15+
todoTotal: number;
1616
}
1717

1818
export default function BottomSection({
@@ -22,8 +22,8 @@ export default function BottomSection({
2222
loading,
2323
error,
2424
onToggle,
25+
todoTotal,
2526
}: BottomSectionProps) {
26-
const today = useTodayPlanItems(uid);
2727
const upcoming = useUpcomingPlanItems(uid);
2828

2929
return (
@@ -41,7 +41,7 @@ export default function BottomSection({
4141
items={upcoming.items}
4242
loading={upcoming.loading}
4343
error={upcoming.error}
44-
limit={today.total}
44+
limit={todoTotal}
4545
/>
4646
</div>
4747
);

0 commit comments

Comments
 (0)