Skip to content

Schedule sessions from the New session dialog - #525

Merged
jhodapp merged 8 commits into
mainfrom
feat/schedule-session-dialog
Nov 4, 2026
Merged

jhodapp merged 8 commits into
mainfrom
feat/schedule-session-dialog

Conversation

@jhodapp

@jhodapp jhodapp commented Nov 3, 2026 •

Copy link
Copy Markdown
Member

Description

Fourth of five PRs for the stepped "New session" dialog. Schedule mode: Add New › Coaching session and the empty Upcoming card's "Schedule a coaching session" now open the new dialog. Its steps are Who, When and Repeat, plus Resolve overlap when the chosen time clashes. It replaces the old "Create New Coaching Session" form. Stacked on #524.

Changes

  • Dialog: a newSessionDialogStore with its host mounted once in Providers. The dialog can open from any page, and every open starts fresh. A useNewSessionDialog hook drives the presentational step components, built on New session dialog step controls #523's controls and StepDialog, the shared stepped modal #524's StepDialog.
  • Who: shows the people you coach, ordered by activity, with their usual slot or last session. Inactive people stay behind "Show everyone".
  • When: picking a person prefills their usual day and time if that slot is free. Busy days get dots, with a day tooltip. Up to five free time suggestions. A clash shows an overlap note with the next free time.
  • Repeat: Doesn't repeat, Weekly, Every 2 weeks or Monthly; weekdays; ends after N sessions or on a date.
  • Resolve overlap: move the other session to a free slot in that week, or keep both. If the move fails, the new session is kept and an error toast says the other one didn't move.
  • Submit: creates a single session or a series, then moves the other session if one was chosen. Shows "Scheduled · …" toasts. Stays open with your choices on a retryable error.
  • Pure logic: lib/schedule-draft.ts. Suggested times now count a coach's start time only once it's been used twice.
  • Removed:
    • The create half of coaching-session-form.tsx (the coachee Select and the recurrence section). It's update-only now, for Reschedule until the next PR.
    • sessionCreatedMessage and seriesCreatedMessage.
  • StepDialog: a rail row can be current and done at once (as in the mockup). Opening the dialog focuses the dialog itself, not ×.
  • Docs:
    • New docs/test-plans/new_session_dialog_manual_testing.md.
    • Design-system plan Case E5 updated.
    • The e2e create flow now uses the new dialog.

Screenshots / Videos Showing UI Changes (if applicable)

Useful: each step on desktop (Who, When with an overlap, Repeat Weekly, Resolve overlap), and When at 375px.

Testing Strategy

  • Specs written first:
    • The whole dialog flow: who's listed, prefill, overlap, resolve, payloads, toasts, errors, double click, fresh state per open.
    • The pure draft logic and the store.
  • All 2692 tests pass; tsc and lint are clean.
  • Real browser against a local backend:
    • Geometry stays fixed across steps, short windows and 375px.
    • Each step matches the mockups.
    • Tooltips aren't clipped.
    • Sessions created through the Jim-coaches-Jim relationship landed with the right payload and toast, and showed on the dashboard without a reload.
    • The e2e spec's new dialog steps, replayed on the current data, schedule successfully.
    • A live overlap: the new session was created first, then the overlapped session was moved (same id). The toast ended "· Caleb moves to Wed 4, 4:00 PM", and both showed on the dashboard without a reload.
  • Manual: run docs/test-plans/new_session_dialog_manual_testing.md.

Concerns

  • The full multi-org-live.spec.ts wasn't run, since it needs a freshly seeded database. Its changed steps were replayed by hand.
  • The overlap check covers a series' first session only (a known v1 limit, Case E7).
  • At 320px, calendar days are 41px circles; seven columns can't fit 44.

@jhodapp jhodapp self-assigned this Nov 3, 2026
@jhodapp jhodapp added enhancement Improves existing functionality or feature feature work Specifically implementing a new feature labels Nov 3, 2026
@jhodapp jhodapp added this to the 1.0.0-beta4 milestone Nov 3, 2026
@jhodapp jhodapp moved this to 🏗 In progress in Refactor Coaching Platform Nov 3, 2026
@jhodapp jhodapp changed the title feat(scheduling): schedule sessions from the New session dialog Schedule sessions from the New session dialog Nov 3, 2026
@jhodapp jhodapp moved this from 🏗 In progress to Review in Refactor Coaching Platform Nov 3, 2026
@jhodapp
jhodapp marked this pull request as ready for review November 3, 2026 21:49
@greptile-apps

