diff --git a/src/frontend/src/pages/ViewPage/index.tsx b/src/frontend/src/pages/ViewPage/index.tsx index 4ce5baed4..a85875637 100644 --- a/src/frontend/src/pages/ViewPage/index.tsx +++ b/src/frontend/src/pages/ViewPage/index.tsx @@ -1,18 +1,28 @@ import { useContext, useEffect, useState } from "react"; import { useParams } from "react-router-dom"; +import { darkContext } from "../../contexts/darkContext"; import { TabsContext } from "../../contexts/tabsContext"; import { getVersion } from "../../controllers/API"; import Page from "../FlowPage/components/PageComponent"; export default function ViewPage() { const { flows, tabId, setTabId } = useContext(TabsContext); - const { id } = useParams(); + const { setDark } = useContext(darkContext); + const { id, theme } = useParams(); // Set flow tab id useEffect(() => { setTabId(id!); }, [id]); + useEffect(() => { + if (theme) { + setDark(theme === "dark"); + } else { + setDark(false); + } + }, [theme]); + // Initialize state variable for the version const [version, setVersion] = useState(""); useEffect(() => { diff --git a/src/frontend/src/routes.tsx b/src/frontend/src/routes.tsx index e9e6f1858..63c61eb45 100644 --- a/src/frontend/src/routes.tsx +++ b/src/frontend/src/routes.tsx @@ -44,7 +44,7 @@ const Router = () => { } />