feat(mobile): implement event switcher sheet in header
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

- Replaced direct navigation with a bottom sheet for event switching
- Created reusable EventSwitcherSheet component
- Preserves context when switching events
This commit is contained in:
Codex Agent
2026-01-17 19:17:19 +01:00
parent 9d7990fe71
commit 45f0cea264
2 changed files with 97 additions and 2 deletions

View File

@@ -21,6 +21,7 @@ import { loadPhotoQueue } from '../lib/photoModerationQueue';
import { countQueuedPhotoActions } from '../lib/queueStatus';
import { useAdminTheme } from '../theme';
import { useAuth } from '../../auth/context';
import { EventSwitcherSheet } from './EventSwitcherSheet';
type MobileShellProps = {
title?: string;
@@ -55,6 +56,7 @@ export function MobileShell({ title, subtitle, children, activeTab, onBack, head
const [loadingEvents, setLoadingEvents] = React.useState(false);
const [attemptedFetch, setAttemptedFetch] = React.useState(false);
const [queuedPhotoCount, setQueuedPhotoCount] = React.useState(0);
const [switcherOpen, setSwitcherOpen] = React.useState(false);
const effectiveEvents = events.length ? events : fallbackEvents;
const effectiveActive = activeEvent ?? (effectiveEvents.length === 1 ? effectiveEvents[0] : null);
@@ -136,7 +138,7 @@ export function MobileShell({ title, subtitle, children, activeTab, onBack, head
}
return (
<Pressable onPress={() => navigate(ADMIN_EVENTS_PATH)}>
<Pressable onPress={() => setSwitcherOpen(true)}>
<XStack
backgroundColor="rgba(255, 255, 255, 0.12)"
paddingHorizontal="$3"
@@ -334,6 +336,13 @@ export function MobileShell({ title, subtitle, children, activeTab, onBack, head
</YStack>
<BottomNav active={activeTab} onNavigate={go} />
<EventSwitcherSheet
open={switcherOpen}
onClose={() => setSwitcherOpen(false)}
events={effectiveEvents}
activeSlug={effectiveActive?.slug ?? null}
/>
</YStack>
);
}
@@ -364,4 +373,4 @@ export function HeaderActionButton({
{children}
</Pressable>
);
}
}