Skip to content

Commit a378e13

Browse files
committed
fix: spa routing
1 parent dfb40e7 commit a378e13

3 files changed

Lines changed: 22 additions & 1 deletion

File tree

TheGreenEpochWeb/index.html

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,15 @@
1414
<link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;500;600;700&display=swap" rel="stylesheet" />
1515

1616
<title>TheGreenEpoch - CO₂-aware LLM training simulator</title>
17+
<script>
18+
(function() {
19+
var redirect = sessionStorage.redirect;
20+
delete sessionStorage.redirect;
21+
if (redirect && redirect !== location.pathname + location.search + location.hash) {
22+
history.replaceState(null, '', redirect);
23+
}
24+
})();
25+
</script>
1726
</head>
1827
<body>
1928
<noscript>You need to enable JavaScript to run this app.</noscript>

TheGreenEpochWeb/public/404.html

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>TheGreenEpoch</title>
6+
<script>
7+
sessionStorage.redirect = location.pathname + location.search + location.hash;
8+
location.replace('/TheGreenEpoch/');
9+
</script>
10+
</head>
11+
<body></body>
12+
</html>

TheGreenEpochWeb/src/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ export function App() {
122122

123123
return (
124124
<Show when={app.state.ready} fallback={<LoadingFallback />}>
125-
<Router root={Layout}>
125+
<Router base={import.meta.env.BASE_URL} root={Layout}>
126126
<Route path="/" component={ScenariosPage} />
127127
<Route path="/simulate/:id" component={LiveSimPage} />
128128
<Route path="/results/:id" component={ResultsPage} />

0 commit comments

Comments
 (0)