Skip to content

Job application tracker and AI-powered job search assistant. Helps job seekers manage their search journey with AI resume review, job matching, task logging, and application analytics, all while keeping your data private.

831 B
Raw Blame
"use client";
import { useCallback } from "react";
import { usePdfPreview } from "@/components/pdf-export/usePdfPreview";
import type { Resume } from "@/models/profile.model";
import type { ResumeExportSettings } from "@/models/resumeExport.model";
import { canExportResume } from "./useResumePdfExport";

export function useResumePdfPreview(
  resume: Resume,
  settings: ResumeExportSettings,
  open: boolean,
) {
  // The dynamic import stays here, so the shared hook never pulls
  // @react-pdf/renderer into its own chunk.
  const generate = useCallback(
    async (next: ResumeExportSettings) => {
      const { generateResumePdfBlob } = await import("../resume-pdf");
      return generateResumePdfBlob(resume, next);
    },
    [resume],
  );

  return usePdfPreview(generate, settings, open && canExportResume(resume));
}