From 5377b3c81a394a1e93528b74f856b87376ace699 Mon Sep 17 00:00:00 2001 From: Marc Mintel Date: Fri, 12 Jun 2026 13:05:24 +0200 Subject: [PATCH] feat(klz-2026): use external URL and static .vcf files for ultra-minimalist QR codes --- public/v/johannesgleich.vcf | 10 ++++++++++ public/v/klausmintel.vcf | 10 ++++++++++ public/v/michaelbodemer.vcf | 10 ++++++++++ scripts/generate-business-cards.ts | 18 ++++++++++++++---- 4 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 public/v/johannesgleich.vcf create mode 100644 public/v/klausmintel.vcf create mode 100644 public/v/michaelbodemer.vcf diff --git a/public/v/johannesgleich.vcf b/public/v/johannesgleich.vcf new file mode 100644 index 00000000..e5cc7dff --- /dev/null +++ b/public/v/johannesgleich.vcf @@ -0,0 +1,10 @@ +BEGIN:VCARD +VERSION:3.0 +N:Gleich;Johannes;;; +FN:Johannes Gleich +ORG:KLZ Vertriebs GmbH +TITLE:Senior Key Account Manager +TEL;TYPE=WORK,VOICE:+49 172 739 1109 +EMAIL;TYPE=PREF,INTERNET:johannes.gleich@klz-cables.com +URL:https://klz-cables.com +END:VCARD \ No newline at end of file diff --git a/public/v/klausmintel.vcf b/public/v/klausmintel.vcf new file mode 100644 index 00000000..4d0b1cb3 --- /dev/null +++ b/public/v/klausmintel.vcf @@ -0,0 +1,10 @@ +BEGIN:VCARD +VERSION:3.0 +N:Mintel;Klaus;;; +FN:Klaus Mintel +ORG:KLZ Vertriebs GmbH +TITLE:Managing Director +TEL;TYPE=WORK,VOICE:+49 151 1775 2873 +EMAIL;TYPE=PREF,INTERNET:klaus.mintel@klz-cables.com +URL:https://klz-cables.com +END:VCARD \ No newline at end of file diff --git a/public/v/michaelbodemer.vcf b/public/v/michaelbodemer.vcf new file mode 100644 index 00000000..59c889e0 --- /dev/null +++ b/public/v/michaelbodemer.vcf @@ -0,0 +1,10 @@ +BEGIN:VCARD +VERSION:3.0 +N:Bodemer;Michael;;; +FN:Michael Bodemer +ORG:KLZ Vertriebs GmbH +TITLE:Owner & Managing Director +TEL;TYPE=WORK,VOICE:+49 151 462 467 98 +EMAIL;TYPE=PREF,INTERNET:michael.bodemer@klz-cables.com +URL:https://klz-cables.com +END:VCARD \ No newline at end of file diff --git a/scripts/generate-business-cards.ts b/scripts/generate-business-cards.ts index fbdde7ba..0d15f933 100644 --- a/scripts/generate-business-cards.ts +++ b/scripts/generate-business-cards.ts @@ -54,13 +54,23 @@ async function generateBusinessCards() { const lastName = person.name.split(' ').slice(1).join(' '); const firstName = person.name.split(' ')[0]; - // Generate MECARD QR Code (much shorter than VCARD, leading to a less dense QR code that can be printed smaller) - const mecard = `MECARD:N:${lastName},${firstName};ORG:KLZ Vertriebs GmbH;TEL:${person.phone};EMAIL:${person.email};URL:https://klz-cables.com;;`; - const qrCodeDataUrl = await QRCode.toDataURL(mecard, { + // To make the QR code extremely coarse (minimalist), we cannot encode all contact details into it directly. + // Instead, we create a physical .vcf file and encode ONLY its URL into the QR Code (e.g. 35 chars vs 140 chars). + const shortId = person.name.toLowerCase().replace(/[^a-z0-9]/g, ''); // "michaelbodemer" + const vcfUrl = `https://klz-cables.com/v/${shortId}.vcf`; + + const vcardFull = `BEGIN:VCARD\r\nVERSION:3.0\r\nN:${lastName};${firstName};;;\r\nFN:${person.name}\r\nORG:KLZ Vertriebs GmbH\r\nTITLE:${person.role}\r\nTEL;TYPE=WORK,VOICE:${person.phone}\r\nEMAIL;TYPE=PREF,INTERNET:${person.email}\r\nURL:https://klz-cables.com\r\nEND:VCARD`; + + // Save the physical .vcf file so it can be served by Next.js from /public/v/ + const vcardDir = path.join(process.cwd(), 'public/v'); + if (!fs.existsSync(vcardDir)) fs.mkdirSync(vcardDir, { recursive: true }); + fs.writeFileSync(path.join(vcardDir, `${shortId}.vcf`), vcardFull); + + const qrCodeDataUrl = await QRCode.toDataURL(vcfUrl, { width: 400, margin: 0, - errorCorrectionLevel: 'L', // Low error correction = less dots = easier to scan when small + errorCorrectionLevel: 'L', // Low error correction = less dots color: { dark: '#000000', light: '#ffffff' }, });