mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-17 04:45:33 -08:00
Update the web console server, screens, help, prefs and loop setup, with matching page and logic suites
AI Assisted
This commit is contained in:
1 parent
2468027a5a
commit
8e34bf1005
119 files changed
+9957
-3728
No files matched your search
@@ -0,0 +1,31 @@
|
||||
// Plan2Code Web Console - what the User Preferences dialog is.
|
||||
//
|
||||
// Its tabs in order, which one opens, and what Back to default resets on
|
||||
// each. No DOM access at module scope, and its one import is the data-only
|
||||
// palette.js: the page and `node --test` both import this file.
|
||||
|
||||
import { SOUND_EVENTS, soundKey } from "./palette.js";
|
||||
|
||||
const tab = (id, label, hint, sections) => Object.freeze({ id, label, hint, sections: Object.freeze(sections) });
|
||||
|
||||
// Each section id names one fieldset in the dialog (its data-section).
|
||||
export const PREFS_TABS = Object.freeze([
|
||||
tab("appearance", "Appearance", "Theme, width, color, role", ["theme", "width", "accent", "role"]),
|
||||
tab("agents", "Agents & models", "Your CLIs and models", ["agents"]),
|
||||
tab("system", "System", "Cleanup, desktop app", ["cleanup", "desktop"]),
|
||||
tab("sounds", "Sounds & activities", "What plays", ["sounds", "activities"]),
|
||||
]);
|
||||
|
||||
// The tab the dialog opens on: the one asked for when there is such a tab,
|
||||
// else Appearance. Nothing is remembered between opens.
|
||||
export function prefsOpenTab(asked) {
|
||||
return PREFS_TABS.some((t) => t.id === asked) ? asked : "appearance";
|
||||
}
|
||||
|
||||
// The looks keys Back to default resets on a tab, or null where it has
|
||||
// nothing to reset (and is hidden).
|
||||
export function prefsResetScope(tab) {
|
||||
if (tab === "appearance") return ["theme", "width", "accent", "role"];
|
||||
if (tab === "sounds") return ["sound", ...Object.keys(SOUND_EVENTS).map(soundKey), "hideActivities", "activitySounds", "gameMusic"];
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user