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

✨ Use only geographic time zones #1033

Merged
merged 13 commits into from
Feb 24, 2024
Merged

✨ Use only geographic time zones #1033

merged 13 commits into from
Feb 24, 2024

Conversation

lukevella
Copy link
Owner

@lukevella lukevella commented Feb 23, 2024

Summary by CodeRabbit

  • New Features
    • Added state management for timezone commands in the Poll Options form.
    • Introduced grouping for supported time zones based on regions.
  • Enhancements
    • Simplified time preferences and time zone selection components.
    • Improved layout and styling for the Date Card component.
    • Updated form accessibility with htmlFor attribute in poll details form.
  • Refactor
    • Consolidated time zone data handling and utility functions.
    • Adjusted UI component styling for better visual consistency.
  • Bug Fixes
    • Corrected timezone issues by unsetting non-geographic time zones in the database.
  • Documentation
    • Updated test configuration details.

Copy link

vercel bot commented Feb 23, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
app ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 24, 2024 1:13am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
landing ⬜️ Ignored (Inspect) Visit Preview Feb 24, 2024 1:13am

Copy link
Contributor

coderabbitai bot commented Feb 23, 2024

Warning

Rate Limit Exceeded

@lukevella has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 1 minutes and 7 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.
Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.
Please see our FAQ for further information.

Commits Files that changed from the base of the PR and between b0e890e and 2d58be9.

Walkthrough

The recent updates focus on refining the user interface and enhancing the functionality across various components related to time zones, date and time preferences, and forms. Notable changes include the simplification of props, introduction of new state logic, and a significant redesign of the DateCard component. Additionally, adjustments in utility functions and styling modifications across UI components aim to improve user experience and code maintainability. A database migration addresses invalid time zones, ensuring data integrity.

Changes

Files Change Summary
.../clock.tsx, .../date-time-preferences.tsx Simplified props, refactored time zone calculations, assigned default values directly.
.../forms/poll-details-form.tsx, .../forms/poll-options-form/... Enhanced form elements with new attributes, imports, and state logic. Adjusted component structure.
.../time-zone-picker/..., .../utils/..., .../settings/... Updated imports, removed unused functions, added new utility functions and time zone management.
.../date-card.tsx Revamped styling and structure to display day and month differently.
.../prisma/migrations/.../migration.sql Database migration to unset non-geographic time zones.
packages/ui/src/... Styling adjustments in card, command dialog, tooltip, input, and textarea components.
vitest.workspace.ts, .../playwright.config.ts Updated configuration for tests.

Poem

In the land of code, where the changes bloom, 🌼
A rabbit hopped, avoiding doom. 🐇💨
Simplifying props, with a keen eye,
Adjusting styles, under the digital sky. 🌌
With each leap and bound, the code did refine,
Celebrating changes, with carrots and wine. 🥕🍷
"To better UX," the rabbit did cheer,
"Let's hop to it, and bring joy far and near!" 🎉

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>.
    • Generate unit-tests for this file.
  • 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 tests 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 generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

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 as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • 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/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 39a22ac and c210d9e.
Files ignored due to path filters (8)
  • apps/web/package.json is excluded by: !**/*.json
  • apps/web/public/locales/en/app.json is excluded by: !**/*.json
  • apps/web/src/components/time-zone-picker/time-zones.json is excluded by: !**/*.json
  • apps/web/tsconfig.json is excluded by: !**/*.json
  • package.json is excluded by: !**/*.json
  • packages/ui/package.json is excluded by: !**/*.json
  • turbo.json is excluded by: !**/*.json
  • yarn.lock is excluded by: !**/*.lock
Files selected for processing (17)
  • apps/web/src/components/clock.tsx (4 hunks)
  • apps/web/src/components/forms/poll-details-form.tsx (1 hunks)
  • apps/web/src/components/forms/poll-options-form/poll-options-form.tsx (3 hunks)
  • apps/web/src/components/settings/date-time-preferences.tsx (1 hunks)
  • apps/web/src/components/time-zone-picker/time-zone-select.tsx (4 hunks)
  • apps/web/src/utils/auth.ts (1 hunks)
  • apps/web/src/utils/date-time-utils.ts (2 hunks)
  • apps/web/src/utils/date-time-utilts.test.ts (1 hunks)
  • apps/web/src/utils/dayjs.tsx (2 hunks)
  • apps/web/src/utils/grouped-time-zone.ts (1 hunks)
  • apps/web/src/utils/supported-time-zones.ts (1 hunks)
  • apps/web/vitest.config.ts (1 hunks)
  • packages/database/prisma/migrations/20240221084400_unset_invalid_timezones/migration.sql (1 hunks)
  • packages/ui/src/card.tsx (4 hunks)
  • packages/ui/src/command.tsx (1 hunks)
  • packages/ui/src/tooltip.tsx (1 hunks)
  • vitest.workspace.ts (1 hunks)
Files skipped from review due to trivial changes (3)
  • apps/web/src/components/settings/date-time-preferences.tsx
  • apps/web/src/utils/supported-time-zones.ts
  • vitest.workspace.ts
Additional comments: 10
packages/database/prisma/migrations/20240221084400_unset_invalid_timezones/migration.sql (1)
  • 1-3: The SQL migration script correctly targets non-geographic time zones for both users and polls, setting them to NULL if they don't match the geographic time zone pattern or belong to the 'Etc/' category. This aligns well with the PR's objectives of refining time zone handling.

It's advisable to test this script on a backup or staging environment before applying it to the production database to ensure no unintended data is affected.

