feat: complete CMS v2 with Docker, Fischerei, Meetings, Verband modules + UX audit fixes
Major changes: - Docker Compose: full Supabase stack (11 services) equivalent to supabase CLI - Fischerei module: 16 DB tables, waters/species/stocking/catch books/competitions - Sitzungsprotokolle module: meeting protocols, agenda items, task tracking - Verbandsverwaltung module: federation management, member clubs, contacts, fees - Per-account module activation via Modules page toggle - Site Builder: live CMS data in Puck blocks (courses, events, membership registration) - Public registration APIs: course signup, event registration, membership application - Document generation: PDF member cards, Excel reports, HTML labels - Landing page: real Com.BISS content (no filler text) - UX audit fixes: AccountNotFound component, shared status badges, confirm dialog, pagination, duplicate heading removal, emoji→badge replacement, a11y fixes - QA: healthcheck fix, API auth fix, enum mismatch fix, password required attribute
This commit is contained in:
@@ -0,0 +1,110 @@
|
||||
'use client';
|
||||
|
||||
import { useRouter } from 'next/navigation';
|
||||
import { useTransition } from 'react';
|
||||
|
||||
import { Fish, FileSignature, Building2 } from 'lucide-react';
|
||||
import { toast } from '@kit/ui/sonner';
|
||||
|
||||
import { Switch } from '@kit/ui/switch';
|
||||
|
||||
import { toggleModuleAction } from '../_lib/server/toggle-module';
|
||||
|
||||
interface ModuleDefinition {
|
||||
key: string;
|
||||
label: string;
|
||||
description: string;
|
||||
icon: React.ReactNode;
|
||||
}
|
||||
|
||||
const AVAILABLE_MODULES: ModuleDefinition[] = [
|
||||
{
|
||||
key: 'fischerei',
|
||||
label: 'Fischerei',
|
||||
description:
|
||||
'Gewässer, Fischarten, Besatz, Fangbücher und Wettbewerbe verwalten',
|
||||
icon: <Fish className="h-5 w-5" />,
|
||||
},
|
||||
{
|
||||
key: 'meetings',
|
||||
label: 'Sitzungsprotokolle',
|
||||
description:
|
||||
'Sitzungsprotokolle, Tagesordnungspunkte und Beschlüsse verwalten',
|
||||
icon: <FileSignature className="h-5 w-5" />,
|
||||
},
|
||||
{
|
||||
key: 'verband',
|
||||
label: 'Verbandsverwaltung',
|
||||
description:
|
||||
'Mitgliedsvereine, Kontaktpersonen, Beiträge und Statistiken verwalten',
|
||||
icon: <Building2 className="h-5 w-5" />,
|
||||
},
|
||||
];
|
||||
|
||||
interface ModuleTogglesProps {
|
||||
accountId: string;
|
||||
features: Record<string, boolean>;
|
||||
}
|
||||
|
||||
export function ModuleToggles({ accountId, features }: ModuleTogglesProps) {
|
||||
const router = useRouter();
|
||||
const [isPending, startTransition] = useTransition();
|
||||
|
||||
const handleToggle = (moduleKey: string, enabled: boolean) => {
|
||||
startTransition(async () => {
|
||||
const result = await toggleModuleAction(accountId, moduleKey, enabled);
|
||||
|
||||
if (result.success) {
|
||||
toast.success(
|
||||
enabled ? 'Modul aktiviert' : 'Modul deaktiviert',
|
||||
);
|
||||
|
||||
router.refresh();
|
||||
} else {
|
||||
toast.error('Fehler beim Aktualisieren des Moduls');
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="flex flex-col gap-4">
|
||||
<div>
|
||||
<h2 className="text-xl font-semibold">Verfügbare Module</h2>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
Aktivieren oder deaktivieren Sie Module für Ihren Verein
|
||||
</p>
|
||||
</div>
|
||||
|
||||
<div className="divide-y rounded-lg border">
|
||||
{AVAILABLE_MODULES.map((mod) => {
|
||||
const isEnabled = features[mod.key] === true;
|
||||
|
||||
return (
|
||||
<div
|
||||
key={mod.key}
|
||||
className="flex items-center justify-between gap-4 p-4"
|
||||
>
|
||||
<div className="flex items-center gap-3">
|
||||
<div className="text-muted-foreground">{mod.icon}</div>
|
||||
<div>
|
||||
<p className="font-medium">{mod.label}</p>
|
||||
<p className="text-muted-foreground text-sm">
|
||||
{mod.description}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<Switch
|
||||
checked={isEnabled}
|
||||
onCheckedChange={(checked) =>
|
||||
handleToggle(mod.key, Boolean(checked))
|
||||
}
|
||||
disabled={isPending}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user