Repository navigation
feat(atlas): project dashboards — a paged manager dashboard and an admin overview - #1029
Conversation
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]>
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]>
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
|
🚅 Deployed to the SahajCloud-pr-1029 environment in sahajcloud
1 service not affected by this PR
|
|
🤖 no session running recent dispatchesWritten by the sydevs dispatcher. Sessions never edit this comment. |
sydevs-bot
left a comment
There was a problem hiding this comment.
🧐 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—publishedstops 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 onverificationStage.tests/int/atlas-dashboard.int.spec.ts:133.
What was checked
OrganiserHome.tsxwhole:groups.publishedfeeds the summary alone, andFILTERShas no published tab, so tab counts are untouched.DEFAULT_VERIFICATION_STAGEisverified, so a newly saved draft still lands indraftsand the Drafts empty state stays true.excludeFinishedEventsandsyncVerificationOnSave: the public feeds key onschedule.lastDate, not the stage (#603).grep '<h1'oversrc/componentsandsrc/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 & Smokeis green on340cbc5, 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
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
|
Both review findings adopted. Pushed at eabe479.
Base Lean gate ✓, 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
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
…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]>
- 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]>
…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
|
Merged
Lean gate green, plus 🤖 Written by the sydevs autonomous loop — see what this is Generated by Claude Code |
Summary
Each project gets its own admin dashboard.
views.dashboardis 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
PaginationandPerPage(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:
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
Each dashboard folder has the same shape:
index.tsxloads and renders,data.tsis the loader,<Folder>View.tsxrenders the data, plus<Folder>.module.css.AtlasManageraddsmodel.tsfor what its client view and loader share.Flow: which project a manager is in
Data
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
isManagerInAtlasProjectbecomesisManager(user, project?), besideisAdminManager. 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:NAV_LINKS(AdminNavLinks/links.ts) is the one name and address of each sidebar link, and the dashboards link toNAV_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.FathomDashboardmoves next toAnalyticsView, its only consumer.Testing
pnpm lint,pnpm format:check,pnpm typecheck,pnpm typecheck:testsandpnpm test:unitall pass (232 files, 2938 tests).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-sidebarandevents.🤖 Generated with Claude Code