frontend phase 4: catalog browse (Home A5) & nurse service builder (B7)

Light up the two faces of the configurable service catalog over a new cached
services/catalog domain (consumes the b5 contract; unlocks f6 search).

- services/catalog: types/keys/constants/apis(client+mock+seam)/hooks/index +
  names.ts. Categories & option groups are session-cached reference data
  (Infinity staleTime, like geography); variant mutations invalidate
  myVariantsLists() and setQueryData the edited row. Mock-primary
  (USE_CATALOG_MOCK), one-line swap; mock reproduces the 400 missing-required
  and (nurse,category,option-set) 409 duplicate rules.
- Customer Home (A5): greeting+avatar, search bar (navigates toward f6),
  data-driven category grid (loading/empty/error), patient nudge from the
  cached f2 query. Deferred /search placeholder stub.
- Nurse Services & prices (B7) at /nurse/services: offerings list (active vs
  deactivated, edit, soft-deactivate w/ confirm, reactivate, no delete) and a
  3-step variant builder (category -> required/optional options -> price+unit+
  duration). Required-group gate; Toman->IRR digit-string at the field
  boundary (no float); live unit-aware estimated total (never from price
  alone); editable auto display_name; inline 409 duplicate warning; locked
  category edit form.
- Shared, tested components: CategoryTile, PriceDisplay, VariantCard. Money
  util: tomanToRial + multiplyIrr (integer-safe) + tests.
- i18n: catalog/services/search namespaces + home additions + nav.services
  (both locales, in sync). Icons, routes (SEARCH, NURSE_SERVICES), nurse nav.

Gate: npm run check green; npm run test:ci green (147 tests, +18 across 4
suites); npm run build green with NEXT_PUBLIC_API_URL set.

Docs: client/CLAUDE.md (Project Structure, caching note, namespaces), STATUS,
for-backend REQ-010 (pagination param casing), phase report, mocks registry.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
hamid
2026-07-05 17:33:44 +03:30
parent 5839b3508f
commit 99ebf5d881
41 changed files with 2382 additions and 26 deletions
+82 -2
View File
@@ -7,6 +7,7 @@
"profile": "Profile",
"bank": "Bank account",
"coverage": "Coverage",
"services": "Services",
"dashboard": "Dashboard",
"verification": "Verification",
"visits": "Visits",
@@ -43,8 +44,14 @@
"placeholder_body": "This area will be built in a later phase."
},
"home": {
"greeting": "Welcome to Balinyaar",
"greeting_named": "Hi, {name}",
"greeting_plain": "Hi there",
"subtitle": "Manage care for the people you love.",
"search_placeholder": "Search a service or nurse…",
"search_action": "Search",
"categories_title": "Services",
"categories_error": "Couldn't load services.",
"categories_empty": "No services have been set up yet.",
"nudge_patient_title": "Complete the patient record",
"nudge_patient_body": "Add conditions, medications and routine so nurses arrive prepared.",
"nudge_patient_cta": "Open patients",
@@ -134,7 +141,7 @@
"unverified_title": "Your profile isn't active yet",
"unverified_body": "Complete identity verification to appear to families and receive bookings.",
"unverified_cta": "Complete verification",
"deferred_services": "You'll add your services & prices and available days in a later step."
"deferred_services": "Manage your services & prices in the Services section; available days come in a later step."
},
"bank": {
"title": "Bank account",
@@ -235,6 +242,79 @@
"remove_confirm": "Remove",
"removed": "Coverage area removed"
},
"catalog": {
"unit_per_hour": "hourly",
"unit_per_session": "per session",
"unit_per_half_day": "per half-day",
"unit_per_day": "daily",
"unit_per_24h": "24-hour (live-in)",
"count_per_hour": "hours",
"count_per_session": "sessions",
"count_per_half_day": "half-days",
"count_per_day": "days",
"count_per_24h": "days (24h)",
"estimate_label": "Estimated total",
"estimate_for": "for {count} {unit}"
},
"services": {
"title": "Services & prices",
"subtitle": "The services you offer and what each costs.",
"add": "Add service",
"empty_title": "No services yet",
"empty_body": "Add at least one active, priced service so families can find and book you.",
"active_chip": "Active",
"inactive_chip": "Deactivated",
"inactive_hint": "This service is deactivated and can't be booked.",
"edit": "Edit",
"deactivate": "Deactivate",
"activate": "Reactivate",
"deactivate_title": "Deactivate this service?",
"deactivate_body": "It becomes unbookable and drops out of search. You can reactivate it anytime — it is never deleted.",
"deactivate_confirm": "Deactivate",
"deactivated_toast": "Service deactivated",
"activated_toast": "Service reactivated",
"toggle_error": "That couldn't be done. Please try again.",
"builder_add_title": "Add a new service",
"builder_edit_title": "Edit service",
"step_category": "Category",
"step_options": "Options",
"step_price": "Price",
"category_title": "Choose the service category",
"category_subtitle": "Every service belongs to one category.",
"categories_error": "Couldn't load categories. Please try again.",
"category_locked": "The category can't be changed after a service is created.",
"options_title": "Set the service options",
"options_subtitle": "Pick one option for each required item.",
"options_none": "This category has no options to configure.",
"required_badge": "Required",
"optional_badge": "Optional",
"options_incomplete": "Answer every required item to continue.",
"price_title": "Set the price and unit",
"price_label": "Price (Toman)",
"price_hint": "Enter the price in Toman.",
"price_required": "Enter a valid price greater than zero.",
"unit_label": "Price unit",
"duration_label": "Duration / count",
"duration_hint": "Optional — add a duration to preview the estimated total.",
"rate_note": "This is the base rate per unit, not the full total.",
"display_name_label": "Display name",
"display_name_hint": "Auto-generated from your options — you can edit it.",
"duplicate_warning": "You already have a service with these exact details. Change an option or the category.",
"summary_options": "Options",
"summary_none": "No options",
"next": "Next",
"submit_create": "Add service",
"submit_save": "Save changes",
"create_error": "The service couldn't be saved. Check your inputs and try again.",
"created_toast": "Service added",
"saved_toast": "Changes saved"
},
"search": {
"title": "Search",
"deferred": "Search and results arrive in the next phase.",
"query_echo": "You searched for “{query}”.",
"category_echo": "Filtered to the selected service category."
},
"auth": {
"customer_title": "Sign in to Balinyaar",
"customer_subtitle": "Sign in with your mobile number",