Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,7 @@
});
</script>

<script>
var path = window.location.pathname;
if (!path.startsWith("/#") && !['/', ''].includes(path)) {
window.location.replace(`/#${path}`);
}
</script>
<script src="redirect.js"></script>
</head>
<body>
<div id="root"></div>
Expand Down
12 changes: 12 additions & 0 deletions public/404.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Redirecting…</title>
<script src="redirect.js"></script>
</head>
<body>
<p>Redirecting…</p>
</body>
</html>
8 changes: 8 additions & 0 deletions public/redirect.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
(() => {
var path = window.location.pathname;
if (path === "/" || path === "") return;
var lastSlash = path.lastIndexOf("/");
var base = lastSlash <= 0 ? "/" : path.slice(0, lastSlash);
var route = lastSlash <= 0 ? path : path.slice(lastSlash);
window.location.replace(base + "#" + route);
})();
2 changes: 1 addition & 1 deletion src/App.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { Route, Routes } from "react-router-dom";
import { usePageTracking } from "./hooks/usePageTracking";
import Home from "./pages/Home";
import Team from "./pages/Team";
import Sponsors from "./pages/Sponsors";
import Team from "./pages/Team";

function App() {
usePageTracking();
Expand Down
4 changes: 1 addition & 3 deletions src/main.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,9 @@ import { HashRouter } from "react-router-dom";
import "./index.css";
import App from "./App.jsx";

const baseUrl = (import.meta.env.BASE_URL ?? "/").replace(/\/$/, "") || undefined;

createRoot(document.getElementById("root")).render(
<StrictMode>
<HashRouter basename={baseUrl}>
<HashRouter>
<App />
</HashRouter>
</StrictMode>,
Expand Down
8 changes: 3 additions & 5 deletions src/pages/Sponsors/index.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const Sponsors = () => {
return (
<div>Sponsors</div>
)
}
return <div>Sponsors</div>;
};

export default Sponsors
export default Sponsors;