import { useCallback, useState } from "react"; import { Checkbox, Label, Link } from "@methanium/ui"; import { legalDocsSchema } from "@tensamin/shared/features/legal/schema"; import type { z } from "zod"; import { useOnboardingStep } from "@methanium/ui"; export default function LegalPage({ docs, initiallyAcceptedPP, initiallyAcceptedTOS, onAccept, }: { docs: z.infer; initiallyAcceptedPP: boolean; initiallyAcceptedTOS: boolean; onAccept: () => Promise; }) { const [acceptedPP, setAcceptedPP] = useState(initiallyAcceptedPP); const [acceptedTOS, setAcceptedTOS] = useState(initiallyAcceptedTOS); const handleContinue = useCallback(async () => { if (!acceptedPP || !acceptedTOS) return false; await onAccept(); }, [acceptedPP, acceptedTOS, onAccept]); useOnboardingStep({ canContinue: acceptedPP && acceptedTOS, onContinue: handleContinue, }); return (
); } function BigCheckbox({ id, label, checked, onChange, }: { id: string; label: string; checked: boolean; onChange: (checked: boolean) => void; }) { return (
); }