neuer demo tenant switcher + demo tenants mit eigenem artisan command. Event Admin überarbeitet, aber das ist nur ein Zwischenstand.
This commit is contained in:
@@ -40,6 +40,7 @@ import {
|
||||
} from '../api';
|
||||
import { isAuthError } from '../auth/tokens';
|
||||
import { useAuth } from '../auth/context';
|
||||
import { useEventContext } from '../context/EventContext';
|
||||
import {
|
||||
adminPath,
|
||||
ADMIN_HOME_PATH,
|
||||
@@ -82,6 +83,7 @@ export default function DashboardPage() {
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { user } = useAuth();
|
||||
const { events: ctxEvents, activeEvent: ctxActiveEvent } = useEventContext();
|
||||
const { progress, markStep } = useOnboardingProgress();
|
||||
const { t, i18n } = useTranslation('dashboard', { keyPrefix: 'dashboard' });
|
||||
const { t: tc } = useTranslation('common');
|
||||
@@ -132,7 +134,7 @@ export default function DashboardPage() {
|
||||
try {
|
||||
const [summary, events, packages] = await Promise.all([
|
||||
getDashboardSummary().catch(() => null),
|
||||
getEvents().catch(() => [] as TenantEvent[]),
|
||||
getEvents({ force: true }).catch(() => [] as TenantEvent[]),
|
||||
getTenantPackagesOverview().catch(() => ({ packages: [], activePackage: null })),
|
||||
]);
|
||||
|
||||
@@ -141,11 +143,12 @@ export default function DashboardPage() {
|
||||
}
|
||||
|
||||
const fallbackSummary = buildSummaryFallback(events, packages.activePackage);
|
||||
const primaryEvent = events[0] ?? null;
|
||||
const eventPool = events.length ? events : ctxEvents;
|
||||
const primaryEvent = ctxActiveEvent ?? eventPool[0] ?? null;
|
||||
const primaryEventName = primaryEvent ? resolveEventName(primaryEvent.name, primaryEvent.slug) : null;
|
||||
|
||||
setReadiness({
|
||||
hasEvent: events.length > 0,
|
||||
hasEvent: eventPool.length > 0,
|
||||
hasTasks: primaryEvent ? (Number(primaryEvent.tasks_count ?? 0) > 0) : false,
|
||||
hasQrInvites: primaryEvent
|
||||
? Number(
|
||||
@@ -162,7 +165,7 @@ export default function DashboardPage() {
|
||||
|
||||
setState({
|
||||
summary: summary ?? fallbackSummary,
|
||||
events,
|
||||
events: eventPool,
|
||||
activePackage: packages.activePackage,
|
||||
loading: false,
|
||||
errorKey: null,
|
||||
@@ -217,12 +220,21 @@ export default function DashboardPage() {
|
||||
const subtitle = translate('welcome.subtitle');
|
||||
const errorMessage = errorKey ? translate(`errors.${errorKey}`) : null;
|
||||
const dateLocale = i18n.language?.startsWith('en') ? 'en-GB' : 'de-DE';
|
||||
const canCreateEvent = React.useMemo(() => {
|
||||
if (!activePackage) {
|
||||
return true;
|
||||
}
|
||||
if (activePackage.remaining_events === null || activePackage.remaining_events === undefined) {
|
||||
return true;
|
||||
}
|
||||
return activePackage.remaining_events > 0;
|
||||
}, [activePackage]);
|
||||
|
||||
const upcomingEvents = getUpcomingEvents(events);
|
||||
const publishedEvents = events.filter((event) => event.status === 'published');
|
||||
const primaryEvent = events[0] ?? null;
|
||||
const upcomingEvents = getUpcomingEvents(ctxEvents.length ? ctxEvents : events);
|
||||
const publishedEvents = (ctxEvents.length ? ctxEvents : events).filter((event) => event.status === 'published');
|
||||
const primaryEvent = ctxActiveEvent ?? (ctxEvents[0] ?? events[0] ?? null);
|
||||
const primaryEventName = primaryEvent ? resolveEventName(primaryEvent.name, primaryEvent.slug) : null;
|
||||
const singleEvent = events.length === 1 ? events[0] : null;
|
||||
const singleEvent = ctxEvents.length === 1 ? ctxEvents[0] : (events.length === 1 ? events[0] : null);
|
||||
const singleEventName = singleEvent ? resolveEventName(singleEvent.name, singleEvent.slug) : null;
|
||||
const singleEventDateLabel = singleEvent?.event_date ? formatDate(singleEvent.event_date, dateLocale) : null;
|
||||
const primaryEventLimits = primaryEvent?.limits ?? null;
|
||||
@@ -468,7 +480,15 @@ export default function DashboardPage() {
|
||||
label: translate('quickActions.createEvent.label'),
|
||||
description: translate('quickActions.createEvent.description'),
|
||||
icon: <Plus className="h-5 w-5" />,
|
||||
onClick: () => navigate(ADMIN_EVENT_CREATE_PATH),
|
||||
onClick: () => {
|
||||
if (!canCreateEvent) {
|
||||
toast.error(tc('errors.eventLimit', 'Dein aktuelles Paket enthält keine freien Event-Slots mehr.'));
|
||||
navigate(ADMIN_BILLING_PATH);
|
||||
return;
|
||||
}
|
||||
navigate(ADMIN_EVENT_CREATE_PATH);
|
||||
},
|
||||
disabled: !canCreateEvent,
|
||||
},
|
||||
{
|
||||
key: 'photos',
|
||||
@@ -559,7 +579,7 @@ export default function DashboardPage() {
|
||||
);
|
||||
|
||||
return (
|
||||
<AdminLayout title={adminTitle} subtitle={adminSubtitle} actions={layoutActions} tabs={dashboardTabs} currentTabKey={currentDashboardTab}>
|
||||
<AdminLayout title={adminTitle} subtitle={adminSubtitle} tabs={dashboardTabs} currentTabKey={currentDashboardTab}>
|
||||
{errorMessage && (
|
||||
<Alert variant="destructive">
|
||||
<AlertTitle>{t('dashboard.alerts.errorTitle')}</AlertTitle>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import { useNavigate, useParams, useSearchParams } from 'react-router-dom';
|
||||
import { useNavigate, useParams, useSearchParams, useLocation } from 'react-router-dom';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import {
|
||||
AlertTriangle,
|
||||
@@ -94,6 +94,7 @@ export default function EventDetailPage({ mode = 'detail' }: EventDetailPageProp
|
||||
const { slug: slugParam } = useParams<{ slug?: string }>();
|
||||
const [searchParams] = useSearchParams();
|
||||
const navigate = useNavigate();
|
||||
const location = useLocation();
|
||||
const { t } = useTranslation('management');
|
||||
const { t: tCommon } = useTranslation('common');
|
||||
|
||||
@@ -217,19 +218,53 @@ export default function EventDetailPage({ mode = 'detail' }: EventDetailPageProp
|
||||
? t('events.workspace.toolkitSubtitle', 'Moderation, Aufgaben und Einladungen für deinen Eventtag bündeln.')
|
||||
: t('events.workspace.detailSubtitle', 'Behalte Status, Aufgaben und Einladungen deines Events im Blick.');
|
||||
|
||||
const tabLabels = React.useMemo(
|
||||
() => ({
|
||||
overview: t('events.workspace.tabs.overview', 'Überblick'),
|
||||
live: t('events.workspace.tabs.live', 'Live'),
|
||||
setup: t('events.workspace.tabs.setup', 'Vorbereitung'),
|
||||
recap: t('events.workspace.tabs.recap', 'Nachbereitung'),
|
||||
}),
|
||||
[t],
|
||||
);
|
||||
const limitWarnings = React.useMemo(
|
||||
() => (event?.limits ? buildLimitWarnings(event.limits, (key, options) => tCommon(`limits.${key}`, options)) : []),
|
||||
[event?.limits, tCommon],
|
||||
);
|
||||
const [dismissedWarnings, setDismissedWarnings] = React.useState<Set<string>>(new Set());
|
||||
|
||||
React.useEffect(() => {
|
||||
const slug = event?.slug;
|
||||
if (!slug || typeof window === 'undefined') {
|
||||
setDismissedWarnings(new Set());
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const raw = window.localStorage.getItem(`tenant-admin:dismissed-limit-warnings:${slug}`);
|
||||
if (!raw) {
|
||||
setDismissedWarnings(new Set());
|
||||
return;
|
||||
}
|
||||
const parsed = JSON.parse(raw) as string[];
|
||||
setDismissedWarnings(new Set(parsed));
|
||||
} catch {
|
||||
setDismissedWarnings(new Set());
|
||||
}
|
||||
}, [event?.slug]);
|
||||
|
||||
const visibleWarnings = React.useMemo(
|
||||
() => limitWarnings.filter((warning) => !dismissedWarnings.has(warning.id)),
|
||||
[limitWarnings, dismissedWarnings],
|
||||
);
|
||||
|
||||
const dismissWarning = React.useCallback(
|
||||
(id: string) => {
|
||||
const slug = event?.slug;
|
||||
setDismissedWarnings((prev) => {
|
||||
const next = new Set(prev);
|
||||
next.add(id);
|
||||
if (slug && typeof window !== 'undefined') {
|
||||
window.localStorage.setItem(
|
||||
`tenant-admin:dismissed-limit-warnings:${slug}`,
|
||||
JSON.stringify(Array.from(next)),
|
||||
);
|
||||
}
|
||||
return next;
|
||||
});
|
||||
},
|
||||
[event?.slug],
|
||||
);
|
||||
|
||||
const eventTabs = React.useMemo(() => {
|
||||
if (!event) {
|
||||
@@ -243,6 +278,11 @@ export default function EventDetailPage({ mode = 'detail' }: EventDetailPageProp
|
||||
});
|
||||
}, [event, toolkitData?.photos?.pending?.length, toolkitData?.tasks?.summary.total, toolkitData?.invites?.summary.active, t]);
|
||||
|
||||
const isRecapRoute = React.useMemo(
|
||||
() => location.pathname.endsWith('/recap'),
|
||||
[location.pathname],
|
||||
);
|
||||
|
||||
const shownWarningToasts = React.useRef<Set<string>>(new Set());
|
||||
//const [addonBusyId, setAddonBusyId] = React.useState<string | null>(null);
|
||||
|
||||
@@ -336,7 +376,12 @@ const shownWarningToasts = React.useRef<Set<string>>(new Set());
|
||||
}
|
||||
|
||||
return (
|
||||
<AdminLayout title={eventName} subtitle={subtitle} tabs={eventTabs} currentTabKey="overview">
|
||||
<AdminLayout
|
||||
title={eventName}
|
||||
subtitle={subtitle}
|
||||
tabs={eventTabs}
|
||||
currentTabKey={isRecapRoute ? 'recap' : 'overview'}
|
||||
>
|
||||
{error && (
|
||||
<Alert variant="destructive">
|
||||
<AlertTitle>{t('events.alerts.failedTitle', 'Aktion fehlgeschlagen')}</AlertTitle>
|
||||
@@ -344,9 +389,9 @@ const shownWarningToasts = React.useRef<Set<string>>(new Set());
|
||||
</Alert>
|
||||
)}
|
||||
|
||||
{limitWarnings.length > 0 && (
|
||||
{visibleWarnings.length > 0 && (
|
||||
<div className="mb-6 space-y-2">
|
||||
{limitWarnings.map((warning) => (
|
||||
{visibleWarnings.map((warning) => (
|
||||
<Alert
|
||||
key={warning.id}
|
||||
variant={warning.tone === 'danger' ? 'destructive' : 'default'}
|
||||
@@ -357,33 +402,43 @@ const shownWarningToasts = React.useRef<Set<string>>(new Set());
|
||||
<AlertTriangle className="h-4 w-4" />
|
||||
{warning.message}
|
||||
</AlertDescription>
|
||||
{(['photos', 'guests', 'gallery'] as const).includes(warning.scope) ? (
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => { void handleAddonPurchase(warning.scope as 'photos' | 'guests' | 'gallery'); }}
|
||||
disabled={addonBusyId === warning.scope}
|
||||
className="justify-start"
|
||||
>
|
||||
<ShoppingCart className="mr-2 h-4 w-4" />
|
||||
{warning.scope === 'photos'
|
||||
? t('events.actions.buyMorePhotos', 'Mehr Fotos freischalten')
|
||||
: warning.scope === 'guests'
|
||||
? t('events.actions.buyMoreGuests', 'Mehr Gäste freischalten')
|
||||
: t('events.actions.extendGallery', 'Galerie verlängern')}
|
||||
</Button>
|
||||
{addonsCatalog.length > 0 ? (
|
||||
<AddonsPicker
|
||||
addons={addonsCatalog}
|
||||
scope={warning.scope as 'photos' | 'guests' | 'gallery'}
|
||||
onCheckout={(key) => { void handleAddonPurchase(warning.scope as 'photos' | 'guests' | 'gallery', key); }}
|
||||
busy={addonBusyId === warning.scope}
|
||||
t={(key, fallback) => t(key, fallback)}
|
||||
/>
|
||||
) : null}
|
||||
</div>
|
||||
) : null}
|
||||
<div className="flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-3">
|
||||
{(['photos', 'guests', 'gallery'] as const).includes(warning.scope) ? (
|
||||
<>
|
||||
<Button
|
||||
variant="outline"
|
||||
size="sm"
|
||||
onClick={() => { void handleAddonPurchase(warning.scope as 'photos' | 'guests' | 'gallery'); }}
|
||||
disabled={addonBusyId === warning.scope}
|
||||
className="justify-start"
|
||||
>
|
||||
<ShoppingCart className="mr-2 h-4 w-4" />
|
||||
{warning.scope === 'photos'
|
||||
? t('events.actions.buyMorePhotos', 'Mehr Fotos freischalten')
|
||||
: warning.scope === 'guests'
|
||||
? t('events.actions.buyMoreGuests', 'Mehr Gäste freischalten')
|
||||
: t('events.actions.extendGallery', 'Galerie verlängern')}
|
||||
</Button>
|
||||
{addonsCatalog.length > 0 ? (
|
||||
<AddonsPicker
|
||||
addons={addonsCatalog}
|
||||
scope={warning.scope as 'photos' | 'guests' | 'gallery'}
|
||||
onCheckout={(key) => { void handleAddonPurchase(warning.scope as 'photos' | 'guests' | 'gallery', key); }}
|
||||
busy={addonBusyId === warning.scope}
|
||||
t={(key, fallback) => t(key, fallback)}
|
||||
/>
|
||||
) : null}
|
||||
</>
|
||||
) : null}
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
onClick={() => dismissWarning(warning.id)}
|
||||
className="justify-start text-slate-600 hover:text-slate-900"
|
||||
>
|
||||
{tCommon('actions.dismiss', 'Hinweis ausblenden')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
</Alert>
|
||||
))}
|
||||
@@ -408,12 +463,11 @@ const shownWarningToasts = React.useRef<Set<string>>(new Set());
|
||||
navigate={navigate}
|
||||
/>
|
||||
|
||||
<Tabs defaultValue="overview" className="space-y-6">
|
||||
<TabsList className="grid gap-2 rounded-2xl bg-slate-100/80 p-1 dark:bg-white/5 sm:grid-cols-4">
|
||||
<TabsTrigger value="overview">{tabLabels.overview}</TabsTrigger>
|
||||
<TabsTrigger value="live">{tabLabels.live}</TabsTrigger>
|
||||
<TabsTrigger value="setup">{tabLabels.setup}</TabsTrigger>
|
||||
<TabsTrigger value="recap">{tabLabels.recap}</TabsTrigger>
|
||||
<Tabs defaultValue={isRecapRoute ? 'recap' : 'overview'} className="space-y-6">
|
||||
<TabsList className="grid gap-2 rounded-2xl bg-slate-100/80 p-1 dark:bg-white/5 sm:grid-cols-3">
|
||||
<TabsTrigger value="overview">{t('events.workspace.tabs.overview', 'Überblick')}</TabsTrigger>
|
||||
<TabsTrigger value="setup">{t('events.workspace.tabs.setup', 'Vorbereitung')}</TabsTrigger>
|
||||
<TabsTrigger value="recap">{t('events.workspace.tabs.recap', 'Nachbereitung')}</TabsTrigger>
|
||||
</TabsList>
|
||||
|
||||
<TabsContent value="overview" className="space-y-6">
|
||||
@@ -424,31 +478,6 @@ const shownWarningToasts = React.useRef<Set<string>>(new Set());
|
||||
<MetricsGrid metrics={toolkitData?.metrics} stats={stats} />
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="live" className="space-y-6">
|
||||
{(toolkitData?.alerts?.length ?? 0) > 0 && <AlertList alerts={toolkitData?.alerts ?? []} />}
|
||||
|
||||
<SectionCard className="space-y-6">
|
||||
<SectionHeader
|
||||
eyebrow={t('events.notifications.badge', 'Gästefeeds')}
|
||||
title={t('events.notifications.panelTitle', 'Nachrichten an Gäste')}
|
||||
description={t('events.notifications.panelDescription', 'Verschicke kurze Hinweise oder Hilfe an die Gästepwa. Links werden direkt im Notification-Center angezeigt.')}
|
||||
/>
|
||||
<div className="grid gap-6 lg:grid-cols-[minmax(0,1.1fr)_minmax(0,0.9fr)]">
|
||||
<GuestNotificationStatsCard notifications={toolkitData?.notifications} />
|
||||
<GuestBroadcastCard eventSlug={event.slug} eventName={eventName} />
|
||||
</div>
|
||||
</SectionCard>
|
||||
|
||||
<div className="grid gap-6 xl:grid-cols-[minmax(0,1.4fr)_minmax(0,0.8fr)]">
|
||||
<PendingPhotosCard
|
||||
slug={event.slug}
|
||||
photos={toolkitData?.photos.pending ?? []}
|
||||
navigateToModeration={() => navigate(ADMIN_EVENT_PHOTOS_PATH(event.slug))}
|
||||
/>
|
||||
<RecentUploadsCard slug={event.slug} photos={toolkitData?.photos.recent ?? []} />
|
||||
</div>
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="setup" className="space-y-6">
|
||||
<div className="grid gap-6 xl:grid-cols-[minmax(0,1.4fr)_minmax(0,0.8fr)]">
|
||||
<TaskOverviewCard tasks={toolkitData?.tasks} navigateToTasks={() => navigate(ADMIN_EVENT_TASKS_PATH(event.slug))} />
|
||||
@@ -480,7 +509,13 @@ const shownWarningToasts = React.useRef<Set<string>>(new Set());
|
||||
</TabsContent>
|
||||
|
||||
<TabsContent value="recap" className="space-y-6">
|
||||
<GalleryShareCard invites={toolkitData?.invites} onManageInvites={() => navigate(`${ADMIN_EVENT_INVITES_PATH(event.slug)}?tab=layout`)} />
|
||||
<GalleryShareCard
|
||||
invites={toolkitData?.invites}
|
||||
onManageInvites={() => navigate(`${ADMIN_EVENT_INVITES_PATH(event.slug)}?tab=layout`)}
|
||||
/>
|
||||
{event.limits?.gallery ? (
|
||||
<GalleryStatusCard gallery={event.limits.gallery} />
|
||||
) : null}
|
||||
<FeedbackCard slug={event.slug} />
|
||||
</TabsContent>
|
||||
</Tabs>
|
||||
@@ -1033,6 +1068,59 @@ function GalleryShareCard({
|
||||
);
|
||||
}
|
||||
|
||||
function GalleryStatusCard({ gallery }: { gallery: GallerySummary }) {
|
||||
const { t } = useTranslation('management');
|
||||
|
||||
const stateLabel =
|
||||
gallery.state === 'expired'
|
||||
? t('events.galleryStatus.stateExpired', 'Galerie abgelaufen')
|
||||
: gallery.state === 'warning'
|
||||
? t('events.galleryStatus.stateWarning', 'Galerie läuft bald ab')
|
||||
: t('events.galleryStatus.stateOk', 'Galerie aktiv');
|
||||
|
||||
const expiresLabel =
|
||||
gallery.expires_at && gallery.state !== 'unlimited'
|
||||
? formatDate(gallery.expires_at)
|
||||
: t('events.galleryStatus.noExpiry', 'Kein Ablaufdatum gesetzt');
|
||||
|
||||
const daysRemaining =
|
||||
typeof gallery.days_remaining === 'number' && gallery.days_remaining >= 0
|
||||
? gallery.days_remaining
|
||||
: null;
|
||||
|
||||
return (
|
||||
<SectionCard className="space-y-3">
|
||||
<SectionHeader
|
||||
eyebrow={t('events.galleryStatus.badge', 'Laufzeit')}
|
||||
title={t('events.galleryStatus.title', 'Galerie-Laufzeit & Verfügbarkeit')}
|
||||
description={t('events.galleryStatus.subtitle', 'Halte im Blick, wie lange Gäste noch auf die Galerie zugreifen können.')}
|
||||
/>
|
||||
<div className="flex flex-col gap-3 rounded-2xl border border-slate-200 bg-white/90 p-4 text-sm text-slate-700 dark:border-white/10 dark:bg-white/5 dark:text-slate-200 md:flex-row md:items-center md:justify-between">
|
||||
<div className="space-y-1">
|
||||
<p className="text-xs uppercase tracking-[0.3em] text-slate-500 dark:text-slate-400">
|
||||
{t('events.galleryStatus.stateLabel', 'Status')}
|
||||
</p>
|
||||
<p className="text-sm font-semibold text-slate-900 dark:text-white">{stateLabel}</p>
|
||||
<p className="text-xs text-slate-600 dark:text-slate-300">
|
||||
{t('events.galleryStatus.expiresAt', {
|
||||
defaultValue: 'Ablaufdatum: {{date}}',
|
||||
date: expiresLabel,
|
||||
})}
|
||||
</p>
|
||||
</div>
|
||||
<div className="space-y-1">
|
||||
<p className="text-xs uppercase tracking-[0.3em] text-slate-500 dark:text-slate-400">
|
||||
{t('events.galleryStatus.daysLabel', 'Verbleibende Tage')}
|
||||
</p>
|
||||
<p className="text-2xl font-semibold text-slate-900 dark:text-white">
|
||||
{daysRemaining !== null ? daysRemaining : '—'}
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</SectionCard>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function extractBrandingPalette(
|
||||
settings: TenantEvent['settings'],
|
||||
@@ -1068,133 +1156,7 @@ function extractBrandingPalette(
|
||||
return { colors, font };
|
||||
}
|
||||
|
||||
function PendingPhotosCard({
|
||||
slug,
|
||||
photos,
|
||||
navigateToModeration,
|
||||
}: {
|
||||
slug: string;
|
||||
photos: TenantPhoto[];
|
||||
navigateToModeration: () => void;
|
||||
}) {
|
||||
const { t } = useTranslation('management');
|
||||
const [entries, setEntries] = React.useState(photos);
|
||||
const [updatingId, setUpdatingId] = React.useState<number | null>(null);
|
||||
|
||||
React.useEffect(() => {
|
||||
setEntries(photos);
|
||||
}, [photos]);
|
||||
|
||||
const handleVisibility = async (photo: TenantPhoto, visible: boolean) => {
|
||||
setUpdatingId(photo.id);
|
||||
try {
|
||||
const updated = await updatePhotoVisibility(slug, photo.id, visible);
|
||||
setEntries((prev) => prev.map((item) => (item.id === photo.id ? updated : item)));
|
||||
toast.success(
|
||||
visible
|
||||
? t('events.photos.toastVisible', 'Foto wieder sichtbar gemacht.')
|
||||
: t('events.photos.toastHidden', 'Foto ausgeblendet.'),
|
||||
);
|
||||
} catch (err) {
|
||||
toast.error(
|
||||
isAuthError(err)
|
||||
? t('events.photos.errorAuth', 'Session abgelaufen. Bitte erneut anmelden.')
|
||||
: t('events.photos.errorVisibility', 'Sichtbarkeit konnte nicht geändert werden.'),
|
||||
);
|
||||
} finally {
|
||||
setUpdatingId(null);
|
||||
}
|
||||
};
|
||||
|
||||
const handleFeature = async (photo: TenantPhoto, feature: boolean) => {
|
||||
setUpdatingId(photo.id);
|
||||
try {
|
||||
const updated = feature ? await featurePhoto(slug, photo.id) : await unfeaturePhoto(slug, photo.id);
|
||||
setEntries((prev) => prev.map((item) => (item.id === photo.id ? updated : item)));
|
||||
toast.success(
|
||||
feature
|
||||
? t('events.photos.toastFeatured', 'Foto als Highlight markiert.')
|
||||
: t('events.photos.toastUnfeatured', 'Highlight entfernt.'),
|
||||
);
|
||||
} catch (err) {
|
||||
toast.error(getApiErrorMessage(err, t('events.photos.errorFeature', 'Aktion fehlgeschlagen.')));
|
||||
} finally {
|
||||
setUpdatingId(null);
|
||||
}
|
||||
};
|
||||
|
||||
return (
|
||||
<SectionCard className="space-y-3">
|
||||
<SectionHeader
|
||||
eyebrow={t('events.photos.pendingBadge', 'Moderation')}
|
||||
title={t('events.photos.pendingTitle', 'Fotos in Moderation')}
|
||||
description={t('events.photos.pendingSubtitle', 'Schnell prüfen, bevor Gäste live gehen.')}
|
||||
endSlot={(
|
||||
<Badge variant="outline" className="border-emerald-200 text-emerald-600 dark:border-emerald-500/30 dark:text-emerald-200">
|
||||
{t('events.photos.pendingCount', { defaultValue: '{{count}} Fotos offen', count: entries.length })}
|
||||
</Badge>
|
||||
)}
|
||||
/>
|
||||
<div className="space-y-3 text-sm text-slate-700 dark:text-slate-300">
|
||||
{entries.length ? (
|
||||
<div className="grid gap-3 sm:grid-cols-2">
|
||||
{entries.slice(0, 4).map((photo) => {
|
||||
const hidden = photo.status === 'hidden';
|
||||
return (
|
||||
<div key={photo.id} className="rounded-xl border border-slate-200 bg-white/90 p-2">
|
||||
<div className="relative overflow-hidden rounded-lg">
|
||||
<img
|
||||
src={photo.thumbnail_url ?? photo.url ?? undefined}
|
||||
alt={photo.caption ?? 'Foto'}
|
||||
className={`h-32 w-full object-cover ${hidden ? 'opacity-60' : ''}`}
|
||||
/>
|
||||
{photo.is_featured ? (
|
||||
<span className="absolute left-2 top-2 rounded-full bg-pink-500/90 px-2 py-0.5 text-[10px] font-semibold text-white">
|
||||
Highlight
|
||||
</span>
|
||||
) : null}
|
||||
</div>
|
||||
<div className="mt-2 flex flex-wrap gap-2 text-[11px] text-slate-500">
|
||||
<Badge variant="outline">{photo.uploader_name ?? 'Gast'}</Badge>
|
||||
<Badge variant="outline">♥ {photo.likes_count}</Badge>
|
||||
</div>
|
||||
<div className="mt-2 flex flex-wrap gap-2 text-xs">
|
||||
<Button
|
||||
size="sm"
|
||||
variant="outline"
|
||||
disabled={updatingId === photo.id}
|
||||
onClick={() => handleVisibility(photo, hidden)}
|
||||
>
|
||||
{hidden
|
||||
? t('events.photos.show', 'Einblenden')
|
||||
: t('events.photos.hide', 'Verstecken')}
|
||||
</Button>
|
||||
<Button
|
||||
size="sm"
|
||||
variant={photo.is_featured ? 'secondary' : 'outline'}
|
||||
disabled={updatingId === photo.id}
|
||||
onClick={() => handleFeature(photo, !photo.is_featured)}
|
||||
>
|
||||
{photo.is_featured
|
||||
? t('events.photos.unfeature', 'Highlight entfernen')
|
||||
: t('events.photos.feature', 'Als Highlight markieren')}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
) : (
|
||||
<p className="text-xs text-slate-500">{t('events.photos.pendingEmpty', 'Aktuell warten keine Fotos auf Freigabe.')}</p>
|
||||
)}
|
||||
|
||||
<Button variant="outline" onClick={navigateToModeration} className="border-emerald-200 text-emerald-600 hover:bg-emerald-50">
|
||||
<Camera className="mr-2 h-4 w-4" /> {t('events.photos.openModeration', 'Moderation öffnen')}
|
||||
</Button>
|
||||
</div>
|
||||
</SectionCard>
|
||||
);
|
||||
}
|
||||
// Pending photos summary moved to the dedicated Live/Photos view.
|
||||
|
||||
function RecentUploadsCard({ slug, photos }: { slug: string; photos: TenantPhoto[] }) {
|
||||
const { t } = useTranslation('management');
|
||||
|
||||
@@ -1205,9 +1205,6 @@ export default function EventInvitesPage(): React.ReactElement {
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
{t('invites.export.actions.hint', 'PDF enthält Beschnittmarken, PNG ist für schnelle digitale Freigaben geeignet.')}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
@@ -1499,10 +1496,6 @@ function InviteShareSummaryCard({ invite, onCopy, onCreate, onOpenLayout, onOpen
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<p className="text-xs text-muted-foreground">
|
||||
<Mail className="mr-1 inline h-3.5 w-3.5 text-primary" />
|
||||
{t('invites.share.hint', 'Teile den Link direkt im Team oder binde ihn im Newsletter ein.')}
|
||||
</p>
|
||||
</CardContent>
|
||||
</Card>
|
||||
);
|
||||
|
||||
@@ -278,18 +278,6 @@ export default function EventPhotosPage() {
|
||||
|
||||
<LimitWarningsBanner limits={limits} translate={translateLimits} eventSlug={slug} addons={addons} />
|
||||
|
||||
{eventAddons.length > 0 && (
|
||||
<Card className="mb-6 border-0 bg-white/85 shadow-lg shadow-slate-100/50">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base font-semibold text-slate-900">{t('events.sections.addons.title', 'Add-ons & Upgrades')}</CardTitle>
|
||||
<CardDescription>{t('events.sections.addons.description', 'Zusätzliche Kontingente für dieses Event.')}</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<AddonSummaryList addons={eventAddons} t={(key, fallback) => t(key, fallback)} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
|
||||
<Card className="border-0 bg-white/85 shadow-xl shadow-sky-100/60">
|
||||
<CardHeader className="flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between">
|
||||
<div>
|
||||
@@ -351,6 +339,22 @@ export default function EventPhotosPage() {
|
||||
)}
|
||||
</CardContent>
|
||||
</Card>
|
||||
|
||||
{eventAddons.length > 0 && (
|
||||
<Card className="mt-6 border-0 bg-white/85 shadow-lg shadow-slate-100/50">
|
||||
<CardHeader>
|
||||
<CardTitle className="text-base font-semibold text-slate-900">
|
||||
{t('events.sections.addons.title', 'Add-ons & Upgrades')}
|
||||
</CardTitle>
|
||||
<CardDescription>
|
||||
{t('events.sections.addons.description', 'Zusätzliche Kontingente für dieses Event.')}
|
||||
</CardDescription>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<AddonSummaryList addons={eventAddons} t={(key, fallback) => t(key, fallback)} />
|
||||
</CardContent>
|
||||
</Card>
|
||||
)}
|
||||
</AdminLayout>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -259,7 +259,10 @@ export default function EventTasksPage() {
|
||||
}
|
||||
}, [event, hydrateTasks, slug, t]);
|
||||
|
||||
const isPhotoOnlyMode = event?.engagement_mode === 'photo_only';
|
||||
const isPhotoOnlyMode = React.useMemo(() => {
|
||||
const mode = event?.engagement_mode ?? (event?.settings as any)?.engagement_mode;
|
||||
return mode === 'photo_only';
|
||||
}, [event?.engagement_mode, event?.settings]);
|
||||
|
||||
async function handleModeChange(checked: boolean) {
|
||||
if (!event || !slug) return;
|
||||
@@ -271,10 +274,20 @@ export default function EventTasksPage() {
|
||||
const nextMode = checked ? 'photo_only' : 'tasks';
|
||||
const updated = await updateEvent(slug, {
|
||||
settings: {
|
||||
...(event.settings ?? {}),
|
||||
engagement_mode: nextMode,
|
||||
},
|
||||
});
|
||||
setEvent(updated);
|
||||
setEvent((prev) => ({
|
||||
...(prev ?? updated),
|
||||
...(updated ?? {}),
|
||||
engagement_mode: updated?.engagement_mode ?? nextMode,
|
||||
settings: {
|
||||
...(prev?.settings ?? {}),
|
||||
...(updated?.settings ?? {}),
|
||||
engagement_mode: nextMode,
|
||||
},
|
||||
}));
|
||||
} catch (err) {
|
||||
if (!isAuthError(err)) {
|
||||
setError(
|
||||
@@ -297,8 +310,8 @@ export default function EventTasksPage() {
|
||||
|
||||
return (
|
||||
<AdminLayout
|
||||
title={t('management.tasks.title', 'Event-Tasks')}
|
||||
subtitle={t('management.tasks.subtitle', 'Verwalte Aufgaben, die diesem Event zugeordnet sind.')}
|
||||
title={t('management.tasks.title', 'Aufgaben & Missionen')}
|
||||
subtitle={t('management.tasks.subtitle', 'Stelle Mission Cards und Aufgaben für dieses Event zusammen.')}
|
||||
actions={actions}
|
||||
tabs={eventTabs}
|
||||
currentTabKey="tasks"
|
||||
@@ -387,6 +400,30 @@ export default function EventTasksPage() {
|
||||
</div>
|
||||
</div>
|
||||
</CardHeader>
|
||||
<CardContent className="pb-0">
|
||||
<Alert variant="default" className="rounded-2xl border border-dashed border-emerald-200 bg-emerald-50/60 text-xs text-slate-700">
|
||||
<AlertTitle className="text-sm font-semibold text-slate-900">
|
||||
{t('management.tasks.library.hintTitle', 'Weitere Vorlagen in der Aufgaben-Bibliothek')}
|
||||
</AlertTitle>
|
||||
<AlertDescription className="mt-1 flex flex-wrap items-center gap-2">
|
||||
<span>
|
||||
{t(
|
||||
'management.tasks.library.hintCopy',
|
||||
'Lege eigene Aufgaben, Emotionen oder Mission Packs zentral an und nutze sie in mehreren Events.',
|
||||
)}
|
||||
</span>
|
||||
<Button
|
||||
type="button"
|
||||
variant="outline"
|
||||
size="sm"
|
||||
className="mt-1 rounded-full border-emerald-300 text-emerald-700 hover:bg-emerald-100"
|
||||
onClick={() => navigate(buildEngagementTabPath('tasks'))}
|
||||
>
|
||||
{t('management.tasks.library.open', 'Aufgaben-Bibliothek öffnen')}
|
||||
</Button>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
</CardContent>
|
||||
<CardContent className="grid gap-4 lg:grid-cols-2">
|
||||
<section className="space-y-3">
|
||||
<div className="flex flex-wrap items-center justify-between gap-2">
|
||||
|
||||
37
resources/js/admin/pages/LiveRedirectPage.tsx
Normal file
37
resources/js/admin/pages/LiveRedirectPage.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
// @ts-nocheck
|
||||
import React from 'react';
|
||||
import { useNavigate } from 'react-router-dom';
|
||||
import { useEventContext } from '../context/EventContext';
|
||||
import { ADMIN_EVENTS_PATH, ADMIN_EVENT_PHOTOS_PATH } from '../constants';
|
||||
|
||||
export default function LiveRedirectPage(): React.ReactElement {
|
||||
const navigate = useNavigate();
|
||||
const { activeEvent, events, isLoading, refetch } = useEventContext();
|
||||
|
||||
React.useEffect(() => {
|
||||
if (!isLoading && !events.length) {
|
||||
void refetch();
|
||||
}
|
||||
}, [isLoading, events.length, refetch]);
|
||||
|
||||
React.useEffect(() => {
|
||||
if (isLoading) {
|
||||
return;
|
||||
}
|
||||
const targetEvent = activeEvent ?? events[0] ?? null;
|
||||
if (targetEvent) {
|
||||
navigate(ADMIN_EVENT_PHOTOS_PATH(targetEvent.slug), { replace: true });
|
||||
} else {
|
||||
navigate(ADMIN_EVENTS_PATH, { replace: true });
|
||||
}
|
||||
}, [isLoading, activeEvent, events, navigate]);
|
||||
|
||||
if (isLoading) {
|
||||
return (
|
||||
<div className="flex min-h-screen items-center justify-center text-sm text-muted-foreground">
|
||||
Lade Events ...
|
||||
</div>
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
Reference in New Issue
Block a user