Show Viewing as on Roles as a select, also with one agent

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
WolfandClaude Fable 5.1 committed 2026-09-29 16:40:33 +02:00
1 parent 6124b00062
commit 4b722744a7
5 files changed
+9 -16

No files matched your search

-6
View File
@@ -617,12 +617,6 @@ kbd {
min-height: 2.6rem; padding: .2rem .5rem;
border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
}
/* One agent is not a choice, so it is its name, not a select of one. */
#rail p.agent-pick {
padding: .45rem .6rem; line-height: 1.35; overflow-wrap: anywhere;
background: color-mix(in srgb, var(--accent) 10%, transparent);
box-shadow: inset 3px 0 0 var(--accent); border-radius: 3px;
}
.rail-viewing .rail-note { margin-top: 0; }
/* A link in a heading ("agents", "clear") is a word, not a second heading. */
#rail h3 .linky { text-transform: none; letter-spacing: 0; font-weight: 400; }
+3 -6
View File
@@ -410,16 +410,15 @@
$("#rail-toggle").setAttribute("aria-expanded", String(state.railOpen));
}
/* Viewing as: a select with two or more agents, the name with one, and
/* Viewing as: a select of the enabled agents, also when there is one, and
with none a sentence and the way to make one. Nothing until the agents
are in, so a page with agents never says it has none. */
function renderAgent() {
const agents = state.agents;
const select = $("#agent");
select.hidden = agents.length < 2;
$("#agent-one").hidden = agents.length !== 1;
select.hidden = !agents.length;
$("#agent-none").hidden = !state.agentsLoaded || agents.length > 0;
if (agents.length > 1) {
if (agents.length) {
// Rebuilt only when the agents changed, since the rail is drawn again on
// every filter and a rebuild shuts a select that is open.
const key = agents.map((a) => `${a.id}:${a.name}`).join("\n");
@@ -430,8 +429,6 @@
select.value = String(state.filter.agent);
// A long name is cut at the rail's edge; the whole of it is a hover away.
select.title = select.selectedOptions[0]?.text || "";
} else if (agents.length === 1) {
$("#agent-one").textContent = agents[0].name;
} else if (state.agentsLoaded) {
$("#agent-none").innerHTML = `No search agent is enabled, so nothing is ranked.
<a href="/settings/agents">Search agents</a> sets one up.`;