-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(settings): add required and autosubmit settings
misc upgrades
- Loading branch information
Showing
11 changed files
with
557 additions
and
1,074 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
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
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 @@ | ||
export const DEFAULT_LANG = 'en'; |
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
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
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,69 @@ | ||
import { FC, SyntheticEvent } from 'react'; | ||
import { useTranslation } from 'react-i18next'; | ||
|
||
import InfoIcon from '@mui/icons-material/InfoRounded'; | ||
import FormControlLabel from '@mui/material/FormControlLabel'; | ||
import Stack from '@mui/material/Stack'; | ||
import Switch from '@mui/material/Switch'; | ||
import Tooltip from '@mui/material/Tooltip'; | ||
import Typography from '@mui/material/Typography'; | ||
|
||
import { GeneralSettings } from '@/config/appSettings'; | ||
|
||
const GeneralSettingsEdit: FC<{ | ||
general: GeneralSettings; | ||
onChange: (newSetting: GeneralSettings) => void; | ||
}> = ({ general, onChange }) => { | ||
const { t } = useTranslation('translations', { | ||
keyPrefix: 'SETTINGS.GENERAL', | ||
}); | ||
|
||
const { required, autosubmit } = general; | ||
|
||
const handleRequiredChange = ( | ||
_event: SyntheticEvent, | ||
checked: boolean, | ||
): void => { | ||
onChange({ | ||
...general, | ||
required: checked, | ||
}); | ||
}; | ||
|
||
const handleAutosubmitChange = ( | ||
_event: SyntheticEvent, | ||
checked: boolean, | ||
): void => { | ||
onChange({ | ||
...general, | ||
autosubmit: checked, | ||
}); | ||
}; | ||
return ( | ||
<Stack spacing={1}> | ||
<Typography variant="h2">{t('TITLE')}</Typography> | ||
<FormControlLabel | ||
control={<Switch />} | ||
label={t('REQUIRED_SWITCH_LABEL')} | ||
checked={required} | ||
onChange={handleRequiredChange} | ||
/> | ||
<FormControlLabel | ||
control={<Switch />} | ||
label={ | ||
<> | ||
{t('AUTOSUBMIT_SWITCH_LABEL')} | ||
{/* TODO: Improve this */} | ||
<Tooltip title={t('AUTOSUBMIT_MORE_INFO')}> | ||
<InfoIcon /> | ||
</Tooltip> | ||
</> | ||
} | ||
checked={autosubmit} | ||
onChange={handleAutosubmitChange} | ||
/> | ||
</Stack> | ||
); | ||
}; | ||
|
||
export default GeneralSettingsEdit; |
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
Oops, something went wrong.