Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions client/src/components/layout/Sidebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,17 @@
* Sidebar with navigation tree and entity tables.
*/

import { Box, Typography, Divider } from "@mui/material";
import { Box, Typography, Divider, IconButton } from "@mui/material";
import LightModeIcon from "@mui/icons-material/LightMode";
import DarkModeIcon from "@mui/icons-material/DarkMode";
import { useConfig } from "@/api/hooks";
import { useThemeMode } from "@/contexts/ThemeContext";
import { RunTree } from "@/components/navigation/RunTree";
import { EntityTabs } from "@/components/entities/EntityTabs";

export function Sidebar() {
const { data: config } = useConfig();
const { mode, toggleMode } = useThemeMode();

return (
<Box sx={{ display: "flex", flexDirection: "column", height: "100%", overflow: "hidden" }}>
Expand All @@ -21,9 +25,12 @@ export function Sidebar() {
alt="Copick"
sx={{ width: 32, height: 32, flexShrink: 0 }}
/>
<Typography variant="h6" noWrap>
<Typography variant="h6" noWrap sx={{ flexGrow: 1 }}>
{config?.name ?? "Copick Web"}
</Typography>
<IconButton size="small" onClick={toggleMode} title={`Switch to ${mode === "dark" ? "light" : "dark"} mode`}>
{mode === "dark" ? <LightModeIcon fontSize="small" /> : <DarkModeIcon fontSize="small" />}
</IconButton>
</Box>
{config?.description && (
<Typography variant="caption" color="text.secondary" noWrap>
Expand Down
13 changes: 3 additions & 10 deletions client/src/main.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from "react";
import ReactDOM from "react-dom/client";
import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
import { ThemeProvider, createTheme, CssBaseline } from "@mui/material";
import { ThemeContextProvider } from "./contexts/ThemeContext";
import App from "./App";
import "./index.css";

Expand All @@ -14,19 +14,12 @@ const queryClient = new QueryClient({
},
});

const darkTheme = createTheme({
palette: {
mode: "dark",
},
});

ReactDOM.createRoot(document.getElementById("root")!).render(
<React.StrictMode>
<QueryClientProvider client={queryClient}>
<ThemeProvider theme={darkTheme}>
<CssBaseline />
<ThemeContextProvider>
<App />
</ThemeProvider>
</ThemeContextProvider>
</QueryClientProvider>
</React.StrictMode>
);
Loading