From 4ca909b1a80a3cc39f2bee53d3845a56fdbfc133 Mon Sep 17 00:00:00 2001 From: Gamosoft Date: Mon, 9 Feb 2026 18:55:55 +0100 Subject: [PATCH] added QR code generation --- frontend/app.js | 32 ++++++++++++++++++++++++++++++-- frontend/index.html | 38 +++++++++++++++++++++++++++++++++++--- locales/de-DE.json | 4 +++- locales/en-GB.json | 4 +++- locales/en-US.json | 4 +++- locales/es-ES.json | 4 +++- locales/fr-FR.json | 4 +++- locales/it-IT.json | 4 +++- locales/ja-JP.json | 4 +++- locales/ru-RU.json | 4 +++- locales/sl-SI.json | 4 +++- locales/zh-CN.json | 4 +++- 12 files changed, 95 insertions(+), 15 deletions(-) diff --git a/frontend/app.js b/frontend/app.js index 24e4c26..2c6e76d 100644 --- a/frontend/app.js +++ b/frontend/app.js @@ -277,6 +277,7 @@ function noteApp() { showShareModal: false, shareInfo: null, shareLoading: false, + showShareQR: false, shareLinkCopied: false, _sharedNotePaths: new Set(), // O(1) lookup for shared note indicators @@ -5378,13 +5379,40 @@ function noteApp() { this.closeQuickSwitcher(); }, + // Close share modal and reset state after animation + closeShareModal() { + this.showShareModal = false; + // Delay state reset until modal is fully hidden + setTimeout(() => { + this.showShareQR = false; + this.shareInfo = null; + this.shareLoading = false; + }, 200); + }, + + // Generate QR code for share URL + generateQRCode(url) { + if (!url || typeof qrcode === 'undefined') return ''; + try { + const qr = qrcode(0, 'M'); // 0 = auto version, M = medium error correction + qr.addData(url); + qr.make(); + return qr.createDataURL(4); // 4 = module size in pixels + } catch (e) { + console.error('QR code generation failed:', e); + return ''; + } + }, + // Open share modal and fetch current share status async openShareModal() { if (!this.currentNote) return; - this.showShareModal = true; - this.shareLoading = true; + // Reset state BEFORE showing modal to prevent flicker + this.showShareQR = false; this.shareInfo = null; + this.shareLoading = true; + this.showShareModal = true; try { const notePath = this.currentNote.replace('.md', ''); diff --git a/frontend/index.html b/frontend/index.html index 0f0ea01..e4f2e16 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -109,6 +109,8 @@ + + @@ -3007,8 +3009,8 @@
@@ -3073,6 +3075,36 @@
+ +
+ +
+ QR Code +
+
+