Skip to content

Commit eab2fa3

Browse files
committed
Fix sonar issues
Signed-off-by: Ayoub LABIDI <[email protected]>
1 parent c703c70 commit eab2fa3

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/components/graph/nodes/labeled-group-node.styles.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,18 @@ import { zoomStyles } from '../zoom.styles';
1111

1212
export const LABEL_BLOCK_HEIGHT = 30; // px, matches label box vertical size
1313

14-
export const getContainerStyle = (theme: Theme, isLight: boolean) => ({
15-
...zoomStyles.labeledGroupBorder(theme),
16-
background: theme.tree?.is.minimalDetail ? (isLight ? theme.palette.grey[200] : colors.grey[700]) : 'transparent',
17-
borderColor: isLight ? colors.grey[400] : colors.grey[500],
18-
});
14+
export const getContainerStyle = (theme: Theme, isLight: boolean) => {
15+
let backgroundColor = 'transparent';
16+
if (theme.tree?.is.minimalDetail) {
17+
backgroundColor = isLight ? theme.palette.grey[200] : colors.grey[700];
18+
}
19+
20+
return {
21+
...zoomStyles.labeledGroupBorder(theme),
22+
background: backgroundColor,
23+
borderColor: isLight ? colors.grey[400] : colors.grey[500],
24+
};
25+
};
1926

2027
export const labeledGroupNodeStyles = {
2128
label: (theme) => ({

src/components/graph/nodes/network-modification-node.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,10 @@ const NetworkModificationNode = (props: NodeProps<ModificationNode>) => {
4949
}, [props.id, selectionForCopy]);
5050

5151
const nodeOpacity = useMemo(() => {
52-
return isSelectedForCut() ? (getLocalStorageTheme() === LIGHT_THEME ? 0.3 : 0.6) : 1;
52+
if (!isSelectedForCut()) {
53+
return 1;
54+
}
55+
return getLocalStorageTheme() === LIGHT_THEME ? 0.3 : 0.6;
5356
}, [isSelectedForCut]);
5457

5558
const tooltipContent = useMemo(() => {

0 commit comments

Comments
 (0)