fix(admin): address PR review feedback from all personas

Blockers resolved:
- localStorage key collision: UsersListPanel/GroupsListPanel/TagsListPanel
  now each use their own key (admin_*_list_collapsed)
- $effect autocollapse replaced with $derived(autocollapse || manualCollapse)
  across all three list panels (Felix — Svelte 5 rule violation)
- groups/new: add READ_ALL and ANNOTATE_ALL to available standard permissions
- Mobile back-to-list links added to all five detail panel headers (md:hidden)
  so users landing directly on a detail URL on mobile can navigate back
- onDestroy(() => stopPolling()) added to system/+page.svelte (Tobias)

High priority resolved:
- Permission labels in groups/[id] and groups/new now use Paraglide i18n keys
  (admin_perm_read_all, admin_perm_annotate_all, etc.) across de/en/es
- $derived used for permission arrays (reactive i18n) — Felix Svelte 5 rule
- UserGroup type in +layout.server.ts now uses generated API type (Markus/Felix)
- discardTarget annotation changed to variable-level type annotation

Accessibility (Leonie):
- EntityNav tablet icon strip buttons: min-h-[44px] for WCAG 2.5.8 compliance
- Flyout focus management: openFlyout() focuses first link, closeFlyout()
  returns focus to the trigger button that opened it
- Flyout animation replaced: broken inline style -> transition:fly={{ x: -160 }}

Tests (Sara/Felix):
- localStorage key assertion tests added per panel
- localStorage.removeItem calls updated to use the panel-specific keys
- page.server.spec.ts added for groups/[id] and tags/[id] delete actions
- Polling lifecycle tests added to system/page.svelte.spec.ts

Note: Paraglide types for new admin_perm_* keys regenerate automatically on
next npm run dev (Vite plugin). No manual compilation step needed.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Marcel
2026-03-30 11:23:27 +02:00
parent 09d8fb5f95
commit 393cb52178
21 changed files with 434 additions and 71 deletions

View File

@@ -3,19 +3,23 @@ import { enhance } from '$app/forms';
import { beforeNavigate, goto } from '$app/navigation';
import { m } from '$lib/paraglide/messages.js';
const availableStandard = [{ value: 'WRITE_ALL', label: 'Lesen & Schreiben' }];
const availableAdmin = [
{ value: 'ADMIN', label: 'Vollzugriff (Admin)' },
{ value: 'ADMIN_USER', label: 'Benutzer verwalten' },
{ value: 'ADMIN_TAG', label: 'Schlagworte verwalten' },
{ value: 'ADMIN_PERMISSION', label: 'Berechtigungen verwalten' }
];
const availableStandard = $derived([
{ value: 'READ_ALL', label: m.admin_perm_read_all() },
{ value: 'ANNOTATE_ALL', label: m.admin_perm_annotate_all() },
{ value: 'WRITE_ALL', label: m.admin_perm_write_all() }
]);
const availableAdmin = $derived([
{ value: 'ADMIN', label: m.admin_perm_admin() },
{ value: 'ADMIN_USER', label: m.admin_perm_admin_user() },
{ value: 'ADMIN_TAG', label: m.admin_perm_admin_tag() },
{ value: 'ADMIN_PERMISSION', label: m.admin_perm_admin_permission() }
]);
let { form } = $props();
let isDirty = $state(false);
let showUnsavedWarning = $state(false);
let discardTarget = $state<string | null>(null);
let discardTarget: string | null = $state(null);
beforeNavigate(({ cancel, to }) => {
if (isDirty) {
@@ -31,6 +35,21 @@ beforeNavigate(({ cancel, to }) => {
<div
class="flex items-center border-b border-green-200 bg-green-50 px-5 py-3 dark:border-green-900 dark:bg-green-950/30"
>
<a
href="/admin/groups"
class="mr-3 inline-flex items-center gap-1 text-xs text-green-700 hover:text-green-900 md:hidden"
>
<svg
class="h-4 w-4"
fill="none"
viewBox="0 0 24 24"
stroke="currentColor"
stroke-width="2"
aria-hidden="true"
>
<path stroke-linecap="round" stroke-linejoin="round" d="M15 19l-7-7 7-7" />
</svg>
</a>
<h2 class="flex-1 font-sans text-sm font-bold text-green-800 dark:text-green-300">
{m.admin_group_new_heading()}
</h2>