-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
20 changed files
with
315 additions
and
90 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { SettingsDialog } from './settingsDialog'; | ||
export { SettingSpacer } from './settingSpacer'; | ||
export { SettingsSelectField } from './settingsSelectField'; |
File renamed without changes.
62 changes: 62 additions & 0 deletions
62
app/front-end/src/components/dialogs/settingsDialog/settingsDialog.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { SettingSpacer } from '@/components/dialogs/settingsDialog'; | ||
import { ColorModeSetting, LanguageSetting, TimeZoneSetting } from '@/components/dialogs/settingsDialog/settingsFields'; | ||
import { Close as CloseIcon } from '@mui/icons-material'; | ||
import { Box, Dialog, DialogContent, DialogTitle, Grid, IconButton, styled, useTheme } from '@mui/material'; | ||
|
||
const BootstrapDialog = styled(Dialog)(({ theme }) => ({ | ||
backdropFilter: 'blur(5px)', | ||
'& .MuiDialogContent-root': { | ||
padding: '1.5rem', | ||
}, | ||
'& .MuiDialogActions-root': { | ||
padding: '1.5rem', | ||
}, | ||
'& .MuiDialog-paper': { | ||
borderRadius: '1.5rem', | ||
minWidth: '25%', | ||
backgroundColor: theme.palette.background.default, | ||
}, | ||
})); | ||
|
||
interface SettingsDialogProps { | ||
open: boolean; | ||
handleClose: () => void; | ||
} | ||
|
||
export const SettingsDialog: React.FC<SettingsDialogProps> = ({ open, handleClose }) => { | ||
const Theme = useTheme(); | ||
|
||
return ( | ||
<BootstrapDialog onClose={handleClose} open={open}> | ||
<Grid container spacing={2} justifyContent='center' alignItems='center'> | ||
<Grid item xs={8}> | ||
<DialogTitle sx={{ color: Theme.palette.primary.main, pl: '1.5rem', pt: '1.5rem', fontWeight: '700' }}> | ||
Settings | ||
</DialogTitle> | ||
</Grid> | ||
<Grid item xs={4}> | ||
<Box display='flex' justifyContent='flex-end'> | ||
<IconButton | ||
aria-label='close' | ||
onClick={handleClose} | ||
sx={{ | ||
color: Theme.palette.primary.main, | ||
mt: '0.5rem', | ||
mr: '1.5rem', | ||
}} | ||
> | ||
<CloseIcon /> | ||
</IconButton> | ||
</Box> | ||
</Grid> | ||
</Grid> | ||
<DialogContent dividers> | ||
<ColorModeSetting /> | ||
<SettingSpacer /> | ||
<LanguageSetting /> | ||
<SettingSpacer /> | ||
<TimeZoneSetting /> | ||
</DialogContent> | ||
</BootstrapDialog> | ||
); | ||
}; |
23 changes: 23 additions & 0 deletions
23
app/front-end/src/components/dialogs/settingsDialog/settingsFields/colorModeSetting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { SettingsSelectField } from '@/components/dialogs/settingsDialog'; | ||
import { useThemeContext } from '@/hooks'; | ||
|
||
export const ColorModeSetting = () => { | ||
const ThemeContext = useThemeContext(); | ||
|
||
const handleThemeChange = () => { | ||
ThemeContext.update(); | ||
}; | ||
|
||
return ( | ||
<SettingsSelectField | ||
title='Color mode' | ||
description='Toggle between light and dark modes' | ||
settings={[ | ||
{ value: 'light', label: 'Light' }, | ||
{ value: 'dark', label: 'Dark' }, | ||
]} | ||
value={ThemeContext.mode} | ||
onChange={handleThemeChange} | ||
/> | ||
); | ||
}; |
3 changes: 3 additions & 0 deletions
3
app/front-end/src/components/dialogs/settingsDialog/settingsFields/index.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
export { ColorModeSetting } from './colorModeSetting'; | ||
export { LanguageSetting } from './languageSetting'; | ||
export { TimeZoneSetting } from './timeZoneSetting'; |
28 changes: 28 additions & 0 deletions
28
app/front-end/src/components/dialogs/settingsDialog/settingsFields/languageSetting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { SettingsSelectField } from '@/components/dialogs/settingsDialog'; | ||
import { SelectChangeEvent } from '@mui/material'; | ||
import { useState } from 'react'; | ||
|
||
export const LanguageSetting = () => { | ||
// TODO: Implement language switching functionality and replace with correct values | ||
|
||
const [switchLanguage, setSwitchLanguage] = useState('en'); | ||
|
||
const handleLanguageChange = (event: SelectChangeEvent<string>) => { | ||
const selectedLanguage = event.target.value; | ||
setSwitchLanguage(selectedLanguage); | ||
}; | ||
|
||
return ( | ||
<SettingsSelectField | ||
title='Language' | ||
description='Change the language of the application' | ||
settings={[ | ||
{ value: 'en', label: 'English' }, | ||
{ value: 'lt', label: 'Lithuanian' }, | ||
{ value: 'it', label: 'Italian' }, | ||
]} | ||
value={switchLanguage} | ||
onChange={handleLanguageChange} | ||
/> | ||
); | ||
}; |
24 changes: 24 additions & 0 deletions
24
app/front-end/src/components/dialogs/settingsDialog/settingsFields/timeZoneSetting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import { SettingsSelectField } from '@/components/dialogs/settingsDialog'; | ||
import { SelectChangeEvent } from '@mui/material'; | ||
import { useState } from 'react'; | ||
|
||
export const TimeZoneSetting = () => { | ||
// TODO: Implement time zone switching functionality and replace with correct values | ||
|
||
const [switchTimeZone, setSwitchTimeZone] = useState('GMT+3'); | ||
|
||
const handleTimeZoneChange = (event: SelectChangeEvent<string>) => { | ||
const selectedValue = event.target.value; | ||
setSwitchTimeZone(selectedValue); | ||
}; | ||
|
||
return ( | ||
<SettingsSelectField | ||
title='Time zone' | ||
description='Change the time zone of the application' | ||
settings={[{ value: 'GMT+3', label: 'GMT+3' }]} | ||
value={switchTimeZone} | ||
onChange={handleTimeZoneChange} | ||
/> | ||
); | ||
}; |
53 changes: 53 additions & 0 deletions
53
app/front-end/src/components/dialogs/settingsDialog/settingsSelectField.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { Box, FormControl, Grid, MenuItem, Select, SelectChangeEvent, Typography, useTheme } from '@mui/material'; | ||
import React from 'react'; | ||
|
||
interface Setting { | ||
value: string | undefined; | ||
label: string; | ||
} | ||
|
||
interface SettingsSelectFieldProps { | ||
title: string; | ||
description: string; | ||
settings: Setting[]; | ||
value: string | undefined; | ||
onChange: (event: SelectChangeEvent) => void; | ||
} | ||
|
||
export const SettingsSelectField: React.FC<SettingsSelectFieldProps> = ({ | ||
title, | ||
description, | ||
settings, | ||
value, | ||
onChange, | ||
}) => { | ||
const Theme = useTheme(); | ||
|
||
return ( | ||
<Grid container spacing={2} justifyContent='center' alignItems='center'> | ||
<Grid item xs={8}> | ||
<Typography sx={{ fontSize: '1.1rem', fontWeight: '500' }}>{title}</Typography> | ||
<Typography sx={{ fontSize: '0.9rem', color: Theme.palette.text.secondary }}>{description}</Typography> | ||
</Grid> | ||
<Grid item xs={4}> | ||
<Box display='flex' justifyContent='flex-end'> | ||
<FormControl sx={{ minWidth: 120 }}> | ||
<Select | ||
value={value} | ||
onChange={onChange} | ||
displayEmpty | ||
size='small' | ||
inputProps={{ 'aria-label': 'Without label' }} | ||
> | ||
{settings.map((setting) => ( | ||
<MenuItem key={setting.value} value={setting.value}> | ||
{setting.label} | ||
</MenuItem> | ||
))} | ||
</Select> | ||
</FormControl> | ||
</Box> | ||
</Grid> | ||
</Grid> | ||
); | ||
}; |
Oops, something went wrong.