Skip to content

feat(atlas): give program organisers their own dashboard - #1017

Closed
antontcymbal wants to merge 6 commits into
mainfrom
feat/atlas-organiser-dashboard
Closed

antontcymbal wants to merge 6 commits into
mainfrom
feat/atlas-organiser-dashboard

Conversation

@antontcymbal

Copy link
Copy Markdown
Contributor

Summary

  • Atlas organisers land on "Your programs": their programs in one table, with review/draft states and filters.
  • The header has "Add new program" and a "View public map" button, as agreed on the 23 Oct call.
  • A small shared theme layer gives headings, secondary buttons, labels and tables more room.

Change outline

Flow — which dashboard a user gets

defaultLayout picks the widget per user. A layout saved before this widget existed beats defaultLayout, so a beforeDashboard fallback covers it.

 DashboardView                                         @payloadcms/next
+  beforeDashboard: PreferenceFallback                 src/components/admin/AtlasDashboard/PreferenceFallback.tsx
+    not isAtlasOrganiser(user) → nothing
+    saved dashboard-layout already has atlas-programs-* (or none saved) → nothing
+    payload.auth(headers)                             # the `user` prop has flattened per-locale roles
+    AtlasDashboardContent(req)
   ModularDashboard
-    defaultLayout: [collections]
+    defaultLayout: atlasDashboardLayout({ req })      src/components/admin/AtlasDashboard/model.ts
+      isAtlasOrganiser(req.user) → atlas-programs, else collections
+    widget atlas-programs → AtlasDashboard            src/components/admin/AtlasDashboard/index.tsx
+      isAtlasOrganiser → AtlasDashboardContent, else CollectionCards

Flow — what the home lists

The list is the Events collection's own update scope, so it is exactly what the organiser can edit.

+getAtlasDashboardData(req)                            src/components/admin/AtlasDashboard/data.ts
+  access.update + access.create, concurrently         # each on its own localeIsolatedReq copy
+  update === false → { events: [] }
+  find events, draft: true, where: scope              # latest drafts
+  find events, draft: false, where: scope AND published
+    published copy's verificationStage wins           # a draft save must not hide an urgent live listing
+  sortPrograms: urgent → needs review → rest → finished, newest edit first

Components — the organiser home

Built from Payload's Table, Banner, Button, Pill and icons. Counts and tabs come from one programGroups, and status labels from one programStatus.

OrganiserHome                                         src/components/admin/AtlasDashboard/OrganiserHome.tsx
  header: "Your programs" + [View public map → /admin/map] + [Add new program, when create is allowed]
  summary line: published · drafts · awaiting review   # finished programs excluded
  Banner (warning), when any program needs review → [Review program]
  filter buttons: All / Needs review / Drafts, each with its count
  Table: Program (link, place, "Unpublished changes") | Status (Pill) | Next step (Button)
  empty states: first-program prompt, or "assigned programs appear here" without create access

Behaviour — the Atlas sidebar and nav

 AtlasNav                                             src/components/admin/AtlasNav/AtlasNav.tsx
-  user.type === 'manager' && currentProject === 'sahaj-atlas'
+  isAtlasOrganiser(user)                             src/components/admin/helpers/isAtlasOrganiser.ts
 AtlasSidebar
-  <AdminNavLinks disabled={['dashboard']} />
+  <AdminNavLinks />                                  # organisers now get the Dashboard link
-  New Event when regions.length > 0
+  New Event when permissions.collections.events.create

Preview

The preview's seeded user is an admin, so it sees the collection cards. Seeing the organiser home needs a managers row of type: 'manager' with the atlas-manager role and Sahaj Atlas selected.

Test results

  • Lean gate: ✓ lint, typecheck, test-suite typecheck, unit lane (225 files / 2890 tests)
  • Targeted specs: atlas-dashboard.int.spec.ts 6 passed, atlas-dashboard-model.spec.ts 3 passed
  • pnpm format:check: ✓
  • Build: N/A (Railway builds the preview)

Manual verification

  1. As an Atlas manager with Sahaj Atlas selected, open /admin: "Your programs" lists your programs; "View public map" opens the map.
  2. Click "Needs review" and "Drafts": the counts match the rows, and an empty tab offers "Show all programs".
  3. As an admin, or in the We Meditate project, /admin still shows the collection cards.
  4. Open any collection list and edit form to judge the shared styling.

