Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
wants to merge 5 commits into from

Conversation

aaryan610
Copy link
Collaborator

@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

  • New Features

    • Upgraded react-day-picker library to version 9.5.0
    • Enhanced date picker components with improved styling and layout
    • Added dropdown caption layout for date pickers
    • Refined visual interactions for date selection
  • Bug Fixes

    • Corrected date variable assignment in date filter modal
  • Style

    • Updated CSS classes and styling for day picker components
    • Improved button and interaction styles for date pickers

Copy link
Contributor

coderabbitai bot commented Jan 27, 2025

Walkthrough

The pull request introduces significant updates to the date picker components across multiple files in the web project. The primary changes involve upgrading the react-day-picker library from version 8.10.0 to 9.5.0, which necessitates modifications to component styling, class names, and configuration. The updates include implementing getDefaultClassNames, adjusting DayPicker properties like captionLayout and autoFocus, and revamping the associated CSS styles to align with the new library version.

Changes

File Change Summary
web/core/components/*/filters/date-filter-modal.tsx
web/core/components/dropdowns/date-range.tsx
web/core/components/dropdowns/date.tsx
web/core/components/inbox/modals/snooze-issue-modal.tsx
- Added getDefaultClassNames import
- Introduced defaultClassNames constant
- Updated DayPicker props: captionLayout="dropdown", classNames, autoFocus
- Removed initialFocus prop
web/package.json - Updated react-day-picker dependency to ^9.5.0
web/styles/react-day-picker.css - Renamed multiple CSS classes
- Restructured styles for day picker components
- Modified button and interaction styles

Possibly related PRs

Suggested Labels

🌟enhancement

Suggested Reviewers

  • gakshita
  • SatishGandham
  • rahulramesha

Poem

🐰 Hop, hop, through the picker's day,
Styles dancing in a brand new way,
Dropdowns bloom with fresh delight,
Classes renamed, pixels just right,
A rabbit's code, both sleek and bright! 🌈


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

🔭 Outside diff range comments (1)
web/core/components/core/filters/date-filter-modal.tsx (1)

Line range hint 51-52: Fix incorrect date2 variable assignment.

There's a bug in the date2 variable assignment. It's currently using watch("date1") instead of watch("date2"), which could cause incorrect date range filtering.

Apply this fix:

  const date1 = getDate(watch("date1"));
- const date2 = getDate(watch("date1"));
+ const date2 = getDate(watch("date2"));
🧹 Nitpick comments (2)
web/styles/react-day-picker.css (2)

33-44: Enhance button accessibility with ARIA attributes.

While the button styles are well-structured, consider adding ARIA attributes for better accessibility.

 .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%;
+  /* Add these styles */
+  -webkit-tap-highlight-color: transparent;
+  touch-action: manipulation;
 }

Line range hint 178-207: Enhance dropdown styles for better month/year selection.

The dropdown styles support the new month/year selection feature from the PR objectives. However, consider adding transition effects for smoother interactions.

 .rdp-dropdowns {
   position: relative;
   display: inline-flex;
   align-items: center;
+  transition: background-color 0.2s ease;
 }

 .rdp-dropdown {
   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;
   border: none;
   font-family: inherit;
   font-size: 1rem;
   line-height: inherit;
   cursor: pointer;
   background: transparent;
+  transition: background-color 0.2s ease;

   &:hover {
     background-color: rgba(var(--color-background-80)) !important;
   }
 }
📜 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 8603b9e.

