updated settings to be more user-friendly and added a status message area to provide feedback on settings actions.

This commit is contained in:
2026-04-22 00:06:52 -07:00
parent be94dac6f4
commit 0e7ba18f35
5 changed files with 212 additions and 92 deletions
+6
View File
@@ -35,6 +35,7 @@ const statusEl = document.getElementById("status");
const monthStripEl = document.getElementById("month-strip"); const monthStripEl = document.getElementById("month-strip");
const calendarEl = document.getElementById("calendar"); const calendarEl = document.getElementById("calendar");
const timelineSectionEl = document.getElementById("timeline-section"); const timelineSectionEl = document.getElementById("timeline-section");
const settingsSectionEl = document.getElementById("settings-section");
const calendarSectionEl = document.getElementById("calendar-section"); const calendarSectionEl = document.getElementById("calendar-section");
const holidaySectionEl = document.getElementById("holiday-section"); const holidaySectionEl = document.getElementById("holiday-section");
const audioCircleSectionEl = document.getElementById("audio-circle-section"); const audioCircleSectionEl = document.getElementById("audio-circle-section");
@@ -60,6 +61,7 @@ const quizSectionEl = document.getElementById("quiz-section");
const godsSectionEl = document.getElementById("gods-section"); const godsSectionEl = document.getElementById("gods-section");
const enochianSectionEl = document.getElementById("enochian-section"); const enochianSectionEl = document.getElementById("enochian-section");
const openHomeEl = document.getElementById("open-home"); const openHomeEl = document.getElementById("open-home");
const openSettingsEl = document.getElementById("open-settings");
const openCalendarEl = document.getElementById("open-calendar"); const openCalendarEl = document.getElementById("open-calendar");
const openCalendarTimelineEl = document.getElementById("open-calendar-timeline"); const openCalendarTimelineEl = document.getElementById("open-calendar-timeline");
const openCalendarMonthsEl = document.getElementById("open-calendar-months"); const openCalendarMonthsEl = document.getElementById("open-calendar-months");
@@ -473,6 +475,7 @@ sectionStateUi.init?.({
calendarEl, calendarEl,
monthStripEl, monthStripEl,
nowPanelEl, nowPanelEl,
settingsSectionEl,
timelineSectionEl, timelineSectionEl,
calendarSectionEl, calendarSectionEl,
holidaySectionEl, holidaySectionEl,
@@ -499,6 +502,7 @@ sectionStateUi.init?.({
godsSectionEl, godsSectionEl,
enochianSectionEl, enochianSectionEl,
openHomeEl, openHomeEl,
openSettingsEl,
openCalendarEl, openCalendarEl,
openCalendarTimelineEl, openCalendarTimelineEl,
openCalendarMonthsEl, openCalendarMonthsEl,
@@ -562,6 +566,7 @@ settingsUi.init?.({
onStatus: (text) => setStatus(text), onStatus: (text) => setStatus(text),
onConnectionSaved: async () => ensureConnectedApp(), onConnectionSaved: async () => ensureConnectedApp(),
getActiveSection: () => sectionStateUi.getActiveSection?.() || "home", getActiveSection: () => sectionStateUi.getActiveSection?.() || "home",
setActiveSection: (section) => sectionStateUi.setActiveSection?.(section),
onReopenActiveSection: (section) => sectionStateUi.setActiveSection?.(section), onReopenActiveSection: (section) => sectionStateUi.setActiveSection?.(section),
onRenderWeek: () => appRuntime.renderWeek?.() onRenderWeek: () => appRuntime.renderWeek?.()
}); });
@@ -604,6 +609,7 @@ navigationUi.init?.({
selectNumberEntry, selectNumberEntry,
elements: { elements: {
openHomeEl, openHomeEl,
openSettingsEl,
openCalendarEl, openCalendarEl,
openCalendarTimelineEl, openCalendarTimelineEl,
openCalendarMonthsEl, openCalendarMonthsEl,
+109
View File
@@ -402,6 +402,16 @@
box-sizing: border-box; box-sizing: border-box;
overflow: auto; overflow: auto;
} }
#settings-section {
height: calc(100vh - 61px);
height: calc(100dvh - 61px);
background:
radial-gradient(circle at top left, rgba(245, 158, 11, 0.12), transparent 30%),
radial-gradient(circle at top right, rgba(59, 130, 246, 0.1), transparent 32%),
linear-gradient(180deg, #111318, #18181b 40%, #111318);
box-sizing: border-box;
overflow: auto;
}
#tarot-section[hidden] { #tarot-section[hidden] {
display: none; display: none;
} }
@@ -429,6 +439,94 @@
#holiday-section[hidden] { #holiday-section[hidden] {
display: none; display: none;
} }
#settings-section[hidden] {
display: none;
}
.settings-page-shell {
width: min(1120px, calc(100% - 24px));
margin: 0 auto;
padding: clamp(18px, 2.8vw, 32px);
box-sizing: border-box;
}
.settings-page-hero {
display: flex;
align-items: flex-start;
justify-content: space-between;
gap: 16px;
margin-bottom: 20px;
}
.settings-page-eyebrow {
font-size: 11px;
text-transform: uppercase;
letter-spacing: 0.16em;
color: #f59e0b;
margin-bottom: 8px;
}
.settings-page-title {
margin: 0;
font-size: clamp(28px, 4vw, 42px);
line-height: 1.05;
color: #fafafa;
}
.settings-page-copy {
margin: 10px 0 0;
max-width: 720px;
color: #cbd5e1;
line-height: 1.6;
}
.settings-page-back {
padding: 10px 14px;
border-radius: 999px;
border: 1px solid rgba(245, 158, 11, 0.35);
background: rgba(17, 24, 39, 0.78);
color: #f8fafc;
cursor: pointer;
white-space: nowrap;
}
.settings-page-back:hover {
background: rgba(31, 41, 55, 0.96);
}
.settings-page-layout {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 16px;
}
.settings-panel {
padding: 18px;
border-radius: 20px;
border: 1px solid rgba(63, 63, 70, 0.92);
background: linear-gradient(180deg, rgba(24, 24, 27, 0.96), rgba(9, 9, 11, 0.96));
box-shadow: 0 18px 40px rgba(0, 0, 0, 0.2);
}
.settings-panel-wide {
grid-column: 1 / -1;
}
.settings-panel-head {
display: flex;
flex-direction: column;
gap: 6px;
margin-bottom: 14px;
}
.settings-panel-head strong {
color: #fafafa;
font-size: 15px;
}
.settings-panel-head span {
color: #94a3b8;
font-size: 13px;
line-height: 1.5;
}
.settings-panel-actions {
margin-top: 14px;
display: flex;
justify-content: flex-start;
}
.settings-page-actions {
margin-top: 18px;
padding-top: 16px;
border-top: 1px solid rgba(63, 63, 70, 0.7);
justify-content: flex-end;
}
.calendar-year-control { .calendar-year-control {
display: flex; display: flex;
justify-content: space-between; justify-content: space-between;
@@ -7071,6 +7169,17 @@
.settings-popup-header button:hover { .settings-popup-header button:hover {
background: #3f3f46; background: #3f3f46;
} }
@media (max-width: 800px) {
.settings-page-hero {
flex-direction: column;
}
.settings-page-layout {
grid-template-columns: minmax(0, 1fr);
}
.settings-panel-wide {
grid-column: auto;
}
}
@media (max-width: 640px) { @media (max-width: 640px) {
.connection-gate { .connection-gate {
padding: 16px; padding: 16px;
+8 -4
View File
@@ -3,6 +3,7 @@
const VALID_SECTIONS = new Set([ const VALID_SECTIONS = new Set([
"home", "home",
"settings",
"timeline", "timeline",
"calendar", "calendar",
"holidays", "holidays",
@@ -87,6 +88,7 @@
const magickDataset = getMagickDataset(); const magickDataset = getMagickDataset();
const isHomeOpen = activeSection === "home"; const isHomeOpen = activeSection === "home";
const isSettingsOpen = activeSection === "settings";
const isTimelineOpen = activeSection === "timeline"; const isTimelineOpen = activeSection === "timeline";
const isCalendarOpen = activeSection === "calendar"; const isCalendarOpen = activeSection === "calendar";
const isHolidaysOpen = activeSection === "holidays"; const isHolidaysOpen = activeSection === "holidays";
@@ -120,6 +122,7 @@
const isEnochianOpen = activeSection === "enochian"; const isEnochianOpen = activeSection === "enochian";
setHidden(elements.timelineSectionEl, !isTimelineOpen); setHidden(elements.timelineSectionEl, !isTimelineOpen);
setHidden(elements.settingsSectionEl, !isSettingsOpen);
setHidden(elements.calendarSectionEl, !isCalendarOpen); setHidden(elements.calendarSectionEl, !isCalendarOpen);
setHidden(elements.holidaySectionEl, !isHolidaysOpen); setHidden(elements.holidaySectionEl, !isHolidaysOpen);
setHidden(elements.audioCircleSectionEl, !isAudioCircleOpen); setHidden(elements.audioCircleSectionEl, !isAudioCircleOpen);
@@ -147,6 +150,7 @@
setHidden(elements.nowPanelEl, !isHomeOpen); setHidden(elements.nowPanelEl, !isHomeOpen);
setPressed(elements.openHomeEl, isHomeOpen); setPressed(elements.openHomeEl, isHomeOpen);
setPressed(elements.openSettingsEl, isSettingsOpen);
setPressed(elements.openCalendarEl, isCalendarMenuOpen); setPressed(elements.openCalendarEl, isCalendarMenuOpen);
toggleActive(elements.openCalendarTimelineEl, isTimelineOpen); toggleActive(elements.openCalendarTimelineEl, isTimelineOpen);
toggleActive(elements.openCalendarMonthsEl, isCalendarOpen); toggleActive(elements.openCalendarMonthsEl, isCalendarOpen);
@@ -177,15 +181,15 @@
setPressed(elements.openGodsEl, isGodsOpen); setPressed(elements.openGodsEl, isGodsOpen);
setPressed(elements.openEnochianEl, isEnochianOpen); setPressed(elements.openEnochianEl, isEnochianOpen);
if (!isHomeOpen) {
config.settingsUi?.closeSettingsPopup?.();
}
if (isTimelineOpen) { if (isTimelineOpen) {
renderHomeFallback(); renderHomeFallback();
return; return;
} }
if (isSettingsOpen) {
return;
}
if (isCalendarOpen) { if (isCalendarOpen) {
ensure.ensureCalendarSection?.(referenceData, magickDataset); ensure.ensureCalendarSection?.(referenceData, magickDataset);
return; return;
+13 -42
View File
@@ -18,16 +18,17 @@
onStatus: null, onStatus: null,
onConnectionSaved: null, onConnectionSaved: null,
onReopenActiveSection: null, onReopenActiveSection: null,
setActiveSection: null,
getActiveSection: null, getActiveSection: null,
onRenderWeek: null onRenderWeek: null
}; };
let lastNonSettingsSection = "home";
function getElements() { function getElements() {
return { return {
openSettingsEl: document.getElementById("open-settings"), openSettingsEl: document.getElementById("open-settings"),
closeSettingsEl: document.getElementById("close-settings"), closeSettingsEl: document.getElementById("close-settings"),
settingsPopupEl: document.getElementById("settings-popup"),
settingsPopupCardEl: document.getElementById("settings-popup-card"),
latEl: document.getElementById("lat"), latEl: document.getElementById("lat"),
lngEl: document.getElementById("lng"), lngEl: document.getElementById("lng"),
timeFormatEl: document.getElementById("time-format"), timeFormatEl: document.getElementById("time-format"),
@@ -460,28 +461,16 @@
} }
function openSettingsPopup() { function openSettingsPopup() {
const { settingsPopupEl, openSettingsEl } = getElements(); const activeSection = typeof config.getActiveSection === "function" ? config.getActiveSection() : "home";
if (!settingsPopupEl) { if (activeSection && activeSection !== "settings") {
return; lastNonSettingsSection = activeSection;
} }
applySettingsToInputs(loadSavedSettings()); applySettingsToInputs(loadSavedSettings());
settingsPopupEl.hidden = false; config.setActiveSection?.("settings");
if (openSettingsEl) {
openSettingsEl.setAttribute("aria-expanded", "true");
}
} }
function closeSettingsPopup() { function closeSettingsPopup() {
const { settingsPopupEl, openSettingsEl } = getElements(); config.setActiveSection?.(lastNonSettingsSection || "home");
if (!settingsPopupEl) {
return;
}
settingsPopupEl.hidden = true;
if (openSettingsEl) {
openSettingsEl.setAttribute("aria-expanded", "false");
}
} }
async function handleSaveSettings() { async function handleSaveSettings() {
@@ -502,10 +491,9 @@
); );
const didPersist = saveSettings(normalized); const didPersist = saveSettings(normalized);
emitSettingsUpdated(normalized); emitSettingsUpdated(normalized);
if (typeof config.getActiveSection === "function" && config.getActiveSection() !== "home") { if (typeof config.getActiveSection === "function" && config.getActiveSection() !== "home" && config.getActiveSection() !== "settings") {
config.onReopenActiveSection?.(config.getActiveSection()); config.onReopenActiveSection?.(config.getActiveSection());
} }
closeSettingsPopup();
if (connectionChanged && typeof config.onConnectionSaved === "function") { if (connectionChanged && typeof config.onConnectionSaved === "function") {
await config.onConnectionSaved(connectionResult, connectionSettings); await config.onConnectionSaved(connectionResult, connectionSettings);
} else if (typeof config.onRenderWeek === "function") { } else if (typeof config.onRenderWeek === "function") {
@@ -514,6 +502,8 @@
if (!didPersist || connectionResult.didPersist === false) { if (!didPersist || connectionResult.didPersist === false) {
setStatus("Settings applied for this session. Browser storage is unavailable."); setStatus("Settings applied for this session. Browser storage is unavailable.");
} else {
setStatus("Settings saved.");
} }
} catch (error) { } catch (error) {
setStatus(error?.message || "Unable to save settings."); setStatus(error?.message || "Unable to save settings.");
@@ -557,8 +547,6 @@
useLocationEl, useLocationEl,
openSettingsEl, openSettingsEl,
closeSettingsEl, closeSettingsEl,
settingsPopupEl,
settingsPopupCardEl,
latEl, latEl,
lngEl lngEl
} = getElements(); } = getElements();
@@ -585,7 +573,7 @@
if (openSettingsEl) { if (openSettingsEl) {
openSettingsEl.addEventListener("click", (event) => { openSettingsEl.addEventListener("click", (event) => {
event.stopPropagation(); event.stopPropagation();
if (settingsPopupEl?.hidden) { if ((config.getActiveSection?.() || "home") !== "settings") {
openSettingsPopup(); openSettingsPopup();
} else { } else {
closeSettingsPopup(); closeSettingsPopup();
@@ -597,25 +585,8 @@
closeSettingsEl.addEventListener("click", closeSettingsPopup); closeSettingsEl.addEventListener("click", closeSettingsPopup);
} }
document.addEventListener("click", (event) => {
const clickTarget = event.target;
if (!settingsPopupEl || settingsPopupEl.hidden) {
return;
}
if (!(clickTarget instanceof Node)) {
return;
}
if (settingsPopupCardEl?.contains(clickTarget) || openSettingsEl?.contains(clickTarget)) {
return;
}
closeSettingsPopup();
});
document.addEventListener("keydown", (event) => { document.addEventListener("keydown", (event) => {
if (event.key === "Escape") { if (event.key === "Escape" && (config.getActiveSection?.() || "home") === "settings") {
closeSettingsPopup(); closeSettingsPopup();
} }
}); });
+39 -9
View File
@@ -22,7 +22,7 @@
<div class="topbar"> <div class="topbar">
<button id="open-home" class="topbar-home-button" type="button" aria-pressed="true">Tarot Time!</button> <button id="open-home" class="topbar-home-button" type="button" aria-pressed="true">Tarot Time!</button>
<button id="topbar-menu-toggle" class="topbar-menu-toggle" type="button" aria-expanded="false" aria-controls="topbar-actions" aria-label="Open navigation menu">Menu</button> <button id="topbar-menu-toggle" class="topbar-menu-toggle" type="button" aria-expanded="false" aria-controls="topbar-actions" aria-label="Open navigation menu">Menu</button>
<button id="open-settings" class="topbar-menu-toggle topbar-settings-toggle" type="button" aria-haspopup="dialog" aria-expanded="false">Settings</button> <button id="open-settings" class="topbar-menu-toggle topbar-settings-toggle" type="button" aria-pressed="false">Settings</button>
<div id="topbar-actions" class="topbar-actions"> <div id="topbar-actions" class="topbar-actions">
<div class="topbar-dropdown" aria-label="Alphabet menu"> <div class="topbar-dropdown" aria-label="Alphabet menu">
<button id="open-alphabet" class="settings-trigger" type="button" aria-pressed="false" aria-haspopup="menu" aria-controls="alphabet-subpages" aria-expanded="false">Alphabet ▾</button> <button id="open-alphabet" class="settings-trigger" type="button" aria-pressed="false" aria-haspopup="menu" aria-controls="alphabet-subpages" aria-expanded="false">Alphabet ▾</button>
@@ -98,11 +98,21 @@
</div> </div>
</div> </div>
</div> </div>
<div id="settings-popup" class="settings-popup" hidden> <section id="settings-section" hidden>
<div id="settings-popup-card" class="settings-popup-card" role="dialog" aria-modal="false" aria-label="Calendar Settings"> <div class="settings-page-shell">
<div class="settings-popup-header"> <div class="settings-page-hero">
<strong>Settings</strong> <div>
<button id="close-settings" type="button">Close</button> <div class="settings-page-eyebrow">Configuration</div>
<h1 class="settings-page-title">Settings</h1>
<p class="settings-page-copy">A dedicated page for app behavior, deck caching, and API connection settings. This stays scrollable and leaves room for more controls later.</p>
</div>
<button id="close-settings" class="settings-page-back" type="button">Back</button>
</div>
<div class="settings-page-layout">
<section class="settings-panel">
<div class="settings-panel-head">
<strong>Location And Time</strong>
<span>Controls calendar rendering, the Now panel, and optional sky background.</span>
</div> </div>
<div class="settings-grid"> <div class="settings-grid">
<label class="settings-field">Latitude <label class="settings-field">Latitude
@@ -121,6 +131,17 @@
<label class="settings-field settings-field-full">Birth Date <label class="settings-field settings-field-full">Birth Date
<input id="birth-date" type="date"> <input id="birth-date" type="date">
</label> </label>
</div>
<div class="settings-panel-actions">
<button id="use-location" type="button">Use My Location</button>
</div>
</section>
<section class="settings-panel">
<div class="settings-panel-head">
<strong>Tarot And Assets</strong>
<span>Choose the active deck and monitor local browser cache warmup for card images.</span>
</div>
<div class="settings-grid">
<label class="settings-field settings-field-full">Tarot Deck <label class="settings-field settings-field-full">Tarot Deck
<select id="tarot-deck"> <select id="tarot-deck">
<option value="ceremonial-magick" selected>Loading deck manifests...</option> <option value="ceremonial-magick" selected>Loading deck manifests...</option>
@@ -135,6 +156,14 @@
</span> </span>
<small id="stellarium-background-hint" class="settings-field-hint">Enter a location or use My Location before enabling the live sky background.</small> <small id="stellarium-background-hint" class="settings-field-hint">Enter a location or use My Location before enabling the live sky background.</small>
</label> </label>
</div>
</section>
<section class="settings-panel settings-panel-wide">
<div class="settings-panel-head">
<strong>API Connection</strong>
<span>Set the API base URL and key used by this client shell.</span>
</div>
<div class="settings-grid">
<label class="settings-field settings-field-full">API Base URL <label class="settings-field settings-field-full">API Base URL
<input id="api-base-url" type="url" inputmode="url" placeholder="http://localhost:3100"> <input id="api-base-url" type="url" inputmode="url" placeholder="http://localhost:3100">
</label> </label>
@@ -142,12 +171,13 @@
<input id="api-key" type="password" autocomplete="off" placeholder="Optional unless the API requires one"> <input id="api-key" type="password" autocomplete="off" placeholder="Optional unless the API requires one">
</label> </label>
</div> </div>
<div class="settings-actions"> </section>
<button id="use-location" type="button">Use My Location</button> </div>
<div class="settings-actions settings-page-actions">
<button id="save-settings" type="button">Save Settings</button> <button id="save-settings" type="button">Save Settings</button>
</div> </div>
</div> </div>
</div> </section>
<section id="calendar-section" hidden> <section id="calendar-section" hidden>
<div class="planet-layout"> <div class="planet-layout">
<aside class="planet-list-panel"> <aside class="planet-list-panel">