Skip to content

Commit

Permalink
feat: switch from BrowserRouter to HashRouter (#22)
Browse files Browse the repository at this point in the history
  • Loading branch information
noworneverev authored Oct 23, 2024
1 parent 8532c55 commit 4125e81
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions src/app/layout/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useEffect, useState } from "react";
import {
BrowserRouter as Router,
HashRouter as Router,
Routes,
Route,
Navigate,
Expand All @@ -23,6 +23,9 @@ import LightModeOutlinedIcon from "@mui/icons-material/LightModeOutlined";
import DarkModeOutlinedIcon from "@mui/icons-material/DarkModeOutlined";
import GitHubIcon from "@mui/icons-material/GitHub";

const basename =
process.env.NODE_ENV === "development" ? "" : "/graphrag-visualizer";

const App: React.FC = () => {
const [darkMode, setDarkMode] = useState(true);
const paletteType = darkMode ? "dark" : "light";
Expand Down Expand Up @@ -79,7 +82,7 @@ const App: React.FC = () => {

return (
<ThemeProvider theme={theme}>
<Router basename="/graphrag-visualizer">
<Router basename={basename}>
<Container disableGutters maxWidth={false}>
<CssBaseline />

Expand Down Expand Up @@ -120,18 +123,11 @@ const App: React.FC = () => {
)}
</Box>
<Routes>
{" "}
{/* **Added Routes** */}
<Route path="/" element={<Navigate to="/upload" replace />} />{" "}
{/* **Redirect Root to /upload** */}
<Route path="/upload" element={<GraphDataHandler />} />{" "}
{/* **Upload Tab** */}
<Route path="/graph" element={<GraphDataHandler />} />{" "}
{/* **Graph Visualization Tab** */}
<Route path="/data" element={<GraphDataHandler />} />{" "}
{/* **Data Tables Tab** */}
<Route path="*" element={<Navigate to="/upload" replace />} />{" "}
{/* **Catch-All Redirect** */}
</Routes>

{/* <GraphDataHandler /> */}
Expand Down

0 comments on commit 4125e81

Please sign in to comment.