refactor: reuse shared booking and up-next helpers - #3044
Merged
Conversation
Reuse the existing timezone helper and month/date key checks instead of local copies, and point the host copy button at useCopiedFlag. Co-authored-by: tyler <tyler@switchback.tech>
The grid view model already joins conference onto the event. Shortcuts and the card now use the same field instead of a second events.find. Co-authored-by: tyler <tyler@switchback.tech>
Co-authored-by: tyler <tyler@switchback.tech>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Behavior-preserving cleanup of leftovers from recent merges (#3026, #3034, #3040), without touching the open booking overflow (#3043) or onboarding game (#3036) PRs.
BookingCopyLinkusesuseCopiedFlag, the same copy-state hook as the guest cancel link.VreadsupNext.conference.urlfrom the grid projection, matching the card instead of a secondevents.find.isGuestEmailfrom core.toBookingErrorResponseusesBookingException.statusCodeinstead of looking the status up again.Simplicity
Deleted local copies. No new abstractions beyond exporting helpers that already had two call sites. Public booking error messages, URL drop-invalid-to-undefined, copy toasts, and conference join behavior stay the same.
Automated validation
bun run verifypackage checks passed after rebase ontoorigin/main:Focused suites: booking search/format, BookingCopyLink, Up Next card/banner (46 passed); core contracts + booking.error (31 passed). Playwright Chromium was installed; the event-action-row a11y spec flaked once on contrast and passed on retry.
Independent review
.agents/handoffs/simplify-recent-3040.mdTest plan
bun run verifybun test:web -- packages/web/src/booking/public-booking-search.test.ts packages/web/src/booking/public-booking.format.test.ts packages/web/src/booking/BookingCopyLink.test.tsx packages/web/src/components/Sidebar/UpNextCard/bun test packages/core/src/types/booking.contracts.test.ts packages/backend/src/booking/booking.error.test.tsbunx playwright test e2e/accessibility/app-a11y.spec.ts -g "event action row" --workers=1Note
Low Risk
Refactor-only with tests and verify passing; minor assumption that shared timezone validation and grid
conferencematch prior behavior.Overview
Behavior-preserving cleanup that deduplicates booking and sidebar helpers left over from recent merges, without changing guest-facing validation rules or URL parsing semantics.
Guest email is centralized in
@core/types/booking.contractsasisGuestEmail(andGUEST_EMAIL_PATTERN); the public guest form andpublic-booking.serviceboth call it instead of local regex copies. Public booking URL search now usesisBookingMonthKey/isBookingDateKeyfrompublic-booking.formatandisValidTimeZonefrombrowser-timezoneinstead of inline patterns and a local timezone check.Host
BookingCopyLinkswitches to the shareduseCopiedFlaghook (same pattern as the guest cancel link) for copy state and toasts. Up Next readsconferenceUrlfromupNext?.conference?.urlon the grid projection instead of re-deriving it fromsourceEvent.contentwhenkind === "details".Booking API errors:
toBookingErrorResponsereturnsBookingException.statusCodedirectly rather than mappingbookingCodethroughSTATUS_BY_CODEagain. Agent ledger/handoff files document verification for tasksimplify-recent-3040.Reviewed by Cursor Bugbot for commit f65bc4a. Bugbot is set up for automated code reviews on this repo. Configure here.