apps/web/vitest.config.ts (1)
  • 1-14: The Vitest configuration updates are well-implemented, correctly excluding **/*.spec.ts files from testing and setting up an alias for easier module resolution. These changes enhance the testing setup and code maintainability.
apps/web/src/utils/grouped-time-zone.ts (1)
  • 1-14: The utility for grouping supported time zones by region is implemented effectively, using reduce to accumulate time zones into an organized structure. This enhances the application's ability to handle time zones in a structured manner.

Consider adding unit tests for this utility to ensure the grouping logic works as expected across various time zones.

packages/ui/src/tooltip.tsx (1)
  • 23-23: The update to the tooltip's background color to bg-gray-800 is a thoughtful adjustment for visual coherence.

Ensure to verify the contrast ratio against the text color to maintain or improve accessibility.

apps/web/src/utils/dayjs.tsx (2)
  • 19-22: The addition of resolveGeographicTimeZone from date-time-utils is a positive change, ensuring that geographic time zones are resolved correctly. This aligns with the PR's objective to enhance time zone handling.
  • 211-216: The logic to determine preferredTimeZone using resolveGeographicTimeZone when config?.timeZone is available, and falling back to getBrowserTimeZone otherwise, is correctly implemented. This ensures that the application uses geographic time zones as intended, enhancing user experience with time settings.
apps/web/src/components/forms/poll-options-form/poll-options-form.tsx (3)
  • 1-14: The addition of imports for Button, CommandDialog, Label, Switch, Tooltip, and the replacement of TimeZonePicker with TimeZoneCommand are in line with the PR's objectives to refine UI components related to time zone selection. This ensures a more intuitive and efficient user interface.
  • 35-36: Introducing the isTimeZoneCommandModalOpen state to manage the visibility of the time zone command modal is a good practice. It enhances the component's interactivity and user experience by providing a more dynamic and responsive UI.
  • 235-255: The logic to open the TimeZoneCommand modal upon button click and handle the selection of a new time zone is correctly implemented. This provides a clear and user-friendly way to select time zones, aligning with the PR's goal to improve time zone handling.
apps/web/src/utils/auth.ts (1)
  • 265-276: > 📝 NOTE

This review was outside the diff hunks, and no overlapping diff hunk was found. Original lines [211-216]

The modifications to the jwt callback function to include additional user details (locale, timeFormat, timeZone, weekStart) in the token when the trigger is "signIn" are appropriate. This ensures that user preferences are correctly propagated through the session, enhancing the user experience by personalizing the application's behavior based on their settings.

@vercel vercel bot temporarily deployed to Preview – app February 23, 2024 10:30 Inactive
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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between c210d9e and edeb068.
Files selected for processing (1)
  • packages/database/prisma/migrations/20240221084400_unset_invalid_timezones/migration.sql (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • packages/database/prisma/migrations/20240221084400_unset_invalid_timezones/migration.sql

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between edeb068 and 27a04de.
Files selected for processing (1)
  • apps/web/playwright.config.ts (1 hunks)
Additional comments: 1
apps/web/playwright.config.ts (1)
  • 26-26: The addition of testDir: "./tests", is a good practice for specifying the directory where test files are located, ensuring that Playwright tests are well-organized and easily manageable. This change is correctly implemented and aligns with Playwright's configuration options.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 27a04de and 0b4198f.
Files selected for processing (3)
  • apps/web/src/components/date-card.tsx (1 hunks)
  • apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx (2 hunks)
  • apps/web/src/components/forms/poll-options-form/poll-options-form.tsx (3 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/forms/poll-options-form/poll-options-form.tsx
Additional comments: 4
apps/web/src/components/date-card.tsx (2)
  • 19-19: The updated class names enhance the visual presentation of the DateCard component, aligning with the PR's objective to refine UI elements. The choice of classes seems appropriate for the intended styling adjustments.
  • 23-27: The structural changes to the DateCard component, focusing on displaying the month and day more prominently, align with the PR's objectives to improve the handling and presentation of time-related information. The removal of the dow prop simplifies the component, making it more focused on its primary purpose.
apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx (2)
  • 267-267: The addition of sm:items-start to the className attribute improves the alignment of items in the MonthCalendar component on smaller screens, aligning with the PR's objective to refine UI elements for better responsiveness and user experience.
  • 269-271: Removing the wrapping div around DateCard simplifies the JSX structure, making the component more readable and maintainable. This change aligns with the PR's objectives to improve the codebase's structure and logic.

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 0b4198f and 8b6777b.
Files selected for processing (1)
  • apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx

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.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8b6777b and b0e890e.
Files selected for processing (3)
  • apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx (3 hunks)
  • packages/ui/src/input.tsx (1 hunks)
  • packages/ui/src/textarea.tsx (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • apps/web/src/components/forms/poll-options-form/month-calendar/month-calendar.tsx
Additional comments: 2
packages/ui/src/textarea.tsx (1)
  • 12-12: The addition of the text-sm class to the Textarea component aligns with the PR's objectives of UI consistency and enhancement. This change standardizes the text size across form elements, contributing to a more uniform user experience.
packages/ui/src/input.tsx (1)
  • 22-22: Adjusting the text size for the md size variant from text-base to text-sm in the Input component is a positive change that supports the PR's objectives of UI consistency. Standardizing text sizes across input components enhances the user experience by providing a more uniform appearance.

@lukevella lukevella enabled auto-merge (squash) February 24, 2024 01:11
@lukevella lukevella merged commit 27dda65 into main Feb 24, 2024
4 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant