Companies and Searches: follow, hide not mute, prune moved, one row style
Companies gets a Follow-a-company form, a combined affinity/on-off filter, and one .srow-style row per company (name, board or "from searches", open roles, on/off switch, affinity). The prune-by-region tool moves here from Searches, folded under the list in a <details>. The lede states the difference between switching a board off (stops reading it, closes its roles) and hiding a company (keeps reading it, keeps its roles out of the list and unscored). affinityControl becomes three icon toggles (favourite, like, hidden) instead of four letter buttons with a neutral one; pressing the pressed icon clears back to neutral. "Hidden" is the word everywhere the UI names affinity -1; the code keeps mute/hide_muted. CompanyOut carries each company's board subscription id and on-state, so the Companies page needs only /api/companies, not a second fetch of /api/sources. Setting a company's affinity now enqueues a score job, deduped by the queue to one run. Searches keeps only the search form and list, in the same row style; company boards and the prune tool left with it, and "Pull now" left for Pulls (package B3). Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
1 parent
7d31cca394
commit
55248555e9
8 files changed
+419
-318
No files matched your search
+16
-10
@@ -113,30 +113,36 @@
|
||||
return companies;
|
||||
}
|
||||
|
||||
/* Three icon toggles, not four: there is no button for neutral, since
|
||||
pressing the one that is already pressed is how a company gets back to
|
||||
it. "Hidden" is the word for -1 everywhere the UI names it, even though
|
||||
the code and the API keep `mute`/`hide_muted` — a rename in the store
|
||||
and CLI is a separate, larger change than this control. */
|
||||
const AFFINITY_LEVELS = [
|
||||
{ value: -1, label: "Mute" },
|
||||
{ value: 0, label: "Neutral" },
|
||||
{ value: 1, label: "Like" },
|
||||
{ value: 2, label: "Favourite" },
|
||||
{ value: 2, icon: "★", label: "Favourite" }, // ★
|
||||
{ value: 1, icon: "▲", label: "Like" }, // ▲
|
||||
{ value: -1, icon: "⦸", label: "Hidden" }, // ⊘
|
||||
];
|
||||
|
||||
/* The four buttons. `onChange` runs after the server accepted the change,
|
||||
so each page decides what a change means for it: the role list refetches,
|
||||
since muting changes which roles come back, and the company table redraws. */
|
||||
/* `onChange` runs after the server accepted the change, so each page
|
||||
decides what a change means for it: the role list refetches, since a
|
||||
hidden company's roles come out of it, and the company list redraws. */
|
||||
function affinityControl(companyKey, current, onChange) {
|
||||
const span = document.createElement("span");
|
||||
span.className = "affinity";
|
||||
span.setAttribute("role", "group");
|
||||
span.setAttribute("aria-label", "Company affinity");
|
||||
for (const level of AFFINITY_LEVELS) {
|
||||
const pressed = level.value === current;
|
||||
const button = document.createElement("button");
|
||||
button.type = "button";
|
||||
button.dataset.value = String(level.value);
|
||||
button.textContent = level.label[0];
|
||||
button.textContent = level.icon;
|
||||
button.title = level.label;
|
||||
button.setAttribute("aria-label", level.label);
|
||||
button.setAttribute("aria-pressed", String(level.value === current));
|
||||
button.addEventListener("click", () => setAffinity(companyKey, level.value, onChange));
|
||||
button.setAttribute("aria-pressed", String(pressed));
|
||||
button.addEventListener("click", () =>
|
||||
setAffinity(companyKey, pressed ? 0 : level.value, onChange));
|
||||
span.appendChild(button);
|
||||
}
|
||||
return span;
|
||||
|
||||
Reference in new issue
Block a user