Order a role's buttons ▼ ● ▲ ★ and like a role when it is saved
The company control follows as ⊘ ▲ ★, so like and favourite sit together. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
bf6ef72b15
commit
17e7615599
5 files changed
+18
-12
No files matched your search
+7
-4
@@ -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);
|
||||
|
||||
Reference in new issue
Block a user