Skip to content

Commit b8b8ab5

Browse files
committed
feat(ui): support import entry deep link
1 parent 984c131 commit b8b8ab5

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/components/builder/builder-form.tsx

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"use client";
22

33
import { useEffect, useRef, useState } from "react";
4+
import { useSearchParams } from "next/navigation";
45
import { useResumeStore } from "@/store/resume-store";
56
import { PersonalInfoForm } from "./forms/personal-info-form";
67
import { ExperienceForm } from "./forms/experience-form";
@@ -29,6 +30,7 @@ const SECTIONS = [
2930
] as const;
3031

3132
export 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

Comments
 (0)