prop to hide toggle for advanced settings (#3681)

This commit is contained in:
blessedcoolant 2023-07-08 06:13:19 +12:00 committed by GitHub
commit 3ddbb70bd7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -90,6 +90,7 @@ type ConfigOptions = {
shouldShowDeveloperSettings: boolean; shouldShowDeveloperSettings: boolean;
shouldShowResetWebUiText: boolean; shouldShowResetWebUiText: boolean;
shouldShowBetaLayout: boolean; shouldShowBetaLayout: boolean;
shouldShowAdvancedOptionsSettings: boolean;
}; };
type SettingsModalProps = { type SettingsModalProps = {
@ -106,6 +107,8 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
const shouldShowDeveloperSettings = const shouldShowDeveloperSettings =
config?.shouldShowDeveloperSettings ?? true; config?.shouldShowDeveloperSettings ?? true;
const shouldShowResetWebUiText = config?.shouldShowResetWebUiText ?? true; const shouldShowResetWebUiText = config?.shouldShowResetWebUiText ?? true;
const shouldShowAdvancedOptionsSettings =
config?.shouldShowAdvancedOptionsSettings ?? true;
useEffect(() => { useEffect(() => {
if (!shouldShowDeveloperSettings) { if (!shouldShowDeveloperSettings) {
@ -193,6 +196,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
dispatch(setShouldConfirmOnDelete(e.target.checked)) dispatch(setShouldConfirmOnDelete(e.target.checked))
} }
/> />
{shouldShowAdvancedOptionsSettings && (
<IAISwitch <IAISwitch
label={t('settings.showAdvancedOptions')} label={t('settings.showAdvancedOptions')}
isChecked={shouldShowAdvancedOptions} isChecked={shouldShowAdvancedOptions}
@ -200,6 +204,7 @@ const SettingsModal = ({ children, config }: SettingsModalProps) => {
dispatch(setShouldShowAdvancedOptions(e.target.checked)) dispatch(setShouldShowAdvancedOptions(e.target.checked))
} }
/> />
)}
</StyledFlex> </StyledFlex>
<StyledFlex> <StyledFlex>