feat(frontend): replace JS confirm() with native dialog component

- ConfirmDialog: centered <dialog> with backdrop blur, cancel + confirm (danger variant)
- tags/[id]: delete tag uses ConfirmDialog
- categories/[id]: delete category uses ConfirmDialog
- files: bulk delete calls POST /files/bulk/delete, removes files from list,
  text updated to "Move to trash" (soft delete)
- mock: add POST /files/bulk/delete handler

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-04-05 23:48:21 +03:00
parent 1931adcd38
commit 1f591f3a3f
5 changed files with 184 additions and 12 deletions
+10
View File
@@ -317,6 +317,16 @@ export function mockApiPlugin(): Plugin {
return json(res, 200, getMockFile(id));
}
// POST /files/bulk/delete — soft delete (just remove from mock array)
if (method === 'POST' && path === '/files/bulk/delete') {
const body = (await readBody(req)) as { file_ids?: string[] };
const ids = new Set(body.file_ids ?? []);
for (let i = MOCK_FILES.length - 1; i >= 0; i--) {
if (ids.has(MOCK_FILES[i].id)) MOCK_FILES.splice(i, 1);
}
return noContent(res);
}
// POST /files — upload (mock: drain body, return a new fake file)
if (method === 'POST' && path === '/files') {
// Drain the multipart body without parsing it