Skip to content

feat(atlas): project dashboards — a paged manager dashboard and an admin overview - #1029

Merged
sydevs-bot merged 33 commits into
mainfrom
claude/fix-1017-dashboard-review
Oct 27, 2026
Merged

sydevs-bot merged 33 commits into
mainfrom
claude/fix-1017-dashboard-review

Conversation

@sydevs-bot

@sydevs-bot sydevs-bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Each project gets its own admin dashboard. views.dashboard is a view this repo composes, in place of Payload's widget grid. In Sahaj Atlas, a manager gets "Your programs" (AtlasManager) and an admin gets a map-wide overview (AtlasAdmin). A project with no dashboard of its own shows a notice, and All Content keeps Payload's collection cards.

  • The manager dashboard pages. Tabs (All / Needs review / Drafts), page and page size live in the URL, using Payload's Pagination and PerPage (50 per page). Programs are ordered urgent first and finished last, newest edit first within each group, and that order holds across pages.

  • Admins get an overview, not every event. It shows:

    • verification health by stage;
    • a Needs attention row: events nobody has adopted, countries with no manager, and public proposals awaiting review;
    • recent changes.

    Every count opens Payload's list view filtered to its rows.

  • One owner decides which projects a manager can reach and which one they're in, and both server and browser use it. A manager reaches their roles' projects, plus Sahaj Atlas once any event is assigned to them. With exactly one reachable project, they are moved into it from every admin page. A saved project they can no longer reach is not shown.

  • Supersedes feat(atlas): give program organisers their own dashboard #1017, whose commits this branch carries.

Change outline

Flow: which dashboard a user gets

+DashboardView                                    src/components/admin/Dashboard/DashboardView.tsx
+  dashboardChoiceFor(req.user)                   # same file; its only consumer
+    resolveProject(user).project                 src/plugins/access/config/currentProject.ts
+      'sahaj-atlas', admin    → AtlasAdmin       Dashboard/AtlasAdmin/
+      'sahaj-atlas', manager  → AtlasManager     Dashboard/AtlasManager/
+      other project           → CenteredNotice   # "no dashboard yet"
+      none, manager           → ProjectSelectionPrompt
+      none, admin             → CollectionCards  # All Content

Each dashboard folder has the same shape: index.tsx loads and renders, data.ts is the loader, <Folder>View.tsx renders the data, plus <Folder>.module.css. AtlasManager adds model.ts for what its client view and loader share.

Flow: which project a manager is in

+getManagerProjects(user)          roles' projects ∪ sahaj-atlas when the managedEvents join has docs
+resolveProject(user)              admin → stored | reachable stored → keep | one reachable → move (persist) | else → choose
+  read by: dashboardChoiceFor, isManager(user, project) → AtlasNav, ProjectSelector, ProjectSelectionPrompt, ProjectProvider
+ProjectProvider (wraps every admin page)
+  persist → useSwitchProject(project)       POST set-project, then router.refresh() (or /admin if the open collection hides)
+  failure → toast, then retry on the next navigation

Data

+getAtlasManagerData(req, query)    Events update scope, overrideAccess: false
+  every program in scope: id, stage, status, updatedAt only     # a region subtree keeps this small
+  sortPrograms by STAGES[stage].rank, then newest edit → filter by tab → paginate
+  the page shown reads its latest drafts: title, place, unpublished changes
+getAtlasAdminData(req)             counts per stage, unadopted events, countries with no manager,
+                                   proposals awaiting review; 10 most recent edits

A Postgres enum sorts in declaration order, and the lifecycle order is not the review order. Sorting in the database would therefore need a stored rank column. Sorting four columns in memory avoids the column, its save hook and a migration.

Smaller changes

  • isManagerInAtlasProject becomes isManager(user, project?), beside isAdminManager. It also replaces four inline manager checks in the access layer, the event import and the region create hook.
  • CenteredNotice (src/components/admin/CenteredNotice/) replaces the hand-styled cards for:
    • the "no dashboard" notice;
    • the project selection prompt;
    • both of the manager dashboard's empty states.
  • NAV_LINKS (AdminNavLinks/links.ts) is the one name and address of each sidebar link, and the dashboards link to NAV_LINKS.map. It sits next to the browser-only ('use client') component rather than inside it, so server components can read it as a plain value.
  • FathomDashboard moves next to AnalyticsView, its only consumer.
  • Tables across the CMS have ruled rows in a bordered frame instead of zebra stripes. Condensed relationship and join tables keep Payload's own grid.

