Finish the wonderland: System told truthfully, in eight tabs instead of ten
Claude-Session: https://claude.ai/code/session_01Ms2FbjQy31TVf3CEvQhGM8
This commit is contained in:
@@ -80,13 +80,28 @@ Singleton {
|
||||
{ page: "storage", label: "Storage" },
|
||||
{ page: "snapshots", label: "Snapshots" },
|
||||
{ page: "containers", label: "Containers" },
|
||||
{ page: "datetime", label: "Date & Time" },
|
||||
{ page: "region", label: "Region & Language" },
|
||||
{ page: "manual", label: "Manual" },
|
||||
{ page: "datetime", label: "Date, Time & Region" },
|
||||
{ page: "sync", label: "Sync & Backup" }
|
||||
] }
|
||||
]
|
||||
|
||||
// Leaves that are routable but are not tabs.
|
||||
//
|
||||
// The manual is reference material rather than a control surface: it is
|
||||
// reached from About's Manual card, from a deep link, or from the search
|
||||
// box, and a tenth tab spent on something nobody switches to while
|
||||
// adjusting a setting made the System strip harder to read than the pages
|
||||
// it addressed. It still needs to be a leaf -- every one of those callers
|
||||
// hands `resolve()` the id "manual" and expects the page, not Home.
|
||||
//
|
||||
// Deliberately a separate array rather than a field inside a category: the
|
||||
// two generators that regex-parse `categories` require each category to end
|
||||
// `tabs: [...] }` and cross-check that every `page:` inside the array is
|
||||
// accounted for, so a hidden leaf declared in there would break both.
|
||||
readonly property var hiddenLeaves: [
|
||||
{ page: "manual", label: "Manual", category: "system" }
|
||||
]
|
||||
|
||||
// Pages whose entire backing stack can be absent hide once a scan has
|
||||
// proven it absent: a Containers tab with no podman and a Snapshots tab
|
||||
// with no snapper configuration render permanently empty, which reads as
|
||||
@@ -103,19 +118,37 @@ Singleton {
|
||||
return true;
|
||||
}
|
||||
|
||||
// The hidden leaf with this id, or undefined.
|
||||
function hiddenLeaf(page: string): var {
|
||||
return root.hiddenLeaves.find(leaf => leaf.page === page);
|
||||
}
|
||||
|
||||
// The category owning a leaf. Tab membership is checked before category
|
||||
// ids so the three doubled ids land on their category either way.
|
||||
function categoryOf(leaf: string): var {
|
||||
const byTab = root.categories.find(cat => cat.tabs.some(tab => tab.page === leaf));
|
||||
if (byTab)
|
||||
return byTab;
|
||||
const hidden = root.hiddenLeaf(leaf);
|
||||
if (hidden) {
|
||||
const owner = root.categories.find(cat => cat.page === hidden.category);
|
||||
if (owner)
|
||||
return owner;
|
||||
}
|
||||
return root.categories.find(cat => cat.page === leaf) ?? root.categories[0];
|
||||
}
|
||||
|
||||
// Retired page ids keep resolving forever: old Vicinae commands, shell
|
||||
// history, and muscle memory all hold them. Each maps to the leaf that
|
||||
// absorbed its content.
|
||||
readonly property var retired: ({ "home-phone": "my-home", "desktop": "bar" })
|
||||
readonly property var retired: ({
|
||||
"home-phone": "my-home",
|
||||
"desktop": "bar",
|
||||
// Region & Language merged into Date, Time & Region: one tab now owns
|
||||
// the clock, the timezone, the language and the per-category formats,
|
||||
// which were three answers to "what does this machine consider local".
|
||||
"region": "datetime"
|
||||
})
|
||||
|
||||
// Any id a caller may hold — leaf, category, retired id, or garbage — to
|
||||
// the leaf that should render: a leaf resolves to itself, a category to
|
||||
@@ -128,7 +161,7 @@ Singleton {
|
||||
return root.retired[id];
|
||||
const asLeaf = root.categories.some(cat => (cat.page === id && cat.tabs.length === 0)
|
||||
|| cat.tabs.some(tab => tab.page === id));
|
||||
if (asLeaf)
|
||||
if (asLeaf || root.hiddenLeaf(id) !== undefined)
|
||||
return id;
|
||||
const category = root.categories.find(cat => cat.page === id);
|
||||
if (category) {
|
||||
@@ -141,6 +174,10 @@ Singleton {
|
||||
|
||||
// The available tabs of the category owning a leaf, for the strip above
|
||||
// the page. One entry (or none) means no strip is worth rendering.
|
||||
//
|
||||
// A hidden leaf still gets its category's strip, with nothing selected:
|
||||
// the manual is somewhere you arrive on purpose and leave again, and the
|
||||
// strip is how you leave.
|
||||
function tabsFor(leaf: string): var {
|
||||
return root.categoryOf(leaf).tabs.filter(tab => root.pageAvailable(tab.page));
|
||||
}
|
||||
@@ -149,7 +186,8 @@ Singleton {
|
||||
// what search results show, so a hit says where it will land.
|
||||
function breadcrumb(leaf: string): string {
|
||||
const category = root.categoryOf(leaf);
|
||||
const tab = category.tabs.find(t => t.page === leaf);
|
||||
const tab = category.tabs.find(t => t.page === leaf)
|
||||
?? root.hiddenLeaves.find(entry => entry.page === leaf);
|
||||
return tab ? category.label + " › " + tab.label : category.label;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user