Skip to content

Commit 8e4f2a1

Browse files
committed
fix: routing
1 parent d1213da commit 8e4f2a1

File tree

4 files changed

+29
-26
lines changed

4 files changed

+29
-26
lines changed

packages/app-explorer/next.config.mjs

+6-13
Original file line numberDiff line numberDiff line change
@@ -29,23 +29,16 @@ const config = {
2929
eslint: {
3030
ignoreDuringBuilds: !!process.env.CI,
3131
},
32-
redirects: async () => {
32+
rewrites: async () => {
3333
return [
3434
{
35-
source: '/portal',
35+
source: '/portal/:path*',
3636
destination: '/portal/index.html',
37-
permanent: false,
38-
},
39-
{
40-
source: '/ecosystem',
41-
destination: '/portal/index.html#/ecosystem',
42-
permanent: false,
43-
},
44-
{
45-
source: '/bridge',
46-
destination: '/portal/index.html#/bridge',
47-
permanent: false,
4837
},
38+
];
39+
},
40+
redirects: async () => {
41+
return [
4942
{
5043
source: '/portal-storybook',
5144
destination: '/portal-storybook/index.html',

packages/app-explorer/src/systems/Core/components/TopNav/TopNav.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ export function TopNav() {
5050
>
5151
Explorer
5252
</Nav.MenuItem>
53-
<Nav.MenuItem href="/bridge">Bridge</Nav.MenuItem>
54-
<Nav.MenuItem href="/portal">Ecosystem</Nav.MenuItem>
53+
<Nav.MenuItem href="/portal/bridge">Bridge</Nav.MenuItem>
54+
<Nav.MenuItem href="/portal/ecosystem">Ecosystem</Nav.MenuItem>
5555
</>
5656
);
5757

packages/app-portal/src/routes.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
import { HashRouter, Navigate, Route, Routes } from 'react-router-dom';
1+
import { BrowserRouter, Navigate, Route, Routes } from 'react-router-dom';
22

33
import { bridgeRoutes } from './systems/Bridge/routes';
44
import { ecosystemRoutes } from './systems/Ecosystem/routes';
55
import { Pages } from './types';
66

77
export const routes = (
8-
<HashRouter>
8+
<BrowserRouter basename="/portal">
99
<Routes>
1010
<Route>
1111
<Route path="*" element={<Navigate to={Pages.ecosystem} />} />
1212
{bridgeRoutes}
1313
{ecosystemRoutes}
1414
</Route>
1515
</Routes>
16-
</HashRouter>
16+
</BrowserRouter>
1717
);

packages/app-portal/src/systems/Bridge/hooks/useBridge.tsx

+18-8
Original file line numberDiff line numberDiff line change
@@ -166,21 +166,31 @@ export function useBridge() {
166166
searchParams.set('from', 'eth');
167167
searchParams.set('to', 'fuel');
168168

169-
navigate({
170-
pathname: Pages.bridge,
171-
search: searchParams.toString(),
172-
});
169+
navigate(
170+
{
171+
pathname: Pages.bridge,
172+
search: searchParams.toString(),
173+
},
174+
{
175+
replace: true,
176+
},
177+
);
173178
}
174179

175180
function goToWithdraw() {
176181
const searchParams = new URLSearchParams(location.search);
177182
searchParams.set('from', 'fuel');
178183
searchParams.set('to', 'eth');
179184

180-
navigate({
181-
pathname: Pages.bridge,
182-
search: searchParams.toString(),
183-
});
185+
navigate(
186+
{
187+
pathname: Pages.bridge,
188+
search: searchParams.toString(),
189+
},
190+
{
191+
replace: true,
192+
},
193+
);
184194
}
185195

186196
function connectNetwork(network?: SupportedChain) {

0 commit comments

Comments
 (0)