diff --git a/docs/superpowers/plans/2026-09-11-site-scope.md b/docs/superpowers/plans/2026-09-11-site-scope.md index 4d3a73a..4d725d6 100644 --- a/docs/superpowers/plans/2026-09-11-site-scope.md +++ b/docs/superpowers/plans/2026-09-11-site-scope.md @@ -10,16 +10,23 @@ **Spec:** `docs/superpowers/specs/2026-09-11-site-scope-switcher-design.md` -> ### Line numbers in this plan will have drifted +> ### Progress, and how to read the line numbers > -> A separate "project Month/Week" feature is landing in several of the -> same files (it added a `periodFilter` beside `projectFilter` in three of -> the four view files, already shifting them by ~10 lines). **Treat every -> `file:line` below as a hint, not an address.** The dropdown-removal -> steps are written to anchor on identifier names and code snippets for -> exactly this reason — match on the name, then check the surrounding -> code looks like the snippet. If it doesn't, stop and re-read the file -> rather than editing by line number. +> **Tasks 1-5 are already implemented and committed** (`8fe08fa`, +> `38ad190`, `c88ebb1`, `63eb8ed`, plus the `Topbar` wiring now visible at +> `src/components/layout/sidebar.tsx:295,302`). Start at **Task 6**. Do not +> redo 1-5; read them only for the helper signatures they established. +> +> Every `file:line` below was re-verified against `main` at **`6609ce8`**. +> Three were stale and are now corrected: the Overview line ranges in +> Task 6, the hamburger line in Task 5, and a claim that +> `plant/page.tsx` still had `perPage: 5000` caps (it does not). +> +> **Still treat every `file:line` as a hint, not an address.** The +> dropdown-removal steps deliberately anchor on identifier names and code +> snippets: match on the name, then check the surrounding code looks like +> the snippet. If it doesn't, the file has moved on — re-read it rather +> than editing by line number. --- @@ -836,7 +843,7 @@ export function Topbar({ title, subtitle, right }: { title: string; subtitle?: s

{title}

{subtitle &&

{subtitle}

} {/* Mobile: the scope pill gets its own row. The hamburger is - position:fixed over the topbar's left edge (line 252), so + position:fixed over the topbar's left edge (line 256), so the two would otherwise compete for that space. */}
@@ -911,7 +918,7 @@ import { - [ ] **Step 2: Replace the capped sites read and filter every collection** -In the `Promise.all` at `src/app/dashboard/page.tsx:64-88`, replace the five reads with: +In the `Promise.all` at `src/app/dashboard/page.tsx:72-89`, replace the five reads with: ```tsx // getFullList, not getList(1, 50) — the cap silently dropped site 51+ @@ -944,7 +951,7 @@ In the `Promise.all` at `src/app/dashboard/page.tsx:64-88`, replace the five rea Note the `sites` read filters on `id`, not `site` — it *is* the sites collection. `siteFilter()` is wrong there by construction, which is why it is spelled out. -Then apply `siteF` to the four single-row counts below it (`src/app/dashboard/page.tsx:89-106`): +Then apply `siteF` to the four single-row counts below it (`src/app/dashboard/page.tsx:92-106`): ```tsx const casuals = await pb @@ -966,9 +973,31 @@ Then apply `siteF` to the four single-row counts below it (`src/app/dashboard/pa `sites` is now an array, not a list response. Update the three call sites flagged in the assessment: -- `src/app/dashboard/page.tsx:112-113` — `for (const s of sites.items)` becomes `for (const s of sites)`. -- `src/app/dashboard/page.tsx:157` — `sites.items.length` becomes `sites.length`. -- `src/app/dashboard/page.tsx:191-193` — the `data.sites[0]?.name` sub-label: delete it. It was never meaningful with more than one site (assessment Tier 3.10), and with a scope switcher above it, it is actively misleading. +`sites` is now an array, not a list response. There are **four** +`sites.items` uses inside `loadOverview`, not two — all verified present: + +- `:134` — `for (const s of sites.items) siteById.set(s.id, s);` becomes `for (const s of sites)`. +- `:185` — the returned `sites: sites.items,` becomes just `sites,`. +- `:204` — `okSiteCount: sites.items.length - problemSites.length` becomes `sites.length - problemSites.length`. +- `:206` — `rain: await loadRainOutlook(sites.items),` becomes `loadRainOutlook(sites)`. + +Then the misleading "Sites" sub-label. This plan originally said to +delete `sub: data.sites[0]?.name ?? "No sites yet",` outright (assessment +Tier 3.10). **As implemented it was made scope-aware instead, which is +better — keep it:** + +```tsx +sub: scope.mode === "all" ? "Across every site" : data.sites[0]?.name ?? "No sites yet", +``` + +Under a single-site scope `data.sites` holds exactly that one site, so +`data.sites[0]?.name` is correct rather than arbitrary; the only broken +case was "all", and that now reads "Across every site". Do not revert +this to a deletion. + +The other `data.sites` uses (`:216`, and the list at `:315`, `:318`, +`:322`) need **no change** — `data.sites` was already an array on the +consuming side and stays one. Grep to be sure nothing is missed: @@ -1031,7 +1060,7 @@ export default async function Page({ searchParams }: { searchParams: Promise