mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-11-16 04:45:33 -08:00
Add an Always SKIP Intro preference
AI Assisted
This commit is contained in:
1 parent
f24a254f96
commit
459b840db9
6 files changed
+20
-5
No files matched your search
@@ -827,7 +827,7 @@ test("prefs: four tabs in order, each section in exactly one", () => {
|
||||
for (const t of PREFS_TABS) assert.ok(t.hint, `${t.id} has a hint`);
|
||||
const sections = PREFS_TABS.flatMap((t) => t.sections);
|
||||
assert.equal(new Set(sections).size, sections.length, "no section sits in two tabs");
|
||||
assert.deepEqual(PREFS_TABS[0].sections, ["theme", "width", "accent", "role"], "Appearance in its order");
|
||||
assert.deepEqual(PREFS_TABS[0].sections, ["theme", "width", "accent", "role", "intro"], "Appearance in its order");
|
||||
});
|
||||
|
||||
test("prefs: the dialog opens on the tab asked for, else Appearance", () => {
|
||||
@@ -836,7 +836,7 @@ test("prefs: the dialog opens on the tab asked for, else Appearance", () => {
|
||||
});
|
||||
|
||||
test("prefs: Back to default resets Appearance or Sounds & activities only, and nothing on the other two", () => {
|
||||
assert.deepEqual(prefsResetScope("appearance"), ["theme", "width", "accent", "role"]);
|
||||
assert.deepEqual(prefsResetScope("appearance"), ["theme", "width", "accent", "role", "skipIntro"]);
|
||||
const sounds = prefsResetScope("sounds");
|
||||
assert.deepEqual(sounds, ["sound", ...Object.keys(SOUND_EVENTS).map(soundKey), "hideActivities", "activitySounds", "gameMusic"]);
|
||||
for (const key of [...prefsResetScope("appearance"), ...sounds]) {
|
||||
@@ -850,7 +850,7 @@ test("prefs: Back to default resets Appearance or Sounds & activities only, and
|
||||
test("looks: resetLooks(keys) changes only those keys, and the role is marked as asked", () => {
|
||||
const before = { ...looks };
|
||||
try {
|
||||
Object.assign(looks, { theme: "dark", width: "wide", accent: "violet", role: "pm", sound: false, soundQuestion: false, hideActivities: false, activityBestSnake: 7, lastActivity: "snake" });
|
||||
Object.assign(looks, { theme: "dark", width: "wide", accent: "violet", role: "pm", sound: false, soundQuestion: false, hideActivities: false, activityBestSnake: 7, lastActivity: "snake", skipIntro: true });
|
||||
resetLooks(prefsResetScope("appearance"));
|
||||
assert.equal(looks.theme, DEFAULT_LOOKS.theme);
|
||||
assert.equal(looks.width, DEFAULT_LOOKS.width);
|
||||
@@ -858,6 +858,7 @@ test("looks: resetLooks(keys) changes only those keys, and the role is marked as
|
||||
assert.equal(looks.role, ROLE_NOT_SET, "cleared but marked as asked");
|
||||
assert.equal(looks.sound, false, "sounds untouched by Appearance");
|
||||
assert.equal(looks.hideActivities, false);
|
||||
assert.equal(looks.skipIntro, DEFAULT_LOOKS.skipIntro, "Appearance resets Always SKIP Intro");
|
||||
resetLooks(prefsResetScope("sounds"));
|
||||
assert.equal(looks.sound, true);
|
||||
assert.equal(looks.soundQuestion, true);
|
||||
|
||||
@@ -3636,6 +3636,11 @@
|
||||
<select id="looks-role" aria-label="Role"></select>
|
||||
<p class="help">Only puts the starter templates most useful to you first.</p>
|
||||
</fieldset>
|
||||
<fieldset data-section="intro" class="modal-ranges">
|
||||
<legend>Intro</legend>
|
||||
<label><input type="checkbox" id="looks-skip-intro" /> <span>Always SKIP Intro</span></label>
|
||||
<p class="help">A newly opened dashboard starts with Planny asleep, waiting to be woken. Tick this to go straight to the dashboard every time.</p>
|
||||
</fieldset>
|
||||
</section>
|
||||
<section class="prefs-panel" data-tab="agents">
|
||||
<div class="prefs-agents" data-section="agents">
|
||||
|
||||
@@ -31,6 +31,8 @@ export const DEFAULT_LOOKS = {
|
||||
...soundPrefs(null),
|
||||
width: DEFAULT_CARD_WIDTH,
|
||||
hideUnavailable: true,
|
||||
// Always SKIP Intro: never play the dashboard's first-open wake-up (Planny asleep), off by default.
|
||||
skipIntro: false,
|
||||
// Activities: the top bar's die (hidden until someone turns on Show Activities), whether its games play sounds (under Play
|
||||
// sounds, which silences them too), the game last picked, and one best score
|
||||
// per listed game (activityBestSnake) or, for a game with courses, per
|
||||
@@ -61,6 +63,7 @@ export function adoptLooks(saved) {
|
||||
Object.assign(looks, soundPrefs(looks));
|
||||
if (typeof looks.hideUnavailable !== "boolean") looks.hideUnavailable = DEFAULT_LOOKS.hideUnavailable;
|
||||
looks.width = cardWidth(looks.width);
|
||||
if (typeof looks.skipIntro !== "boolean") looks.skipIntro = DEFAULT_LOOKS.skipIntro;
|
||||
if (typeof looks.hideActivities !== "boolean") looks.hideActivities = DEFAULT_LOOKS.hideActivities;
|
||||
if (typeof looks.activitySounds !== "boolean") looks.activitySounds = DEFAULT_LOOKS.activitySounds;
|
||||
if (typeof looks.gameMusic !== "boolean") looks.gameMusic = DEFAULT_LOOKS.gameMusic;
|
||||
@@ -263,6 +266,7 @@ export function renderSwatches() {
|
||||
box.disabled = !looks.sound;
|
||||
}
|
||||
$("looks-role").value = looks.role ?? ROLE_NOT_SET;
|
||||
$("looks-skip-intro").checked = looks.skipIntro;
|
||||
$("looks-activities").checked = !looks.hideActivities;
|
||||
// Like a cue, the game sounds keep their tick while Play sounds is off.
|
||||
$("looks-activity-sounds").checked = looks.activitySounds;
|
||||
|
||||
@@ -10,7 +10,7 @@ const tab = (id, label, hint, sections) => Object.freeze({ id, label, hint, sect
|
||||
|
||||
// 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("appearance", "Appearance", "Theme, width, color, role, intro", ["theme", "width", "accent", "role", "intro"]),
|
||||
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"]),
|
||||
@@ -25,7 +25,7 @@ export function prefsOpenTab(asked) {
|
||||
// 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 === "appearance") return ["theme", "width", "accent", "role", "skipIntro"];
|
||||
if (tab === "sounds") return ["sound", ...Object.keys(SOUND_EVENTS).map(soundKey), "hideActivities", "activitySounds", "gameMusic"];
|
||||
return null;
|
||||
}
|
||||
@@ -298,6 +298,7 @@ const delay = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
||||
function maybeWake() {
|
||||
if (wakeTried || page.S.wake !== true || finish()) return;
|
||||
wakeTried = true;
|
||||
if (looks.skipIntro === true) return;
|
||||
const key = "p2c-console:woke:" + page.S.sid;
|
||||
try {
|
||||
if (sessionStorage.getItem(key)) return;
|
||||
|
||||
@@ -96,6 +96,10 @@ export function wireLooks() {
|
||||
if (!looks.gameMusic) hushMusic();
|
||||
hooks.markSaved(fieldsetOf(e.target), saveLooks());
|
||||
});
|
||||
$("looks-skip-intro").addEventListener("change", (e) => {
|
||||
looks.skipIntro = e.target.checked;
|
||||
hooks.markSaved(fieldsetOf(e.target), saveLooks());
|
||||
});
|
||||
$("looks-activities").addEventListener("change", (e) => {
|
||||
looks.hideActivities = !e.target.checked;
|
||||
hooks.markSaved(fieldsetOf(e.target), saveLooks());
|
||||
|
||||
Reference in new issue
Block a user