Help centre Families Coaches Support

Littles Baby Tracker

Help for families and coaches

Site Tools


technical:features:17_view_as_family

17 — View as family

Technical reference. For task-based help, see the corresponding user guide.
Documentation status: complete for the current implementation

Reviewed: 2026-07-21

Primary users: authorized assigned coaches

Surfaces: mobile coach workspace and platform API

Purpose

View as family lets a coach inspect and, where explicitly permitted, work in the mobile-first family experience for one assigned family. It reuses branded family screens but carries a trusted coachView subject context, a persistent visual banner and assignment-derived permissions.

It is not authentication impersonation. The session actor remains the coach, the subject remains the family, writes are attributed to the coach, and every API call resolves authorization again.

User outcomes

User need Outcome
Understand the family experience Open the same branded home, activity, analysis and artifact presentation the family uses.
Review a baby's records Keep the selected baby in route state while moving between eligible family screens.
Correct or add a log Write only when the assignment grants edit permission and support/organization access is current.
Review family notes See family-entered notes without overwriting them; keep coach-private notes separate.
Leave safely Use the visible Exit view action to return to the coach workspace.

Entry and visual context

  1. The coach opens a current family from /coach or /coach/families.
  2. The root route is /coach/families/:familyId/view-as.
  3. The family home displays a Viewing as / Coach view as mode banner with the family name, family timezone and Exit view.
  4. Organization branding is resolved for the subject family so the coach sees the intended family-facing colour/logo context.
  5. Entering view-as can mark the roster's general activity summary seen; notification-feed seen state is independent.

Supported routes

Route Current behavior
/coach/families/:familyId/view-as Branded family home, selected baby, recent activities and navigation.
/coach/families/:familyId/track/:activityType View activity history and add/edit when canWriteActivities permits.
/coach/families/:familyId/analysis Trends/analysis when canViewAnalysis permits.
/coach/families/:familyId/questionnaires Read-only questionnaire collection and answers.
/coach/families/:familyId/sleep-plans Family-visible published plans only.
/coach/families/:familyId/allergy-ladders View and manage ladders according to trusted write permission.
/coach/families/:familyId/reminders Opens the reminder screen shell, but reminders are device-local; see the limitation below.
/coach/families/:familyId/session-prep Coach-specific preparation tool, linked from the family context but not a family screen.

The selected baby's identifier is carried as ?babyId=… where the destination supports it. Tracking actions created from the family hero also append that identifier, avoiding an accidental switch to another baby.

Trusted subject context

The family summary returns a ResolvedAccessContext containing:

  • the real coach session;
  • subjectUser for the family;
  • mode: coachView;
  • the matching assignment and organization;
  • resolved family premium state; and
  • explicit booleans for read, write, support-date, revoke and analysis permissions.
Permission Coach-view rule User-visible effect
canReadActivities Active matching assignment, active organization membership, support record access and assignment canViewLogs. Required to enter/read the family record. Denial blocks the route.
canWriteActivities Read access plus eligible organization and assignment canEditLogs. Add/edit/delete controls are enabled; otherwise screens are read-only.
canViewAnalysis Record access, assignment canViewAnalysis and active premium analysis entitlement. Analysis loads or shows the access/premium state.
canManageSupportDates Organization permits management and support entitlement remains visible. Used by coach lifecycle tools, not as blanket family-screen write authority.
canRevokeAssignment False in ordinary coachView. Revocation stays in explicit caseload workflow.

The mobile CoachBillingRouteGate also checks coach subscription state around these routes. A client-side gate improves feedback; it does not replace subject authorization.

Activity and note behavior

  1. Family activities can be read only when canReadActivities is true.
  2. Coach-created and coach-edited activity mutations retain the coach as actor/update source for audit and analytics.
  3. Coach view cannot write a family-facing activity note. An attempted non-empty family note is denied server-side.
  4. Existing family notes can be shown as family-provided context.
  5. Coach-private baby/activity notes use separate endpoints and UI, are scoped to the genuine coach and are never merged into the family note. See Feature 19.
  6. Realtime activity changes cause the relevant view to refresh, with conflict handling in the underlying activity screens.

Family artifacts

  1. Questionnaires use the coach-family collection endpoint but the form is forced read-only.
  2. Sleep plans use the published-only collection, matching what the family can see rather than the coach authoring draft/history.
  3. Allergy ladders use family subject permissions; write controls depend on canWriteActivities.
  4. Analysis requires both assignment permission and premium access.

Current reminders limitation

The view-as menu currently links to /coach/families/:familyId/reminders, but RemindersScreen receives no family identifier and reminders are stored locally on the current device. This route must not be interpreted as access to the family's reminders. It is a shell/navigation reuse, not a trusted family-reminder record view.

Messaging and synthetic-context boundary

Coach view-as is treated as a synthetic family context by the mobile chat provider. Chat inbox/composer UI is hidden there, and message sending must occur as the genuine coach from the coach chat workflow. This prevents a coach-view screen from appearing to speak as the family.

Authorization and privacy rules

  1. A coach can enter only a family assigned to that same coach through an active assignment.
  2. Active organization membership, organization state, coach billing and support record access are enforced by the platform.
  3. Expired/revoked relationships cannot regain records through a bookmarked view-as URL.
  4. A route family identifier is untrusted input. The API resolves the matching assignment and rejects mismatches.
  5. The visible banner is necessary user context but is not the security control.
  6. Family-facing notes remain family data; coach-private notes remain per-coach private data.
  7. Coach view-as is separate from the super-admin's owner-view-as-coach session. Neither is allowed to bypass feature-specific genuine-coach restrictions such as private notes or chat participation.

Loading and failure states

State Expected behavior
Family summary loading Keep subject records hidden behind a focused loading state.
Cached summary refresh failure Label cached data and offer retry rather than presenting it as current.
Assignment/support expired Show denied/access state and return path; do not reveal stale records.
Write permission absent Render read-only controls or deny the mutation server-side.
Premium analysis unavailable Keep activity read separate and explain why analysis is unavailable.
Invalid activity type Show route-not-found state and return to coach home.
Explicit exit Return to /coach and remove family-view chrome/context.

Acceptance checklist

  1. The banner always identifies family view-as and offers an explicit exit.
  2. The actor remains the coach and the subject family identifier is verified on every API operation.
  3. Selected-baby context survives eligible view-as navigation.
  4. Read/write/analysis controls follow the returned permission booleans and backend denial remains authoritative.
  5. Questionnaires are read-only and sleep plans are published-only in view-as.
  6. A coach cannot add or overwrite a family-facing activity note.
  7. Private notes remain visually/data-model separate and chat remains unavailable in the synthetic view-as context.
  8. The reminders route is not documented or represented as family reminder access.
  9. An expired or revoked assignment cannot be opened from a saved URL.

Source evidence

Mobile web

  • mobile-web/src/App.tsx
  • mobile-web/src/components/AppShell.tsx
  • mobile-web/src/components/FamilySideMenu.tsx
  • mobile-web/src/routes/FamilyDashboard.tsx
  • mobile-web/src/routes/ActivityTrackingScreen.tsx
  • mobile-web/src/routes/AnalysisScreen.tsx
  • mobile-web/src/routes/AllergyLaddersScreen.tsx
  • mobile-web/src/routes/RemindersScreen.tsx

Platform and contracts

  • platform/packages/shared/src/access.ts
  • platform/apps/api/src/services/authorization-service.ts
  • platform/apps/api/src/services/prisma-invite-flow-service.ts
  • platform/apps/api/src/services/family-service.ts