Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add routing to application #100

Closed
wants to merge 21 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
1 change: 1 addition & 0 deletions packages/web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
},
"dependencies": {
"@duckdb/duckdb-wasm": "1.28.1-dev106.0",
"react-router-dom": "^6.23.1",
"regenerator-runtime": "0.13.x",
"semver": "7.3.x"
}
Expand Down
15 changes: 14 additions & 1 deletion packages/web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { memoize } from "lodash";
import * as React from "react";
import { render } from "react-dom";
import { Provider } from "react-redux";
import { createBrowserRouter, RouterProvider } from "react-router-dom";

import NotificationServiceWeb from "./services/NotificationServiceWeb";
import PersistentConfigServiceWeb from "./services/PersistentConfigServiceWeb";
Expand All @@ -14,6 +15,7 @@ import FmsFileExplorer from "../../core/App";
import { createReduxStore } from "../../core/state";
import FileViewerServiceWeb from "./services/FileViewerServiceWeb";
import FileDownloadServiceWeb from "./services/FileDownloadServiceWeb";
import Root from "./routes/Root";

const APP_ID = "fms-file-explorer-web";

Expand Down Expand Up @@ -54,9 +56,20 @@ const collectPlatformDependentServices = memoize(() => ({
persistentConfigService,
}));

const router = createBrowserRouter([
{
path: "/",
element: <Root />, // Splash page placeholder
},
{
path: "app",
element: <FmsFileExplorer platformDependentServices={collectPlatformDependentServices()} />,
},
]);

render(
<Provider store={createReduxStore()}>
<FmsFileExplorer platformDependentServices={collectPlatformDependentServices()} />
<RouterProvider router={router} />
</Provider>,
document.getElementById(APP_ID)
);
10 changes: 10 additions & 0 deletions packages/web/src/routes/Root/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as React from "react";

// Placeholder for the splash page
export default function Root() {
return (
<div>
<h1> Coming soon </h1>
</div>
);
}
1 change: 1 addition & 0 deletions packages/web/webpack/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ module.exports = ({ analyze, production } = {}) => ({
devServer: {
host: devServer.host,
port: devServer.port,
historyApiFallback: true,
},
entry: {
app: "./src/index.tsx",
Expand Down
Loading