Add Photos onboarding step; let pending/rejected users re-edit freely
- New /onboarding/photos step (upload/delete grid, needs >=1 photo to continue), inserted as step 2 right after basic info. - Pending screen gets an "edit your info" entry point into the wizard; Rejected screen's edit button now goes there too instead of just the read-only profile page. - Step 1's back button now returns to /home instead of /login when the user is already onboarded (was previously always /login). - Progress bar segments become clickable to jump directly to any step once the user is already onboarded. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
||||
import { useRouter } from "next/navigation";
|
||||
import { Bell, HourglassIcon, XCircle, SlidersHorizontal, Heart } from "lucide-react";
|
||||
import { Bell, HourglassIcon, XCircle, SlidersHorizontal, Heart, Pencil } from "lucide-react";
|
||||
import { EmptyState } from "@/components/ui/EmptyState";
|
||||
import { Badge } from "@/components/ui/Badge";
|
||||
import { Button } from "@/components/ui/Button";
|
||||
@@ -28,6 +28,7 @@ function BrandHeader() {
|
||||
}
|
||||
|
||||
function PendingReview() {
|
||||
const router = useRouter();
|
||||
const { refreshUser } = useAuth();
|
||||
const [checking, setChecking] = useState(false);
|
||||
const intervalRef = useRef<ReturnType<typeof setInterval> | null>(null);
|
||||
@@ -64,6 +65,14 @@ function PendingReview() {
|
||||
actionLabel={checking ? "در حال بررسی..." : "بررسی وضعیت"}
|
||||
onAction={handleCheck}
|
||||
/>
|
||||
<Button
|
||||
variant="ghost"
|
||||
size="sm"
|
||||
icon={<Pencil size={14} />}
|
||||
onClick={() => router.push("/onboarding/basic-info")}
|
||||
>
|
||||
هنوز وقت هست؛ اطلاعاتت رو ویرایش کن
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
@@ -90,7 +99,7 @@ function Rejected({ reason }: { reason?: string }) {
|
||||
<p className="text-[14px] text-(--color-content-secondary) leading-6">{reason}</p>
|
||||
)}
|
||||
</div>
|
||||
<Button size="sm" onClick={() => router.push("/profile")}>
|
||||
<Button size="sm" onClick={() => router.push("/onboarding/basic-info")}>
|
||||
ویرایش پروفایل
|
||||
</Button>
|
||||
</div>
|
||||
|
||||
@@ -7,6 +7,7 @@ import { useRequireAuth } from "@/lib/hooks";
|
||||
import { FullScreenLoader } from "@/components/ui/FullScreenLoader";
|
||||
import { OnboardingScreen } from "@/components/onboarding/OnboardingScreen";
|
||||
import { BasicInfoStep } from "@/components/onboarding/steps/BasicInfoStep";
|
||||
import { PhotosStep } from "@/components/onboarding/steps/PhotosStep";
|
||||
import { BodyInfoStep } from "@/components/onboarding/steps/BodyInfoStep";
|
||||
import { ProfileQuestionsStep } from "@/components/onboarding/steps/ProfileQuestionsStep";
|
||||
import { EducationStep } from "@/components/onboarding/steps/EducationStep";
|
||||
@@ -90,12 +91,19 @@ export default function OnboardingStepPage() {
|
||||
return <FullScreenLoader />;
|
||||
}
|
||||
|
||||
const alreadyOnboarded = !!onboardingStatus?.is_onboarded;
|
||||
|
||||
return (
|
||||
<OnboardingScreen
|
||||
order={meta.order}
|
||||
title={meta.title}
|
||||
emoji={meta.emoji}
|
||||
onBack={meta.order === 1 ? () => router.push("/login") : undefined}
|
||||
onBack={
|
||||
meta.order === 1
|
||||
? () => router.push(alreadyOnboarded ? "/home" : "/login")
|
||||
: undefined
|
||||
}
|
||||
onJumpToStep={alreadyOnboarded ? (s) => router.push(`/onboarding/${s}`) : undefined}
|
||||
>
|
||||
{renderStep(slug, profile, goNext)}
|
||||
</OnboardingScreen>
|
||||
@@ -106,6 +114,8 @@ function renderStep(slug: string, profile: FullProfile | null, onNext: () => voi
|
||||
switch (slug) {
|
||||
case "basic-info":
|
||||
return <BasicInfoStep initialProfile={profile} onNext={onNext} />;
|
||||
case "photos":
|
||||
return <PhotosStep initialProfile={profile} onNext={onNext} />;
|
||||
case "body-info":
|
||||
return <BodyInfoStep initialProfile={profile} onNext={onNext} />;
|
||||
case "profile-questions":
|
||||
|
||||
Reference in New Issue
Block a user