Skip to content

Comments

feat: simplify the date picking usage when a user schedules an email and remove premature "in the past" warning#1983

Merged
ahmetskilinc merged 5 commits intostagingfrom
better-picker
Aug 26, 2025
Merged

feat: simplify the date picking usage when a user schedules an email and remove premature "in the past" warning#1983
ahmetskilinc merged 5 commits intostagingfrom
better-picker

Conversation

@retrogtx
Copy link
Contributor

@retrogtx retrogtx commented Aug 11, 2025

Summary by cubic

Simplified the email scheduling flow by splitting date and time selection, and removed the early "in the past" warning to make scheduling clearer.

  • UI Improvements
  • Added separate popovers for picking date and time.
  • Updated calendar with dropdowns for month and year.
  • "In the past" warning now only shows after selection is complete.

Summary by CodeRabbit

  • New Features

    • Redesigned “Schedule send” with separate date and time pickers and dedicated popovers for clearer interaction.
    • Calendar now offers month/year dropdowns and previous/next navigation, with an adjustable year range.
    • Clear trigger label shows “Send later” or the selected date and time.
  • Bug Fixes

    • Prevents selecting past dates/times with inline validation and feedback.
    • Ensures the scheduled value stays in sync with external updates for consistent display.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Aug 11, 2025

Note

Other AI code review bot(s) detected

CodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review.

Important

Review skipped

Auto incremental reviews are disabled on this repository.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

Refactors ScheduleSendPicker into a two-panel date/time flow with separate popovers and validation, syncing internal state to prop changes. Introduces a stateful Calendar with custom month/year controls and a new yearRange prop. Calendar public types updated; ScheduleSendPicker public props unchanged.

Changes

Cohort / File(s) Summary of changes
Scheduling UI refactor
apps/mail/components/create/schedule-send-picker.tsx
Replaces single datetime input with separate date and time controls, each in its own Popover. Adds isScheduling, selectedDate, time, datePickerOpen/timePickerOpen, emitChange with validation and ISO assembly, toast rejection for past times, startOfToday guard, Calendar integration, and synchronized prop-to-state updates.
Calendar component enhancements
apps/mail/components/ui/calendar.tsx
Makes Calendar stateful with currentMonth, adds custom caption with month/year selects and nav buttons, new yearRange prop (default 10), wires DayPicker to internal month state, updates types and props, and imports date-fns helpers for navigation/formatting.

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant SSP as ScheduleSendPicker
  participant Cal as Calendar Popover
  participant TI as Time Input Popover
  participant P as Parent(onChange)

  U->>SSP: Click "Send later"
  SSP->>Cal: Open date popover
  U->>Cal: Pick date
  Cal-->>SSP: selectedDate
  SSP->>TI: Open time popover
  U->>TI: Enter HH:mm
  TI-->>SSP: time
  SSP->>SSP: Validate (not in past)
  alt valid
    SSP->>P: onChange(ISO datetime)
  else invalid
    SSP->>U: Toast: reject past time
  end
Loading
sequenceDiagram
  participant U as User
  participant C as Calendar
  participant DP as DayPicker

  U->>C: Change month select
  C->>C: setMonth(currentMonth, index)
  C->>DP: update displayMonth

  U->>C: Change year select
  C->>C: setYear(currentMonth, year)
  C->>DP: update displayMonth

  U->>C: Click nav buttons
  C->>C: add/subMonths
  C->>DP: update displayMonth
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

design, high priority

Suggested reviewers

  • MrgSub

Poem

Rockets to calendars, we iterate time,
Two popovers orbit in elegant rhyme.
Months shift like stages, years on the dial,
Schedule ignites with a click and a smile.
No past launches—only futures align.
T-minus now: send later, perfectly timed. 🚀

✨ Finishing Touches
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch better-picker

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@coderabbitai coderabbitai bot requested a review from MrgSub August 11, 2025 15:59
@coderabbitai coderabbitai bot added design Improvements & changes to design & UX High Priority High Priority Work labels Aug 11, 2025
Copy link
Contributor

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

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

cubic analysis

3 issues found across 2 files • Review in cubic

React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 8

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between df4f38d and 8a13559.

