Skip to content

Commit 9de91a6

Browse files
authored
disable icon if root node (#3361)
Signed-off-by: SOUISSI Maissa (Externe) <[email protected]>
1 parent 1843bb8 commit 9de91a6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/components/horizontal-toolbar.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ import { Box, Grid, ToggleButton, ToggleButtonGroup, Tooltip } from '@mui/materi
2020
import { DeviceHubIcon, type MuiStyles, OverflowableText, PhotoLibraryIcon, TuneIcon } from '@gridsuite/commons-ui';
2121
import { useDisplayModes } from '../hooks/use-display-modes';
2222
import { useEffect } from 'react';
23+
import { NodeType } from './graph/tree-node.type';
2324

2425
const styles = {
2526
horizontalToolbar: (theme) => ({
@@ -66,6 +67,8 @@ export function HorizontalToolbar() {
6667
}
6768
}, [enableDeveloperMode, toggleOptions, applyModes]);
6869

70+
const isModificationsDisabled = currentNode === null || currentNode?.type !== NodeType.NETWORK_MODIFICATION;
71+
6972
return (
7073
<Grid container alignItems="center" sx={styles.horizontalToolbar}>
7174
<Grid sx={{ marginRight: 'auto', marginLeft: '20px' }}>
@@ -102,9 +105,9 @@ export function HorizontalToolbar() {
102105
<span style={{ display: 'inline-flex' }}>
103106
<ToggleButton
104107
value={StudyDisplayMode.MODIFICATIONS}
105-
disabled={currentNode === null || currentNode?.type !== 'NETWORK_MODIFICATION'}
108+
disabled={isModificationsDisabled}
106109
>
107-
<TuneIcon />
110+
<TuneIcon disabled={isModificationsDisabled} />
108111
</ToggleButton>
109112
</span>
110113
</Tooltip>

0 commit comments

Comments
 (0)