Files
fotospiel-app/resources/js/admin/components/AdminLayout.tsx
Codex Agent 1a4bdb1fe1 tenant admin startseite schicker gestaltet und super-admin und tenant admin (filament) aufgesplittet.
Es gibt nun task collections und vordefinierte tasks für alle. Onboarding verfeinert und webseite-carousel gefixt (logging später entfernen!)
2025-10-14 15:17:52 +02:00

84 lines
2.9 KiB
TypeScript

import React from 'react';
import { NavLink } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { cn } from '@/lib/utils';
import {
ADMIN_HOME_PATH,
ADMIN_EVENTS_PATH,
ADMIN_SETTINGS_PATH,
ADMIN_TASKS_PATH,
ADMIN_BILLING_PATH,
ADMIN_TASK_COLLECTIONS_PATH,
ADMIN_EMOTIONS_PATH,
} from '../constants';
import { LanguageSwitcher } from './LanguageSwitcher';
const navItems = [
{ to: ADMIN_HOME_PATH, labelKey: 'navigation.dashboard', end: true },
{ to: ADMIN_EVENTS_PATH, labelKey: 'navigation.events' },
{ to: ADMIN_TASKS_PATH, labelKey: 'navigation.tasks' },
{ to: ADMIN_TASK_COLLECTIONS_PATH, labelKey: 'navigation.collections' },
{ to: ADMIN_EMOTIONS_PATH, labelKey: 'navigation.emotions' },
{ to: ADMIN_BILLING_PATH, labelKey: 'navigation.billing' },
{ to: ADMIN_SETTINGS_PATH, labelKey: 'navigation.settings' },
];
interface AdminLayoutProps {
title: string;
subtitle?: string;
actions?: React.ReactNode;
children: React.ReactNode;
}
export function AdminLayout({ title, subtitle, actions, children }: AdminLayoutProps) {
const { t } = useTranslation('common');
React.useEffect(() => {
document.body.classList.add('tenant-admin-theme');
return () => {
document.body.classList.remove('tenant-admin-theme');
};
}, []);
return (
<div className="min-h-screen bg-brand-gradient text-brand-slate">
<header className="border-b border-brand-rose-soft bg-brand-card/90 shadow-brand-primary backdrop-blur-md">
<div className="mx-auto flex w-full max-w-6xl flex-col gap-4 px-6 py-6 md:flex-row md:items-center md:justify-between">
<div>
<p className="text-xs uppercase tracking-[0.35em] text-brand-rose">{t('app.brand')}</p>
<h1 className="font-display text-3xl font-semibold text-brand-slate">{title}</h1>
{subtitle && <p className="mt-1 text-sm font-sans-marketing text-brand-navy/75">{subtitle}</p>}
</div>
<div className="flex flex-wrap items-center gap-2">
<LanguageSwitcher />
{actions}
</div>
</div>
<nav className="mx-auto flex w-full max-w-6xl gap-3 px-6 pb-4 text-sm font-medium text-brand-navy/80">
{navItems.map((item) => (
<NavLink
key={item.to}
to={item.to}
end={item.end}
className={({ isActive }) =>
cn(
'rounded-full px-4 py-2 transition-colors',
isActive
? 'bg-brand-rose text-white shadow-md shadow-rose-400/40'
: 'bg-white/70 text-brand-navy/80 hover:bg-white hover:text-brand-slate'
)
}
>
{t(item.labelKey)}
</NavLink>
))}
</nav>
</header>
<main className="mx-auto w-full max-w-6xl px-6 py-10">
<div className="grid gap-6">{children}</div>
</main>
</div>
);
}