From cd5252c1854816ee8ea9f683577063342dfcc520 Mon Sep 17 00:00:00 2001 From: Disco DeDisco Date: Wed, 22 Apr 2026 23:54:05 -0400 Subject: [PATCH] =?UTF-8?q?note=20palette:=20swatch=20previews=20body=20pa?= =?UTF-8?q?lette,=20NVM=20reverts,=20OK=20saves=20sitewide;=20note=5Fset?= =?UTF-8?q?=5Fpalette=20also=20saves=20user.palette=20=E2=80=94=20TDD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - note-page.js: body class swap on swatch click; 10s auto-revert timer; NVM reverts; .note-item--active persists border/glow while modal open; .previewing on swatch - billboard/views.py: note_set_palette also saves user.palette via _unlocked_palettes_for_user - _note.scss: .note-swatch-body gradient (palette vars cascade from parent palette-* class); .previewing state; .note-item--active; note-palette-modal tooltip glass; note-palette-confirm floats below modal (position:absolute, out of flow) - my_notes.html: note-item__body wrapper; image-box right; swatch row OK buttons removed - FTs: T2a URL fix (/recognition → /my-notes); T2b split into preview+persist & NVM tests; NoteSetPaletteViewTest.test_also_saves_user_palette IT Code architected by Disco DeDisco Git commit message Co-Authored-By: Claude Sonnet 4.6 --- .../static/apps/billboard/note-page.js | 93 ++++++++++---- .../billboard/tests/integrated/test_views.py | 11 ++ src/apps/billboard/views.py | 8 +- src/functional_tests/test_applet_my_notes.py | 112 ++++++++++++----- src/static/tests/NoteSpec.js | 6 +- src/static_src/scss/_note.scss | 117 +++++++++++++----- src/templates/apps/billboard/my_notes.html | 9 +- 7 files changed, 258 insertions(+), 98 deletions(-) diff --git a/src/apps/billboard/static/apps/billboard/note-page.js b/src/apps/billboard/static/apps/billboard/note-page.js index 5954be6..6aa48d3 100644 --- a/src/apps/billboard/static/apps/billboard/note-page.js +++ b/src/apps/billboard/static/apps/billboard/note-page.js @@ -1,9 +1,10 @@ (function () { 'use strict'; - var _state = 'closed'; // 'closed' | 'open' | 'previewing' var _selectedPalette = null; var _activeItem = null; + var _originalPalette = null; + var _dismissTimer = null; // ── helpers ────────────────────────────────────────────────────────────── @@ -15,6 +16,22 @@ return Array.from(el.classList).find(function (c) { return c.startsWith('palette-'); }) || ''; } + function _currentBodyPalette() { + return Array.from(document.body.classList).find(function (c) { return c.startsWith('palette-'); }) || null; + } + + function _swapBodyPalette(paletteName) { + var old = _currentBodyPalette(); + if (old) document.body.classList.remove(old); + document.body.classList.add(paletteName); + } + + function _revertBodyPalette() { + var current = _currentBodyPalette(); + if (current) document.body.classList.remove(current); + if (_originalPalette) document.body.classList.add(_originalPalette); + } + function _getCsrf() { var m = document.cookie.match(/csrftoken=([^;]+)/); return m ? m[1] : ''; @@ -23,7 +40,6 @@ // ── modal lifecycle ─────────────────────────────────────────────────────── function _openModal() { - // Clone from