-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
add timezone and datetime formatting on workspace member level #5699
base: main
Are you sure you want to change the base?
add timezone and datetime formatting on workspace member level #5699
Conversation
TODOs/FIXMEs:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
- Added timezone and datetime formatting fields to
WorkspaceMember
type in GraphQL - Introduced
DateTimeSettings
component for user-specific datetime preferences - Refactored and moved timezone and datetime utilities to
workspace-member
module - Deleted redundant components and constants related to datetime settings
- Updated mock data to include new timezone and datetime formatting properties
packages/twenty-front/src/modules/settings/profile/components/DateTimeSettings.tsx
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/utils/detectTimeFormat.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/utils/formatDateLabel.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/utils/formatTimeLabel.ts
Outdated
Show resolved
Hide resolved
...ty-server/src/modules/workspace-member/standard-objects/workspace-member.workspace-entity.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, added some first comments, think we should use enums for workspace-member entity as you suggest, also we would like to create a graphql type to be able to use those enum values in the front
packages/twenty-front/src/modules/workspace-member/utils/formatDateLabel.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/utils/formatDateLabel.ts
Outdated
Show resolved
Hide resolved
...ty-server/src/modules/workspace-member/standard-objects/workspace-member.workspace-entity.ts
Outdated
Show resolved
Hide resolved
packages/twenty-server/src/engine/core-modules/user/dtos/workspace-member.dto.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/constants/TimeFormat.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/constants/TimeFormat.ts
Outdated
Show resolved
Hide resolved
packages/twenty-front/src/modules/workspace-member/constants/DateFormat.ts
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR Summary
(updates since last review)
- Introduced timezone and datetime formatting at the workspace member level
- Updated GraphQL queries and mutations to use new
DateFormat
andTimeFormat
enums - Enhanced
DateTimeSettings.tsx
for granular control over date and time settings - Added new fields and enums for timeZone, dateFormat, and timeFormat in
workspace-member.dto.ts
- Updated
workspace-member.workspace-entity.ts
to define and use new enums for date and time formats
@@ -34,7 +34,7 @@ export const Elipsis: Story = { | |||
|
|||
export const Performance = getProfilingStory({ | |||
componentName: 'DateTimeFieldDisplay', | |||
averageThresholdInMs: 0.1, | |||
averageThresholdInMs: 0.2, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: check - if we merge like this we need to be sure there isn't a better solution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is okay to increase if we don't have the choice but in that case you have to "proof" that you've understood the reason why it was increasing and why we can't do any better
timeZone: timeZone === 'system' ? detectTimeZone() : timeZone, | ||
}); | ||
|
||
updateWorkspaceMember(workspaceMember); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
}, | ||
{ | ||
value: WorkspaceMemberTimeFormatEnum.HH_MM, | ||
label: 'Military', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think military means XXYY without separator and beginning with 0. Let's call it 24HRS / 12HRS or something that would speak more to a reader
|
||
setCurrentWorkspaceMember(workspaceMember); | ||
|
||
setDateTimeFormat({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Haven't fully grasped the code yet but it feels wrong that setDateTimeFormat
is called so many times with all those parameters. I have a feeling we can refactor/simplify or re-organize to do it differently
setTimeZone, | ||
TimeFormat.STANDARD, | ||
)})`, | ||
value: TimeFormat.STANDARD, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How come 12 hours is "standard" 😁. We use 24hours in France ;)
) => { | ||
switch (dateLabel) { | ||
case WorkspaceMemberDateFormatEnum.System: | ||
return detectDateFormat(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have you checked the performance / how often this was recomputed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(e.g. basic console.log into that function ; if it's called more than once upon loading the initial page then we're probably doing something wrong - I didn't test)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! Almost there :)
closes: #5140