Skip to content

Commit 7a80686

Browse files
committed
feat: implement interactive manual input components for resume builder sections
1 parent feef4c3 commit 7a80686

4 files changed

Lines changed: 4 additions & 51 deletions

File tree

apps/web/src/features/resume-builder/components/manual/awards-section.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
VaultData,
1010
} from "@uaps/shared/resume-builder";
1111
import { useResumeBuilderActions } from "../../state/use-resume-builder-actions";
12-
import { useClickOutsideWithAutoSave } from "../../../../hooks/use-click-outside-auto-save";
12+
1313

1414
export interface AwardsSectionProps {
1515
awards: VaultData["awards"];
@@ -40,17 +40,6 @@ export function AwardsSection({
4040
name: "",
4141
desc: "",
4242
});
43-
const handleAddAwardInternal = () => {
44-
onAddAward({ preventDefault: () => {} } as FormEvent<HTMLFormElement>);
45-
};
46-
47-
const addFormRef = useRef<HTMLFormElement>(null);
48-
useClickOutsideWithAutoSave({
49-
formRef: addFormRef,
50-
onClose: onHideAwardForm,
51-
onSave: handleAddAwardInternal,
52-
shouldAutoSave: showAwardForm && !!newAward.name.trim(),
53-
});
5443

5544
const handleEditClick = (e: React.MouseEvent, award: VaultData["awards"][0]) => {
5645
e.stopPropagation();
@@ -183,7 +172,6 @@ export function AwardsSection({
183172

184173
{showAwardForm ? (
185174
<form
186-
ref={addFormRef}
187175
onSubmit={onAddAward}
188176
className="bg-slate-50 p-4 border border-blue-200 rounded-lg space-y-3 relative"
189177
>

apps/web/src/features/resume-builder/components/manual/certificates-section.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
VaultData,
1010
} from "@uaps/shared/resume-builder";
1111
import { useResumeBuilderActions } from "../../state/use-resume-builder-actions";
12-
import { useClickOutsideWithAutoSave } from "../../../../hooks/use-click-outside-auto-save";
12+
1313

1414
export interface CertificatesSectionProps {
1515
certificates: VaultData["certificates"];
@@ -40,17 +40,6 @@ export function CertificatesSection({
4040
name: "",
4141
year: "",
4242
});
43-
const handleAddCertificateInternal = () => {
44-
onAddCertificate({ preventDefault: () => {} } as FormEvent<HTMLFormElement>);
45-
};
46-
47-
const addFormRef = useRef<HTMLFormElement>(null);
48-
useClickOutsideWithAutoSave({
49-
formRef: addFormRef,
50-
onClose: onHideCertificateForm,
51-
onSave: handleAddCertificateInternal,
52-
shouldAutoSave: showCertificateForm && !!newCertificate.name.trim(),
53-
});
5443

5544
const handleEditClick = (e: React.MouseEvent, cert: VaultData["certificates"][0]) => {
5645
e.stopPropagation();
@@ -189,7 +178,6 @@ export function CertificatesSection({
189178

190179
{showCertificateForm ? (
191180
<form
192-
ref={addFormRef}
193181
onSubmit={onAddCertificate}
194182
className="bg-slate-50 p-4 border border-blue-200 rounded-lg space-y-3 relative"
195183
>

apps/web/src/features/resume-builder/components/manual/experiences-section.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
VaultData,
1010
} from "@uaps/shared/resume-builder";
1111
import { useResumeBuilderActions } from "../../state/use-resume-builder-actions";
12-
import { useClickOutsideWithAutoSave } from "../../../../hooks/use-click-outside-auto-save";
12+
1313

1414
export interface ExperienceSectionProps {
1515
experience: VaultData["experience"];
@@ -43,17 +43,6 @@ export function ExperienceSection({
4343
endDate: "",
4444
responsibilities: "",
4545
});
46-
const handleAddExperienceInternal = () => {
47-
onAddExperience({ preventDefault: () => {} } as FormEvent<HTMLFormElement>);
48-
};
49-
50-
const addFormRef = useRef<HTMLFormElement>(null);
51-
useClickOutsideWithAutoSave({
52-
formRef: addFormRef,
53-
onClose: onHideExperienceForm,
54-
onSave: handleAddExperienceInternal,
55-
shouldAutoSave: showExperienceForm && !!newExperience.role.trim(),
56-
});
5746

5847
const handleEditClick = (e: React.MouseEvent, exp: VaultData["experience"][0]) => {
5948
e.stopPropagation();
@@ -227,7 +216,6 @@ export function ExperienceSection({
227216

228217
{showExperienceForm ? (
229218
<form
230-
ref={addFormRef}
231219
onSubmit={onAddExperience}
232220
className="bg-slate-50 p-4 border border-blue-200 rounded-lg space-y-3 relative"
233221
>

apps/web/src/features/resume-builder/components/manual/projects-section.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import type {
99
VaultData,
1010
} from "@uaps/shared/resume-builder";
1111
import { useResumeBuilderActions } from "../../state/use-resume-builder-actions";
12-
import { useClickOutsideWithAutoSave } from "../../../../hooks/use-click-outside-auto-save";
12+
1313

1414
export interface ProjectsSectionProps {
1515
projects: VaultData["projects"];
@@ -43,17 +43,7 @@ export function ProjectsSection({
4343
endDate: "",
4444
githubUrl: "",
4545
});
46-
const handleAddProjectInternal = () => {
47-
onAddProject({ preventDefault: () => {} } as FormEvent<HTMLFormElement>);
48-
};
4946

50-
const addFormRef = useRef<HTMLFormElement>(null);
51-
useClickOutsideWithAutoSave({
52-
formRef: addFormRef,
53-
onClose: onHideProjectForm,
54-
onSave: handleAddProjectInternal,
55-
shouldAutoSave: showProjectForm && !!newProject.title.trim(),
56-
});
5747

5848
const handleEditClick = (e: React.MouseEvent, project: VaultData["projects"][0]) => {
5949
e.stopPropagation();
@@ -245,7 +235,6 @@ export function ProjectsSection({
245235
</div>
246236
{showProjectForm ? (
247237
<form
248-
ref={addFormRef}
249238
onSubmit={onAddProject}
250239
className="bg-slate-50 p-4 border border-slate-200 rounded-lg space-y-3 relative"
251240
>

0 commit comments

Comments
 (0)