Files
helix-engage/src/components/setup/wizard-layout-context.tsx
saridsa2 f57fbc1f24 feat(onboarding/phase-6): setup wizard polish, seed script alignment, doctor visit slots
- Setup wizard: 3-pane layout with right-side live previews, resume
  banner, edit/copy icons on team step, AI prompt configuration
- Forms: employee-create replaces invite-member (no email invites),
  clinic form with address/hours/payment, doctor form with visit slots
- Seed script: aligned to current SDK schema — doctors created as
  workspace members (HelixEngage Manager role), visitingHours replaced
  by doctorVisitSlot entity, clinics seeded, portalUserId linked
  dynamically, SUB/ORIGIN/GQL configurable via env vars
- Pages: clinics + doctors CRUD updated for new schema, team settings
  with temp password + role assignment
- New components: time-picker, day-selector, wizard-right-panes,
  wizard-layout-context, resume-setup-banner
- Removed: invite-member-form (replaced by employee-create-form per
  no-email-invites rule)

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-10 08:37:34 +05:30

28 lines
1.2 KiB
TypeScript

import { createContext } from 'react';
// Context that lets each WizardStep render content into the wizard
// shell's right pane via a portal — without lifting per-step data
// fetching up to the page. The shell sets `rightPaneEl` to the
// `<aside>` DOM node once it mounts; child WizardStep components read
// it and createPortal their `rightPane` prop into it.
//
// Why a portal and not a state-lifted prop on WizardShell:
// - The right pane is tightly coupled to the active step's data
// (e.g. "list of clinics created so far") which lives in the step
// component's state. Lifting that state to the page would mean
// duplicating the data-fetching layer, OR re-querying everything
// from the page.
// - Trying to pass `rightPane: ReactNode` upward via callbacks
// either causes a one-frame flash (useEffect) or violates the
// "no setState during render" rule.
// - Portals are React-native, no extra render cycles, and the
// DOM target is already part of the layout.
export type WizardLayoutContextValue = {
rightPaneEl: HTMLElement | null;
};
export const WizardLayoutContext = createContext<WizardLayoutContextValue>({
rightPaneEl: null,
});