Notes for reviewer

  • Global CSS. You asked for CSS variables rather than overrides. The secondary-button rule and the button weight are Payload variables. The h1, label.field-label, .field-description and .table rules have no Payload variable behind them, so they are overrides. They are unlayered, so they also reach Payload's own h1s in modals and drawers, and every list loses its zebra stripes. Moving them into OrganiserHome.module.css is the alternative if you'd rather not restyle the whole CMS.
  • Saved layouts. PreferenceFallback parses Payload's unexported dashboard-layout preference shape and its ${slug}-${index} widget ids, in an @experimental API. It also re-adds the home for an organiser who saved an empty layout, outside the grid where it can't be removed. The other option is to drop it and reset organisers' saved layouts once. The local prod snapshot (2026-10-12) had no dashboard-layout rows at all, since organisers had no Dashboard link before.
  • Widget drawer. Payload's "Add widget" drawer offers "Your programs" to every user; for a non-organiser it renders a second set of collection cards.
  • Dismissed review findings: deriving the needs-review set from the sidebar's bucketForEvent (its order puts expired after needsVerification, which the home ranks together); taking canCreate from the permissions prop (keeping it in the loader lets the integration spec assert "assigned without create access").
Detail
  • Prototyped in a proposal branch, then carried over without the event-defaults, live-preview and address-map parts of that proposal, which stay separate.
  • AGENTS.md's Next.js block heading changed from # to ## because next dev 16.4.2 writes ##; committing it keeps the tree clean, as the root guide says.
  • tests/PERF.md and its three consumer docs now say 225 files / 2890 tests, which perf-figures-pinned requires.
  • Security review ran because payload.config.ts matches the trigger. No findings: every new read uses overrideAccess: false, and the re-authentication reads the same request headers as the admin shell.

🤖 Generated with Claude Code

antontcymbal and others added 6 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]>
@railway-app

railway-app Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

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

Service Status Web Updated
SahajCloud ✅ Success (View Logs) Web Oct 23, 2026 at 8:45 pm UTC
1 service not affected by this PR
  • mailpit

@railway-app
railway-app Bot temporarily deployed to sahajcloud / SahajCloud-pr-1017 October 23, 2026 20:40 Destroyed
@antontcymbal

Copy link
Copy Markdown
Contributor Author

@sydevs-bot revise

@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

🤖 no session running

recent dispatches
  • 18:55Z address-review · attempt 1 · session · done
  • 18:55Z address-review · attempt 1 · session
  • 23:34Z review-pr · attempt 1 · session · done
  • 23:34Z review-pr · attempt 1 · session
  • 22:57Z 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

Choose a reason for hiding this comment

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

🧐 Adversarial review

One dashboard listing one collection arrives as seven new modules plus 58 lines of global SCSS. The data layer earns its keep — reading the Events update scope rather than project read access is the right call, and localeIsolatedReq on the concurrent reads follows src/collections/AGENTS.md. The two layers I would cut are the global theme block and PreferenceFallback: the first restyles the whole CMS to style one page, the second guards a state the body itself measured as never having occurred. Remove both and this is a focused PR. No contract surface is touched.

Findings

  • blocker — custom.scss:136 drops zebra striping from every collection list in both projects.
  • should-fix — custom.scss:93 restyles the panel's headings, buttons and labels globally, with hardcoded sizes.
  • should-fix — PreferenceFallback.tsx:12 guards an unobserved state, on an unexported preference shape.
  • should-fix — model.ts:57 overlapping groups make the summary line double-count a program.
  • consider — payload.config.ts:147 duplicates ATLAS_PROGRAMS_WIDGET as a literal.

What was checked

Diff read whole against origin/main (21 files), then every new module, both specs and custom.scss.

Verified from the code, not the body: scopeRegionSubtreeWrite returns a boolean for events create with no data and a Where for list update, so canCreate === true and where: scope are both right and agree with the sidebar's new permissions path; excludeFinishedEvents fires for clients only, so the finished rank is live for a manager; ownManagerPreferences scopes the preference read to its caller.

Preview /admin and /admin/map answer 200, unsigned-in — no PREVIEW_ADMIN_EMAIL here, and the body says the seeded user is an admin, so the organiser home is not visible there.

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


Generated by Claude Code

Comment thread src/app/(payload)/custom.scss Resolved
Comment thread src/app/(payload)/custom.scss Resolved
Comment thread src/payload.config.ts Resolved
@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
@Ardnived

Copy link
Copy Markdown
Contributor

@sydevs-bot address

@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

Copy link
Copy Markdown
Contributor

Addressed in #1029, stacked on this branch. A human's PR, so nothing was pushed here. Every thread carries its reply and SHA.

Adopted, one commit each:

Rebutted — PreferenceFallback.tsx:12. dashboard-layout is one key per user, not per project.

Asked, left open — do label.field-label and .field-description stay CMS-wide?

