930a080ccf98e9a9f4996f700bcdb48473960345
Replaces static services import and mock slot/date functions with fetchServices() (Task 4) and useAvailability() (Task 5). Fixes two real bugs surfaced by this task's cross-task integration: 1. Book.test.tsx's useAvailability mock returned fresh inline-wrapped functions every render, causing Book.tsx's exhaustive-deps-correct effect to re-fire every render (infinite loop, hung the test indefinitely). Fixed by returning the already-stable vi.fn() references directly. 2. useAvailability.ts's fire-and-forget `void load()` had no try/catch, so a synchronous throw from a mocked/unexpected supabase.from() call became an unhandled promise rejection (surfaced via Home.test.tsx rendering Book with an unmocked schedule_template/schedule_exceptions query). Added try/catch; pure robustness fix, no production behavior change since the real client never throws synchronously. Also fixed a react-hooks/set-state-in-effect lint error (moved the slot effect's guard clause inside its async closure, same pattern used throughout Phase 2B) and the resulting exhaustive-deps warning, by memoizing useAvailability's return value so Book.tsx can safely depend on the whole `availability` object without risking the same re-render-loop class of bug this task started with. Claude-Session: https://claude.ai/code/session_01NhxA4npAXAxmCDEJt6kxSH
Braids by Mira
Public marketing site for Braids by Mira — landing page, product showcase, booking flow, and salon policies.
Scripts
npm run dev— start the local dev servernpm test(ornpx vitest run) — run the frontend test suitenpm run build— type-check and build for productionnpm run lint— run ESLintnpm run test:functions— run the Deno tests for the Edge Functions' shared email builders (requires Deno installed)npm run seed— seed products, services, and the default schedule into a Supabase project (see below). Re-running it after admin-panel edits will revert those rows to the hardcoded seed defaults — use it for initial setup / disaster recovery, not routine use.
Backend (Supabase)
The backend lives in supabase/ — Postgres schema/RLS migrations, pgTAP tests, and Deno Edge Functions for booking/inquiry email notifications.
npx supabase start— start the local Docker-based Supabase dev stack (Postgres, Studio, Auth, Storage, Edge Functions runtime). Requires Docker.npx supabase db reset— replay all migrations from scratch against the local database.npx supabase test db— run the pgTAP test suite insupabase/tests/database/against the local database.
Environment variables
Copy .env.example to .env.local and fill in:
VITE_SUPABASE_URL,VITE_SUPABASE_ANON_KEY— frontend Supabase client config (exposed to the browser).SUPABASE_URL,SUPABASE_SERVICE_ROLE_KEY— used only byscripts/seed.ts(server-side, never expose the service role key to the browser). These are distinct from theVITE_-prefixed frontend variables above.
Description
Languages
TypeScript
77.5%
PLpgSQL
14.6%
CSS
7.1%
HTML
0.5%
JavaScript
0.3%