Repository navigation
Phase 11 completion: the missing §47/§48 mobile + image-performance items - #25
Merged
Merged
Conversation
Audit of Phase 11 against §46-§49 found four spec items never delivered: - §47 responsive image sizes: new responsiveImageSrcSet() builds f_auto,q_auto,w_<n> candidates per layout width; product cards fetch 400/600/800 with a sizes attribute matching the 2/3/4-up grid, and the gallery hero 600-1400 at 50vw/100vw — phones stop paying for desktop derivatives - §48 sticky Add to Cart / Buy Now: mobile-only fixed purchase bar on the product page mirroring the same handlers and price, with a flow spacer so the footer is never obscured; hidden from sm up - §48 bottom-sheet filters: FiltersSheet renders the same GET form in a dialog-style sheet on mobile (aria-modal, Escape, focus return); desktop keeps the sidebar, and a noscript override restores it when JS is off — filtering still works without JavaScript - §48 swipe gallery: the main image becomes a scroll-snap strip (one photograph per view, touch swiping with zero JS), thumbnails scroll it, keyboard arrows keep parity; pinch-zoom deliberately stays native Tests: 213 → 217 (responsiveImageSrcSet unit suite). App code only, no migration.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
|
@copilot review |
Contributor
I reviewed the current PR changes and didn’t find any blocking issues in the implementation. The code paths for responsive images, mobile sticky purchase bar, mobile filter sheet accessibility, and swipe gallery behavior look consistent with the stated scope. Remaining check is manual mobile interaction QA as noted in the PR description. |
5 of 6 tasks
ManoharPaturi
added a commit
that referenced
this pull request
Oct 9, 2026
## Summary Phase 12: the **§9 Super Admin panel** (previously a placeholder stub) and **§39 realtime for the client dashboard**. One migration (idempotent, **pre-applied on this branch and verified by read-back**), no new dependencies. Branch cut from `main` @ `32afb57` (after #24); zero file overlap with open PR #25. ## A. Super Admin area (§9) — all routes proxy.ts gates `/admin/*` to SUPER_ADMIN and RLS gates every query beneath — both kept; each page additionally renders a notice instead of data for non-super-admins (defense in depth). | Route | What it does | |---|---| | `/admin` | Today's order/payment counters (same `dashboardStats` surface, RLS-scoped), integration rollup (set/not set), 8 newest audit events | | `/admin/users` | Profiles directory: email, name, phone, role, joined. Role picker → `setUserRole` action | | `/admin/roles` | Role distribution matrix + the same audited assignment table | | `/admin/client` | Read-only client team + §30 store settings (edits stay in /client/settings) | | `/admin/integrations/whatsapp` | Status only — which env vars are set; honest "behaviour while unwired" section; **never values**; wiring stays owner-deferred | | `/admin/integrations/cloudinary` | Status only + how signed uploads flow (secret never client-side) | | `/admin/logs` | `whatsapp_messages` browser with status filter; NOT_CONFIGURED failures show honestly; order links | | `/admin/webhooks` | `webhook_events` list + guarded **"Mark resolved"** (see actions below) | | `/admin/audit` | `audit_logs` newest-first, filter chips derived from real actions | | `/admin/system` | `/api/health` mirror, env matrix (set/not set), backup posture summary | **Actions** (`lib/admin/actions.ts`, SUPER_ADMIN-only session gate, RLS beneath, audit-logged via the service-role client — the payment-verification pattern): - `setUserRole` — validates against `roleChangeGuard` (pure, unit-tested): real roles only, same-role = no-op, and **the last active SUPER_ADMIN can never be demoted**. Writes `admin.role_change` to audit_logs with old/new role. - `markWebhookEventResolved` — only RECEIVED/FAILED rows (`isResolvableWebhookStatus`, unit-tested); sets PROCESSED + processed_at, keeps the error text for history, writes `admin.webhook_mark_resolved` to audit_logs. **This is the 04-OPEN-ITEMS §5 cleanup path — the two stuck rows get closed by the owner's clicks, one at a time, never by SQL.** ## B. Realtime (§39) — client dashboard only - **Migration `20261009190000_realtime_phase12.sql`** (idempotent): `orders` added to `supabase_realtime` (duplicate_object tolerated); `orders` replica identity **full** so payloads carry the old row for status diffing; `profiles.email` added + backfilled from auth.users (the admin users/roles pages need it — the API surface can't join auth.users) and kept in sync by the signup trigger. - **`OrdersLive`** on `/client` and `/client/orders`: session-scoped `postgres_changes` subscription on `orders`; INSERT (new order) and UPDATE where payment/fulfilment status moved → `router.refresh()` + an aria-live toast. `describeOrderChange` is pure and unit-tested; untracked updates, deletes, and missing-old payloads stay silent. Storefront pages never subscribe (§39 rule). Degrades silently if realtime can't connect. ## Verification - [x] `npm run typecheck` — clean - [x] `eslint` on all new/changed files — clean - [x] `npm test` — **242/242** (229 on main + 13 new: role guards, webhook resolvability, change describer) - [x] `npm run build` — all 10 admin routes compile - [x] Migration **pre-applied on this branch** via "Apply DB migration" ([run 37965908811](https://github.com/manohar-test123/sri-vartali-commerce/actions/runs/37965908811)) and **verified by read-back** ([run 37966011783](https://github.com/manohar-test123/sri-vartali-commerce/actions/runs/37966011783)): `supabase_realtime` lists `public.orders`; `orders.relreplident = f`; `profiles`: 1 row, 1 with email. The read-back SQL rides the branch as `supabase/ops/20261009_realtime_readback.sql` (SELECT-only). - [ ] **Local e2e on :3123 not run here** — this machine has no `.env.local` (owner-transferred). Owner ritual: two tabs, place a clearly-named test order in one, watch the dashboard toast + refresh in the other; then clean the test order up. ## Notes for review - On merge, the Supabase integration re-applies the migration — idempotent, so a no-op (publication already contains orders). - No new dependencies; toast and dialog patterns are hand-rolled like the rest of the codebase. - Rollback: revert the squash (app code) — the migration's DB effects are additive/harmless to leave (publication membership + a nullable column), or reversible with one-line SQL if ever wanted. - Non-goals honoured: no Meta wiring, no paid plans, nothing weakened, service-role key never near client code (`lib/db/admin.ts` window guard untouched). --------- Co-authored-by: Manohar Paturi <[email protected]>
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Phase 11 (Production Hardening) shipped in #23, but an audit against the actual spec checklist (§46-§49) found four §47/§48 items that were never delivered. This PR completes them. App code only — no migration, no schema touch.
Audit → fix map
w_600URL for every viewportresponsiveImageSrcSet()+sizeson cards and galleryAlready complete and untouched: rate limits, CSP/headers, sitemap/robots, lazy loading, LCP
fetchPriority, reduced-motion CSS, backup workflow, runbooks.Changes
lib/media/optimized-url.ts— new pureresponsiveImageSrcSet(url, widths):f_auto,q_auto,w_<n>candidates per width; returnsnullfor non-Cloudinary hosts (a srcset of identical URLs would only waste bytes — plainsrcalready covers those).product-card.tsx— primary and hover images now carrysrcSet(400/600/800) +sizesmatching the 2-up/3-up/4-up grid: phones fetch small derivatives, desktops large ones.product-gallery.tsx— main image becomes a horizontalsnap-x snap-mandatorystrip: swipe on touch with no JS, thumbnails scroll to a photo, ← → keys keep working, first image stays the LCP (fetchPriority=high, eager; rest lazy + responsive). Pinch-zoom intentionally remains native browser zoom — no custom gesture code to break.add-to-cart.tsx—sm:hiddenfixed bar with selected variant price, availability, Add to Cart and Buy Now reusing the exact handlers; a flow spacer reserves the bar's height so the footer is never obscured.filters-sheet.tsx(new) +catalog-view.tsx— mobile gets a "Filters" trigger (active-count badge) opening arole="dialog"sheet:aria-modal, Escape closes, backdrop click closes, focus moves into the sheet and returns to the trigger. The same GET form renders in sidebar (desktop) and sheet (mobile); a<noscript>style override restores the sidebar on mobile when JavaScript is off — filtering never depends on JS.Testing
npm run typecheck— clean (after clearing stale.nextfrom another branch's build)eslinton all seven touched files — cleannpm test— 217/217 (213 on main + 4 newresponsiveImageSrcSettests)npm run build— compilesNotes for review
main; both PRs merge independently in any order.