Public: anyone can read this; the crew can change it.

/explore filters apps by 'changed this week' with a plain link chip #15123

Merged opened this

Check · Review · Land · Live done — Landed and live in production.

Merged

torque/forge:torque/15088-explore-filters-apps-by-changed-this-wee → main 4 commits fork 1 thread · 1 unresolved

  • Merged. torque/15088-explore-filters-apps-by-changed-this-wee was merged into main as 5f527c6.

Review

Sign in to review this change.
3 files changed +15 −3
docs/features/explore.md +1 −1
@@ -51,7 +51,7 @@ What a person filters on `/explore` an agent filters with the same words. Each f
5151 |---|---|---|---|
5252 | Best / Forks / Shipped / Liked / Use / Fresh / Newest | `sort=score` `forks` `ships` `likes` `use` `fresh` `new` (`name` by hand) | `?sort=forks` | `{ sort: "forks" }` |
5353 | All / Apps / People / Forges (admin) | `kind=app` `person` `forge` | `?kind=app` | `{ kind: "app" }` |
54 | Any time / Today / This week / This month | `since=1d` `7d` `30d` (`updated=` is the same; `week=1` is `7d`, and `updated`/`since` win beside it) | `?since=7d` | `{ since: "7d" }` |
54 | Any time / Today / This week / This month | `since=1d` `7d` `30d` (`updated=` is the same; `week=1` and `fresh=7` are `7d`, any other `fresh` is ignored, and `updated`/`since` win beside it) | `?since=7d` | `{ since: "7d" }` |
5555 | Show archived | `archived=yes` | `?archived=yes` | `{ archived: "yes" }` |
5656 | (owner link on a row) | `owner=name` | `?owner=name` | `{ owner: "name" }` |
5757 | (type it) at least N forks by people | `forks=3` (0–1000) | `?forks=3` | `{ forks: "3" }` |
src/actions/explore.ts +5 −2
@@ -172,8 +172,11 @@ export function exploreLineFrom(get: (name: string) => string | null | undefined
172172 if (key === "live") value = LIVE_WORDS[value.toLowerCase()] ?? "";
173173 if (value !== "") given.set(key, value);
174174 }
175 // `week=1` is `updated:7d`; any other value, and `updated`/`since` beside it, win or are ignored.
176 if (!given.has("updated") && (get("week") ?? "").trim() === "1") given.set("updated", "7d");
175 // `week=1` and `fresh=7` (#15088) are the same 7-day window; any other value is ignored, not an
176 // error.
177 if (!given.has("updated") && ((get("week") ?? "").trim() === "1" || (get("fresh") ?? "").trim() === "7")) {
178 given.set("updated", "7d");
outdated

Duplicates the week line above. Merge: if (!given.has("updated") && ((get("week") ?? "").trim() === "1" || (get("fresh") ?? "").trim() === "7")) given.set("updated", "7d");. And document fresh=7 in docs/features/explore.md.

179 }
177180 // A parameter wins: the same key typed in `q` is dropped, not left to the reader's order.
178181 const typed = cappedQuery(get("q"))
179182 .split(/\s+/)
test/explore-quick-filters.test.ts +9
@@ -81,6 +81,15 @@ test("week=1 keeps only apps changed in under 7 days", async () => {
8181 expect(names((await get("?kind=app&week=1")).html)).toEqual(["both", "weekonly"]);
8282 });
8383
84 test("fresh=7 is the same week; off and any other value narrow nothing (#15088)", async () => {
85 expect(names((await get("?kind=app&fresh=7")).html)).toEqual(["both", "weekonly"]);
86 const on = (await get("?kind=app&fresh=7")).html;
87 expect(link(on, "This week").tag).toContain('aria-current="page"');
88 // The chip toggles it off: following its link leaves the week out.
89 expect(names((await get(link(on, "Any time").href.replace("/explore", ""))).html)).toEqual(ALL);
90 for (const v of ["", "0", "8", "week", "-7", "7d"]) expect(names((await get(`?kind=app&fresh=${v}`)).html)).toEqual(ALL);
91 });
92
8493 test("both together intersect", async () => {
8594 expect(names((await get("?kind=app&live=1&week=1")).html)).toEqual(["both"]);
8695 });

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs