Handle no-tasks mode in guest v2
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user