Improve toolbox architecture and initial bundle loading
All checks were successful
Deploy Sokko G / deploy (push) Successful in 15s
All checks were successful
Deploy Sokko G / deploy (push) Successful in 15s
This commit is contained in:
parent
f76cddcc95
commit
b221257616
34 changed files with 8358 additions and 6744 deletions
|
|
@ -1,10 +1,9 @@
|
|||
// Rôle : point d'entrée React, assemble données, routes, shell et overlays.
|
||||
import React, { useCallback, useEffect, useState } from "react";
|
||||
import { lazy, Suspense, useCallback, useEffect, useState } from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import "./styles/main.scss";
|
||||
import { AppOverlays } from "./components/AppOverlays.jsx";
|
||||
import { Shell } from "./components/Shell.jsx";
|
||||
import { ToolboxDrawer } from "./features/toolboxes/ToolboxPages.jsx";
|
||||
import { useIndexedToolboxes } from "./features/toolboxes/storage/useIndexedToolboxes.js";
|
||||
import { useToolboxActions } from "./features/toolboxes/useToolboxActions.js";
|
||||
import { useAppData } from "./hooks/useAppData.js";
|
||||
|
|
@ -14,6 +13,8 @@ import { RouteContent } from "./router/RouteContent.jsx";
|
|||
import { useHashRoute } from "./router/hashRouter.js";
|
||||
import { normalizeTimerData } from "./features/toolboxes/storage/toolboxStorage.js";
|
||||
|
||||
const ToolboxDrawer = lazy(() => import("./features/toolboxes/ToolboxPages.jsx").then((module) => ({ default: module.ToolboxDrawer })));
|
||||
|
||||
function App() {
|
||||
const route = useHashRoute();
|
||||
const { siteContent, siteContentError, games, gamesError, mhwilds, diablo4 } = useAppData(route);
|
||||
|
|
@ -25,7 +26,8 @@ function App() {
|
|||
const [image, setImage] = useState(null);
|
||||
const [notifications, setNotifications] = useState([]);
|
||||
const [storageError, setStorageError] = useState("");
|
||||
const store = useIndexedToolboxes((message) => setStorageError(message));
|
||||
const handleStorageError = useCallback((message) => setStorageError(message), []);
|
||||
const store = useIndexedToolboxes(handleStorageError);
|
||||
|
||||
const notify = useCallback((message) => {
|
||||
setNotifications((current) => [
|
||||
|
|
@ -113,19 +115,21 @@ function App() {
|
|||
addImageFiles={actions.addImageFiles}
|
||||
/>
|
||||
{drawerGameId && (
|
||||
<ToolboxDrawer
|
||||
gameId={drawerGameId}
|
||||
game={getGame(drawerGameId)}
|
||||
siteContent={siteContent}
|
||||
toolboxes={store.toolboxes}
|
||||
links={store.links}
|
||||
actions={actions}
|
||||
storageUsage={store.storageUsage}
|
||||
getModuleData={store.getModuleData}
|
||||
updateToolbox={actions.updateToolbox}
|
||||
updateModuleData={store.updateModuleData}
|
||||
addImageFiles={actions.addImageFiles}
|
||||
/>
|
||||
<Suspense fallback={null}>
|
||||
<ToolboxDrawer
|
||||
gameId={drawerGameId}
|
||||
game={getGame(drawerGameId)}
|
||||
siteContent={siteContent}
|
||||
toolboxes={store.toolboxes}
|
||||
links={store.links}
|
||||
actions={actions}
|
||||
storageUsage={store.storageUsage}
|
||||
getModuleData={store.getModuleData}
|
||||
updateToolbox={actions.updateToolbox}
|
||||
updateModuleData={store.updateModuleData}
|
||||
addImageFiles={actions.addImageFiles}
|
||||
/>
|
||||
</Suspense>
|
||||
)}
|
||||
<AppOverlays
|
||||
actions={actions}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue