Skip to content

Commit 9fd45c7

Browse files
committed
chore(suite): unify debug mode usage
1 parent 398315a commit 9fd45c7

File tree

3 files changed

+12
-8
lines changed

3 files changed

+12
-8
lines changed

packages/suite/src/components/suite/layouts/SuiteLayout/Sidebar/QuickActions/DebugAndExperimental.tsx

+5-4
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { spacings } from '@trezor/theme';
66
import { useDispatch, useSelector } from 'src/hooks/suite';
77
import { goto } from 'src/actions/suite/routerActions';
88
import { SettingsAnchor } from 'src/constants/suite/anchors';
9+
import { selectIsDebugModeActive } from 'src/reducers/suite/suiteReducer';
910

1011
import { QuickActionButton } from './QuickActionButton';
1112
import { TooltipRow } from './TooltipRow';
@@ -73,27 +74,27 @@ export const DebugAndExperimental = () => {
7374

7475
const isEapEnabled = useSelector(state => state.desktopUpdate.allowPrerelease);
7576
const isExperimental = useSelector(state => state.suite.settings.experimental !== undefined);
76-
const isDebugMode = useSelector(state => state.suite.settings.debug.showDebugMenu);
77+
const isDebug = useSelector(selectIsDebugModeActive);
7778

7879
const handleEapClick = () => {
7980
dispatch(goto('settings-index', { anchor: SettingsAnchor.EarlyAccess }));
8081
};
8182

82-
if (!isEapEnabled && !isExperimental && !isDebugMode) return null;
83+
if (!isEapEnabled && !isExperimental && !isDebug) return null;
8384

8485
return (
8586
<QuickActionButton
8687
tooltip={
8788
<DebugAndExperimentalTooltip
88-
isDebugMode={isDebugMode}
89+
isDebugMode={isDebug}
8990
isEapEnabled={isEapEnabled}
9091
isExperimental={isExperimental}
9192
/>
9293
}
9394
onClick={handleEapClick}
9495
>
9596
<Relative $size={getIconSize(iconSizes.medium)}>
96-
{isDebugMode && (
97+
{isDebug && (
9798
<Absolute>
9899
<Icon name="debug" variant="destructive" size={iconSizes.medium} />
99100
</Absolute>

packages/suite/src/views/settings/SettingsGeneral/Theme.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ import { ActionColumn, ActionSelect, TextColumn, Translation } from 'src/compone
88
import { useDispatch, useSelector, useTranslation } from 'src/hooks/suite';
99
import { SettingsAnchor } from 'src/constants/suite/anchors';
1010
import { getOsTheme } from 'src/utils/suite/env';
11+
import { selectIsDebugModeActive } from 'src/reducers/suite/suiteReducer';
1112

1213
type ThemeColorVariantWithSystem = ThemeColorVariant | 'system';
1314
type Option = { value: ThemeColorVariantWithSystem; label: string };
1415

1516
const useThemeOptions = () => {
1617
const { translationString } = useTranslation();
17-
const showDebugMenu = useSelector(state => state.suite.settings.debug.showDebugMenu);
18+
const isDebug = useSelector(selectIsDebugModeActive);
1819

1920
const systemOption: Option = {
2021
value: 'system',
@@ -29,7 +30,7 @@ const useThemeOptions = () => {
2930

3031
const optionGroups = [
3132
{ options: [systemOption] },
32-
{ options: [lightOption, darkOption, ...(showDebugMenu ? [debugOption] : [])] },
33+
{ options: [lightOption, darkOption, ...(isDebug ? [debugOption] : [])] },
3334
];
3435

3536
const getOption = (theme: ThemeColorVariantWithSystem) => {

packages/suite/src/views/wallet/details/CoinjoinLogs.tsx

+4-2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import { useSelector } from 'src/hooks/suite/useSelector';
88
import { useAnchor } from 'src/hooks/suite/useAnchor';
99
import { CoinjoinLogsAnchor } from 'src/constants/suite/anchors';
1010
import { anchorOutlineStyles } from 'src/utils/suite/anchor';
11+
import { selectIsDebugModeActive } from 'src/reducers/suite/suiteReducer';
1112

1213
// eslint-disable-next-line local-rules/no-override-ds-component
1314
const SetupCard = styled(Card)<{ $shouldHighlight?: boolean }>`
@@ -19,10 +20,11 @@ const SetupCard = styled(Card)<{ $shouldHighlight?: boolean }>`
1920
`;
2021

2122
export const CoinjoinLogs = () => {
22-
const showDebugMenu = useSelector(state => state.suite.settings.debug.showDebugMenu);
23+
const isDebug = useSelector(selectIsDebugModeActive);
24+
2325
const { anchorRef, shouldHighlight } = useAnchor(CoinjoinLogsAnchor);
2426

25-
if (!showDebugMenu) return null;
27+
if (!isDebug) return null;
2628

2729
return (
2830
<SetupCard ref={anchorRef} $shouldHighlight={shouldHighlight}>

0 commit comments

Comments
 (0)