feat: add section heading icons to PDF templates (#3127)

* feat: add section heading icons to PDF templates

Add customizable Phosphor icons before section titles in PDF output.
Users can toggle visibility globally via a new "Hide section heading icons"
switch (independent of item-level icons) and customize individual section
icons through the builder sidebar icon picker.

- Add `icon` field to `baseSectionSchema` and `summarySchema`
- Add `hideSectionIcons` to `pageSchema` (defaults to true for backward compat)
- Implement `SectionHeadingIcon` component with heading font-size scaling
- Support "none" sentinel for per-section icon hiding
- Fallback to sensible defaults (briefcase, graduation-cap, etc.) for legacy data
- Add icon picker to builder sidebar sections and custom section dialogs

Closes #2632

* test: add unit tests for section heading icons

- Add tests for getResumeSectionIcon() covering built-in sections,
  summary, custom sections, "none" sentinel, and default fallbacks
- Add schema tests for baseSectionSchema icon field, summarySchema icon,
  and pageSchema hideSectionIcons default behavior

* refactor: minor updates to icon display

* Update apps/web/locales/es-ES.po

Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>

---------

Co-authored-by: Amruth Pillai <im.amruth@gmail.com>
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
This commit is contained in:
JamesGoslings
2026-06-01 14:02:42 +02:00
committed by GitHub
co-authored by coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Amruth Pillai
parent 1522794733
commit b932711f08
81 changed files with 1153 additions and 306 deletions
+17 -1
View File
@@ -94,6 +94,12 @@ export const basicsSchema = z.object({
export const summarySchema = z.object({
title: z.string().describe("The title of the summary of the resume."),
icon: z
.string()
.catch("")
.describe(
"Phosphor icon name to display before the summary section title in the PDF output. Empty string uses the default summary icon; 'none' hides the icon.",
),
columns: z.number().int().min(1).max(6).catch(1).describe("The number of columns the summary should span across."),
hidden: z.boolean().describe("Whether to hide the summary from the resume."),
content: z.string().describe("The content of the summary of the resume. This should be a HTML-formatted string."),
@@ -271,6 +277,12 @@ export type CoverLetterItem = z.infer<typeof coverLetterItemSchema>;
export const baseSectionSchema = z.object({
title: z.string().describe("The title of the section."),
icon: z
.string()
.catch("")
.describe(
"Phosphor icon name to display before the section title in the PDF output. Empty string uses the default section icon; 'none' hides the icon.",
),
columns: z.number().int().min(1).max(6).catch(1).describe("The number of columns the section should span across."),
hidden: z.boolean().describe("Whether to hide the section from the resume."),
});
@@ -457,7 +469,11 @@ export const pageSchema = z.object({
.string()
.describe("The locale of the page. Used for displaying pre-translated section headings, if not overridden.")
.catch("en-US"),
hideIcons: z.boolean().describe("Whether to hide the icons of the sections.").catch(false),
hideIcons: z.boolean().describe("Whether to hide the item-level icons (skills, profiles, interests).").catch(false),
hideSectionIcons: z
.boolean()
.describe("Whether to hide the section heading icons displayed before section titles.")
.catch(true),
});
export const levelDesignSchema = z.object({