ui: log page tone badge follows the toggle (novice / pro)
The Strategic Log Archive panel header used to show two engineery
badges sourced from server config:
new logs use: tone intermediate analysis speculative
Both were misleading:
- The tone badge described the SERVER's generator setting, not the
user's reading preference — confusingly disconnected from the
Novice | Pro toggle in the topbar that actually controls what AI
panels render.
- The analysis flag is always SPECULATIVE in production, so the badge
carried no information.
Drop the "new logs use:" prefix and the analysis badge. The tone badge
now mirrors the user's toggle: NOVICE → "novice", INTERMEDIATE → "pro"
(same data values; just the display label flips, matching the header
relabel from 3e1a14f).
Wiring lives in base.html: a new cassandraSyncToneBadge(tone) helper
updates the #tone-badge element when present. Called from
DOMContentLoaded (so the initial badge picks up the localStorage tone)
and from cassandraSetTone (so toggling the header updates the badge
live, without a page refresh).
current_tone / current_analysis are removed from _log_page_context —
log.html was the only consumer and neither key is referenced now.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
parent
259146ecdc
commit
6c4c711830
3 changed files with 23 additions and 6 deletions
|
|
@ -130,12 +130,30 @@
|
|||
// top-of-page inline script already wrote to <html data-theme>.
|
||||
var themePill = document.getElementById('theme-toggle');
|
||||
if (themePill) themePill.dataset.theme = document.documentElement.dataset.theme || 'light';
|
||||
// Sync the /log page's tone badge to the saved tone — server-side
|
||||
// first render defaults to "pro", but a returning NOVICE user
|
||||
// should see "novice" before any toggle interaction.
|
||||
window.cassandraSyncToneBadge(currentTone());
|
||||
});
|
||||
|
||||
// Sync the optional #tone-badge (currently used on the /log page) to
|
||||
// the supplied tone. NOVICE renders as "novice"; INTERMEDIATE renders
|
||||
// as "pro" — matches the header toggle's display labels. Safe to call
|
||||
// on pages that don't render the badge.
|
||||
window.cassandraSyncToneBadge = function (tone) {
|
||||
var badge = document.getElementById('tone-badge');
|
||||
if (!badge) return;
|
||||
var label = (tone === 'NOVICE') ? 'novice' : 'pro';
|
||||
badge.className = 'badge badge--tone-' + label;
|
||||
var span = badge.querySelector('[data-tone-label]');
|
||||
if (span) span.textContent = label;
|
||||
};
|
||||
|
||||
window.cassandraSetTone = function (newTone) {
|
||||
try { localStorage.setItem('cassandra.tone', newTone); } catch (e) {}
|
||||
var pill = document.getElementById('tone-toggle');
|
||||
if (pill) pill.dataset.tone = newTone;
|
||||
window.cassandraSyncToneBadge(newTone);
|
||||
// Trigger a re-fetch of every AI-driven HTMX target on the page.
|
||||
// Easiest: dispatch a custom event that the relevant elements
|
||||
// listen to. Simpler still: fire htmx.trigger on the well-known
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue