(wip): add onboarding
All checks were successful
/ build-web (push) Successful in 7m19s
/ build-desktop (linux) (push) Successful in 11m52s
/ build-mobile (push) Successful in 18m26s
/ release (push) Successful in 2m59s

(fix): login page reloading
This commit is contained in:
Alois 2026-07-24 12:18:05 +02:00
commit bf8f449f03
Signed by: alois
SSH key fingerprint: SHA256:GBzT2DXvAuGV9XIV5W3WrzVpjU54FThmxHXdbz95J24
19 changed files with 461 additions and 439 deletions

View file

@ -0,0 +1,98 @@
import { useCallback, useState } from "react";
import { Checkbox, Label, Link } from "@tensamin/ui";
import { legalDocsSchema } from "@tensamin/shared/features/legal/schema";
import type { z } from "zod";
import { useOnboardingStep } from "@tensamin/ui";
type LegalDocs = z.infer<typeof legalDocsSchema>;
export default function LegalPage({
docs,
initiallyAcceptedPP,
initiallyAcceptedTOS,
onAccept,
}: {
docs: LegalDocs;
initiallyAcceptedPP: boolean;
initiallyAcceptedTOS: boolean;
onAccept: () => Promise<void>;
}) {
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 (
<div className="mx-auto flex h-full w-full max-w-5xl flex-col gap-10 p-10 py-20 md:p-24">
<div>
<h1 className="text-3xl font-bold md:text-4xl" tabIndex={-1}>
Privacy Policy &amp; ToS
</h1>
<p className="pt-3 text-xl text-muted-foreground">
{docs.pp.version} / {docs.tos.version}
</p>
</div>
<div className="flex flex-1 items-center justify-center">
<div className="flex flex-col items-start gap-2">
<BigCheckbox
id="acceptPP"
checked={acceptedPP}
onChange={setAcceptedPP}
label="I agree to the Privacy Policy"
/>
<BigCheckbox
id="acceptTOS"
checked={acceptedTOS}
onChange={setAcceptedTOS}
label="I agree to the Terms of Service"
/>
<div className="w-full border-t-2" />
<Link
label="Privacy Policy"
link={`https://legal.tensamin.net/pp/${docs.pp.version}`}
/>
<Link
label="Terms of Service"
link={`https://legal.tensamin.net/tos/${docs.tos.version}`}
/>
</div>
</div>
</div>
);
}
function BigCheckbox({
id,
label,
checked,
onChange,
}: {
id: string;
label: string;
checked: boolean;
onChange: (checked: boolean) => void;
}) {
return (
<div className="flex items-center space-x-2">
<Checkbox
id={id}
checked={checked}
onCheckedChange={onChange}
className="flex size-5.5 items-center justify-center rounded-md"
/>
<Label htmlFor={id} className="text-lg">
{label}
</Label>
</div>
);
}

View file

@ -0,0 +1,9 @@
export default function OnboardingPage() {
return (
<div className="flex h-full items-center justify-center p-8">
<h1 className="text-3xl font-bold" tabIndex={-1}>
Onboarding
</h1>
</div>
);
}