diff --git a/client/src/app/dashboard/create/page.tsx b/client/src/app/dashboard/create/page.tsx
index 7f983db..3d720d2 100644
--- a/client/src/app/dashboard/create/page.tsx
+++ b/client/src/app/dashboard/create/page.tsx
@@ -82,6 +82,17 @@ export default function CreateQRPage() {
}
};
+ const handleDownload = async () => {
+ try {
+ const QRCodeStyling = (await import('qr-code-styling')).default;
+ const qrCode = new QRCodeStyling(qrOptions);
+ qrCode.download({ name: qrName || 'QR-Code', extension: 'png' });
+ } catch (err) {
+ console.error('Download failed', err);
+ alert('Failed to download QR code');
+ }
+ };
+
return (
@@ -89,13 +100,22 @@ export default function CreateQRPage() {
Create QR Code
Design a beautiful, dynamic QR code
-
+
+
+
+
diff --git a/client/src/app/dashboard/page.tsx b/client/src/app/dashboard/page.tsx
index a5df144..f35a010 100644
--- a/client/src/app/dashboard/page.tsx
+++ b/client/src/app/dashboard/page.tsx
@@ -10,6 +10,7 @@ interface QRCode {
short_url_id: string;
created_at: string;
scans: number;
+ design_data: any;
}
export default function DashboardPage() {
@@ -79,6 +80,23 @@ export default function DashboardPage() {
}
};
+ const handleDownload = async (qr: QRCode) => {
+ try {
+ const QRCodeStyling = (await import('qr-code-styling')).default;
+ const baseUrl = process.env.NEXT_PUBLIC_APP_URL || 'https://qr.houseofwebsites.ai';
+ const shortUrl = `${baseUrl}/l/${qr.short_url_id}`;
+
+ const qrCode = new QRCodeStyling({
+ ...qr.design_data,
+ data: shortUrl
+ });
+ qrCode.download({ name: qr.name || 'QR-Code', extension: 'png' });
+ } catch (err) {
+ console.error('Failed to download QR code', err);
+ alert('Failed to download QR code');
+ }
+ };
+
const totalScans = qrs.reduce((sum, qr) => sum + Number(qr.scans), 0);
const baseUrl = process.env.NEXT_PUBLIC_APP_URL || 'http://localhost:4001';
@@ -169,7 +187,10 @@ export default function DashboardPage() {
-