Testing

  • pnpm lint, pnpm format:check, pnpm typecheck, pnpm typecheck:tests and pnpm test:unit all pass (232 files, 2938 tests).
  • Integration specs, run one at a time, all pass:
    • atlas-manager: paging keeps the unpaged order, and a page past the end clamps to the last page.
    • atlas-admin: unadopted events, countries with no manager and open proposals are counted correctly.
    • role-based-access, event-imports, atlas-sidebar and events.
  • Checked in a browser against seeded data:
    • A manager's dashboard pages at 10 per page and keeps the tab in the URL.
    • A manager with no role and one assigned event lands on the Atlas dashboard.
    • An admin in Sahaj Atlas gets the overview, and its Urgent card opens the filtered Events list.

🤖 Generated with Claude Code

antontcymbal and others added 10 commits October 23, 2026 22:11
Atlas managers working in the Sahaj Atlas project now land on "Your
programs" instead of collection cards: their programs in one native
Payload table, draft and review states, filters, and buttons to add a
program or open the public map. Admins and other projects keep the
collection cards.

The program list uses the Events collection's update access, so it shows
exactly what the organiser can edit. "Add new program" follows the
create access. A small shared theme layer in custom.scss gives headings,
secondary buttons, field labels and tables more room across the admin.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
- Use the existing admin/helpers/tableColumn instead of a copy.
- One isAtlasOrganiser in admin/helpers, shared by AtlasNav and the home.
- Program status, sort and tab groups come from one typed stage map;
  counts are derived once on the client instead of twice.
- Read latest and published events concurrently, each on its own req copy.
- Drop AdminNavLinks' unused `disabled` prop.
- Narrow `.empty span`, which also hit the Button's inner spans, and keep
  Payload's bolder active list tab by not overriding tab button weight.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The beforeDashboard fallback built its request from the `user` prop, which
Payload has run through a field read: that flattens a manager's per-locale
roles, and docs/rules/access.md calls that shape wrong for deciding access.
It now re-authenticates, only when the fallback actually renders.

The two access checks in the data loader also run concurrently, so each now
gets its own request copy, as the concurrent-read rule asks.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The dashboard adds one unit spec, and perf-figures-pinned holds PERF.md and
its consumer docs to the count on disk.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The `.table` treatment sat unlayered in custom.scss, so it beat Payload's
own `@layer payload-default` rules on every table in the CMS — collection
lists, relationship tables and version history in both projects. Its
`tbody tr:nth-child(odd) { background: transparent }` removed the zebra
striping those lists ship with, which no part of this change asked for.

Scoped to `.home` in the organiser home's own module stylesheet instead.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Df8v5sXTeSzZWUgVXCfbeS
The bare `h1` rule was unlayered, so its hardcoded `clamp()` and
`letter-spacing` replaced Payload's own type scale for every heading in
the panel, modal and drawer headings included. `docs/rules/admin-ui.md`
asks for Payload CSS variables rather than hardcoded sizes.

The organiser home is the one page that wanted the larger heading, so the
rule moves to its header. The two button rules stay in custom.scss: both
set Payload variables rather than overriding a declaration.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Df8v5sXTeSzZWUgVXCfbeS
`review` was derived from `needsConfirmation` while `drafts` and
`published` were derived from the draft flag, so a program needing review
landed in two groups. The summary line adds the three together: four
programs read "1 published · 2 drafts · 2 awaiting review", and a live
program needing review was pilled "Needs review" while the summary called
it published.

All three now key on `programStatus`, which is already the single answer
the pills render, so the groups are disjoint and the filter tabs agree
with the pill on every row.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Df8v5sXTeSzZWUgVXCfbeS
`needsAtlasDashboardFallback` matches saved widget ids against
`${ATLAS_PROGRAMS_WIDGET}-`, so a literal that drifts from the constant
switches the preference fallback off with nothing to notice it. The config
already imports from that module.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Df8v5sXTeSzZWUgVXCfbeS
@railway-app

railway-app Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

🚅 Deployed to the SahajCloud-pr-1029 environment in sahajcloud

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Oct 27, 2026 at 1:14 am UTC
1 service not affected by this PR
  • mailpit

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1029 October 24, 2026 23:08 Destroyed
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 24, 2026
@sydevs-bot

sydevs-bot commented Oct 24, 2026 •

Copy link
Copy Markdown
Contributor Author

🤖 no session running
CI fix 1

recent dispatches
  • 01:01Z resolve-conflicts · attempt 1 · session · done
  • 01:01Z resolve-conflicts · attempt 1 · session
  • 21:04Z fix-ci · attempt 1 · session · done
  • 21:04Z fix-ci · attempt 1 · session
  • 23:26Z address-review · attempt 1 · session · done

Written by the sydevs dispatcher. Sessions never edit this comment.

@sydevs-bot sydevs-bot left a comment

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧐 Adversarial review

Both problems are real and the diff is no bigger than either. The two global rules go back out — main...feat/atlas-organiser-dashboard confirms #1017 added both — and the three counts become one partition keyed on the programStatus every pill already reads.

One cost went unnamed: making them disjoint changed what "published" means to an organiser, and the summary line is that number's only reader.

