Summen-Statistik der Kategorien
Eigenes 'Löschen' PopUp
This commit is contained in:
@@ -3,6 +3,7 @@
|
||||
import { useState, useEffect } from 'react';
|
||||
import AusgabenForm from '@/components/AusgabenForm';
|
||||
import AusgabenList from '@/components/AusgabenList';
|
||||
import MonatsStatistik from '@/components/MonatsStatistik';
|
||||
import LogoutButton from '@/components/LogoutButton';
|
||||
import { AusgabenEntry } from '@/types/ausgaben';
|
||||
import packageJson from '@/package.json';
|
||||
@@ -12,6 +13,7 @@ export default function Home() {
|
||||
const [entries, setEntries] = useState<AusgabenEntry[]>([]);
|
||||
const [isLoading, setIsLoading] = useState(true);
|
||||
const [selectedEntry, setSelectedEntry] = useState<AusgabenEntry | null>(null);
|
||||
const [statsRefreshKey, setStatsRefreshKey] = useState(0);
|
||||
|
||||
const version = packageJson.version;
|
||||
const buildDate = process.env.NEXT_PUBLIC_BUILD_DATE || new Date().toLocaleDateString('de-DE', { day: '2-digit', month: '2-digit', year: 'numeric' });
|
||||
@@ -43,6 +45,7 @@ export default function Home() {
|
||||
|
||||
const handleSuccess = () => {
|
||||
setSelectedEntry(null);
|
||||
setStatsRefreshKey((k) => k + 1);
|
||||
setTimeout(() => {
|
||||
fetchRecentEntries();
|
||||
}, 100);
|
||||
@@ -50,6 +53,7 @@ export default function Home() {
|
||||
|
||||
const handleDelete = (id: number) => {
|
||||
setEntries(entries.filter(entry => entry.ID !== id));
|
||||
setStatsRefreshKey((k) => k + 1);
|
||||
};
|
||||
|
||||
const handleEdit = (entry: AusgabenEntry) => {
|
||||
@@ -93,6 +97,8 @@ export default function Home() {
|
||||
<h2 className="text-xl font-semibold mb-4">Eingabe</h2>
|
||||
<AusgabenForm onSuccess={handleSuccess} selectedEntry={selectedEntry} typ={activeTab} />
|
||||
|
||||
<MonatsStatistik typ={activeTab} refreshKey={statsRefreshKey} />
|
||||
|
||||
<div className="mt-6 bg-white border border-black rounded-lg shadow-md p-6">
|
||||
<h3 className="text-xl font-semibold mb-4">Letzte 20 Einträge</h3>
|
||||
{isLoading ? (
|
||||
|
||||
Reference in New Issue
Block a user