ee97b4ed9f
- gemeinsame Oberflaeche (CustomModuleManager, Formular, Loeschdialog) fuer Verwaltung und Einstellungen - Einstellungen: persoenliche Eintraege, Verwaltung sendet shared: true und zeigt nur gemeinsame - Navigation, Texte de/en, Komponententests Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
43 lines
1.4 KiB
TypeScript
43 lines
1.4 KiB
TypeScript
'use client';
|
|
|
|
import { useTranslations } from 'next-intl';
|
|
import { CustomModuleManager } from '@/components/custom-modules/custom-module-manager';
|
|
import { useAuthStore } from '@/lib/stores/auth-store';
|
|
|
|
/**
|
|
* Verwaltung „Eigene Module“ (quick-260929-9wc, D-07, Vorbild
|
|
* `admin/groups`; quick-260929-dzu: nur die GEMEINSAMEN Eintraege). ADMIN und
|
|
* SUPER_ADMIN; die Rollenpruefung hier ist nur Anzeige — durchgesetzt wird sie
|
|
* serverseitig: die API verlangt fuer gemeinsame Eintraege (`shared: true`,
|
|
* Aendern, Loeschen) die Administrator-Rolle. Persoenliche Eintraege eines
|
|
* Administrators stehen wie bei jedem Benutzer unter Einstellungen.
|
|
*/
|
|
export default function AdminCustomModulesPage() {
|
|
const t = useTranslations('admin.customModules');
|
|
const tCommon = useTranslations('common');
|
|
const currentUser = useAuthStore((s) => s.user);
|
|
|
|
const hasAccess = currentUser?.role === 'ADMIN' || currentUser?.role === 'SUPER_ADMIN';
|
|
|
|
if (!hasAccess) {
|
|
return (
|
|
<div className="flex min-h-[60vh] items-center justify-center">
|
|
<p className="text-lg text-muted-foreground">{tCommon('accessDenied')}</p>
|
|
</div>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<CustomModuleManager
|
|
scope="shared"
|
|
texts={{
|
|
title: t('title'),
|
|
description: t('description'),
|
|
create: t('create'),
|
|
noModules: t('noModules'),
|
|
noModulesBody: t('noModulesBody'),
|
|
}}
|
|
/>
|
|
);
|
|
}
|