Remove QR code from printed labels, keep barcode only
Deploy to LXC / deploy (push) Successful in 19s

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-09 17:25:48 +07:00
parent 3a3781ba7a
commit 64040f7391
4 changed files with 4 additions and 18 deletions
@@ -3,9 +3,7 @@ import { db } from '$lib/server/db/index.js';
import { components } from '$lib/server/db/schema.js';
import { eq } from 'drizzle-orm';
import { error } from '@sveltejs/kit';
import { generateQrSvg } from '$lib/server/qr.js';
import { generateBarcodeSvg } from '$lib/server/barcode.js';
import { env } from '$env/dynamic/private';
export const load: PageServerLoad = async ({ params }) => {
const [component] = await db
@@ -21,10 +19,8 @@ export const load: PageServerLoad = async ({ params }) => {
if (!component) error(404, 'Component not found');
const url = `${env.BASE_URL ?? 'http://localhost:5173'}/components/${params.id}`;
const qrSvg = await generateQrSvg(url);
const shortId = component.id.slice(0, 8).toUpperCase();
const barcodeDataUrl = await generateBarcodeSvg(shortId);
return { component, qrSvg, barcodeDataUrl, shortId };
return { component, barcodeDataUrl, shortId };
};
@@ -37,10 +37,7 @@
{#each Array(copies) as _}
<div class="label" style="width: 70mm; height: 29mm; background: white; color: black; box-sizing: border-box; padding: 1.5mm 2mm; margin: 0 auto 8px auto; border: 1px dashed #ccc; overflow: hidden;">
<div style="display: flex; align-items: center; gap: 3mm; height: 100%; font-family: Arial, Helvetica, sans-serif;">
<div style="width: 23mm; height: 23mm; flex-shrink: 0;">
{@html data.qrSvg}
</div>
<div style="display: flex; align-items: center; height: 100%; font-family: Arial, Helvetica, sans-serif;">
<div style="flex: 1; min-width: 0;">
<div style="font-size: 10pt; font-weight: bold; color: #000; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
{data.component.title}
@@ -3,9 +3,7 @@ import { db } from '$lib/server/db/index.js';
import { devices } from '$lib/server/db/schema.js';
import { eq } from 'drizzle-orm';
import { error } from '@sveltejs/kit';
import { generateQrSvg } from '$lib/server/qr.js';
import { generateBarcodeSvg } from '$lib/server/barcode.js';
import { env } from '$env/dynamic/private';
export const load: PageServerLoad = async ({ params }) => {
const [device] = await db
@@ -24,10 +22,8 @@ export const load: PageServerLoad = async ({ params }) => {
if (!device) error(404, 'Device not found');
const url = `${env.BASE_URL ?? 'http://localhost:5173'}/devices/${params.id}`;
const qrSvg = await generateQrSvg(url);
const shortId = device.id.slice(0, 8).toUpperCase();
const barcodeDataUrl = await generateBarcodeSvg(shortId);
return { device, qrSvg, barcodeDataUrl, shortId };
return { device, barcodeDataUrl, shortId };
};
@@ -37,10 +37,7 @@
{#each Array(copies) as _}
<div class="label" style="width: 70mm; height: 29mm; background: white; color: black; box-sizing: border-box; padding: 1.5mm 2mm; margin: 0 auto 8px auto; border: 1px dashed #ccc; overflow: hidden;">
<div style="display: flex; align-items: center; gap: 3mm; height: 100%; font-family: Arial, Helvetica, sans-serif;">
<div style="width: 23mm; height: 23mm; flex-shrink: 0;">
{@html data.qrSvg}
</div>
<div style="display: flex; align-items: center; height: 100%; font-family: Arial, Helvetica, sans-serif;">
<div style="flex: 1; min-width: 0;">
<div style="font-size: 10pt; font-weight: bold; color: #000; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;">
{data.device.title}