From 17e7615599136c7bac51204f6dda1b14973433a0 Mon Sep 17 00:00:00 2001 From: Wolf Date: Wed, 30 Sep 2026 21:06:11 +0200 Subject: [PATCH] =?UTF-8?q?Order=20a=20role's=20buttons=20=E2=96=BC=20?= =?UTF-8?q?=E2=97=8F=20=E2=96=B2=20=E2=98=85=20and=20like=20a=20role=20whe?= =?UTF-8?q?n=20it=20is=20saved?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The company control follows as ⊘ ▲ ★, so like and favourite sit together. Co-Authored-By: Claude Opus 5.5 --- app/static/app.css | 2 +- app/static/app.js | 7 ++++--- app/static/judge.js | 11 +++++++---- app/static/roles.js | 8 ++++---- docs/decisions.md | 2 ++ 5 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/static/app.css b/app/static/app.css index 43ce7cd..9c83a62 100644 --- a/app/static/app.css +++ b/app/static/app.css @@ -809,7 +809,7 @@ body[data-reader="open"] .company-strip { display: none; } .empty { padding: 4rem 0; max-width: 34rem; color: var(--dim); } .empty h2 { font-size: 1.2rem; font-weight: 600; color: var(--fg); margin: 0 0 .4rem; } -/* ▲ ● ▼ ★, on a row and in the reader's bar (static/judge.js). */ +/* ▼ ● ▲ ★, on a row and in the reader's bar (static/judge.js). */ .judge { display: flex; gap: .15rem; align-items: center; } .judge button { padding: .2rem .45rem; font-size: 1rem; line-height: 1; diff --git a/app/static/app.js b/app/static/app.js index 4f31f50..3c7ca7b 100644 --- a/app/static/app.js +++ b/app/static/app.js @@ -136,11 +136,12 @@ 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. */ + and CLI is a separate, larger change than this control. Low to high, as + the role's ▼ ● ▲ ★, so like and favourite sit together on the right. */ const AFFINITY_LEVELS = [ - { value: 2, icon: "★", label: "Favourite" }, // ★ - { value: 1, icon: "▲", label: "Like" }, // ▲ { value: -1, icon: "⦸", label: "Hidden" }, // ⊘ + { value: 1, icon: "▲", label: "Like" }, // ▲ + { value: 2, icon: "★", label: "Favourite" }, // ★ ]; /* `onChange` runs after the server accepted the change, so each page diff --git a/app/static/judge.js b/app/static/judge.js index ef2f028..36cd200 100644 --- a/app/static/judge.js +++ b/app/static/judge.js @@ -1,4 +1,4 @@ -/* ▲ ● ▼ ★ for one role: the feed row and the reader bar share them. +/* ▼ ● ▲ ★ for one role: the feed row and the reader bar share them. * * news's `voteButtons`, `starButton` and `vote()`, adapted. Three stances and * no stance is four states from three buttons; pressing the stance a role @@ -9,7 +9,9 @@ * ★ is Save. It files the role under Applications (`POST /api/applications`) * and, pressed again, takes it back out (`DELETE /api/applications/{id}`), * which the server allows only while the application is still at `saved`; a - * 409 is toasted by `api()` and the star stays lit. + * 409 is toasted by `api()` and the star stays lit. A save also casts ▲ for + * the agent, unless it is cast already, since a starred role is a liked one; + * an unsave leaves the vote alone. ▲ sits next to ★ for that reason. * * Both are optimistic: the button changes before the request and changes back * if it fails. `api()` has already toasted the failure by then. @@ -63,9 +65,9 @@ } const STANCES = [ - { value: 1, cls: "up", glyph: "▲", said: "Like" }, - { value: 0, cls: "mid", glyph: "●", said: "Neither way" }, { value: -1, cls: "down", glyph: "▼", said: "Pass" }, + { value: 0, cls: "mid", glyph: "●", said: "Neither way" }, + { value: 1, cls: "up", glyph: "▲", said: "Like" }, ]; function button(cls, glyph) { @@ -150,6 +152,7 @@ tracked.set(role.uid, await api("/api/applications", { method: "POST", body: { role_uid: role.uid, status: "saved" }, })); + if (role.vote !== 1) vote(1); } } catch (err) { if (before) tracked.set(role.uid, before); diff --git a/app/static/roles.js b/app/static/roles.js index d9f1f49..f2da6e7 100644 --- a/app/static/roles.js +++ b/app/static/roles.js @@ -11,7 +11,7 @@ * A row is newsdesk's `.row`: the score gutter and number (hidden under * Newest first, since the score is not what put the row there), the title, * company · place · badges · age · tags, the summary or the description's - * opening, and ▲ ● ▼ ★ from judge.js. A passed role and a hidden company's + * opening, and ▼ ● ▲ ★ from judge.js. A passed role and a hidden company's * are dimmed, never dropped, so a stray tap stays visible to be undone. * * Opening a role pushes `/roles/{uid}`; closing goes back. Stepping with j/k @@ -62,7 +62,7 @@ * screen with that company as its one company chip (`?company_keys=`); a * plain click filters in place and pushes. With one company filtered a strip * over the feed names it, counts its roles, links its careers page and - * carries its ★ ▲ ⊘ for the viewing agent. `?company=`, `?company_keys=` and + * carries its ⊘ ▲ ★ for the viewing agent. `?company=`, `?company_keys=` and * `?agent=` are how the Companies and Search agents pages link in. * * Company and Place in the rail are chip inputs (chips.js) on the suggest @@ -1082,7 +1082,7 @@ /* With exactly one company filtered, which is where its name leads, a strip over the feed says whose roles these are and carries what is done - with a company from here: its careers page, and its ★ ▲ ⊘ for the viewing + with a company from here: its careers page, and its ⊘ ▲ ★ for the viewing agent, which is where a company is starred from. Built again only for another company or agent, since the feed is drawn on every page; the count and the affinity are patched. */ @@ -1407,7 +1407,7 @@ el.querySelector(".reader-body").scrollTop = scrolled; } - /* The company's ★ ▲ ⊘, the one place a company is judged outside the + /* The company's ⊘ ▲ ★, the one place a company is judged outside the Companies page, and its two fetch overrides beside them. A company seen only through a search has no row until its first change creates one, so the list is reloaded then, and the overrides, which need a row, wait for it. A diff --git a/docs/decisions.md b/docs/decisions.md index 384e5de..03006f2 100644 --- a/docs/decisions.md +++ b/docs/decisions.md @@ -276,6 +276,8 @@ What was decided for roledesk and the one reason for each. The longer reasoning **Read state is a column on `roles`, and a vote stamps it too.** `read_at` sits beside `vote`, the same shape as newsdesk's `items.read_at`, so the feed filters and counts by it directly rather than joining a side table on every page load. `set_vote` stamps it only when it is still NULL, since voting is reading in newsdesk as well; clearing a vote leaves it alone, because taking back an opinion is not un-reading the posting. +**A role's buttons run ▼ ● ▲ ★, and saving a role likes it.** The order is low to high, so ▲ sits beside ★. A role worth saving is a liked one, so `judge.js` casts ▲ for the viewing agent after a save that succeeded, unless ▲ is cast already. Unsaving leaves the vote alone, as clearing a vote leaves the read mark. This is done in the page, not in `POST /api/applications`, because an application belongs to no agent and a vote does. The company control follows the same order, ⊘ ▲ ★. + **Tags are a table, written only by `summarise`.** `role_tags(uid, tag)` follows newsdesk's `tags` table rather than a JSON array on `roles`, so `tag_counts` and the any/all filter are ordinary SQL (`GROUP BY`, `EXISTS`) instead of scanning every row's array. `summarise` already reads the whole posting once per role, so writing 3 to 8 tags alongside the summary costs no extra model call. **Tag filtering runs in SQL before `LIMIT`, the same as `hide_muted`.** An `EXISTS` or `COUNT(DISTINCT tag)` clause in `_roles_from` keeps the guarantee the muted-company exclusion already established: a filter narrows the rows a page is built from, not the page after it is already built, so a tag matching only older roles is not silently empty on page one.