Skip to content

Commit 5ca8777

Browse files
authored
Merge pull request #41 from mapcomponents/Add-MultiTab
Removing test App and Fixing Hash Router
2 parents 7a50846 + c2599e2 commit 5ca8777

File tree

14 files changed

+7
-281
lines changed

14 files changed

+7
-281
lines changed

multi_tab/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {Button} from "@mui/material";
66
function App() {
77

88
const openTable = () => {
9-
const newUrl = `${window.location.href}table`;
9+
const newUrl = `${window.location.href}#/table`;
1010
window.open(newUrl, "_blank", "popup");
1111
}
1212
return (

multi_tab/src/main.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {MapComponentsProvider} from "@mapcomponents/react-maplibre";
44
import App from './App';
55
import DataTableManager from './components/DataTableManager.jsx';
66
import './index.css';
7-
import { Route, HashRouter as Router } from "react-router-dom";
7+
import {HashRouter as Router, Route, Routes} from "react-router-dom";
88
import {QueryClient, QueryClientProvider} from '@tanstack/react-query';
99
import {DataContextProvider} from "./contexts/DataContext";
1010
import pwaUrl from "./lib/pwaUrl";
@@ -20,7 +20,6 @@ if ('serviceWorker' in navigator) {
2020
});
2121
});
2222
}
23-
const pathname = window.location.pathname;
2423

2524

2625
ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
@@ -29,8 +28,11 @@ ReactDOM.createRoot(document.getElementById('root') as HTMLElement).render(
2928
<MapComponentsProvider>
3029
<DataContextProvider>
3130
<Router>
32-
<Route path={pathname + "/table"} element={<DataTableManager />} />
33-
<Route path={pathname + "/"} element={<App />} />
31+
<Routes>
32+
<Route path="*" element={<div>404 - Page Not Found</div>}/>
33+
<Route path={`/table`} element={<DataTableManager/>}/>
34+
<Route path={`/`} element={<App/>}/>
35+
</Routes>
3436
</Router>
3537
</DataContextProvider>
3638
</MapComponentsProvider>

test_app/.gitignore

Lines changed: 0 additions & 24 deletions
This file was deleted.

test_app/README.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

test_app/eslint.config.js

Lines changed: 0 additions & 38 deletions
This file was deleted.

test_app/index.html

Lines changed: 0 additions & 13 deletions
This file was deleted.

test_app/package.json

Lines changed: 0 additions & 28 deletions
This file was deleted.

test_app/public/vite.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

test_app/src/App.css

Lines changed: 0 additions & 42 deletions
This file was deleted.

test_app/src/App.jsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

test_app/src/assets/react.svg

Lines changed: 0 additions & 1 deletion
This file was deleted.

test_app/src/index.css

Lines changed: 0 additions & 68 deletions
This file was deleted.

test_app/src/main.jsx

Lines changed: 0 additions & 10 deletions
This file was deleted.

test_app/vite.config.js

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)