neuer demo tenant switcher + demo tenants mit eigenem artisan command. Event Admin überarbeitet, aber das ist nur ein Zwischenstand.

This commit is contained in:
Codex Agent
2025-11-25 09:47:39 +01:00
parent 8947a37261
commit fd788ef770
22 changed files with 1096 additions and 299 deletions

View File

@@ -1,7 +1,7 @@
import React from 'react';
import { Link, NavLink, useLocation } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { LayoutDashboard, CalendarDays, Camera, Settings } from 'lucide-react';
import { LayoutDashboard, CalendarDays, Settings } from 'lucide-react';
import toast from 'react-hot-toast';
import { cn } from '@/lib/utils';
import { Badge } from '@/components/ui/badge';
@@ -68,8 +68,7 @@ export function AdminLayout({ title, subtitle, actions, children, disableCommand
: t('navigation.events');
const photosPath = singleEvent?.slug ? ADMIN_EVENT_PHOTOS_PATH(singleEvent.slug) : ADMIN_EVENTS_PATH;
const photosLabel = t('navigation.photos', { defaultValue: 'Fotos' });
const settingsLabel = t('navigation.settings');
const billingLabel = t('navigation.billing', { defaultValue: 'Paket' });
const baseNavItems = React.useMemo<NavItem[]>(() => [
{
@@ -90,21 +89,13 @@ export function AdminLayout({ title, subtitle, actions, children, disableCommand
prefetchKey: ADMIN_EVENTS_PATH,
},
{
key: 'photos',
to: photosPath,
label: photosLabel,
icon: Camera,
end: Boolean(singleEvent?.slug),
prefetchKey: singleEvent?.slug ? undefined : ADMIN_EVENTS_PATH,
},
{
key: 'settings',
to: ADMIN_SETTINGS_PATH,
label: settingsLabel,
key: 'billing',
to: ADMIN_BILLING_PATH,
label: billingLabel,
icon: Settings,
prefetchKey: ADMIN_SETTINGS_PATH,
prefetchKey: ADMIN_BILLING_PATH,
},
], [eventsLabel, eventsPath, photosPath, photosLabel, settingsLabel, singleEvent, events.length, t]);
], [eventsLabel, eventsPath, billingLabel, singleEvent, events.length, t]);
const { user } = useAuth();
const isMember = user?.role === 'member';
@@ -114,7 +105,7 @@ export function AdminLayout({ title, subtitle, actions, children, disableCommand
if (!isMember) {
return true;
}
return !['dashboard', 'settings'].includes(item.key);
return !['dashboard', 'billing'].includes(item.key);
}),
[baseNavItems, isMember],
);
@@ -251,6 +242,17 @@ function PageTabsNav({ tabs, currentKey }: { tabs: PageTab[]; currentKey?: strin
const activeTab = React.useMemo(() => tabs.find((tab) => isActive(tab)), [tabs, location.pathname, currentKey]);
const handleTabClick = React.useCallback(
(tab: PageTab) => {
setMobileOpen(false);
const [path, hash] = tab.href.split('#');
if (location.pathname === path && hash) {
window.location.hash = `#${hash}`;
}
},
[location.pathname],
);
return (
<div className="border-t border-slate-200/70 bg-white/80 backdrop-blur dark:border-white/10 dark:bg-slate-950/70">
<div className="mx-auto flex w-full max-w-6xl flex-col gap-2 px-4 py-2 sm:px-6">
@@ -261,6 +263,7 @@ function PageTabsNav({ tabs, currentKey }: { tabs: PageTab[]; currentKey?: strin
<Link
key={tab.key}
to={tab.href}
onClick={() => handleTabClick(tab)}
className={cn(
'flex items-center gap-2 rounded-2xl px-4 py-2 text-sm font-semibold transition focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-rose-400/60',
active
@@ -318,7 +321,10 @@ function PageTabsNav({ tabs, currentKey }: { tabs: PageTab[]; currentKey?: strin
<Link
key={`sheet-${tab.key}`}
to={tab.href}
onClick={() => setMobileOpen(false)}
onClick={() => {
handleTabClick(tab);
setMobileOpen(false);
}}
className={cn(
'flex items-center justify-between rounded-2xl border px-4 py-3 text-sm font-medium shadow-sm transition',
active