Skip to content

Prayer spaces are manageable from the console - #7

Open
IbraTech04 wants to merge 2 commits into
developfrom
minbar/prayer-space-management
Open

IbraTech04 wants to merge 2 commits into
developfrom
minbar/prayer-space-management

Conversation

@IbraTech04

Copy link
Copy Markdown
Collaborator

Depends on LensBridge/LensBridgeBackend#16, which adds the CRUD this drives.

The page was read-only, and its own doc comment said so: "the backend exposes GET /api/minbar/prayer-spaces and nothing to write with… a space can only be changed by editing the database directly." NOTES-FOR-BACKEND.md §1 called it the single biggest hole. This closes it, and that section is removed.

What changed

The page loads the admin list — every space, unfiltered — rather than the audience-scoped endpoint the app uses, because a console editing the sisters' musallah has to open it whoever is signed in. The audience control stays, now as a client-side filter defaulting to All.

Type and audience are different questions, and the form says so instead of leaving an operator to guess. Type is what kind of room it is: the label on the card and the filter on the map. Audience is who it is listed to. They agree for a gendered musallah and diverge for everything else. On create, audience follows the type until the operator overrides it; on edit it never moves on its own, so relabelling a sisters-only bay cannot quietly publish it to the whole campus.

Saves send only what changed. The form diffs against a record refetched when the editor opens, so "I fixed a typo in step 3" is a patch to step 3 and not a full overwrite of somebody else's concurrent edit.

Coordinates are handled as the pair the API treats them as: both or neither, emptying both sends clearCoordinates rather than silently dropping the edit, and a space without a pin says so plainly rather than showing blanks — the app cannot navigate to it.

The step-by-step preview is preserved. That is what the page was already good for: it renders what a student walking to Jummah would be shown, so a wrong entrance or a stale walk time is visible here rather than reported from the hallway.

Authorization

Writes gated on the new board:prayerspace:write. An account with only board:content:read gets the read-only view it has today, with write affordances absent rather than disabled. The route guard in App.jsx is widened alongside the nav entry, since hiding a link is not authorization.

Testing

npm run typecheck, npm run lint and npm run api:check all pass.

Driven in Chrome against a live backend: the unfiltered list, the detail view, a real create (including watching audience derive from type), a patch, a delete, and the resulting rows landing in the audit log with the right actor and target.

⚠️ Note for review

This repo's working tree carries a large, unrelated, uncommitted console rewrite — src/components/ui/, src/components/shell/, most of src/pages/, and several services exist nowhere in git, on any branch. Some files in this diff (shell/nav.js, shell/TopBar.jsx, services/MinbarService.js) belong to that work and appear as new here only because they have never been committed.

This branch is therefore a slice on top of uncommitted work and will not build against develop until the rest of that rewrite lands. I deliberately did not sweep ~100 files of unrelated authorship into this commit. schema.d.ts also carries a large regeneration diff: the committed spec was stale against the backend well beyond this feature.

Also included: TopBar.jsx loses a dead production variable that was failing lint.

🤖 Generated with Claude Code

The page was read-only, and its own doc comment said so: "the backend exposes
GET /api/minbar/prayer-spaces and nothing to write with... a space can only be
changed by editing the database directly." NOTES-FOR-BACKEND.md called it the
single biggest hole. The backend now has admin CRUD, so this closes it.

The page loads the admin list — every space, unfiltered — rather than the
audience-scoped endpoint the app uses, because a console editing the sisters'
musallah has to be able to open it whoever is signed in. The audience control
stays as a client-side filter, now defaulting to All.

**Type and audience are different questions**, and the form says so instead of
leaving an operator to guess. Type is what kind of room it is: the label on the
card and the filter on the map. Audience is who it is listed to. They agree for
a gendered musallah and diverge for everything else — a multifaith room and a
reflection bay are both shown to everyone. On create, audience follows the type
until the operator overrides it; on edit it never moves on its own, so relabelling
a sisters-only bay cannot quietly publish it to the whole campus.

**Saves send only what changed.** The form diffs against a record refetched when
the editor opens, so "I fixed a typo in step 3" is a patch to step 3 and not a
full overwrite of somebody else's concurrent edit.

Coordinates are handled as the pair the API treats them as: both or neither,
emptying both sends `clearCoordinates` rather than silently dropping the edit,
and a space without a pin says so plainly on the card and in the detail view
rather than showing blanks — the app cannot navigate to it.

Writes are gated on the new `board:prayerspace:write`. An account with only
`board:content:read` gets the read-only view it has today, with the write
affordances absent rather than disabled. The route guard is widened alongside
the nav entry, since hiding a link is not authorization.

Also here: `TopBar.jsx` loses a dead `production` variable that was failing lint.

`npm run typecheck`, `npm run lint` and `npm run api:check` all pass. Create,
edit, delete and the type→audience derivation verified against a live backend.

Note for review: this repo's working tree carries a large, unrelated,
uncommitted console rewrite, and several files here (`shell/nav.js`,
`shell/TopBar.jsx`, `services/MinbarService.js`) belong to it — they appear as
new because they have never been committed. This branch is a slice on top of
that work and will not build against `develop` until the rest of it lands.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.

@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Deploying with  Cloudflare Workers  Cloudflare Workers

The latest updates on your project. Learn more about integrating Git with Workers.

Status Name Latest Commit Preview URL Updated (UTC)
✅ Deployment successful!
View logs
lensbridgefrontend 6f3421b Commit Preview URL

Branch Preview URL
Sep 10 2026, 04:55 PM

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant