Merge the remote pages: scope line, Remote select, remote chips and badge (wp-remote-b)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	app/static/agents.js
This commit is contained in:
Wolf committed 2026-09-30 16:22:22 +02:00
commit 5c3c187dca
7 files changed
+383 -86

No files matched your search

+14 -7
View File
@@ -85,7 +85,7 @@
"use strict";
const { api, esc, debounce, safeUrl, companies, loadCompanies, affinityControl, overridesControl,
judgeButtons, loadTracked, chipInput } = window;
judgeButtons, loadTracked, chipInput, remoteHelpers } = window;
const $ = (sel, root = document) => root.querySelector(sel);
// Below this the rail is over the feed rather than beside it, and the reader
@@ -128,8 +128,10 @@
};
// The place suggestion's kind, as its hint says it: a `place:` token is a
// town (`places.suggest`).
const PLACE_KINDS = { country: "country", region: "region", place: "town" };
// town, a `remote:` token remote roles (`remote:any` within the viewing
// agent's scope, `remote:country:DK` those a person there can take), its
// count the roles it would find (`places.suggest`).
const PLACE_KINDS = { country: "country", region: "region", place: "town", remote: "remote" };
// Everything `clearFilters` has to put back, in one place, so a new filter
// added here cannot be forgotten there. `company` and `place` are the
@@ -890,7 +892,7 @@
/** Closed, pay, remote, function and seniority, as the row and the reader
both show them. */
function badges(role) {
const words = [role.remote, role.function, role.seniority].filter(Boolean);
const words = [remoteHelpers.remoteBadge(role), role.function, role.seniority].filter(Boolean);
const pay = payBadge(role);
return (role.closed_at ? `<span class="badge closed">closed</span>` : "")
+ (pay ? `<span class="badge">${esc(pay)}</span>` : "")
@@ -1659,11 +1661,16 @@
placeholder: "Company", label: "Company",
});
placeChips = chipInput($("#f-place"), {
suggest: (q) => api(`/api/suggest/places?${new URLSearchParams({ q })}`)
.then((rows) => rows.map((s) => ({
suggest: (q) => {
// The viewing agent, so "Remote" counts the remote roles within its
// scope; the server may ignore it.
const p = new URLSearchParams({ q });
if (state.filter.agent !== null) p.set("agent", String(state.filter.agent));
return api(`/api/suggest/places?${p}`).then((rows) => rows.map((s) => ({
value: s.token, label: s.label,
hint: `${PLACE_KINDS[s.kind] || s.kind} · ${number.format(s.count)}`,
}))),
})));
},
onChange: (items) => {
items.forEach((i) => placeLabels.set(i.value, i.label));
setFilter({ places: items.map((i) => i.value) });