📒 Files selected for processing (2)
  • apps/mail/components/create/schedule-send-picker.tsx (2 hunks)
  • apps/mail/components/ui/calendar.tsx (2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{css,js,ts,jsx,tsx,mdx}

📄 CodeRabbit Inference Engine (.cursor/rules/tailwind-css-v4.mdc)

**/*.{css,js,ts,jsx,tsx,mdx}: Chain variants together for composable variants (e.g., group-has-data-potato:opacity-100).
Use new variants such as starting, not-*, inert, nth-*, in-*, open (for :popover-open), and ** for all descendants.
Do not use deprecated utilities like bg-opacity-*, text-opacity-*, border-opacity-*, and divide-opacity-*; use the new syntax (e.g., bg-black/50).
Use renamed utilities: shadow-sm is now shadow-xs, shadow is now shadow-sm, drop-shadow-sm is now drop-shadow-xs, drop-shadow is now drop-shadow-sm, blur-sm is now blur-xs, blur is now blur-sm, rounded-sm is now rounded-xs, rounded is now rounded-sm, outline-none is now outline-hidden.
Use bg-(--brand-color) syntax for CSS variables in arbitrary values instead of bg-[--brand-color].
Stacked variants now apply left-to-right instead of right-to-left.

Files:

  • apps/mail/components/ui/calendar.tsx
  • apps/mail/components/create/schedule-send-picker.tsx
**/*.{js,jsx,ts,tsx}

📄 CodeRabbit Inference Engine (AGENT.md)

**/*.{js,jsx,ts,tsx}: Use 2-space indentation
Use single quotes
Limit lines to 100 characters
Semicolons are required

Files:

  • apps/mail/components/ui/calendar.tsx
  • apps/mail/components/create/schedule-send-picker.tsx
**/*.{js,jsx,ts,tsx,css}

📄 CodeRabbit Inference Engine (AGENT.md)

Use Prettier with sort-imports and Tailwind plugins

Files:

  • apps/mail/components/ui/calendar.tsx
  • apps/mail/components/create/schedule-send-picker.tsx
**/*.{ts,tsx}

📄 CodeRabbit Inference Engine (AGENT.md)

Enable TypeScript strict mode

Files:

  • apps/mail/components/ui/calendar.tsx
  • apps/mail/components/create/schedule-send-picker.tsx
🧠 Learnings (2)
📓 Common learnings
Learnt from: retrogtx
PR: Mail-0/Zero#1573
File: apps/mail/components/create/template-button.tsx:197-216
Timestamp: 2025-07-28T05:37:50.566Z
Learning: retrogtx prefers less nitpicky code review suggestions and may dismiss detailed accessibility/best practice recommendations with casual responses like "bro please".
📚 Learning: 2025-06-28T03:56:09.376Z
Learnt from: retrogtx
PR: Mail-0/Zero#1468
File: apps/server/src/trpc/routes/mail.ts:331-331
Timestamp: 2025-06-28T03:56:09.376Z
Learning: In apps/server/src/trpc/routes/mail.ts, the user indicated they are not using ISO format for the scheduleAt parameter, despite the frontend code showing toISOString() usage in the ScheduleSendPicker component.

Applied to files:

  • apps/mail/components/create/schedule-send-picker.tsx
🧬 Code Graph Analysis (2)
apps/mail/components/ui/calendar.tsx (2)
apps/mail/lib/utils.ts (1)
  • cn (56-56)
apps/mail/components/icons/icons.tsx (2)
  • ChevronLeft (818-833)
  • ChevronRight (835-850)
apps/mail/components/create/schedule-send-picker.tsx (4)
apps/mail/lib/utils.ts (1)
  • cn (56-56)
apps/mail/components/ui/calendar.tsx (1)
  • Calendar (133-133)
apps/mail/components/icons/icons.tsx (1)
  • Clock (1615-1632)
apps/mail/components/ui/input.tsx (1)
  • Input (22-22)
🪛 Biome (2.1.2)
apps/mail/components/ui/calendar.tsx

[error] 76-82: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)


[error] 115-121: Provide an explicit type prop for the button element.

The default type of a button is submit, which causes the submission of a form when placed inside a form element. This is likely not the behaviour that you want inside a React application.
Allowed button types are: submit, button or reset

(lint/a11y/useButtonType)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: cubic · AI code reviewer
  • GitHub Check: Analyze (javascript-typescript)
🔇 Additional comments (1)
apps/mail/components/create/schedule-send-picker.tsx (1)

138-208: Clean implementation of the two-panel flow

This is exactly what we need - separate, focused controls for date and time. Like having separate controls for steering and acceleration. The Cancel button properly cleans up state too. Ship it!

@retrogtx
Copy link
Contributor Author

@MrgSub this is done btw

@ahmetskilinc ahmetskilinc merged commit 7441e3e into staging Aug 26, 2025
6 checks passed
@ahmetskilinc ahmetskilinc deleted the better-picker branch August 26, 2025 12:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

design Improvements & changes to design & UX High Priority High Priority Work

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants