'use client'; import { FunctionComponent } from 'react'; import { useLocale, useTranslations } from 'next-intl'; import { useSnackbar } from 'notistack'; import { Paper, Stack, Typography } from '@mui/material'; import { AppButton, AppIcon } from '@/components'; import { ROUTES } from '@/constants'; import { useVerificationStatus } from '@/services/verification'; import { isApproved } from '@/services/verification/types'; /** * The go-live gate for the nurse's services (the f4 publish stub, wired to verification here). A nurse * is **not bookable and cannot publish until verified**: when the aggregate isn't `approved` the publish * CTA is **disabled** with a blocked-until-verified explanation that links to the B3 checklist; once * approved it enables. Mirrors the server's guarded `is_verified` flip — the UI never implies a nurse is * live before verification completes. Reads the shared `VerificationStatus` query (cached across the app). */ const PublishGate: FunctionComponent = () => { const t = useTranslations('verification'); const locale = useLocale(); const { enqueueSnackbar } = useSnackbar(); const { data: status, isLoading } = useVerificationStatus(); if (isLoading) return null; const approved = isApproved(status); return ( {approved ? t('publish_ready_title') : t('publish_blocked_title')} {approved ? t('publish_ready_body') : t('publish_blocked_body')} enqueueSnackbar(t('publish_done'), { variant: 'success' })} > {t('publish_cta')} {!approved ? ( {t('publish_complete_verification')} ) : null} ); }; export default PublishGate;