From 946bf9ec386c7557dec6514374fcb96124b83244 Mon Sep 17 00:00:00 2001 From: Amruth Pillai Date: Mon, 26 Jan 2026 06:38:59 +0100 Subject: [PATCH] - fixes #2598 --- src/components/resume/shared/items/awards-item.tsx | 3 ++- .../resume/shared/items/certifications-item.tsx | 8 +++++++- .../resume/shared/items/education-item.tsx | 5 ++++- .../resume/shared/items/experience-item.tsx | 5 ++++- .../resume/shared/items/projects-item.tsx | 5 ++++- .../resume/shared/items/publications-item.tsx | 8 +++++++- .../resume/shared/items/references-item.tsx | 5 ++++- .../resume/shared/items/volunteer-item.tsx | 5 ++++- src/components/resume/shared/page-summary.tsx | 3 ++- src/integrations/orpc/router/printer.ts | 14 ++++++++++---- .../resumes/-components/cards/resume-card.tsx | 6 ++---- src/utils/string.ts | 9 +++++++++ 12 files changed, 59 insertions(+), 17 deletions(-) diff --git a/src/components/resume/shared/items/awards-item.tsx b/src/components/resume/shared/items/awards-item.tsx index ed5b874ba..156ced410 100644 --- a/src/components/resume/shared/items/awards-item.tsx +++ b/src/components/resume/shared/items/awards-item.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import type { SectionItem } from "@/schema/resume/data"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { PageLink } from "../page-link"; @@ -25,7 +26,7 @@ export function AwardsItem({ className, ...item }: AwardsItemProps) { {/* Description */} -
+
diff --git a/src/components/resume/shared/items/certifications-item.tsx b/src/components/resume/shared/items/certifications-item.tsx index 78f30715d..e64c67f1a 100644 --- a/src/components/resume/shared/items/certifications-item.tsx +++ b/src/components/resume/shared/items/certifications-item.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import type { SectionItem } from "@/schema/resume/data"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { PageLink } from "../page-link"; @@ -25,7 +26,12 @@ export function CertificationsItem({ className, ...item }: CertificationsItemPro
{/* Description */} -
+
diff --git a/src/components/resume/shared/items/education-item.tsx b/src/components/resume/shared/items/education-item.tsx index 50bca44bb..a4ad72f03 100644 --- a/src/components/resume/shared/items/education-item.tsx +++ b/src/components/resume/shared/items/education-item.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import type { SectionItem } from "@/schema/resume/data"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { PageLink } from "../page-link"; @@ -30,7 +31,9 @@ export function EducationItem({ className, ...item }: EducationItemProps) {
{/* Description */} -
+
diff --git a/src/components/resume/shared/items/experience-item.tsx b/src/components/resume/shared/items/experience-item.tsx index c0c4f2be2..6faecbfa4 100644 --- a/src/components/resume/shared/items/experience-item.tsx +++ b/src/components/resume/shared/items/experience-item.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import type { SectionItem } from "@/schema/resume/data"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { PageLink } from "../page-link"; @@ -26,7 +27,9 @@ export function ExperienceItem({ className, ...item }: ExperienceItemProps) {
{/* Description */} -
+
diff --git a/src/components/resume/shared/items/projects-item.tsx b/src/components/resume/shared/items/projects-item.tsx index fab8b5b50..2d6610984 100644 --- a/src/components/resume/shared/items/projects-item.tsx +++ b/src/components/resume/shared/items/projects-item.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import type { SectionItem } from "@/schema/resume/data"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { PageLink } from "../page-link"; @@ -20,7 +21,9 @@ export function ProjectsItem({ className, ...item }: ProjectsItemProps) {
{/* Description */} -
+
diff --git a/src/components/resume/shared/items/publications-item.tsx b/src/components/resume/shared/items/publications-item.tsx index 51fa8fc59..7d083138f 100644 --- a/src/components/resume/shared/items/publications-item.tsx +++ b/src/components/resume/shared/items/publications-item.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import type { SectionItem } from "@/schema/resume/data"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { PageLink } from "../page-link"; @@ -25,7 +26,12 @@ export function PublicationsItem({ className, ...item }: PublicationsItemProps)
{/* Description */} -
+
diff --git a/src/components/resume/shared/items/references-item.tsx b/src/components/resume/shared/items/references-item.tsx index 4c27a820a..cbbf122dd 100644 --- a/src/components/resume/shared/items/references-item.tsx +++ b/src/components/resume/shared/items/references-item.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import type { SectionItem } from "@/schema/resume/data"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { PageLink } from "../page-link"; @@ -24,7 +25,9 @@ export function ReferencesItem({ className, ...item }: ReferencesItemProps) {
{/* Description */} -
+
diff --git a/src/components/resume/shared/items/volunteer-item.tsx b/src/components/resume/shared/items/volunteer-item.tsx index 753965a0f..4483c8737 100644 --- a/src/components/resume/shared/items/volunteer-item.tsx +++ b/src/components/resume/shared/items/volunteer-item.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import type { SectionItem } from "@/schema/resume/data"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { PageLink } from "../page-link"; @@ -25,7 +26,9 @@ export function VolunteerItem({ className, ...item }: VolunteerItemProps) {
{/* Description */} -
+
diff --git a/src/components/resume/shared/page-summary.tsx b/src/components/resume/shared/page-summary.tsx index b9f0195ed..9b25e54f1 100644 --- a/src/components/resume/shared/page-summary.tsx +++ b/src/components/resume/shared/page-summary.tsx @@ -1,5 +1,6 @@ import { TiptapContent } from "@/components/input/rich-input"; import { getSectionTitle } from "@/utils/resume/section"; +import { stripHtml } from "@/utils/string"; import { cn } from "@/utils/style"; import { useResumeStore } from "../store/resume"; @@ -15,7 +16,7 @@ export function PageSummary({ className }: PageSummaryProps) { className={cn( "page-section page-section-summary", section.hidden && "hidden", - section.content === "" && "hidden", + !stripHtml(section.content) && "hidden", className, )} > diff --git a/src/integrations/orpc/router/printer.ts b/src/integrations/orpc/router/printer.ts index 8a4a17255..7b8adedaa 100644 --- a/src/integrations/orpc/router/printer.ts +++ b/src/integrations/orpc/router/printer.ts @@ -34,11 +34,17 @@ export const printerRouter = { description: "Get a screenshot of a resume. Returns a URL to the screenshot image.", }) .input(z.object({ id: z.string() })) - .output(z.object({ url: z.string() })) + .output(z.object({ url: z.string().nullable() })) .handler(async ({ input }) => { - const { id, data, userId, updatedAt } = await resumeService.getByIdForPrinter({ id: input.id }); - const url = await printerService.getResumeScreenshot({ id, data, userId, updatedAt }); + try { + const { id, data, userId, updatedAt } = await resumeService.getByIdForPrinter({ id: input.id }); + const url = await printerService.getResumeScreenshot({ id, data, userId, updatedAt }); - return { url }; + return { url }; + } catch { + // ignore errors, as the screenshot is not critical + } + + return { url: null }; }), }; diff --git a/src/routes/dashboard/resumes/-components/cards/resume-card.tsx b/src/routes/dashboard/resumes/-components/cards/resume-card.tsx index c893838ee..dadbb34a3 100644 --- a/src/routes/dashboard/resumes/-components/cards/resume-card.tsx +++ b/src/routes/dashboard/resumes/-components/cards/resume-card.tsx @@ -22,8 +22,6 @@ export function ResumeCard({ resume }: ResumeCardProps) { orpc.printer.getResumeScreenshot.queryOptions({ input: { id: resume.id } }), ); - const imageSrc = screenshotData?.url; - const updatedAt = useMemo(() => { return Intl.DateTimeFormat(i18n.locale, { dateStyle: "long", timeStyle: "short" }).format(resume.updatedAt); }, [i18n.locale, resume.updatedAt]); @@ -32,13 +30,13 @@ export function ResumeCard({ resume }: ResumeCardProps) { - {match({ isLoading, imageSrc }) + {match({ isLoading, imageSrc: screenshotData?.url }) .with({ isLoading: true }, () => (
)) - .with({ imageSrc: P.string }, () => ( + .with({ imageSrc: P.string }, ({ imageSrc }) => ( {resume.name}]*>/g, "").trim(); +}