⚠ This PR conflicts with main, and a conflicted PR schedules zero CI runs (#632).

🤖 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

@Ardnived Ardnived left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There are a few high level issues with this PR that need to be addressed:

  • We should be using the term "Manager" instead of "Organizer" for consistency.
  • Currently the Atlas dashboard is configured as a widget that overrides all dashboards on all projects, instead of being contained to the Atlas project.
  • Let's create a generic custom Dashboard component which mediates the dashboard view and replaces the built-in widgets view. It should display a different custom view for each project - very similar to the analytics page. No need to check the role of the user for now, the dashboard is based only on the currentProject. For now the WeMeditateWeb and SahajAtlasWeb projects can just be a placeholder. If possible, incorporate ProjectSelectionPrompt into this dashboard when no project is selected and remove it as a separate component

@Ardnived

Copy link
Copy Markdown
Contributor

@sydevs-bot Revise. There are a few high level issues with this PR that need to be addressed:

  • We should be using the term "Manager" instead of "Organizer" for consistency.
  • Currently the Atlas dashboard is configured as a widget that overrides all dashboards on all projects, instead of being contained to the Atlas project.
  • Let's create a generic custom Dashboard component which mediates the dashboard view and replaces the built-in widgets view. It should display a different custom view for each project - very similar to the analytics page. No need to check the role of the user for now, the dashboard is based only on the currentProject. For now the WeMeditateWeb and SahajAtlasWeb projects can just be a placeholder. If possible, incorporate ProjectSelectionPrompt into this dashboard when no project is selected and remove it as a separate component

@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 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧐 Adversarial review

Second pass, on request, after the maintainer's three asks.

Those asks remove more of this diff than they appear to. A per-project dashboard view keyed on currentProject leaves no widget grid. So PreferenceFallback.tsx has nothing to fall back from, atlasDashboardLayout and needsAtlasDashboardFallback have nothing to lay out, index.tsx's CollectionCards branch has nothing to guard, and payload.config.ts keeps neither the widget nor defaultLayout. The payload.auth(headers) re-read goes too — a views.dashboard Component receives the auth-strategy user, as AtlasNav already does. Four of the seven new modules exist only to sit inside Payload's widget grid. data.ts, model.ts's sorting and grouping, and OrganiserHome survive, and they are the parts worth keeping. No contract surface is touched.

Findings

  • should-fix — OrganiserHome.tsx:66 repeats AdminNavLinks' own /admin/map link under a second label.
  • should-fix — AtlasNav.tsx:19 one predicate answers two questions, and the "Manager" rename makes its name claim a role it never tests.
  • consider — OrganiserHome.tsx:3 a client module takes its prop type from the server loader.

What was checked

Diff re-read whole against origin/main, then every new module and both nav files. scopeRegionSubtreeWrite makes the sidebar's new permissions.collections.events.create gate equal the old regions.length > 0, plus the role grant, so that swap holds. docs/rules/admin-ui.md and the four count docs match the code. First-pass custom.scss and grouping findings are answered in #1029. The two open field-label questions are yours.

🤖 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
@Ardnived

Copy link
Copy Markdown
Contributor

@sydevs-bot address

@sydevs-bot sydevs-bot added the bot:working Lock: a cloud session is running on this item. Removed when it ends. label Oct 25, 2026
@sydevs-bot

Copy link
Copy Markdown
Contributor

Built in #1029, stacked on this branch. A human's PR, so nothing was pushed here.

Your three asks, all in 4c2d3bb:

  • "Manager", not "Organizer" — helper, component, copy and docs.
  • Contained to the Atlas project — the widget, defaultLayout and PreferenceFallback are gone. views.dashboard replaces the grid, so no saved layout carries one project's home into another.
  • A per-project Dashboard, like analytics — DashboardView switches on currentProject and reads no role. ProjectSelectionPrompt moved out of beforeDashboard into it.

⚠ Confirm one reading. You named SahajAtlasWeb as a placeholder, but that is the project this home serves, and your second ask keeps it there. So the two WeMeditate projects got the placeholder.

Your call: an admin switching into a WeMeditate project now sees that placeholder, where Payload's collection cards were. "All Content" keeps the cards.

Critic threads answered in place. The field-label question is still yours.

🤖 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 25, 2026
@Ardnived

Copy link
Copy Markdown
Contributor

Superseded by #1029, which carries every commit from this branch, now targets main, and adds the review follow-ups (paged manager home, admin overview, one owner for a manager's projects). Closing so there is a single PR.

@Ardnived Ardnived closed this Oct 26, 2026
@sydevs-bot sydevs-bot moved this from Revising to Done in SYDevelopers Technical Roadmap Oct 26, 2026

This branch was successfully deployed

No deployments
sahajcloud / SahajCloud-pr-1017 — 272418a4 Deployed Oct 23, 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.

3 participants