Skip to content

Comments

[WEB-3237, 3238] dev: date picker enhancements#6470

Merged
sriramveeraghanta merged 3 commits intopreviewfrom
dev/month-year-picker
Jan 28, 2025
Merged

[WEB-3237, 3238] dev: date picker enhancements#6470
sriramveeraghanta merged 3 commits intopreviewfrom
dev/month-year-picker

Conversation

@aaryan610
Copy link
Member

@aaryan610 aaryan610 commented Jan 27, 2025

Description

This PR includes-

  1. Updated the react-day-picker package to the latest version, v.9.5.0.
  2. Added month and year selection to the date picker.
  3. Fixed the bug where months with different number of days altered the height of the date picker causing a flicker.

Type of Change

  • Improvement (change that would cause existing functionality to not work as expected)

Screenshots and Media (if applicable)

Screen.Recording.2025-01-27.at.18.00.18.mov

issues resolved

#6153, #6389

Summary by CodeRabbit

Release Notes

  • Dependencies

    • Upgraded react-day-picker library to version 9.5.0
  • New Features

    • Enhanced date picker components with improved styling and layout
    • Added dropdown-style captions for date selection interfaces
    • Refined visual appearance of date pickers across multiple components
  • Styling Updates

    • Refreshed CSS classes and styles for date picker components
    • Improved hover and selection states for date picker buttons

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 27, 2025

Walkthrough

This pull request introduces updates to multiple components using the react-day-picker library, upgrading from version 8.10.0 to 9.5.0. The changes primarily focus on enhancing the styling and layout of date picker components across various files. The modifications include introducing getDefaultClassNames, updating DayPicker component properties with new classNames and captionLayout props, and revising the associated CSS styles to support the new version of the library.

Changes

File Change Summary
web/core/components/*/filters/date-filter-modal.tsx Added getDefaultClassNames, created defaultClassNames, updated DayPicker with classNames and captionLayout="dropdown"
web/core/components/dropdowns/date-range.tsx Similar changes to date filter modal, added fixedWeeks prop, replaced initialFocus with autoFocus
web/core/components/dropdowns/date.tsx Identical modifications to date range dropdown component
web/core/components/inbox/modals/snooze-issue-modal.tsx Updated DayPicker import, added getDefaultClassNames, modified modal closing mechanism
web/package.json Upgraded react-day-picker from ^8.10.0 to ^9.5.0
web/styles/react-day-picker.css Comprehensive CSS class renaming and style updates

Possibly related PRs

Suggested labels

🌟enhancement

Suggested reviewers

  • SatishGandham
  • sriramveeraghanta

Poem

🐰 Hop, hop, through the date picker's dance,
Styles refined with a rabbity glance,
Classes renamed, components so bright,
Version upgraded with pixel-perfect might!
A library's journey, smooth and clean 🗓️


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

❤️ 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.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • 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 generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

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. (Beta)
  • @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.

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: 1

🔭 Outside diff range comments (1)
web/styles/react-day-picker.css (1)

Line range hint 178-207: Enhance dropdown styles for better accessibility.

The dropdowns implementation could benefit from improved accessibility:

 .rdp-dropdown {
   appearance: none;
   position: absolute;
   z-index: 2;
+  /* Add ARIA attributes support */
+  &[aria-expanded="true"] {
+    background-color: rgba(var(--color-background-80));
+  }
+  /* Add keyboard navigation support */
+  &:focus-visible {
+    outline: var(--rdp-outline);
+    outline-offset: 2px;
+  }
 }
🧹 Nitpick comments (2)
web/styles/react-day-picker.css (2)

33-44: Fix potential height flickering issue.

The fixed height and width on .rdp-day_button should help resolve the flickering issue mentioned in the PR objectives. However, consider adding min-height to prevent potential collapse:

 .rdp-day_button {
   width: var(--rdp-cell-size);
   max-width: var(--rdp-cell-size);
   height: var(--rdp-cell-size);
+  min-height: var(--rdp-cell-size);
 }

