Das Abschalten des Aufgaben-Modus wird nun sauber in der App reflektiert- die UI passt sich an und der Admin erhält einen Hinweis, dass die Aufgabenverwaltung nicht verfügbar ist
This commit is contained in:
@@ -15,6 +15,7 @@ import type { EventBranding } from './types/event-branding';
|
||||
import type { EventBrandingPayload, FetchEventErrorCode } from './services/eventApi';
|
||||
import { NotificationCenterProvider } from './context/NotificationCenterContext';
|
||||
import RouteErrorElement from '@/components/RouteErrorElement';
|
||||
import { isTaskModeEnabled } from './lib/engagement';
|
||||
|
||||
const LandingPage = React.lazy(() => import('./pages/LandingPage'));
|
||||
const ProfileSetupPage = React.lazy(() => import('./pages/ProfileSetupPage'));
|
||||
@@ -75,8 +76,8 @@ export const router = createBrowserRouter([
|
||||
errorElement: <RouteErrorElement />,
|
||||
children: [
|
||||
{ index: true, element: <HomePage /> },
|
||||
{ path: 'tasks', element: <TaskPickerPage /> },
|
||||
{ path: 'tasks/:taskId', element: <TaskDetailPage /> },
|
||||
{ path: 'tasks', element: <TaskGuard><TaskPickerPage /></TaskGuard> },
|
||||
{ path: 'tasks/:taskId', element: <TaskGuard><TaskDetailPage /></TaskGuard> },
|
||||
{ path: 'upload', element: <UploadPage /> },
|
||||
{ path: 'queue', element: <UploadQueuePage /> },
|
||||
{ path: 'gallery', element: <GalleryPage /> },
|
||||
@@ -133,6 +134,21 @@ function EventBoundary({ token }: { token: string }) {
|
||||
);
|
||||
}
|
||||
|
||||
function TaskGuard({ children }: { children: React.ReactNode }) {
|
||||
const { token } = useParams<{ token: string }>();
|
||||
const { event, status } = useEventData();
|
||||
|
||||
if (status === 'loading') {
|
||||
return <EventLoadingView />;
|
||||
}
|
||||
|
||||
if (event && !isTaskModeEnabled(event)) {
|
||||
return <Navigate to={`/e/${encodeURIComponent(token ?? '')}`} replace />;
|
||||
}
|
||||
|
||||
return <>{children}</>;
|
||||
}
|
||||
|
||||
function SetupLayout() {
|
||||
const { token } = useParams<{ token: string }>();
|
||||
const { event } = useEventData();
|
||||
|
||||
Reference in New Issue
Block a user