From 27074b9fb6ef019b8b7c6313aa3acb9d353b4e46 Mon Sep 17 00:00:00 2001 From: thePR0M3TH3AN <53631862+PR0M3TH3AN@users.noreply.github.com> Date: Tue, 26 May 2026 11:38:34 -0400 Subject: [PATCH] QR layer: add Insert npub + Insert share link buttons (Phase B) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two convenience buttons under the QR data textarea: - Insert npub — async; pulls the signed-in pubkey via the Nostr extension (window.nostr.getPublicKey), encodes it to bech32 npub, writes it into the QR data field. Toasts an error if no extension is present. - Insert share link — async; only valid once the design has been published (checks state.editingDTag). Builds the same naddr / nevent shape that shareIdForRow produces for the community- browser Copy-share-link button: * naddr for replaceable events (kind 30000-39999) with a mode-prefixed d-tag (cover: / disc: / jewel: / customart: / disc-design: / slide: / deck: / pixelart:) * nevent fallback otherwise, using state.editingEventId Then wraps it as `${location.origin}/#/share/` and writes it into the data field. Both writes go through updateQrField('data', value) so undo / history / the live preview pick them up the same way typing in the textarea does. TODO.md: mark QR Phase B as shipped. Co-Authored-By: Claude Opus 4.7 --- TODO.md | 11 ++++------- src/index.html | 49 +++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 53 insertions(+), 7 deletions(-) diff --git a/TODO.md b/TODO.md index cc8b06e..f25fd36 100644 --- a/TODO.md +++ b/TODO.md @@ -18,14 +18,11 @@ Running list of deferred work. Detailed specs for the larger items live in ## QR code layer — remaining phases -Phase A shipped (the `qr` layer type: data, error-correction level, quiet -zone, module / background colors, transparent background, renders on every -surface + canvas export, JSON round-trip). +Phases A and B shipped (the `qr` layer type: data, error-correction level, +quiet zone, module / background colors, transparent background, renders +on every surface + canvas export, JSON round-trip; plus "Insert npub" and +"Insert share link" buttons under the QR data field). -- **Phase B — convenience inserts.** "Insert npub" and "Insert share link" - buttons next to the QR data field. Insert npub fills the signed-in user's - `npub`; Insert share link fills the design's `naddr`/`nevent` once it's - been published. ~80 LoC. - **Phase C — visual polish.** Optional center logo overlay and rounded modules. Riskier: a logo eats into the error-correction budget, so it should nudge the ECC level up. Skippable. diff --git a/src/index.html b/src/index.html index 859ae9a..be04f97 100644 --- a/src/index.html +++ b/src/index.html @@ -2256,6 +2256,8 @@ border-radius: 6px; cursor: pointer; font-family: inherit; } .pixelToolMenu button:hover { background: rgba(127,127,127,.14); } + .qrInsertRow { display: flex; gap: 6px; margin: 6px 0 4px; } + .qrInsertBtn { flex: 1; font-size: .72rem; padding: 4px 6px; } .pixelizePreviewRow { display: flex; gap: 12px; margin: 0 0 10px; } .pixelizePreviewBox { flex: 1; display: flex; flex-direction: column; gap: 4px; min-width: 0; } .pixelizePreviewLabel { font-size: .72rem; color: #64748b; font-weight: 600; } @@ -3171,6 +3173,10 @@