307-310: Consider adding transition for smoother hover effects.

The hover and focus states could benefit from smooth transitions:

 .rdp-day.rdp-range_middle .rdp-day_button:hover,
 .rdp-day.rdp-range_middle .rdp-day_button:focus-visible {
   background-color: var(--rdp-background-color);
   color: inherit;
+  transition: background-color 0.2s ease-in-out;
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f22cd1 and d014061.

📒 Files selected for processing (6)
  • web/core/components/core/filters/date-filter-modal.tsx (4 hunks)
  • web/core/components/dropdowns/date-range.tsx (4 hunks)
  • web/core/components/dropdowns/date.tsx (3 hunks)
  • web/core/components/inbox/modals/snooze-issue-modal.tsx (3 hunks)
  • web/package.json (1 hunks)
  • web/styles/react-day-picker.css (3 hunks)
🧰 Additional context used
📓 Learnings (1)
web/styles/react-day-picker.css (1)
Learnt from: vineetk13
PR: makeplane/plane#6391
File: web/styles/react-day-picker.css:249-282
Timestamp: 2025-01-17T05:17:51.953Z
Learning: In the date range picker's CSS, left/right positioning for cell background effects (like in `.rdp-range_start::before`, `.rdp-range_middle::before`, `.rdp-range_end::before`) should use physical properties instead of logical properties, as these create visual effects that should remain consistent regardless of text direction.
⏰ Context from checks skipped due to timeout of 90000ms (3)
  • GitHub Check: lint-web
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (8)
web/core/components/inbox/modals/snooze-issue-modal.tsx (2)

4-4: LGTM! Import and initialization of defaultClassNames.

The addition of getDefaultClassNames and its initialization aligns with the react-day-picker v9.5.0 upgrade.

Also applies to: 21-22


51-52: LGTM! Enhanced date picker with month/year selection.

The addition of captionLayout="dropdown" enables month and year selection in the date picker, improving user experience.

web/core/components/dropdowns/date.tsx (1)

179-180: LGTM! Comprehensive date picker enhancements.

The changes include:

  1. Month/year selection via captionLayout="dropdown"
  2. Auto-focus behavior for better UX
  3. Fixed weeks to prevent height flickering between months

Also applies to: 187-187, 190-190

web/core/components/core/filters/date-filter-modal.tsx (2)

102-105: LGTM! Consistent styling and enhanced functionality for the first date picker.

The changes align with the new react-day-picker version while maintaining consistent styling through defaultClassNames.


127-130: LGTM! Consistent styling and enhanced functionality for the second date picker.

The changes mirror the first date picker, ensuring a consistent user experience across both pickers.

web/core/components/dropdowns/date-range.tsx (1)

209-210: LGTM! Enhanced date range picker with consistent behavior.

The changes include:

  1. Month/year selection support
  2. Fixed weeks to prevent height flickering
  3. Improved focus management

Also applies to: 223-224

web/package.json (1)

58-58: Verify breaking changes from react-day-picker v8 to v9.

This major version upgrade might include breaking changes that need to be addressed across all date picker implementations.

Run this script to:

  1. Check the migration guide
  2. Verify all date picker implementations in the codebase
  3. List potential breaking changes
✅ Verification successful

The codebase is already compatible with react-day-picker v9

The implementation in all four components and the CSS customizations are already following v9 patterns. No breaking changes need to be addressed.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Analyze impact of react-day-picker upgrade

# Check for DayPicker component usage patterns that might be affected
echo "Checking DayPicker usage patterns..."
rg -A 5 "DayPicker" --type tsx

# Look for potential breaking changes in imports
echo "Checking import statements..."
rg "from 'react-day-picker'" --type tsx

# Search for custom styles that might need updates
echo "Checking custom style overrides..."
rg "rdp-" --type css --type scss

Length of output: 427


Script:

#!/bin/bash
# Search for DayPicker usage with correct file extensions
echo "=== Checking DayPicker usage patterns ==="
rg -t js -t jsx -t ts -t tsx "DayPicker" -A 5

echo -e "\n=== Checking import statements ==="
rg -t js -t jsx -t ts -t tsx "from ['|\"]react-day-picker"

echo -e "\n=== Checking custom style overrides ==="
rg "rdp-" -t css

echo -e "\n=== Fetching package information ==="
curl -s https://registry.npmjs.org/react-day-picker | jq -r '.versions["9.5.0"].dist.tarball' | xargs curl -s | tar -xzf - -O package/README.md

Length of output: 8828


Script:

#!/bin/bash
# Search for DayPicker usage without file type restrictions
echo "=== Checking DayPicker component usage ==="
rg "import.*DayPicker.*from ['|\"]react-day-picker" -A 3

echo -e "\n=== Checking DayPicker implementations ==="
rg "<DayPicker" -A 5

Length of output: 4955

web/styles/react-day-picker.css (1)

Line range hint 1-27: LGTM! Root styles are well-structured.

The root styles provide a good foundation with:

  • Consistent sizing variables
  • Clear documentation comments
  • Proper background handling

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: 1

🔭 Outside diff range comments (2)
web/core/components/inbox/modals/snooze-issue-modal.tsx (1)

Line range hint 71-74: Fix undefined close() function call.

The code attempts to call close() which is undefined. This will cause a runtime error.

-                      close();
+                      handleClose();
web/styles/react-day-picker.css (1)

Line range hint 178-207: Fix dropdown styles for better accessibility.

The dropdown styles have a few accessibility concerns:

  1. The opacity:0 approach might affect screen readers
  2. The hover styles should also apply to keyboard focus
 .rdp-dropdown {
-  appearance: none;
-  --webkit-appearance: none;
-  --moz-appearance: none;
+  appearance: none;
+  -webkit-appearance: none;
+  -moz-appearance: none;
   position: absolute;
   z-index: 2;
   top: 0;
   bottom: 0;
   left: 0;
   width: 100%;
   margin: 0;
   padding: 0;
-  opacity: 0;
+  color: transparent;
   border: none;
   font-family: inherit;
   font-size: 1rem;
   line-height: inherit;
   cursor: pointer;
   background: transparent;

-  &:hover {
+  &:hover,
+  &:focus-visible {
     background-color: rgba(var(--color-background-80)) !important;
   }
 }
🧹 Nitpick comments (2)
web/styles/react-day-picker.css (2)

33-44: Consider adding transition for smooth hover effects.

The day button styles look good, but adding a transition property would make hover and selection effects smoother.

 .rdp-day_button {
   display: flex;
   overflow: hidden;
   align-items: center;
   justify-content: center;
   box-sizing: border-box;
   width: var(--rdp-cell-size);
   max-width: var(--rdp-cell-size);
   height: var(--rdp-cell-size);
   margin: 0;
   border: 2px solid transparent;
   border-radius: 50%;
+  transition: background-color 0.2s ease-in-out;
 }

95-104: Enhance today's indicator for better visibility.

The current today's indicator might be hard to see on some backgrounds. Consider making it more prominent.

 .rdp-today:not(.rdp-outside)::after {
   content: "";
   position: absolute;
   left: 50%;
   bottom: 2px;
   width: 0.5em;
   height: 0.5em;
-  background-color: var(--rdp-background-color);
+  background-color: var(--rdp-accent-color);
+  opacity: 0.5;
   border-radius: 100%;
   transform: translate(-50%, 0);
 }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 7f22cd1 and d014061.

📒 Files selected for processing (6)
  • web/core/components/core/filters/date-filter-modal.tsx (4 hunks)
  • web/core/components/dropdowns/date-range.tsx (4 hunks)
  • web/core/components/dropdowns/date.tsx (3 hunks)
  • web/core/components/inbox/modals/snooze-issue-modal.tsx (3 hunks)
  • web/package.json (1 hunks)
  • web/styles/react-day-picker.css (3 hunks)
🧰 Additional context used
📓 Learnings (1)
web/styles/react-day-picker.css (1)
Learnt from: vineetk13
PR: makeplane/plane#6391
File: web/styles/react-day-picker.css:249-282
Timestamp: 2025-01-17T05:17:51.953Z
Learning: In the date range picker's CSS, left/right positioning for cell background effects (like in `.rdp-range_start::before`, `.rdp-range_middle::before`, `.rdp-range_end::before`) should use physical properties instead of logical properties, as these create visual effects that should remain consistent regardless of text direction.
🔇 Additional comments (6)
web/core/components/inbox/modals/snooze-issue-modal.tsx (1)

51-52: LGTM! Date picker enhancements properly implemented.

The changes correctly implement the month/year selection dropdown and maintain consistent styling with other date pickers.

web/core/components/dropdowns/date.tsx (1)

179-190: LGTM! Excellent improvements to the date picker.

The changes effectively:

  • Add month/year selection via dropdown
  • Fix height flickering with fixedWeeks
  • Maintain consistent styling
web/core/components/core/filters/date-filter-modal.tsx (1)

102-105: LGTM! Consistent implementation across both date pickers.

The changes maintain consistency in styling and functionality between both date picker instances while adding month/year selection capability.

Also applies to: 127-130

web/core/components/dropdowns/date-range.tsx (1)

Line range hint 209-224: LGTM! Comprehensive improvements to the date range picker.

The changes successfully:

  • Add month/year selection via dropdown
  • Fix height flickering with fixedWeeks
  • Maintain consistent styling while preserving the date range validation logic
web/package.json (1)

58-58: Verify breaking changes from react-day-picker v8 to v9.

This is a major version upgrade that may include breaking changes. Please ensure all components using react-day-picker have been updated according to the v9 migration guide.

Run this script to find all files using react-day-picker that might need updates:

✅ Verification successful

The codebase appears compatible with react-day-picker v9

The four components using react-day-picker are already using v9-compatible APIs:

  • web/core/components/core/filters/date-filter-modal.tsx
  • web/core/components/inbox/modals/snooze-issue-modal.tsx
  • web/core/components/dropdowns/date.tsx
  • web/core/components/dropdowns/date-range.tsx
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Find all files importing react-day-picker
echo "Files importing react-day-picker:"
rg -l "from ['|\"]react-day-picker['\"]" --type tsx --type ts

# Find specific v8 API usage that might need updates
echo -e "\nPotential v8 API usage to update:"
rg "className[^s].*DayPicker" --type tsx --type ts
rg "modifiers.*DayPicker" --type tsx --type ts

Length of output: 413


Script:

#!/bin/bash
# Configure TypeScript file types for ripgrep
export RIPGREP_CONFIG_PATH=$(mktemp)
echo '--type-add=ts:*.{ts,tsx}' > "$RIPGREP_CONFIG_PATH"

# Find all files importing or re-exporting react-day-picker
echo "Files using react-day-picker:"
rg -t ts -t js "from ['\"]react-day-picker['\"]|require\(['\"]react-day-picker['\"]"

# Search for common v8 patterns that need updates
echo -e "\nPotential v8 API patterns:"
rg -t ts -t js "import.*DayPicker.*from ['\"]react-day-picker['\"]" -A 2
rg -t ts -t js "(className|modifiers|selected|onDayClick|mode).*DayPicker"

# Clean up
rm "$RIPGREP_CONFIG_PATH"

Length of output: 2256

web/styles/react-day-picker.css (1)

Line range hint 1-28: LGTM! Base styles are well-structured.

The root styles are well-organized with clear CSS variables for customization. The background is properly set to transparent to allow flexible theming.

@sriramveeraghanta sriramveeraghanta merged commit 88b4d32 into preview Jan 28, 2025
12 of 14 checks passed
@sriramveeraghanta sriramveeraghanta deleted the dev/month-year-picker branch January 28, 2025 10:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants