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

Feat/new timezone settings #6398

Closed
wants to merge 64 commits into from
Closed

Conversation

lucasbordeau
Copy link
Contributor

New PR for timezone feature

@lucasbordeau lucasbordeau marked this pull request as draft July 24, 2024 15:58
Copy link

TODOs/FIXMEs:

  • // TODO: use the user's saved time zone. If undefined, default it with the user's detected time zone.: packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarDisplaySettings.tsx
  • // TODO: use the user's saved date format.: packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarDisplaySettings.tsx
  • // TODO: use the user's saved time format.: packages/twenty-front/src/modules/settings/accounts/components/SettingsAccountsCalendarDisplaySettings.tsx

Generated by 🚫 dangerJS against 7c9e229

Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

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

PR Summary

The pull request introduces new timezone settings and updates various components and tests to support user preferences for date and time formats.

  • GraphQL Updates: Added new enums and fields in packages/twenty-front/src/generated/graphql.tsx to support user preferences.
  • Component Refactors: Deleted SettingsAccountsCalendarDateFormatSelect.tsx, SettingsAccountsCalendarTimeFormatSelect.tsx, and SettingsAccountsCalendarTimeZoneSelect.tsx, moving functionality to new components in profile.
  • New Components: Added DateTimeSettings.tsx, DateTimeSettingsDateFormatSelect.tsx, DateTimeSettingsTimeFormatSelect.tsx, and DateTimeSettingsTimeZoneSelect.tsx for managing date and time settings.
  • Test Updates: Modified test files to use new enums from GraphQL types, ensuring consistency and type safety.
  • Recoil Integration: Updated state management in SettingsAccountsCalendarDisplaySettings.tsx and DateTimeDisplay.tsx to use Recoil for user settings.

30 file(s) reviewed, 4 comment(s)
Edit PR Review Bot Settings


const updateWorkspaceMember = async (changedFields: any) => {
if (!currentWorkspaceMember?.id) {
throw new Error('User is not logged in');
Copy link
Contributor

Choose a reason for hiding this comment

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

Style: Throwing an error here could disrupt the user experience. Consider a user-friendly error message or fallback.

}
};

if (!isDefined(currentWorkspaceMember)) return;
Copy link
Contributor

Choose a reason for hiding this comment

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

Style: Returning undefined here may cause issues. Consider a fallback UI or message.

timeZone,
value,
}: DateTimeSettingsDateFormatSelectProps) => {
const setTimeZone = timeZone === 'system' ? detectTimeZone() : timeZone;
Copy link
Contributor

Choose a reason for hiding this comment

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

Style: Consider caching the result of detectTimeZone() to avoid redundant calculations.

Comment on lines +32 to +35
label: `${formatInTimeZone(
Date.now(),
setTimeZone,
DateFormat.MONTH_FIRST,
Copy link
Contributor

Choose a reason for hiding this comment

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

Style: Using Date.now() directly in the formatInTimeZone function may cause issues with re-renders. Consider memoizing the formatted date.

@lucasbordeau
Copy link
Contributor Author

Closing this because it was a test, the correct PR is #6408

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.

2 participants