greptile-apps Bot commented Nov 3, 2026 •

Copy link
Copy Markdown
Contributor

RetriggerView in GreptileConfidence Score: 3/5

[Medium impact] The changes affect how coaches schedule and reschedule sessions.

Fix the calendar-read and multiple-overlap paths before merging.

Fix All in Claude CodeFindings

  1. P1 Unread calendars look free ▶
  2. P1 A second overlap stays hidden ▶
  3. P2 Earlier saves close newer drafts ▶

Summary

Replaces session creation with a shared New session dialog.

  • Coaches schedule sessions through a guided New session dialog.
  • The old session form now only changes existing sessions.
  • The step dialog shows progress while keeping the current step clear.

The supplied description explicitly acknowledges checking only the first occurrence of a series. This remains excluded as a known limit; the supplied author login is jhodapp.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Open dialog] --> B[Choose person]
  B --> C[Choose date and time]
  C --> D[Choose repeat settings]
  D --> E{Overlap found?}
  E -->|Yes| F[Move other session or keep both]
  E -->|No| G[Create session or series]
  F --> G
  G --> H{Move selected?}
  H -->|Yes| I[Move other session]
  H -->|No| J[Refresh lists and show confirmation]
  I --> J
Loading

Reviews (1) · Last reviewed commit: "fix(scheduling): let clicks pass through..." · Reviewed by Greptile

Comment on lines +111 to +120
const busySource = useEnrichedCoachingSessionsForUser(
userId,
window.from,
window.to,
[CoachingSessionInclude.Relationship],
undefined,
undefined,
undefined,
timezone
).enrichedSessions;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Unread calendars look free

useScheduleData drops the busy read's loading and error state. On an uncached month, a slow or failed request returns an empty list. The dialog then offers occupied times as free and lets the coach submit without resolving the overlap. Keep availability in a loading/error state and block confirmation until the selected range has loaded successfully.

Fix in Claude Code

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed on #527 in "fix(scheduling): don't confirm against an unread calendar, a second overlap, or a loading series rule".

Comment thread src/lib/schedule-draft.ts Outdated
Comment on lines +220 to +222
const [first] = overlapping(slot, busy);
if (!first) return None;
return Some({ session: first, instead: nextFreeStart(slot, busyOn(busy, slot.start, None), hours) });

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 A second overlap stays hidden

clashFor keeps only the first overlapping session. A long new session can overlap two existing sessions. Moving the first enables confirmation while the second still overlaps, without asking the coach to keep that overlap. Track all clashes and require a choice for each before confirming.

Fix in Claude Code

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed on #527 in "fix(scheduling): don't confirm against an unread calendar, a second overlap, or a loading series rule".

@jhodapp
jhodapp force-pushed the feat/schedule-session-dialog branch from 9db43e5 to 2ed2e05 Compare November 3, 2026 23:28
…e or length changes

A move target was picked from slots that avoid the old time, so keeping it
after a change could move the other session into a fresh overlap.
In a modal, Radix sets pointer-events: auto inline on tooltip content, so the
tooltip swallowed clicks on the days it covered.
@jhodapp
jhodapp force-pushed the feat/schedule-session-dialog branch from 2ed2e05 to 473b052 Compare November 4, 2026 04:53
Base automatically changed from feat/step-dialog to feat/scheduling-controls November 4, 2026 05:35
Base automatically changed from feat/scheduling-controls to main November 4, 2026 14:03
@jhodapp
jhodapp merged commit d1d8c2d into main Nov 4, 2026
11 checks passed
@jhodapp
jhodapp deleted the feat/schedule-session-dialog branch November 4, 2026 14:15
@github-project-automation github-project-automation Bot moved this from Review to ✅ Done in Refactor Coaching Platform Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improves existing functionality or feature feature work Specifically implementing a new feature

Projects

Status: ✅ Done

Development

Successfully merging this pull request may close these issues.

1 participant