chore: merge web repo history into monorepo at web/
git-subtree-dir: web git-subtree-mainline:75a0ba593dgit-subtree-split:8f624e7416
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
"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>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user