diff --git a/src/app/create/page.tsx b/src/app/create/page.tsx index acfb507..cfa2370 100644 --- a/src/app/create/page.tsx +++ b/src/app/create/page.tsx @@ -37,9 +37,12 @@ export default function CreatePage() { await new Promise((r) => window.setTimeout(r, 300)); const area = document.getElementById("print-area"); if (!area) throw new Error("preview not ready"); - const name = slugify(data.values.fullName || "") || "biodata"; + // Name-based filename; non-Latin names (e.g. Hindi) slugify to empty, so + // fall back to a plain "biodata.pdf" rather than "biodata-biodata.pdf". + const slug = slugify(data.values.fullName || ""); + const filename = slug ? `${slug}-biodata.pdf` : "biodata.pdf"; const { downloadBiodataPdf } = await import("@/lib/pdf"); - await downloadBiodataPdf(area, `${name}-biodata.pdf`); + await downloadBiodataPdf(area, filename); } catch (err) { console.error(err); window.alert("Sorry, the PDF couldn't be generated. Please try again."); diff --git a/src/components/BiodataForm.tsx b/src/components/BiodataForm.tsx index cb36773..99c80f7 100644 --- a/src/components/BiodataForm.tsx +++ b/src/components/BiodataForm.tsx @@ -52,6 +52,8 @@ export default function BiodataForm({ data, onChange }: Props) { reader.onerror = () => setPhotoError("Sorry, that image couldn't be loaded. Please try another."); reader.onload = () => onChange({ ...data, photo: String(reader.result) }); reader.readAsDataURL(file); + // Reset the input so re-selecting the same file (e.g. after Remove) still fires. + e.target.value = ""; }; return ( @@ -232,6 +234,24 @@ function Field({ rows={2} className={base} /> + ) : field.type === "combo" ? ( + <> + {/* Type-or-select: free text with suggestions from a datalist. */} + onChange(e.target.value)} + placeholder={field.placeholder} + className={base} + autoComplete="off" + /> + + > ) : ( {section.title} -