Handle no-tasks mode in guest v2
Some checks failed
linter / quality (push) Has been cancelled
tests / ci (push) Has been cancelled
tests / ui (push) Has been cancelled

This commit is contained in:
Codex Agent
2026-02-05 18:12:29 +01:00
parent 5f75c7ca6a
commit ba56cb4e61
7 changed files with 76 additions and 10 deletions

View File

@@ -35,7 +35,7 @@ function getTaskList(task: TaskItem, key: string): string[] {
}
export default function TaskDetailScreen() {
const { token } = useEventData();
const { token, tasksEnabled } = useEventData();
const { taskId } = useParams<{ taskId: string }>();
const { t, locale } = useTranslation();
const navigate = useNavigate();
@@ -45,6 +45,37 @@ export default function TaskDetailScreen() {
const [loading, setLoading] = React.useState(true);
const [error, setError] = React.useState<string | null>(null);
if (!tasksEnabled) {
return (
<AppShell>
<YStack gap="$4">
<SurfaceCard>
<Text fontSize="$4" fontWeight="$7">
{t('tasks.disabled.title', 'Tasks are disabled')}
</Text>
<Text fontSize="$2" color={mutedText} marginTop="$2">
{t('tasks.disabled.subtitle', 'This event is set to photo-only mode.')}
</Text>
<Button
size="$4"
borderRadius="$pill"
backgroundColor="$primary"
marginTop="$4"
onPress={() => navigate(buildEventPath(token, '/upload'))}
>
<XStack alignItems="center" justifyContent="center" gap="$2" width="100%">
<Camera size={18} color="white" />
<Text fontSize="$3" fontWeight="$7" color="white">
{t('homeV2.captureReady.cta', 'Upload / Take photo')}
</Text>
</XStack>
</Button>
</SurfaceCard>
</YStack>
</AppShell>
);
}
React.useEffect(() => {
let active = true;
if (!token || !taskId) {