Compare commits
2 Commits
v0.1.1
..
8587b9577a
| Author | SHA1 | Date | |
|---|---|---|---|
|
8587b9577a
|
|||
|
9911eaf812
|
+1
-1
@@ -2,7 +2,7 @@
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8" />
|
||||
<link rel="icon" type="image/svg+xml" href="/favicon.svg" />
|
||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>Outfit-Voting Abi26</title>
|
||||
</head>
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 14 KiB |
File diff suppressed because one or more lines are too long
|
Before Width: | Height: | Size: 9.3 KiB |
@@ -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() {
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{selectedIds.size > 0 && (
|
||||
{selectedIds.size > 0 ? (
|
||||
<div className="bulk-actions panel">
|
||||
<span>{selectedIds.size} Einträge ausgewählt</span>
|
||||
<button className="btn-danger" onClick={handleBulkDelete}>
|
||||
<Trash2 size={18} /> Ausgewählte Löschen
|
||||
</button>
|
||||
</div>
|
||||
) : options.length > 0 && (
|
||||
<div className="bulk-actions panel" style={{ justifyContent: 'flex-end' }}>
|
||||
<button className="btn-danger" onClick={handleDeleteAll}>
|
||||
<Trash2 size={18} /> Alle Kategorien & Einträge löschen
|
||||
</button>
|
||||
</div>
|
||||
)}
|
||||
|
||||
<div className="admin-tables">
|
||||
@@ -245,6 +281,7 @@ 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' }}
|
||||
/>
|
||||
</div>
|
||||
<div style={{ display: 'flex', gap: '0.5rem' }}>
|
||||
<button className="btn-icon add-to-cat" onClick={() => {
|
||||
setBulkCategory(cat);
|
||||
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||
@@ -252,6 +289,10 @@ export default function AdminPage() {
|
||||
}}>
|
||||
<Plus size={16} /> Hier hinzufügen
|
||||
</button>
|
||||
<button className="btn-icon delete" onClick={() => handleDeleteCategory(cat)}>
|
||||
<Trash2 size={16} /> Alle löschen
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<table className="admin-table">
|
||||
<thead>
|
||||
|
||||
Reference in New Issue
Block a user