import { useEffect, useState } from "react"; import { Check } from "lucide-react"; import { useTranslation } from "@termix/plugin-sdk/frontend"; import { setAiOptIn } from "./ai-api"; /** * Asks once, plainly. * * "Leave it off" is preselected and applied on mount, so someone who clicks * straight through ends up without the assistant rather than with it. Both * options are described in the same flat register and neither is marked * recommended: this is a choice, not a pitch. */ export function AiAssistantStep() { const { t } = useTranslation(); const [enabled, setEnabled] = useState(false); function apply(next: boolean) { setEnabled(next); // The local choice still shows if the write fails. setAiOptIn(next).catch(() => undefined); } // Skipping the step entirely still has to mean off, not unset. useEffect(() => { apply(false); }, []); const options = [ { value: false, title: t("onboarding.aiSkipTitle"), description: t("onboarding.aiSkipDesc"), }, { value: true, title: t("onboarding.aiEnableTitle"), description: t("onboarding.aiEnableDesc"), }, ]; return (
{t("onboarding.aiIntro")}
{t("onboarding.aiNote")}