diff --git a/src/app/(main)/home/page.tsx b/src/app/(main)/home/page.tsx index 1211773..52dab2b 100644 --- a/src/app/(main)/home/page.tsx +++ b/src/app/(main)/home/page.tsx @@ -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 | null>(null); @@ -64,6 +65,14 @@ function PendingReview() { actionLabel={checking ? "در حال بررسی..." : "بررسی وضعیت"} onAction={handleCheck} /> + ); @@ -90,7 +99,7 @@ function Rejected({ reason }: { reason?: string }) {

{reason}

)} - diff --git a/src/app/onboarding/[slug]/page.tsx b/src/app/onboarding/[slug]/page.tsx index 5f62f33..37188b8 100644 --- a/src/app/onboarding/[slug]/page.tsx +++ b/src/app/onboarding/[slug]/page.tsx @@ -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 ; } + const alreadyOnboarded = !!onboardingStatus?.is_onboarded; + return ( 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)} @@ -106,6 +114,8 @@ function renderStep(slug: string, profile: FullProfile | null, onNext: () => voi switch (slug) { case "basic-info": return ; + case "photos": + return ; case "body-info": return ; case "profile-questions": diff --git a/src/components/onboarding/OnboardingScreen.tsx b/src/components/onboarding/OnboardingScreen.tsx index c4d0f8d..d95ce3d 100644 --- a/src/components/onboarding/OnboardingScreen.tsx +++ b/src/components/onboarding/OnboardingScreen.tsx @@ -12,6 +12,9 @@ interface OnboardingScreenProps { description?: string; children: ReactNode; onBack?: () => void; + // وقتی پروفایل قبلاً کامل شده (در انتظار بررسی یا ردشده)، کاربر می‌تونه + // مستقیم روی هر بخش از نوار پیشرفت بزنه و بین مراحل جابه‌جا بشه + onJumpToStep?: (slug: string) => void; } export function OnboardingScreen({ @@ -21,6 +24,7 @@ export function OnboardingScreen({ description, children, onBack, + onJumpToStep, }: OnboardingScreenProps) { const router = useRouter(); const total = ONBOARDING_STEPS.length; @@ -36,14 +40,25 @@ export function OnboardingScreen({
- {ONBOARDING_STEPS.map((s) => ( -
- ))} + {ONBOARDING_STEPS.map((s) => + onJumpToStep ? ( + +
+ ))} + {photos.length < MAX_PHOTOS && ( + + )} +
+ + + + + + + ); +} diff --git a/src/lib/api.ts b/src/lib/api.ts index b6cd804..39a57a7 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -342,6 +342,11 @@ export function submitBasicInfo(payload: { }); } +// خودِ عکس‌ها با uploadPhoto/deletePhoto آپلود می‌شن؛ این فقط مرحله رو تایید/رد می‌کنه +export function confirmPhotosStep() { + return authRequest("/onboarding/photos", { method: "POST" }); +} + export function submitBodyInfo(payload: { height_cm: number; weight_kg: number }) { return authRequest("/onboarding/body-info", { method: "POST", diff --git a/src/lib/onboarding-steps.ts b/src/lib/onboarding-steps.ts index f0c78bd..f97bca7 100644 --- a/src/lib/onboarding-steps.ts +++ b/src/lib/onboarding-steps.ts @@ -9,19 +9,20 @@ export interface StepMeta { // همون ترتیب و کلیدهایی که بک‌اند در models.OnboardingStepOrder برمی‌گردونه export const ONBOARDING_STEPS: StepMeta[] = [ { key: "basic_info", slug: "basic-info", order: 1, title: "خب اول بگو کی هستی", emoji: "👋" }, - { key: "body_info", slug: "body-info", order: 2, title: "قد و وزنت چقدره؟", emoji: "📏" }, - { key: "profile_questions", slug: "profile-questions", order: 3, title: "یکم از خودت بگو", emoji: "💬" }, - { key: "education", slug: "education", order: 4, title: "تحصیلاتت چیه؟", emoji: "🎓" }, - { key: "occupations", slug: "occupations", order: 5, title: "چیکار می‌کنی؟", emoji: "💼" }, + { key: "photos", slug: "photos", order: 2, title: "چندتا عکس از خودت بذار", emoji: "📸" }, + { key: "body_info", slug: "body-info", order: 3, title: "قد و وزنت چقدره؟", emoji: "📏" }, + { key: "profile_questions", slug: "profile-questions", order: 4, title: "یکم از خودت بگو", emoji: "💬" }, + { key: "education", slug: "education", order: 5, title: "تحصیلاتت چیه؟", emoji: "🎓" }, + { key: "occupations", slug: "occupations", order: 6, title: "چیکار می‌کنی؟", emoji: "💼" }, { key: "relationship_importance", slug: "relationship-importance", - order: 6, + order: 7, title: "توی رابطه چی برات مهمه؟", emoji: "❤️", }, - { key: "interests", slug: "interests", order: 7, title: "به چی علاقه داری؟", emoji: "✨" }, - { key: "looking_for", slug: "looking-for", order: 8, title: "دنبال چی می‌گردی؟", emoji: "🔍" }, + { key: "interests", slug: "interests", order: 8, title: "به چی علاقه داری؟", emoji: "✨" }, + { key: "looking_for", slug: "looking-for", order: 9, title: "دنبال چی می‌گردی؟", emoji: "🔍" }, ]; export function stepBySlug(slug: string) {