Skip to content

Commit

Permalink
Temporarily limit sidebar items
Browse files Browse the repository at this point in the history
  • Loading branch information
spaaaacccee committed Mar 18, 2024
1 parent 0f92d1b commit d9c0bae
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 32 deletions.
68 changes: 36 additions & 32 deletions client/src/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ export function useSidebarBackground() {
return useMemo(
() =>
interpolate([palette.background.paper, palette.text.primary])(
palette.mode === "dark" ? 0.0125 : 0.025
palette.mode === "dark" ? 0.025 : 0.025
),
[palette]
);
Expand Down Expand Up @@ -117,37 +117,41 @@ export function Sidebar({ children }: { children?: ReactNode }) {
orientation="vertical"
sx={{ width: 64 }}
>
{values(pages).flatMap((c, i, cx) => [
!!i && c.color !== cx[i - 1].color && (
<Divider sx={{ mx: 2, my: 1 }} />
),
<Tab
onClick={() => (tab === c.id ? setOpen(false) : setOpen(true))}
key={c.id}
value={c.id}
sx={{
minWidth: 0,
alignItems: "center",
justifyContent: "center",
}}
label={
<Tooltip key={c.id} title={c.name} placement="right">
<Box
sx={{
alignItems: "center",
display: "flex",
"> svg > path": {
strokeWidth: 0.5,
stroke: bgcolor,
},
}}
>
{c.icon}
</Box>
</Tooltip>
}
/>,
])}
{values(pages)
.filter((c) => c.showInSidebar)
.flatMap((c, i, cx) => [
!!i && c.color !== cx[i - 1].color && (
<Divider sx={{ mx: 2, my: 1 }} />
),
<Tab
onClick={() =>
tab === c.id ? setOpen(false) : setOpen(true)
}
key={c.id}
value={c.id}
sx={{
minWidth: 0,
alignItems: "center",
justifyContent: "center",
}}
label={
<Tooltip key={c.id} title={c.name} placement="right">
<Box
sx={{
alignItems: "center",
display: "flex",
"> svg > path": {
strokeWidth: 0.5,
stroke: bgcolor,
},
}}
>
{c.icon}
</Box>
</Tooltip>
}
/>,
])}
</TabList>
</Stack>
<Box sx={{ flex: 1 }}>
Expand Down
1 change: 1 addition & 0 deletions client/src/pages/PageMeta.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,5 @@ export type PageMeta = {
description?: string;
content: (props: PageContentProps) => ReactNode;
allowFullscreen?: boolean;
showInSidebar?: boolean;
};
3 changes: 3 additions & 0 deletions client/src/pages/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export const pages: Dictionary<PageMeta> = {
icon: <RocketIcon />,
content: ExplorePage,
allowFullscreen: true,
showInSidebar: true,
},
viewport: {
id: "viewport",
Expand Down Expand Up @@ -82,6 +83,7 @@ export const pages: Dictionary<PageMeta> = {
icon: <LogsIcon />,
content: InfoPage,
allowFullscreen: true,
showInSidebar: true,
},
settings: {
id: "settings",
Expand All @@ -91,6 +93,7 @@ export const pages: Dictionary<PageMeta> = {
icon: <SettingsIcon />,
content: SettingsPage,
allowFullscreen: true,
showInSidebar: true,
},
// about: {
// id: "about",
Expand Down

0 comments on commit d9c0bae

Please sign in to comment.