diff --git a/frontend/index.html b/frontend/index.html index 3d944d7..768d7e7 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -2,7 +2,7 @@ - + Outfit-Voting Abi26 diff --git a/frontend/src/pages/admin/index.tsx b/frontend/src/pages/admin/index.tsx index 2c2a198..00f3046 100644 --- a/frontend/src/pages/admin/index.tsx +++ b/frontend/src/pages/admin/index.tsx @@ -134,6 +134,36 @@ export default function AdminPage() { }); }; + const handleDeleteCategory = (cat: string) => { + const catIds = options.filter(o => o.Category === cat).map(o => o.ID); + if (catIds.length === 0) return; + openDialog( + "Kategorie leeren?", + `Möchtest du wirklich alle ${catIds.length} Einträge in der Kategorie "${cat}" unwiderruflich löschen?`, + async () => { + await api.bulkDeleteVoteEntries(catIds); + setSelectedIds(new Set([...selectedIds].filter(id => !catIds.includes(id)))); + loadData(); + closeDialog(); + } + ); + }; + + const handleDeleteAll = () => { + if (options.length === 0) return; + openDialog( + "Alle Einträge löschen?", + `ACHTUNG: Möchtest du wirklich ALLE ${options.length} Einträge unwiderruflich löschen?`, + async () => { + const allIds = options.map(o => o.ID); + await api.bulkDeleteVoteEntries(allIds); + setSelectedIds(new Set()); + loadData(); + closeDialog(); + } + ); + }; + const saveEdit = async (id: string) => { await api.setVoteCount(id, editVotes); setEditId(null); @@ -205,13 +235,19 @@ export default function AdminPage() { - {selectedIds.size > 0 && ( + {selectedIds.size > 0 ? (
{selectedIds.size} Einträge ausgewählt
+ ) : options.length > 0 && ( +
+ +
)}
@@ -245,13 +281,18 @@ export default function AdminPage() { style={{ padding: '0.4rem 0.8rem', borderRadius: 'var(--radius-m)', background: 'rgba(255,255,255,0.05)', border: '1px solid var(--panel-border)', fontSize: '0.9rem', width: '160px' }} />
- +
+ + +