Skip to content

Keep selected patient when navigating to Video Sessions #63

Description

@tamtam888

Context

After PR #60 and PR #62, the video consent gate and cloud sync status are working as intended, but video workflows can still appear broken in the pilot.

Claude Code performed a read-only diagnosis of the video launch paths.

Diagnosis

The consent gate itself is correct.

The likely failure is navigation/state related:

  • MediaPage relies on patientsState.selectedPatient.
  • selectedPatient depends on selectedPatientIdNumber being set.
  • If a therapist navigates to the Video Sessions sidebar page without a patient selected in the current session, selectedPatient is null.
  • The MediaPage workflow buttons then remain disabled or show the generic no-patient state.
  • To the therapist, this looks like "video is not working", even though the consent gate is behaving correctly.

Primary risk

A therapist may mark video consent inside Patient Details, then navigate through the sidebar to Video Sessions and expect the same patient to stay active. If selection state is missing or lost, the video page has no active patient.

Expected behavior

When a therapist is working from a patient record, navigation to Video Sessions should preserve or set the current patient context.

Suggested minimal fix

Possible approaches:

  1. In PatientDetailsPage.jsx, ensure the current patient is selected via handleSelectPatient before navigating to Media/Video Sessions.
  2. Add a direct "Go to Video Sessions" action from Patient Details that sets the selected patient and then navigates to /media.
  3. Improve MediaPage empty-state copy so it clearly says that a patient must be opened/selected first.

Files likely involved

  • src/pages/PatientDetailsPage.jsx
  • src/pages/MediaPage.jsx
  • possibly src/App.jsx or patient selection wiring

Out of scope

  • Do not weaken the consent gate.
  • Do not bypass videoConsentGiven.
  • Do not change VideoPanel or MaddVideo before confirming the selected-patient issue.
  • Do not modify AI logic.
  • Do not modify cloud sync status logic.

Severity

High UX issue for the pilot, because therapists may interpret missing selected-patient context as a broken video feature.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions