diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx index 83ea9510..0d22ba06 100644 --- a/src/components/Sidebar/Sidebar.tsx +++ b/src/components/Sidebar/Sidebar.tsx @@ -5,6 +5,7 @@ import styles from "./sidebar.module.css"; import { ChatHistory, type ChatHistoryProps } from "../ChatHistory"; import { Settings } from "./Settings"; import { Statistic } from "../../features/Statistic"; +import { useConfig } from "../../contexts/config-context"; export const Sidebar: React.FC< { @@ -15,6 +16,8 @@ export const Sidebar: React.FC< const handleCloseStatistic = () => { setIsOpenedStatistic(false); }; + const { features } = useConfig(); + return ( {isOpenedStatistic ? ( @@ -47,13 +50,15 @@ export const Sidebar: React.FC< /> - setIsOpenedStatistic(true)} - > - - + {features.statistics && ( + setIsOpenedStatistic(true)} + > + + + )} )} diff --git a/src/contexts/config-context.tsx b/src/contexts/config-context.tsx index fa9a6dc3..08fe9a24 100644 --- a/src/contexts/config-context.tsx +++ b/src/contexts/config-context.tsx @@ -8,9 +8,15 @@ export type Config = { lspUrl?: string; dev?: boolean; themeProps?: ThemeProps; + features: { + statistics: boolean; + }; }; -const ConfigContext = createContext({ host: "web" }); +const ConfigContext = createContext({ + host: "web", + features: { statistics: false }, +}); // TODO: add theme props, and configure vscode to grey const ConfigProvider: React.FC<{ diff --git a/src/main.tsx b/src/main.tsx index 871e945d..3d4a6209 100644 --- a/src/main.tsx +++ b/src/main.tsx @@ -7,5 +7,5 @@ import { render } from "./lib"; const element = document.getElementById("refact-chat"); if (element) { - render(element, { host: "web" }); + render(element, { host: "web", features: { statistics: false } }); }