Feature: Dark Mode View (#1057)

This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-10-16 09:52:24 -03:00 committed by GitHub
commit 49bcadf892
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View file

@ -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(() => {

View file

@ -44,7 +44,7 @@ const Router = () => {
}
/>
<Route
path="view"
path="view/:theme?"
element={
<ProtectedRoute>
<ViewPage />