11"use client" ;
22
33import { useEffect , useRef , useState } from "react" ;
4+ import { useSearchParams } from "next/navigation" ;
45import { useResumeStore } from "@/store/resume-store" ;
56import { PersonalInfoForm } from "./forms/personal-info-form" ;
67import { ExperienceForm } from "./forms/experience-form" ;
@@ -29,6 +30,7 @@ const SECTIONS = [
2930] as const ;
3031
3132export function BuilderForm ( ) {
33+ const searchParams = useSearchParams ( ) ;
3234 const activeSection = useResumeStore ( ( state ) => state . activeSection ) ;
3335 const setActiveSection = useResumeStore ( ( state ) => state . setActiveSection ) ;
3436 const hiddenSections = useResumeStore ( ( state ) => state . hiddenSections ) ;
@@ -68,6 +70,10 @@ export function BuilderForm() {
6870 const activeIndex = visibleSections . findIndex ( ( s ) => s . id === activeSection ) ;
6971
7072 useEffect ( ( ) => {
73+ if ( searchParams . get ( "entry" ) === "import" ) {
74+ setActiveSection ( "personal" ) ;
75+ }
76+
7177 const applyHashSection = ( ) => {
7278 const raw = window . location . hash . replace ( "#" , "" ) . trim ( ) ;
7379 if ( ! raw ) return ;
@@ -80,7 +86,7 @@ export function BuilderForm() {
8086 applyHashSection ( ) ;
8187 window . addEventListener ( "hashchange" , applyHashSection ) ;
8288 return ( ) => window . removeEventListener ( "hashchange" , applyHashSection ) ;
83- } , [ visibleSections ] ) ;
89+ } , [ searchParams , visibleSections , setActiveSection ] ) ;
8490
8591 useEffect ( ( ) => {
8692 if ( ! tabsContainerRef . current ) return ;
0 commit comments