feat: update navigation paths to use '/internship'; enhance certificate generation and user interface elements

This commit is contained in:
Kemas M. Aryadary Rasyad
2026-08-04 09:21:16 +07:00
parent 5dbb21bf5a
commit 753012732d
17 changed files with 78 additions and 46 deletions
+8 -8
View File
@@ -25,7 +25,7 @@ export const previewCertificate = async (
const blob = await generateCertificate(
resolveFileUrl(templateUrl),
cert.user.full_name,
cert.project.project_name,
cert.intern_position,
cert.certificate_no,
formatDateRange(cert.project.start_date, cert.project.end_date),
cert.uuid,
@@ -85,11 +85,11 @@ export const downloadCertificatePdf = async (
cert: Certificate,
templateUrl: string,
): Promise<void> => {
const fileName = `Sertifikat - ${cert.user.full_name} - ${cert.certificate_no}`;
const fileName = `${cert.certificate_no}_${cert.user.full_name}_${cert.project.project_name}`;
const blob = await generateCertificate(
resolveFileUrl(templateUrl),
cert.user.full_name,
cert.project.project_name,
cert.intern_position,
cert.certificate_no,
formatDateRange(cert.project.start_date, cert.project.end_date),
cert.uuid,
@@ -125,11 +125,11 @@ export const downloadCertificateImage = async (
templateUrl: string,
format: "png" | "jpg" = "png",
): Promise<void> => {
const fileName = `Sertifikat - ${cert.user.full_name} - ${cert.certificate_no}`;
const fileName = `${cert.certificate_no}_${cert.user.full_name}_${cert.project.project_name}`;
const blob = await generateCertificate(
resolveFileUrl(templateUrl),
cert.user.full_name,
cert.project.project_name,
cert.intern_position,
cert.certificate_no,
formatDateRange(cert.project.start_date, cert.project.end_date),
cert.uuid,
@@ -192,12 +192,12 @@ export const downloadAllCertificatesZip = async (
const blob = await generateCertificate(
resolveFileUrl(templateUrl),
cert.user.full_name,
cert.project.project_name,
cert.intern_position,
cert.certificate_no,
formatDateRange(cert.project.start_date, cert.project.end_date),
cert.uuid,
);
zip.file(`Sertifikat - ${cert.user.full_name}.png`, blob);
zip.file(`${cert.certificate_no}_${projectName}_${cert.user.full_name}.png`, blob);
onProgress?.(i + 1, total);
}),
);
@@ -205,7 +205,7 @@ export const downloadAllCertificatesZip = async (
const zipBlob = await zip.generateAsync({ type: "blob" });
const a = document.createElement("a");
a.href = URL.createObjectURL(zipBlob);
a.download = `Sertifikat - ${projectName}.zip`;
a.download = `Sertifikat_${projectName}_${new Date().toISOString().slice(0, 10)}.zip`;
a.click();
URL.revokeObjectURL(a.href);
};
+6 -6
View File
@@ -23,13 +23,13 @@ async function ensureFontsLoaded(): Promise<void> {
// LAYOUT DEFAULT SERTIFIKAT YANG AKAN DIGENERATE
const LAYOUT = {
internName: { x: 0.54, y: 0.5, size: 130, font: "Great Vibes", color: "#800000" },
internName: { x: 0.54, y: 0.47, size: 130, font: "Great Vibes", color: "#800000" },
internNameSmall: { x: 0.82, y: 0.889, size: 47, font: "Great Vibes", color: "#090909" },
projectName: { x: 0.815, y: 0.598, size: 46, font: "Grenze", color: "#800000" },
duration: { x: 0.7, y: 0.645, size: 48, font: "Grenze", color: "#090909" },
userposition: { x: 0.855, y: 0.557, size: 46, font: "Grenze", color: "#800000" },
duration: { x: 0.7, y: 0.615, size: 48, font: "Grenze", color: "#090909" },
certNo: { x: 0.56, y: 0.305, size: 50, font: "Grenze", color: "#090909" },
certNoSmall: { x: 0.827, y: 0.92, size: 32, font: "Grenze", color: "#090909"},
qr: { x: 0.77, y: 0.715, size: 0.103 },
qr: { x: 0.772, y: 0.715, size: 0.103 },
};
// HELPER: kurangi ukuran font 25% jika nama melebihi 22 karakter (termasuk spasi)
@@ -48,7 +48,7 @@ function fitNameText(name: string, baseSize: number): number {
export async function generateCertificate(
templateUrl: string,
internName: string,
projectName: string,
userposition: string,
certificateNo: string,
ProjectDuration: string,
verifyUrl: string,
@@ -76,7 +76,7 @@ export async function generateCertificate(
text(LAYOUT.internName, internName);
text(LAYOUT.internNameSmall, internName);
text(LAYOUT.projectName, projectName);
text(LAYOUT.userposition, userposition);
text(LAYOUT.duration, ProjectDuration);
text(LAYOUT.certNo, certificateNo);
text(LAYOUT.certNoSmall, certificateNo);