import { useEffect, useRef } from "react"; import { Trans, useTranslation } from "react-i18next"; import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query"; import { AlertTriangle, Check, Loader2, RefreshCw, ShieldCheck, X, Youtube } from "lucide-react"; import { api, type Me } from "../lib/api"; import { beginGrant, endOnboarding } from "../lib/onboarding"; // A first-login wizard that walks the user through granting YouTube access one scope at a // time, each with a plain explanation and an up-front heads-up about Google's "unverified // app" screen. Sign-in itself only asks for name/email (no warning); YouTube access is // always an explicit, informed opt-in here. // // The visible step is derived from what's already granted, so the wizard resumes correctly // after each redirect: no read -> "read", read but no write -> "write", both -> "done". // Right after read is granted, it auto-imports the user's subscriptions so they land on a // populated feed (channels already in the shared catalog appear instantly). // A small reusable heads-up so the Google consent warning never feels like a surprise. function ConsentHeadsUp() { return (
); } function Dots({ index, total }: { index: number; total: number }) { return (
{t("onboarding.importing.body")}
> )} {step === "write" && !importing && ( <>
{importSubs.isError ? (
<>{t("onboarding.write.importFailed")}>
) : (
<>
{t("onboarding.write.feedReady", {
channels: myStatus.data
? t("onboarding.write.feedReadyChannels", { count: myStatus.data.channels_total })
: "",
})}
>
)}
{!importSubs.isError && (
{t("onboarding.done.body")}
> )}