diff --git a/src/components/dashboard/ProfilePage.tsx b/src/components/dashboard/ProfilePage.tsx index 980fd6d..2a457b6 100644 --- a/src/components/dashboard/ProfilePage.tsx +++ b/src/components/dashboard/ProfilePage.tsx @@ -19,7 +19,7 @@ import { isValidLocation, isValidURL, } from "~/lib/form-validation"; -import { request, uploadDocument } from "~/lib/api"; +import { request, uploadDocument, submitCompanyProfileWithDocuments } from "~/lib/api"; import { getBasicFields, getDocFields, @@ -101,6 +101,444 @@ interface Props { type Tab = "basic" | "documents"; +// ── CompanyWizard — 3-step verification wizard for COMPANY role ────────────── +interface CompanyWizardProps { + wizardStep: () => number; + setWizardStep: (s: number | ((prev: number) => number)) => void; + wizardDocs: () => Record; + setWizardDocs: ( + s: Record | ((prev: Record) => Record) + ) => void; + wizardDocErrors: () => Record; + setWizardDocErrors: ( + s: Record | ((prev: Record) => Record) + ) => void; + wizardSubmitting: () => boolean; + wizardSubmitMsg: () => string; + wizardSubmitSuccess: () => boolean; + wizardCanAdvance: () => boolean; + handleWizardSubmit: () => void; + form: () => Record; + setField: (key: string, val: string) => void; + basicFields: () => Array<{ + key: string; + label: string; + type?: string; + required?: boolean; + options?: string[]; + }>; + getDocFields: (roleKey: string) => Array<{ + key: string; + label: string; + required?: boolean; + hint?: string; + }>; + fieldNote: ( + key: string, + label: string, + required: boolean, + fieldType?: string + ) => any; + wizardReset: () => void; +} + +function CompanyWizard(props: CompanyWizardProps) { + const stepLabels = ["Basic Information", "Documents", "Review & Submit"]; + + const formatBytes = (n: number) => { + if (n < 1024) return `${n} B`; + if (n < 1024 * 1024) return `${Math.round(n / 1024)} KB`; + return `${(n / (1024 * 1024)).toFixed(1)} MB`; + }; + + return ( +
+ {/* ── Success card ─────────────────────────────────────────────── */} + +
+
+

+ Submitted! +

+

+ We'll review your profile and notify you within 24–48 hours. +

+ +
+
+ + + {/* ── Stepper ────────────────────────────────────────────────── */} +
+ + {(i) => ( + <> +
i + ? "#FFF" + : "#F3F4F6", + color: + props.wizardStep() === i + ? "#FFF" + : props.wizardStep() > i + ? "#FF5E13" + : "#9CA3AF", + border: + props.wizardStep() >= i + ? "2px solid #FF5E13" + : "2px solid #E5E7EB", + }} + > + {props.wizardStep() > i ? "✓" : i + 1} +
+ +
i ? "#FF5E13" : "#E5E7EB", + }} + /> + + + )} + +
+

+ Step {props.wizardStep() + 1} of 3 — {stepLabels[props.wizardStep()]} +

+ + {/* ── Step body ─────────────────────────────────────────────── */} +
+ +

+ Tell us about your company +

+

+ Fill in your company details to get started. +

+
+ + {(field) => ( +
+ + + +