Skip to content

Commit b4b4173

Browse files
committed
fix: sidebar fixes
1 parent fb8ca8b commit b4b4173

File tree

5 files changed

+25
-29
lines changed

5 files changed

+25
-29
lines changed

console/ui/.eslintrc.cjs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,6 @@ module.exports = {
2222
'react-refresh/only-export-components': ['warn', { allowConstantExport: true }],
2323
'@typescript-eslint/no-misused-promises': 'off',
2424
'@typescript-eslint/no-unsafe-argument': 'off',
25+
'react-hooks/exhaustive-deps': 'off',
2526
},
2627
};

console/ui/src/entities/sidebar-item/model/types.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ export interface SidebarItemProps {
44
path: string;
55
label: string;
66
icon?: ComponentType<SVGProps<SVGSVGElement>>;
7-
isActive?: string;
7+
isActive?: boolean;
88
isCollapsed?: boolean;
99
target?: string;
1010
}

console/ui/src/entities/sidebar-item/ui/SidebarItemContent.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const SidebarItemContent: FC<SidebarItemProps> = ({
1212
isCollapsed,
1313
}) => {
1414
const theme = useTheme();
15-
15+
1616
return (
1717
<ListItemButton
1818
sx={{
@@ -39,8 +39,8 @@ const SidebarItemContent: FC<SidebarItemProps> = ({
3939
{SidebarIcon ? <SidebarIcon width="30px" height="30px" /> : null}
4040
</ListItemIcon>
4141
{!isCollapsed ? (
42-
<ListItemText
43-
primary={label}
42+
<ListItemText
43+
primary={label}
4444
sx={{
4545
color: 'text.primary',
4646
'& .MuiListItemText-primary': {

console/ui/src/widgets/sidebar/model/constants.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,6 @@ export const sidebarLowData = (t: TFunction) => [
4949
},
5050
];
5151

52-
export const OPEN_SIDEBAR_WIDTH = '220px';
52+
export const OPEN_SIDEBAR_WIDTH = '222px';
5353

54-
export const COLLAPSED_SIDEBAR_WIDTH = '62px';
54+
export const COLLAPSED_SIDEBAR_WIDTH = '66px';

console/ui/src/widgets/sidebar/ui/index.tsx

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Sidebar = () => {
1717
const toggleSidebarCollapse = () => {
1818
setIsCollapsed((prev) => {
1919
const newValue = !prev;
20-
localStorage.setItem('isSidebarCollapsed', newValue);
20+
localStorage.setItem('isSidebarCollapsed', String(newValue));
2121
return newValue;
2222
});
2323
};
@@ -30,43 +30,38 @@ const Sidebar = () => {
3030
if ((!isCollapsed && isLesserThan1600) || (isCollapsed && !isLesserThan1600)) toggleSidebarCollapse();
3131
}, [isLesserThan1600]);
3232

33-
const sidebarItems = sidebarData(t).map((item) => (
34-
<SidebarItem
35-
key={item.label + item.path}
36-
{...item}
37-
isActive={isActive(item.path)} //TODO: fix
38-
isCollapsed={isCollapsed}
39-
/>
40-
));
41-
42-
const sidebarLowIcons = sidebarLowData(t).map((item) => (
43-
<SidebarItem key={item.label + item.path} isCollapsed={isCollapsed} target="_blank" {...item} />
44-
));
45-
4633
return (
4734
<Drawer
4835
variant="permanent"
4936
sx={{
5037
width: isCollapsed ? COLLAPSED_SIDEBAR_WIDTH : OPEN_SIDEBAR_WIDTH,
5138
flexShrink: 0,
39+
overflow: 'auto',
5240
[`& .MuiDrawer-paper`]: {
5341
width: isCollapsed ? COLLAPSED_SIDEBAR_WIDTH : OPEN_SIDEBAR_WIDTH,
5442
boxSizing: 'border-box',
5543
transition: 'width .1s ease-in-out',
5644
},
5745
}}>
5846
<Toolbar />
59-
<Stack
60-
direction="column"
61-
height="100%"
62-
width="100%"
63-
overflow="auto"
64-
alignItems="flex-start"
65-
justifyContent="center">
66-
<List sx={{ width: '100%' }}>{sidebarItems}</List>
47+
<Stack direction="column" height="100%" width="100%" alignItems="flex-start" justifyContent="center">
48+
<List sx={{ width: '100%' }}>
49+
{sidebarData(t).map((item) => (
50+
<SidebarItem
51+
key={item.label + item.path}
52+
{...item}
53+
isActive={isActive(item.path)}
54+
isCollapsed={isCollapsed}
55+
/>
56+
))}
57+
</List>
6758
<Box sx={{ height: '100%' }} />
6859
<Divider flexItem />
69-
<List sx={{ width: '100%', padding: '8px 0 8px 0' }}>{sidebarLowIcons}</List>
60+
<List sx={{ width: '100%', padding: '8px 0 8px 0' }}>
61+
{sidebarLowData(t).map((item) => (
62+
<SidebarItem key={item.label + item.path} isCollapsed={isCollapsed} target="_blank" {...item} />
63+
))}
64+
</List>
7065
<Divider flexItem />
7166
<IconButton
7267
sx={{

0 commit comments

Comments
 (0)