Skip to content

Commit

Permalink
fix: fixed unwanted trigger of navguard in settings
Browse files Browse the repository at this point in the history
  • Loading branch information
giuliano176 committed Jun 2, 2022
1 parent a0e27e8 commit 65d7c1f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,3 +86,5 @@ export const EMAIL_VALIDATION_REGEX =
/(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21\x23-\x5b\x5d-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\x01-\x08\x0b\x0c\x0e-\x1f\x21-\x5a\x53-\x7f]|\\[\x01-\x09\x0b\x0c\x0e-\x7f])+)\])/;

export const ROOT_NAME = 'USER_ROOT';

export const DR_VALUES = ['auto', 'enabled', 'disabled'];
10 changes: 6 additions & 4 deletions src/settings/components/general-settings/appearance-settings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { FormSubSection, Select } from '@zextras/carbonio-design-system';
import { find } from 'lodash';
import { ThemeCallbacksContext } from '../../../boot/theme-provider';
import { AccountSettings, DRPropValues } from '../../../../types';
import { SHELL_APP_ID } from '../../../constants';
import { DR_VALUES, SHELL_APP_ID } from '../../../constants';
import { themeSubSection } from '../../general-settings-sub-sections';

const AppearanceSettings: FC<{
Expand Down Expand Up @@ -48,10 +48,12 @@ const AppearanceSettings: FC<{
);
const onSelectionChange = useCallback(
(v) => {
setDarkReaderState(v);
addMod('props', 'zappDarkreaderMode', { app: SHELL_APP_ID, value: v });
if (DR_VALUES.includes(v) && v !== currentDRMSetting) {
setDarkReaderState(v);
addMod('props', 'zappDarkreaderMode', { app: SHELL_APP_ID, value: v });
}
},
[addMod, setDarkReaderState]
[addMod, currentDRMSetting, setDarkReaderState]
);
const subSection = useMemo(() => themeSubSection(t), [t]);
return (
Expand Down

0 comments on commit 65d7c1f

Please sign in to comment.