Findings

  • should-fix — published stops counting a live program awaiting review, which is still publicly listed. src/components/admin/AtlasDashboard/model.ts:68.
  • consider — the int case named for the draft-vs-live distinction now turns on verificationStage. tests/int/atlas-dashboard.int.spec.ts:133.

What was checked

  • OrganiserHome.tsx whole: groups.published feeds the summary alone, and FILTERS has no published tab, so tab counts are untouched.
  • DEFAULT_VERIFICATION_STAGE is verified, so a newly saved draft still lands in drafts and the Drafts empty state stays true.
  • excludeFinishedEvents and syncVerificationOnSave: the public feeds key on schedule.lastDate, not the stage (#603).
  • grep '<h1' over src/components and src/app — the home is the only admin view that wanted the larger scale.
  • Preview: the managers list and editor both open. The home's own table could not be checked, for the reason the body gives.
  • Lint, Test & Smoke is green on 340cbc5, so the body's "no CI for either PR" no longer holds here.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

Comment thread tests/int/atlas-dashboard.int.spec.ts Resolved
@sydevs-bot sydevs-bot added bot:working Lock: a cloud session is running on this item. Removed when it ends. and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 24, 2026
sydevs-bot and others added 2 commits October 24, 2026 23:29
Making the three summary counts disjoint moved a published program
awaiting review out of "published", but that program is still on the
public map: the client feeds filter `schedule.lastDate` and `_status`,
never `verificationStage` (#603, `excludeFinishedEvents`). An organiser
with five live classes, two reminded, reads "3 published" and could take
the other two for unpublished drafts.

The pills already agree with the counts, so the footnote carries the
rule rather than the counts changing.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Qs3FNLfTXCqjUuTJq7n6sb
The case is named for the never-published-vs-live distinction, but the
only draft it saw was `ownId`, which `programGroups` puts in `review`
for its urgent stage. So `expect(groups.drafts).toEqual([])` held for a
reason the case's name does not claim, and nothing asserted that a
never-published draft reaches `drafts` at all.

A verified draft of its own carries that half. Watched failing with the
fixture's stage set to `urgent`: `drafts` came back empty.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Qs3FNLfTXCqjUuTJq7n6sb
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1029 October 24, 2026 23:34 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Both review findings adopted. Pushed at eabe479.

Base feat/atlas-organiser-dashboard was already current, so there is no merge commit.

Lean gate ✓, pnpm format:check ✓, atlas-dashboard.int.spec.ts 6 passed. Body refreshed: the outline carries the footnote, and the stale "no CI for either PR" note is gone.

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot removed the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 24, 2026
@sydevs-bot
sydevs-bot marked this pull request as ready for review October 24, 2026 23:49
@sydevs-bot
sydevs-bot requested a review from Ardnived October 24, 2026 23:49
The organiser home shipped as an `admin.dashboard` widget with a
function-form `defaultLayout`. That put one project's home in every
project's dashboard: the widget is global, a layout a user saves in one
project is one preference key for all of them, and `PreferenceFallback`
existed only to re-add the home above such a layout.

Register `views.dashboard` instead, so the admin homepage is composed here
rather than assembled from widgets. `dashboardChoiceFor` owns the branch and
reads `currentProject` alone — no role — so an admin working in a project
sees what its managers see. Sahaj Atlas gets the programs home; a project
with no dashboard of its own falls through to a placeholder, which is why no
project list is spelled out in the view. `currentProject: null` stays the
admin "All Content" view and keeps Payload's collection cards.

`ProjectSelectionPrompt` moves out of `beforeDashboard` and into that same
branch, for a manager who has chosen no project. It no longer re-derives
when to appear.

With no widget grid there is nothing to lay out or fall back from, so
`PreferenceFallback`, `atlasDashboardLayout`, `needsAtlasDashboardFallback`
and `ATLAS_PROGRAMS_WIDGET` all go, along with the second `payload.auth()`
per dashboard load that the fallback needed. The loader drops its own role
gate too: the Events `update` scope is regions and assignment, so it answers
the same whatever project is selected — containment is the view's, and the
integration spec now pins that rather than asserting a gate that was never
the project's.

`isAtlasOrganiser` becomes `isManagerInAtlasProject`, which says what it
checks: the sidebar needs `type` so an admin keeps `DefaultNav`, and it
tests no role, so it was never a check for `atlas-manager`.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01Swa9Nt8WCjPxboMASdgkYy
@Ardnived Ardnived changed the title refactor(admin): give each project its own dashboard view feat(atlas): project dashboards — a paged manager home and an admin overview Oct 26, 2026
@Ardnived
Ardnived changed the base branch from feat/atlas-organiser-dashboard to main October 26, 2026 21:54
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1029 October 26, 2026 21:54 Destroyed
@sydevs-bot
sydevs-bot enabled auto-merge October 26, 2026 22:10
…one folder shape

verificationRank is gone, with its field hook and migration. The manager home
reads the four columns that order and count every program in scope, sorts
them by each stage's rank, and pages that list, reading drafts only for the
page shown. A Postgres enum sorts in declaration order, and the lifecycle
order is not the review order, so sorting in the database needed the stored
column; a region subtree keeps the in-memory list small.

- Dashboard/AtlasDashboard becomes AtlasManagerHome, matching AtlasAdminHome.
  Each home is index.tsx (load and render), data.ts, <Folder>View.tsx and
  <Folder>.module.css.
- ProjectPlaceholder is gone: DashboardView renders its CenteredNotice
  inline, under the choice kind no-dashboard.
- CenteredNotice moves to its own folder, and FathomDashboard moves beside
  AnalyticsView, its only consumer.
- The admin home combines unowned work and proposals into "Needs attention",
  and counts countries with no manager rather than regions: a region with no
  manager of its own is still covered by its ancestors'.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1029 October 27, 2026 00:11 Destroyed
- AtlasAdminHome and AtlasManagerHome become AtlasAdmin and AtlasManager,
  their files and types renamed to match.
- dashboardChoiceFor moves into DashboardView.tsx, its only consumer; its
  unit spec mocks Payload's UI package, which imports stylesheets the unit
  lane cannot load.
- PUBLIC_MAP_LINK is gone: the dashboards read NAV_LINKS.map.
- NAV_LINKS moves from helpers/ to AdminNavLinks/links.ts, beside the
  component it belongs to; AdminNavLinks becomes a folder so the constant
  can stay out of its 'use client' module.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@Ardnived Ardnived changed the title feat(atlas): project dashboards — a paged manager home and an admin overview feat(atlas): project dashboards — a paged manager dashboard and an admin overview Oct 27, 2026
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1029 October 27, 2026 00:30 Destroyed
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 27, 2026
@sydevs-bot sydevs-bot moved this from Revising to Approved in SYDevelopers Technical Roadmap Oct 27, 2026
@github-merge-queue
github-merge-queue Bot removed this pull request from the merge queue due to a conflict with the base branch Oct 27, 2026
@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 27, 2026
…oard-review

#999 landed on main and scopes a manager's meditation write to the
editor's language. It added two helpers to accessConfigs.ts, one of
which this branch had deleted.

- src/plugins/access/accessConfigs.ts: both behaviours kept.
  scopesWritesByLocale comes in from main; isActiveNonAdminManager stays
  deleted, since isManager(user) is the same predicate this branch
  replaced it with. Main's new locale-scoping branch now calls isManager.
- tests/PERF.md: main's relabelled session table, which names each row's
  PR, plus this branch's M4 Max row that the relabelling did not carry,
  plus this merge's own measurement.
- AGENTS.md, tests/AGENTS.md, docs/rules/testing-reqs.md, tests/PERF.md:
  the spec counts are re-measured on the merged tree — 233 files, 2955
  tests — rather than taken from either side.

Co-Authored-By: Claude Opus 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01KB7PQUYpCZV66BMZmRLMLh
@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1029 October 27, 2026 01:10 Destroyed
@sydevs-bot

Copy link
Copy Markdown
Contributor Author

Merged main and resolved five conflicts. One is semantic:

src/plugins/access/accessConfigs.ts — #999 added scopesWritesByLocale and kept isActiveNonAdminManager, which this branch had deleted. Both behaviours are kept: the new helper comes in, the deleted one stays deleted, and #999's locale-scoping branch now calls isManager(req.user) — the same predicate, since isManager with no project tests exactly type === 'manager'.

tests/PERF.md — took main's relabelled session table, which names each row's PR, then re-added this branch's M4 Max row that the relabelling dropped.

AGENTS.md, tests/AGENTS.md, docs/rules/testing-reqs.md, tests/PERF.md — the spec counts were re-measured on the merged tree rather than taken from either side: 233 files, 2955 tests.

Lean gate green, plus role-based-access (81 cases).

🤖 Written by the sydevs autonomous loop — see what this is


Generated by Claude Code

@sydevs-bot sydevs-bot added awaiting and removed bot:working Lock: a cloud session is running on this item. Removed when it ends. labels Oct 27, 2026
@sydevs-bot
sydevs-bot added this pull request to the merge queue Oct 27, 2026
Merged via the queue into main with commit 1cb7d20 Oct 27, 2026
22 checks passed
@sydevs-bot
sydevs-bot deleted the claude/fix-1017-dashboard-review branch October 27, 2026 01:40
@sydevs-bot sydevs-bot moved this from Approved to Done in SYDevelopers Technical Roadmap Oct 27, 2026

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1029 — 4a4c2e3e Deployed Oct 27, 2026 by railway-app[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

4 participants