📒 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 (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (7)
web/core/components/inbox/modals/snooze-issue-modal.tsx (1)

4-4: LGTM! The date picker enhancements look good.

The changes properly implement the new react-day-picker v9.5.0 features:

  • Added month/year selection via captionLayout="dropdown"
  • Migrated to the new classNames API using getDefaultClassNames

Also applies to: 21-22, 51-52

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

2-2: Great improvements to prevent date picker flickering!

The changes effectively address the height flickering issue:

  • Added fixedWeeks prop to maintain consistent height
  • Updated to use autoFocus instead of deprecated initialFocus
  • Enhanced dropdown functionality with captionLayout="dropdown"

Also applies to: 36-37, 179-180, 187-187, 190-190

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

5-5: LGTM! Consistent implementation of date picker enhancements.

The changes properly align with other components:

  • Added month/year selection
  • Fixed height flickering
  • Updated to new styling API

Also applies to: 55-56, 209-210, 223-224


4-4: Verify react-day-picker version in package.json.

Let's ensure the package.json has been updated to use react-day-picker v9.5.0.

Also applies to: 5-5

✅ Verification successful

Package version verified: react-day-picker ^9.5.0

The package.json has been correctly updated to use react-day-picker version 9.5.0, which is consistent with the import changes.

🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Check react-day-picker version in package.json
rg '"react-day-picker"' -A 1 package.json

Length of output: 43


Script:

#!/bin/bash
# Find all package.json files
fd package.json

# Search with a more flexible pattern in all package.json files
fd package.json --exec rg -i "day.?picker" -A 2 {}

Length of output: 711

web/package.json (1)

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

Major version upgrade from v8 to v9 may include breaking changes that need careful review.

Let's check the migration guide and verify dependency compatibility:

✅ Verification successful

The react-day-picker v9 upgrade appears safe to proceed

The codebase uses a compatible implementation pattern that should work with v9:

  • Uses getDefaultClassNames() for styling which handles CSS class changes
  • No usage of removed features (useInput hook, deprecated event handlers)
  • Simple component usage with standard props that remain stable in v9

Note: After upgrading, verify that:

  1. ARIA labels in unit tests haven't changed
  2. Custom CSS classes through classNames prop still apply correctly
🏁 Scripts executed

The following scripts were executed for the analysis:

Script:

#!/bin/bash
# Description: Check react-day-picker v9 migration guide and verify peer dependencies

# Check migration guide from GitHub
echo "Fetching migration guide..."
curl -s "https://raw.githubusercontent.com/gpbl/react-day-picker/main/MIGRATE-v9.md"

# Check peer dependencies
echo -e "\nChecking peer dependencies..."
npm info [email protected] peerDependencies

Length of output: 311


Script:

#!/bin/bash
# Try alternative locations for migration guide and changelog
echo "Checking alternative locations for migration guide..."
curl -s "https://raw.githubusercontent.com/gpbl/react-day-picker/v9.5.0/MIGRATE-v9.md"

echo -e "\nChecking changelog..."
curl -s "https://raw.githubusercontent.com/gpbl/react-day-picker/v9.5.0/CHANGELOG.md"

# Let's also check our codebase usage
echo -e "\nChecking react-day-picker usage in codebase..."
rg "react-day-picker" -B 2 -A 2

Length of output: 57476


Script:

#!/bin/bash
# Check component implementations for breaking changes
echo "Checking component implementations..."

# Check for useInput hook usage (removed in v9)
echo -e "\nChecking for useInput hook usage..."
rg "useInput.*react-day-picker" -B 2 -A 2

# Check for removed event handlers
echo -e "\nChecking for removed event handlers..."
rg "onDayTouchStart|onDayTouchEnd|onDayDoubleClick|onWeekNumberClick" -B 2 -A 2

# Check custom components and styles
echo -e "\nChecking for custom components and styles..."
rg "components=|component=|className=.*DayPicker" -B 2 -A 2

# Check CSS imports and custom styles
echo -e "\nChecking CSS related code..."
rg "DayPicker.*\.css|styles.*DayPicker" -B 2 -A 2

Length of output: 2927


Script:

#!/bin/bash
# Check DayPicker usage in specific components
echo "Examining DayPicker usage in components..."

echo -e "\nChecking snooze-issue-modal.tsx..."
cat web/core/components/inbox/modals/snooze-issue-modal.tsx

echo -e "\nChecking date.tsx..."
cat web/core/components/dropdowns/date.tsx

echo -e "\nChecking date-range.tsx..."
cat web/core/components/dropdowns/date-range.tsx

echo -e "\nChecking date-filter-modal.tsx..."
cat web/core/components/core/filters/date-filter-modal.tsx

Length of output: 24413

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

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

The root styles and CSS variables are properly defined with clear comments. The reduced caption font size (1rem) will help prevent height flickering.


271-281: Maintain consistent range selection behavior.

Based on the retrieved learning from PR #6391, ensure physical properties are used for range selection positioning.

The implementation correctly uses physical properties (left/right) instead of logical properties for range selection positioning, which maintains consistent visual effects regardless of text direction.

@aaryan610 aaryan610 marked this pull request as draft January 27, 2025 14:12
@aaryan610 aaryan610 changed the title [WEB-3237] dev: date picker enhancements [WEB-3237, 3238] dev: date picker enhancements Jan 27, 2025
@aaryan610 aaryan610 closed this Jan 27, 2025
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.

2 participants