From 753865b875e8d6cd3d30cc70b4a79894ba2a9e39 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:13:54 +0000 Subject: [PATCH] Refactor budget display MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refactor the budget display to show "목표 진행 상황" in a single line, with the spent amount on the left and the target amount on the right. --- src/pages/Index.tsx | 86 ++++++++++++++++++++++----------------------- 1 file changed, 42 insertions(+), 44 deletions(-) diff --git a/src/pages/Index.tsx b/src/pages/Index.tsx index fd3b9ee..f043963 100644 --- a/src/pages/Index.tsx +++ b/src/pages/Index.tsx @@ -1,4 +1,3 @@ - import React, { useState } from 'react'; import NavBar from '@/components/NavBar'; import BudgetCard from '@/components/BudgetCard'; @@ -6,32 +5,35 @@ 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[] = [{ - id: '1', - title: '식료품 구매', - amount: 25000, - date: '오늘, 12:30 PM', - category: 'shopping', - type: 'expense' - }, { - id: '2', - title: '주유소', - amount: 50000, - date: '어제, 3:45 PM', - category: 'transportation', - type: 'expense' - }, { - id: '3', - title: '월급', - amount: 2500000, - date: '2일전, 9:00 AM', - category: 'income', - type: 'income' - }]; + const transactions: Transaction[] = [ + { + id: '1', + title: '식료품 구매', + amount: 25000, + date: '오늘, 12:30 PM', + category: 'shopping', + type: 'expense' + }, { + id: '2', + title: '주유소', + amount: 50000, + date: '어제, 3:45 PM', + category: 'transportation', + type: 'expense' + }, { + id: '3', + title: '월급', + amount: 2500000, + date: '2일전, 9:00 AM', + category: 'income', + type: 'income' + } + ]; // 예산 데이터 - 실제 앱에서는 백엔드에서 가져와야 함 const budgetData = { @@ -51,6 +53,7 @@ const Index = () => { remainingAmount: 450000 } }; + const formatCurrency = (amount: number) => { return new Intl.NumberFormat('ko-KR', { style: 'currency', @@ -97,13 +100,11 @@ const Index = () => {
-
- 목표 지출 금액 - {formatCurrency(budgetData.daily.targetAmount)} -
-
- 지출 금액 - {formatCurrency(budgetData.daily.spentAmount)} +

목표 진행 상황

+ +
+

{formatCurrency(budgetData.daily.spentAmount)}

+

/ {formatCurrency(budgetData.daily.targetAmount)}

@@ -134,13 +135,11 @@ const Index = () => {
-
- 목표 지출 금액 - {formatCurrency(budgetData.weekly.targetAmount)} -
-
- 지출 금액 - {formatCurrency(budgetData.weekly.spentAmount)} +

목표 진행 상황

+ +
+

{formatCurrency(budgetData.weekly.spentAmount)}

+

/ {formatCurrency(budgetData.weekly.targetAmount)}

@@ -171,13 +170,11 @@ const Index = () => {
-
- 목표 지출 금액 - {formatCurrency(budgetData.monthly.targetAmount)} -
-
- 지출 금액 - {formatCurrency(budgetData.monthly.spentAmount)} +

목표 진행 상황

+ +
+

{formatCurrency(budgetData.monthly.spentAmount)}

+

/ {formatCurrency(budgetData.monthly.targetAmount)}

@@ -230,4 +227,5 @@ const Index = () => {
; }; + export default Index;