import { Suspense } from 'react'; import { useParams } from 'react-router-dom'; import { useSeoMeta } from '@unhead/react'; import { CraftProfileForm } from '@/components/CraftProfileForm'; import { getBecomeRole } from '@/lib/becomeRoles'; import { useTranslation } from '@/contexts/language'; import NotFound from '@/pages/NotFound'; /** * Single entry point for every "become a " flow (/become/:role). * * - Craft roles render the shared from their data config. * - Bespoke roles render their own lazy page component. * - Unknown roles fall through to the 404 page. * * This replaces 12 hardcoded routes + 12 component imports in the router. */ function PageLoader() { return (
); } export default function BecomeRolePage() { const { role: slug } = useParams<{ role: string }>(); const role = getBecomeRole(slug); if (!role) { return ; } if (role.kind === 'craft') { return ; } const Component = role.component; return ( }> ); } function CraftRole({ role, }: { role: Extract, { kind: 'craft' }>; }) { const { t } = useTranslation(); useSeoMeta({ title: role.seoTitleKey ? t(role.seoTitleKey) : role.seoTitle, description: role.seoDescriptionKey ? t(role.seoDescriptionKey) : role.seoDescription, }); return ; }