From e82dac91625c785b1be086843e0dec81158adbe1 Mon Sep 17 00:00:00 2001 From: "gpt-engineer-app[bot]" <159125892+gpt-engineer-app[bot]@users.noreply.github.com> Date: Sat, 15 Mar 2025 02:38:18 +0000 Subject: [PATCH] Visual edit in Lovable Edited UI in Lovable --- src/pages/Analytics.tsx | 189 +++++++++++++++++++++------------------- 1 file changed, 97 insertions(+), 92 deletions(-) diff --git a/src/pages/Analytics.tsx b/src/pages/Analytics.tsx index c38b0e8..c201eea 100644 --- a/src/pages/Analytics.tsx +++ b/src/pages/Analytics.tsx @@ -1,40 +1,66 @@ - import React, { useState } from 'react'; import NavBar from '@/components/NavBar'; import ExpenseChart from '@/components/ExpenseChart'; import AddTransactionButton from '@/components/AddTransactionButton'; import { BarChart, Bar, XAxis, YAxis, Tooltip, ResponsiveContainer, Legend } from 'recharts'; import { ChevronLeft, ChevronRight } from 'lucide-react'; - const Analytics = () => { const [selectedPeriod, setSelectedPeriod] = useState('이번 달'); - + // Sample data for the expense categories - const expenseData = [ - { name: '식비', value: 350000, color: '#9b87f5' }, - { name: '주거', value: 650000, color: '#6e59a5' }, - { name: '교통', value: 125000, color: '#81c784' }, - { name: '취미', value: 200000, color: '#64b5f6' }, - { name: '기타', value: 175000, color: '#e57373' }, - ]; - + const expenseData = [{ + name: '식비', + value: 350000, + color: '#9b87f5' + }, { + name: '주거', + value: 650000, + color: '#6e59a5' + }, { + name: '교통', + value: 125000, + color: '#81c784' + }, { + name: '취미', + value: 200000, + color: '#64b5f6' + }, { + name: '기타', + value: 175000, + color: '#e57373' + }]; + // Sample data for the monthly comparison - const monthlyData = [ - { name: '3월', income: 2400000, expense: 1800000 }, - { name: '4월', income: 2300000, expense: 1700000 }, - { name: '5월', income: 2700000, expense: 1900000 }, - { name: '6월', income: 2200000, expense: 1500000 }, - { name: '7월', income: 2500000, expense: 1650000 }, - { name: '8월', income: 2550000, expense: 1740000 }, - ]; - + const monthlyData = [{ + name: '3월', + income: 2400000, + expense: 1800000 + }, { + name: '4월', + income: 2300000, + expense: 1700000 + }, { + name: '5월', + income: 2700000, + expense: 1900000 + }, { + name: '6월', + income: 2200000, + expense: 1500000 + }, { + name: '7월', + income: 2500000, + expense: 1650000 + }, { + name: '8월', + income: 2550000, + expense: 1740000 + }]; const totalIncome = 2550000; const totalExpense = 1740000; const savings = totalIncome - totalExpense; - const savingsPercentage = Math.round((savings / totalIncome) * 100); - - return ( -
수입
+예산
{new Intl.NumberFormat('ko-KR', { - style: 'currency', - currency: 'KRW', - notation: 'compact', - maximumFractionDigits: 1 - }).format(totalIncome)} + style: 'currency', + currency: 'KRW', + notation: 'compact', + maximumFractionDigits: 1 + }).format(totalIncome)}
지출
{new Intl.NumberFormat('ko-KR', { - style: 'currency', - currency: 'KRW', - notation: 'compact', - maximumFractionDigits: 1 - }).format(totalExpense)} + style: 'currency', + currency: 'KRW', + notation: 'compact', + maximumFractionDigits: 1 + }).format(totalExpense)}
{new Intl.NumberFormat('ko-KR', { - style: 'currency', - currency: 'KRW', - maximumFractionDigits: 0 - }).format(category.value)} + style: 'currency', + currency: 'KRW', + maximumFractionDigits: 0 + }).format(category.value)}
- {Math.round((category.value / totalExpense) * 100)}% + {Math.round(category.value / totalExpense * 100)}%