From fba9714ede18aeb9e8a7f25edc5afa3acedfc2ca Mon Sep 17 00:00:00 2001 From: Codex Agent Date: Thu, 22 Jan 2026 19:48:22 +0100 Subject: [PATCH] Switch tasks quick nav to tabs --- resources/js/admin/mobile/EventTasksPage.tsx | 119 ++++++++---------- .../mobile/__tests__/EventTasksPage.test.tsx | 7 +- 2 files changed, 55 insertions(+), 71 deletions(-) diff --git a/resources/js/admin/mobile/EventTasksPage.tsx b/resources/js/admin/mobile/EventTasksPage.tsx index cfcbd49..7332a0b 100644 --- a/resources/js/admin/mobile/EventTasksPage.tsx +++ b/resources/js/admin/mobile/EventTasksPage.tsx @@ -11,9 +11,9 @@ import { Pressable } from '@tamagui/react-native-web-lite'; import { Button } from '@tamagui/button'; import { AlertDialog } from '@tamagui/alert-dialog'; import { ScrollView } from '@tamagui/scroll-view'; -import { ToggleGroup } from '@tamagui/toggle-group'; import { Switch } from '@tamagui/switch'; import { Checkbox } from '@tamagui/checkbox'; +import { Tabs } from 'tamagui'; import { MobileShell, HeaderActionButton } from './components/MobileShell'; import { MobileCard, CTAButton, SkeletonCard, FloatingActionButton, PillBadge } from './components/Primitives'; import { MobileField, MobileInput, MobileSelect, MobileTextArea } from './components/FormControls'; @@ -65,55 +65,6 @@ function allowPermission(permissions: string[], permission: string): boolean { return false; } -function QuickNavChip({ - value, - label, - count, - onPress, - isActive = false, -}: { - value: TaskSectionKey; - label: string; - count: number; - onPress: () => void; - isActive?: boolean; -}) { - const { textStrong, border, surface, surfaceMuted, primary } = useAdminTheme(); - const activeBorder = withAlpha(primary, 0.45); - const activeBackground = withAlpha(primary, 0.16); - return ( - - - - {label} - - - - {count} - - - - - ); -} - export default function MobileEventTasksPage() { const { slug: slugParam } = useParams<{ slug?: string }>(); const { activeEvent, selectEvent } = useEventContext(); @@ -258,6 +209,12 @@ export default function MobileEventTasksPage() { setShowEmotionSheet(true); }; + const handleQuickNavPress = (key: TaskSectionKey) => { + if (quickNavSelection === key) { + handleQuickNav(key); + } + }; + const load = React.useCallback(async () => { if (!slug) { try { @@ -1093,8 +1050,7 @@ export default function MobileEventTasksPage() { - { const key = next as TaskSectionKey | ''; @@ -1104,23 +1060,50 @@ export default function MobileEventTasksPage() { setQuickNavSelection(key); handleQuickNav(key); }} + orientation="horizontal" > - - {sectionCounts.map((section) => ( - { - setQuickNavSelection(section.key); - handleQuickNav(section.key); - }} - isActive={quickNavSelection === section.key} - /> - ))} - - + + {sectionCounts.map((section) => { + const isActive = quickNavSelection === section.key; + const activeBorder = withAlpha(primary, 0.45); + const activeBackground = withAlpha(primary, 0.16); + return ( + handleQuickNavPress(section.key)} + borderRadius={999} + borderWidth={1} + borderColor={isActive ? activeBorder : border} + backgroundColor={isActive ? activeBackground : surface} + paddingHorizontal="$3" + paddingVertical="$2" + height={36} + pressStyle={{ backgroundColor: isActive ? activeBackground : surfaceMuted }} + > + + + {t(`events.tasks.sections.${section.key}`, section.key)} + + + + {section.count} + + + + + ); + })} + + diff --git a/resources/js/admin/mobile/__tests__/EventTasksPage.test.tsx b/resources/js/admin/mobile/__tests__/EventTasksPage.test.tsx index 84dfa99..c550747 100644 --- a/resources/js/admin/mobile/__tests__/EventTasksPage.test.tsx +++ b/resources/js/admin/mobile/__tests__/EventTasksPage.test.tsx @@ -108,9 +108,10 @@ vi.mock('@tamagui/scroll-view', () => ({ ScrollView: ({ children }: { children: React.ReactNode }) =>
{children}
, })); -vi.mock('@tamagui/toggle-group', () => ({ - ToggleGroup: Object.assign(({ children }: { children: React.ReactNode }) =>
{children}
, { - Item: ({ children }: { children: React.ReactNode }) =>
{children}
, +vi.mock('tamagui', () => ({ + Tabs: Object.assign(({ children }: { children: React.ReactNode }) =>
{children}
, { + List: ({ children }: { children: React.ReactNode }) =>
{children}
, + Tab: ({ children }: { children: React.ReactNode }) => , }), }));