Skip to content

Conversation

@vamsikrishnamathala
Copy link
Member

@vamsikrishnamathala vamsikrishnamathala commented Mar 27, 2025

Description

Added tool tip to display time in user's timezone when he is in different timezone from the project.
Added badge to display UTC offset for the project.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • Feature (non-breaking change which adds functionality)
  • Improvement (change that would cause existing functionality to not work as expected)
  • Code refactoring
  • Performance improvements
  • Documentation update

Screenshots and Media (if applicable)

Test Scenarios

References

WEB-3694

Summary by CodeRabbit

  • New Features

    • The date range picker now displays contextual, timezone-adjusted information for start and end dates via enhanced tooltips.
  • UI Improvements

    • Enhanced layout groups the date selection controls more intuitively, providing a clearer and smoother user experience.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Mar 27, 2025

Walkthrough

This change updates the sidebar-header.tsx component by adding a new import (ArrowRight) from lucide-react and introducing a useTimeZoneConverter hook to compute and display the user's project UTC offset. The rendering logic for the date range selection is revised by wrapping both the start and end date controllers in a flex container. Additionally, the DateRangeDropdown is enhanced with new properties for displaying tooltips that show formatted dates based on the user's timezone. Redundant comments have been removed and the code has been reorganized for clarity.

Changes

File Summary of Changes
web/core/.../sidebar-header.tsx - Added import for ArrowRight from lucide-react
- Introduced and utilized useTimeZoneConverter hook for obtaining projectUTCOffset
- Modified date range UI: wrapped start and end date controllers in a flex container
- Updated DateRangeDropdown to include new props (placeholder, customTooltipHeading, customTooltipContent) and altered tooltip logic
- Removed redundant comments and reorganized code for clarity

Sequence Diagram(s)

sequenceDiagram
    participant U as User
    participant S as SidebarHeader
    participant T as TimeZoneConverterHook
    participant D as DateRangeDropdown

    U->>S: Initiates date range selection
    S->>T: Fetch project UTC offset
    T-->>S: Returns projectUTCOffset
    S->>D: Render with date range and tooltip props
    D->>S: Format dates via renderFormattedDateInUserTimezone
    S-->>U: Display updated date range with contextual tooltip
Loading

Possibly related PRs

Suggested labels

🌟enhancement, 🌐frontend

Suggested reviewers

  • sriramveeraghanta
  • anmolsinghbhatia
  • pushya22

Poem

I’m a little rabbit hopping through the code,
With a shiny new hook, on a delightful road.
Dates and timezones now dance in view,
A flexy layout makes everything anew!
Cheers to clean code and bugs laid low –
Hoppy changes make my heart aglow!

✨ Finishing Touches
  • 📝 Generate Docstrings

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.
    • 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.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai plan to trigger planning for file edits and PR creation.
  • @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.

@makeplane
Copy link

makeplane bot commented Mar 27, 2025

Pull Request Linked with Plane Work Items

Comment Automatically Generated by Plane

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

🧹 Nitpick comments (1)
web/core/components/cycles/analytics-sidebar/sidebar-header.tsx (1)

329-337: Consider adding fallback text for empty dates in tooltip

While the tooltip implementation is good, it might be helpful to add fallback text for when dates are empty but the tooltip is shown (though this is mitigated by the current conditional display).

  customTooltipContent={
    <span className="flex gap-1">
-     {renderFormattedDateInUserTimezone(cycleDetails.start_date ?? "")}
+     {cycleDetails.start_date ? renderFormattedDateInUserTimezone(cycleDetails.start_date) : t("project_cycles.add_date")}
      <ArrowRight className="h-3 w-3 flex-shrink-0 my-auto" />
-     {renderFormattedDateInUserTimezone(cycleDetails.end_date ?? "")}
+     {cycleDetails.end_date ? renderFormattedDateInUserTimezone(cycleDetails.end_date) : t("project_cycles.add_date")}
    </span>
  }
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1121c58 and d54b9d4.

📒 Files selected for processing (1)
  • web/core/components/cycles/analytics-sidebar/sidebar-header.tsx (4 hunks)
🧰 Additional context used
🧬 Code Definitions (1)
web/core/components/cycles/analytics-sidebar/sidebar-header.tsx (1)
web/core/components/dropdowns/date-range.tsx (1)
  • DateRangeDropdown (59-229)
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: Analyze (python)
🔇 Additional comments (5)
web/core/components/cycles/analytics-sidebar/sidebar-header.tsx (5)

6-14: Import enhancement for the timezone feature

The addition of the ArrowRight icon is appropriate for indicating the date range in the new timezone display feature.


31-31: Good addition of timezone converter functionality

The import of the useTimeZoneConverter hook is well-placed and aligns with the PR objective of displaying dates in the user's timezone.


64-67: Well-structured timezone conversion implementation

Extracting the necessary methods from the hook and deriving the project UTC offset is a clean approach. The hook is properly initialized with the projectId parameter.


305-348: Improved date display with timezone context

The UI enhancements effectively implement the PR objectives by:

  1. Restructuring the date range selection UI with a flex container
  2. Adding a helpful tooltip showing dates in the user's timezone
  3. Displaying the project UTC offset as a badge for immediate context

The tooltip is correctly shown only when both dates are available, and the UTC offset badge is conditionally rendered.


343-347: Good use of conditional rendering for UTC offset badge

The conditional rendering of the UTC offset badge ensures it's only shown when needed, and the styling is consistent with the application's design language.

@sriramveeraghanta sriramveeraghanta merged commit a5ffbff into preview Mar 27, 2025
5 of 6 checks passed
@sriramveeraghanta sriramveeraghanta deleted the feat-cycle_date_display branch March 27, 2025 11:48
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.

4 participants