Files
chat_room/web/src/app/onboarding/done/page.tsx
T
mobiniqow cba4bc30da chore: merge web repo history into monorepo at web/
git-subtree-dir: web
git-subtree-mainline: 75a0ba593d
git-subtree-split: 8f624e7416
2026-09-27 10:31:24 +03:30

57 lines
2.5 KiB
TypeScript
Raw Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
"use client";
import { useEffect, useState } from "react";
import { useRouter } from "next/navigation";
import { PartyPopper } from "lucide-react";
import { Button } from "@/components/ui/Button";
import { FullScreenLoader } from "@/components/ui/FullScreenLoader";
import { useAuth } from "@/lib/auth-context";
import { useRequireAuth } from "@/lib/hooks";
export default function OnboardingDonePage() {
const router = useRouter();
const { status } = useRequireAuth();
const { onboardingStatus, refreshOnboardingStatus, refreshUser } = useAuth();
const [checked, setChecked] = useState(false);
useEffect(() => {
if (status !== "authenticated") return;
(async () => {
const s = onboardingStatus ?? (await refreshOnboardingStatus());
if (!s?.is_onboarded) {
router.replace("/onboarding/basic-info");
return;
}
// user توی context از قبل onboarding ممکنه هنوز is_onboarded=false داشته باشه
// (هیچ مرحله‌ای توی خود فرآیند onboarding این رو رفرش نمی‌کنه)؛ بدون این،
// MainLayout با state قدیمی دوباره برمی‌گردونه به یکی از مراحل onboarding.
await refreshUser();
setChecked(true);
})();
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [status]);
if (status !== "authenticated" || !checked) return <FullScreenLoader />;
return (
<div className="flex-1 flex flex-col items-center justify-center text-center gap-6 px-8 min-h-dvh">
<div className="w-24 h-24 rounded-(--radius-xl) bg-(--color-brand-500) flex items-center justify-center shadow-(--shadow-cute-lg) [animation:bounce-in_0.5s_ease-out]">
<PartyPopper size={40} className="text-white" />
</div>
<div className="flex flex-col gap-2">
<h1 className="font-[var(--font-display)] font-extrabold text-[26px]">
پروفایلت کامل شد! 🎉
</h1>
<p className="text-[14px] text-(--color-content-secondary) leading-7 max-w-xs">
پروفایلت رفت برای بررسی ادمین. به‌محض تایید، خودکار می‌تونی افراد جدید رو
کشف کنی. هر وقت خواستی هم می‌تونی از پروفایلت هرکدوم از این اطلاعات رو
ویرایش کنی.
</p>
</div>
<Button size="lg" isBlock onClick={() => router.push("/home")}>
بزن بریم 🚀
</Button>
</div>
);
}