-
Notifications
You must be signed in to change notification settings - Fork 12
Implemented:added current browser timezone support in timezonemodal #311
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
base: main
Are you sure you want to change the base?
Implemented:added current browser timezone support in timezonemodal #311
Conversation
|
@gemini-code-assist review |
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.
Code Review
The pull request introduces the display of the browser's time zone in the TimezoneModal and Settings components, enhancing the user experience by providing immediate context of their current time zone. It also includes the functionality to display the current time for selected time zones. The code changes are well-structured and improve the usability of the application. However, there are some areas where improvements can be made to enhance code clarity and efficiency.
| let queryString = ref("") | ||
| let filteredTimeZones = ref([]) | ||
| let timeZones = ref([]) | ||
| let timeZones = computed(() => userStore.getTimeZones) |
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.
| } | ||
| if(props.showBrowserTimeZone) { | ||
| browserTimeZone.value.label = timeZones.value.find((timeZone: any) => timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()))?.label |
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.
The optional chaining operator ?. is used after the find method. While this prevents errors if no matching time zone is found, it might be better to provide a default label in case timeZones.value is empty or the find method returns undefined. This will ensure that the UI always displays a valid label, even if it's a placeholder.
browserTimeZone.value.label = timeZones.value.find((timeZone: any) => timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()))?.label || 'N/A';browserTimeZone.value.label = timeZones.value.find((timeZone: any) => timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()))?.label || 'N/A';
| if(props.showBrowserTimeZone) { | ||
| filteredTimeZones.value = filteredTimeZones.value.filter((timeZone: any) => !timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase())); | ||
| } |
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.
This filtering logic could be simplified by combining the conditions into a single filter operation. This reduces redundancy and makes the code more readable.
filteredTimeZones.value = filteredTimeZones.value.filter((timeZone: any) => !props.showBrowserTimeZone || !timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()));filteredTimeZones.value = filteredTimeZones.value.filter((timeZone: any) => !props.showBrowserTimeZone || !timeZone.id.toLowerCase().match(browserTimeZone.value.id.toLowerCase()));
Related Issues
Related Issue: Dxp-371
Issue Link: hotwax/dxp-components#371
Short Description and Why It's Useful
Improved and added the current timezone support in the setting page and timezonemodal.
Screenshots of Visual Changes before/after (If There Are Any)
Contribution and Currently Important Rules Acceptance