neuer demo tenant switcher + demo tenants mit eigenem artisan command. Event Admin überarbeitet, aber das ist nur ein Zwischenstand.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -56,7 +56,7 @@ function formatNumber(value?: number | null): string {
|
||||
}
|
||||
|
||||
export function CommandShelf() {
|
||||
const { events, activeEvent, isLoading } = useEventContext();
|
||||
const { events, activeEvent, isLoading, isError, refetch } = useEventContext();
|
||||
const { t, i18n } = useTranslation('common');
|
||||
const navigate = useNavigate();
|
||||
const [mobileShelfOpen, setMobileShelfOpen] = React.useState(false);
|
||||
@@ -85,25 +85,30 @@ export function CommandShelf() {
|
||||
);
|
||||
}
|
||||
|
||||
if (!events.length) {
|
||||
if (isError) {
|
||||
return (
|
||||
<section className="border-b border-slate-200/80 bg-white/80 px-4 py-4 backdrop-blur-sm dark:border-white/10 dark:bg-slate-950/70">
|
||||
<div className="mx-auto flex w-full max-w-6xl flex-col gap-3 rounded-3xl border border-dashed border-rose-200/60 bg-white/70 p-5 text-center dark:border-white/10 dark:bg-white/5">
|
||||
<Sparkles className="mx-auto h-6 w-6 text-rose-500 dark:text-rose-200" />
|
||||
<p className="text-sm font-semibold text-slate-800 dark:text-white">
|
||||
{t('commandShelf.empty.title', 'Starte mit deinem ersten Event')}
|
||||
</p>
|
||||
<p className="text-xs text-slate-500 dark:text-slate-300">
|
||||
{t('commandShelf.empty.hint', 'Erstelle ein Event, dann bündeln wir hier deine wichtigsten Tools.')}
|
||||
</p>
|
||||
<div className="flex justify-center">
|
||||
<div className="mx-auto flex w-full max-w-6xl flex-col gap-3 rounded-3xl border border-amber-200/70 bg-amber-50/70 p-5 dark:border-amber-200/20 dark:bg-amber-500/10">
|
||||
<div className="flex items-start gap-3">
|
||||
<AlertTriangle className="h-5 w-5 text-amber-500" />
|
||||
<div className="space-y-1">
|
||||
<p className="text-sm font-semibold text-slate-800 dark:text-white">
|
||||
{t('commandShelf.error.title', 'Events konnten nicht geladen werden')}
|
||||
</p>
|
||||
<p className="text-xs text-slate-600 dark:text-slate-200">
|
||||
{t('commandShelf.error.hint', 'Bitte versuche es erneut oder lade die Seite neu.')}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex flex-wrap justify-between gap-3">
|
||||
<EventSwitcher compact />
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
className="rounded-full"
|
||||
onClick={() => navigate(ADMIN_EVENT_CREATE_PATH)}
|
||||
onClick={() => refetch()}
|
||||
>
|
||||
<PlusCircle className="mr-2 h-4 w-4" />
|
||||
{t('commandShelf.empty.cta', 'Event anlegen')}
|
||||
{t('commandShelf.error.retry', 'Erneut laden')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
@@ -111,6 +116,11 @@ export function CommandShelf() {
|
||||
);
|
||||
}
|
||||
|
||||
if (!events.length) {
|
||||
// Hide the empty hero entirely; dashboard content already handles the zero-events case.
|
||||
return null;
|
||||
}
|
||||
|
||||
if (!activeEvent) {
|
||||
return (
|
||||
<section className="border-b border-slate-200/80 bg-white/80 px-4 py-4 backdrop-blur-sm dark:border-white/10 dark:bg-slate-950/70">
|
||||
|
||||
@@ -4,10 +4,10 @@ import { Loader2, PanelLeftClose, PanelRightOpen } from 'lucide-react';
|
||||
import { Button } from '@/components/ui/button';
|
||||
|
||||
const DEV_TENANT_KEYS = [
|
||||
{ key: 'lumen', label: 'Lumen Moments' },
|
||||
{ key: 'storycraft', label: 'Storycraft Weddings' },
|
||||
{ key: 'viewfinder', label: 'Viewfinder Studios' },
|
||||
{ key: 'pixel', label: 'Pixel & Co (dormant)' },
|
||||
{ key: 'cust-standard-empty', label: 'Endkunde – Standard (kein Event)' },
|
||||
{ key: 'cust-starter-wedding', label: 'Endkunde – Starter (Hochzeit)' },
|
||||
{ key: 'reseller-s-active', label: 'Reseller S – 3 aktive Events' },
|
||||
{ key: 'reseller-s-full', label: 'Reseller S – voll belegt (5/5)' },
|
||||
] as const;
|
||||
|
||||
declare global {
|
||||
|
||||
Reference in New Issue
Block a user