From 082b59d8fbe182905f31c7b045d6d8cc47d8af9f Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 8 Mar 2025 08:03:11 +0000 Subject: [PATCH] Add summary card with tabs Adds a summary card to the app with tabs for daily, weekly, and monthly views, displaying target spending, actual spending, and remaining spendable amount. --- src/pages/Index.tsx | 118 ++++++++++++++++++++++++++++++++++++++------ 1 file changed, 102 insertions(+), 16 deletions(-) diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index ca0ad7a..30948ac 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -1,12 +1,15 @@ -import React from 'react'; +import React, { useState } from 'react'; import NavBar from '@/components/NavBar'; import BudgetCard from '@/components/BudgetCard'; import TransactionCard, { Transaction } from '@/components/TransactionCard'; import AddTransactionButton from '@/components/AddTransactionButton'; import { Wallet, TrendingUp, Bell } from 'lucide-react'; +import { Tabs, TabsContent, TabsList, TabsTrigger } from '@/components/ui/tabs'; const Index = () => { + const [selectedTab, setSelectedTab] = useState("daily"); + // Sample data - in a real app, this would come from a data source const transactions: Transaction[] = [ { @@ -35,6 +38,33 @@ const Index = () => { }, ]; + // 예산 데이터 - 실제 앱에서는 백엔드에서 가져와야 함 + const budgetData = { + daily: { + targetAmount: 30000, + spentAmount: 15000, + remainingAmount: 15000, + }, + weekly: { + targetAmount: 200000, + spentAmount: 120000, + remainingAmount: 80000, + }, + monthly: { + targetAmount: 1200000, + spentAmount: 750000, + remainingAmount: 450000, + } + }; + + const formatCurrency = (amount: number) => { + return new Intl.NumberFormat('ko-KR', { + style: 'currency', + currency: 'KRW', + maximumFractionDigits: 0 + }).format(amount); + }; + return (
- ₩2,580,000 -
-- 지난 달보다 12% 증가 -
+