feat: Add timezone dropdown to user profile page

This commit adds a new dropdown component for selecting the timezone on the user profile page. The dropdown options are populated using the `TimezoneCode` enum from the `Common/Types/TimezoneCode.ts` file. Users can now select their timezone, which will be used for all date and time related notifications sent to them. This enhancement improves the user experience by providing a convenient way to set the timezone preference.
This commit is contained in:
Simon Larsen 2024-06-14 11:21:25 +01:00
parent 0d97f0447a
commit 1d6a7ee1fa
No known key found for this signature in database
GPG Key ID: 96C5DCA24769DBCA
2 changed files with 87 additions and 0 deletions

View File

@ -0,0 +1,63 @@
enum TimezoneCode {
UTC = 'UTC',
GMT = 'GMT',
EST = 'EST',
EDT = 'EDT',
CST = 'CST',
CDT = 'CDT',
MST = 'MST',
MDT = 'MDT',
PST = 'PST',
PDT = 'PDT',
AKST = 'AKST',
AKDT = 'AKDT',
HST = 'HST',
HDT = 'HDT',
AEST = 'AEST',
AEDT = 'AEDT',
ACST = 'ACST',
ACDT = 'ACDT',
AWST = 'AWST',
AWDT = 'AWDT',
NZST = 'NZST',
NZDT = 'NZDT',
NFT = 'NFT',
IDLW = 'IDLW',
NT = 'NT',
CAT = 'CAT',
EAT = 'EAT',
IST = 'IST',
MSK = 'MSK',
EET = 'EET',
CET = 'CET',
WAT = 'WAT',
GMT1 = 'GMT+1',
GMT2 = 'GMT+2',
GMT3 = 'GMT+3',
GMT4 = 'GMT+4',
GMT5 = 'GMT+5',
GMT6 = 'GMT+6',
GMT7 = 'GMT+7',
GMT8 = 'GMT+8',
GMT9 = 'GMT+9',
GMT10 = 'GMT+10',
GMT11 = 'GMT+11',
GMT12 = 'GMT+12',
GMT13 = 'GMT+13',
GMT14 = 'GMT+14',
GMT_1 = 'GMT-1',
GMT_2 = 'GMT-2',
GMT_3 = 'GMT-3',
GMT_4 = 'GMT-4',
GMT_5 = 'GMT-5',
GMT_6 = 'GMT-6',
GMT_7 = 'GMT-7',
GMT_8 = 'GMT-8',
GMT_9 = 'GMT-9',
GMT_10 = 'GMT-10',
GMT_11 = 'GMT-11',
GMT_12 = 'GMT-12',
GMT_13 = 'GMT-13',
}
export default TimezoneCode;

View File

@ -3,9 +3,11 @@ import RouteMap, { RouteUtil } from '../../../Utils/RouteMap';
import PageComponentProps from '../../PageComponentProps';
import SideMenu from './SideMenu';
import Route from 'Common/Types/API/Route';
import TimezoneCode from 'Common/Types/TimezoneCode';
import FormFieldSchemaType from 'CommonUI/src/Components/Forms/Types/FormFieldSchemaType';
import CardModelDetail from 'CommonUI/src/Components/ModelDetail/CardModelDetail';
import Page from 'CommonUI/src/Components/Page/Page';
import DropdownUtil from 'CommonUI/src/Utils/Dropdown';
import UserUtil from 'CommonUI/src/Utils/User';
import User from 'Model/Models/User';
import React, { FunctionComponent, ReactElement } from 'react';
@ -60,6 +62,21 @@ const Home: FunctionComponent<PageComponentProps> = (
required: true,
title: 'Full Name',
},
{
field: {
timezone: true,
},
fieldType: FormFieldSchemaType.Dropdown,
dropdownOptions:
DropdownUtil.getDropdownOptionsFromEnum(
TimezoneCode
),
placeholder: 'Select Timezone',
description:
'Select your timezone. This will be used for all date and time related notifications sent out to you.',
required: false,
title: 'Timezone',
},
]}
modelDetailProps={{
showDetailsInNumberOfColumns: 2,
@ -78,6 +95,13 @@ const Home: FunctionComponent<PageComponentProps> = (
},
title: 'Email',
},
{
field: {
timezone: true,
},
title: 'Timezone',
placeholder: 'No timezone selected',
},
],
modelId: UserUtil.getUserId(),
}}