import React from 'react';
import { useNavigate } from 'react-router-dom';
import { useTranslation } from 'react-i18next';
import { useQuery } from '@tanstack/react-query';
import { CalendarDays, Sparkles, Users } from 'lucide-react';
import { YStack, XStack } from '@tamagui/stacks';
import { SizableText as Text } from '@tamagui/text';
import { OnboardingShell } from '../components/OnboardingShell';
import { MobileCard, CTAButton } from '../components/Primitives';
import { ADMIN_HOME_PATH, ADMIN_WELCOME_BASE_PATH, ADMIN_WELCOME_PACKAGES_PATH, ADMIN_WELCOME_SUMMARY_PATH, adminPath } from '../../constants';
import { getTenantPackagesOverview, trackOnboarding } from '../../api';
import { getSelectedPackageId } from '../lib/onboardingSelection';
import { ADMIN_COLORS } from '../theme';
export default function WelcomeEventPage() {
const navigate = useNavigate();
const { t } = useTranslation('onboarding');
const selectedId = getSelectedPackageId();
const { data: overview } = useQuery({
queryKey: ['mobile', 'onboarding', 'packages-overview'],
queryFn: () => getTenantPackagesOverview({ force: true }),
staleTime: 60_000,
});
const hasActivePackage =
Boolean(overview?.activePackage) || Boolean(overview?.packages?.some((pkg) => pkg.active));
const remainingEvents = overview?.activePackage?.remaining_events ?? null;
const shouldGoBilling = !hasActivePackage || (remainingEvents !== null && remainingEvents <= 0);
const handleSkip = React.useCallback(() => {
void trackOnboarding('dismissed');
navigate(ADMIN_HOME_PATH);
}, [navigate]);
const backTarget = selectedId
? ADMIN_WELCOME_SUMMARY_PATH
: hasActivePackage
? ADMIN_WELCOME_BASE_PATH
: ADMIN_WELCOME_PACKAGES_PATH;
return (
navigate(backTarget)}
onSkip={handleSkip}
skipLabel={t('layout.jumpToDashboard', 'Jump to dashboard')}
>
{t('eventSetup.step.title', 'Event setup in minutes')}
{t(
'eventSetup.step.description',
'We guide you through name, date, mood, and tasks. Afterwards you can moderate photos and support guests live.',
)}
{t('eventSetup.cta.heading', 'Ready for your first event?')}
{t(
'eventSetup.cta.description',
"You're switching to the event manager. Assign tasks, invite members, and test the gallery. You can always return to the welcome journey.",
)}
navigate(shouldGoBilling ? adminPath('/mobile/billing#packages') : adminPath('/mobile/events/new'))}
/>
navigate(ADMIN_HOME_PATH)}
/>
navigate(adminPath('/mobile/events'))}
/>
);
}
function FeatureRow({
icon: Icon,
title,
body,
}: {
icon: React.ComponentType<{ size?: number; color?: string }>;
title: string;
body: string;
}) {
return (
{title}
{body}
);
}