|
@@ -3,23 +3,24 @@
|
|
|
import ErrorBoundary from "@/components/error-boundary";
|
|
import ErrorBoundary from "@/components/error-boundary";
|
|
|
import styles from "./home.module.scss";
|
|
import styles from "./home.module.scss";
|
|
|
import { SlotID, Path } from "@/constant/route";
|
|
import { SlotID, Path } from "@/constant/route";
|
|
|
-import { HashRouter, Routes, Route, Outlet } from "react-router-dom";
|
|
|
|
|
|
|
+import {
|
|
|
|
|
+ BrowserRouter,
|
|
|
|
|
+ Routes,
|
|
|
|
|
+ Route,
|
|
|
|
|
+ Outlet,
|
|
|
|
|
+ Navigate,
|
|
|
|
|
+ useLocation,
|
|
|
|
|
+ HashRouter,
|
|
|
|
|
+} from "react-router-dom";
|
|
|
import { ExtractorSide } from "./extract-side";
|
|
import { ExtractorSide } from "./extract-side";
|
|
|
import { LanguageProvider } from "@/context/language-provider";
|
|
import { LanguageProvider } from "@/context/language-provider";
|
|
|
import PDFUpload from "@/pages/extract/components/pdf-upload";
|
|
import PDFUpload from "@/pages/extract/components/pdf-upload";
|
|
|
import PDFExtractionJob from "@/pages/extract/components/pdf-extraction";
|
|
import PDFExtractionJob from "@/pages/extract/components/pdf-extraction";
|
|
|
|
|
|
|
|
-// judge if the app has hydrated
|
|
|
|
|
-// const useHasHydrated = () => {
|
|
|
|
|
-// const [hasHydrated, setHasHydrated] = useState<boolean>(false);
|
|
|
|
|
-// useEffect(() => {
|
|
|
|
|
-// setHasHydrated(true);
|
|
|
|
|
-// }, []);
|
|
|
|
|
-// return hasHydrated;
|
|
|
|
|
-// };
|
|
|
|
|
-
|
|
|
|
|
export function WindowContent() {
|
|
export function WindowContent() {
|
|
|
|
|
+ const location = useLocation();
|
|
|
const isHome = location.pathname === Path.Home;
|
|
const isHome = location.pathname === Path.Home;
|
|
|
|
|
+
|
|
|
return (
|
|
return (
|
|
|
<>
|
|
<>
|
|
|
<ExtractorSide className={isHome ? styles["sidebar-show"] : ""} />
|
|
<ExtractorSide className={isHome ? styles["sidebar-show"] : ""} />
|
|
@@ -31,14 +32,16 @@ export function WindowContent() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
function Screen() {
|
|
function Screen() {
|
|
|
- // if you do not need to use the renderContent for rendering router, you can use the other render function to interrupt before the renderContent
|
|
|
|
|
-
|
|
|
|
|
const renderContent = () => {
|
|
const renderContent = () => {
|
|
|
return (
|
|
return (
|
|
|
<div className="w-full h-full flex" id={SlotID.AppBody}>
|
|
<div className="w-full h-full flex" id={SlotID.AppBody}>
|
|
|
<Routes>
|
|
<Routes>
|
|
|
<Route path="/" element={<WindowContent />}>
|
|
<Route path="/" element={<WindowContent />}>
|
|
|
<Route
|
|
<Route
|
|
|
|
|
+ index
|
|
|
|
|
+ element={<Navigate to="/OpenSourceTools/Extractor/PDF" replace />}
|
|
|
|
|
+ />
|
|
|
|
|
+ <Route
|
|
|
path="/OpenSourceTools/Extractor/PDF"
|
|
path="/OpenSourceTools/Extractor/PDF"
|
|
|
element={<PDFUpload />}
|
|
element={<PDFUpload />}
|
|
|
/>
|
|
/>
|
|
@@ -46,15 +49,13 @@ function Screen() {
|
|
|
path="/OpenSourceTools/Extractor/PDF/:jobID"
|
|
path="/OpenSourceTools/Extractor/PDF/:jobID"
|
|
|
element={<PDFExtractionJob />}
|
|
element={<PDFExtractionJob />}
|
|
|
/>
|
|
/>
|
|
|
- {/* <Route path="*" element={<PDFUpload />} /> */}
|
|
|
|
|
|
|
+ <Route
|
|
|
|
|
+ path="*"
|
|
|
|
|
+ element={<Navigate to="/OpenSourceTools/Extractor/PDF" replace />}
|
|
|
|
|
+ />
|
|
|
</Route>
|
|
</Route>
|
|
|
</Routes>
|
|
</Routes>
|
|
|
</div>
|
|
</div>
|
|
|
-
|
|
|
|
|
- // <ExtractorSide className={isHome ? styles["sidebar-show"] : ""} />
|
|
|
|
|
- // <WindowContent className="flex-1">
|
|
|
|
|
- // <AppRoutes />
|
|
|
|
|
- // </WindowContent>
|
|
|
|
|
);
|
|
);
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -62,11 +63,6 @@ function Screen() {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
export function Home() {
|
|
export function Home() {
|
|
|
- // leave this comment to check if the app has hydrated
|
|
|
|
|
- // if (!useHasHydrated()) {
|
|
|
|
|
- // return <LoadingAnimation />;
|
|
|
|
|
- // }
|
|
|
|
|
-
|
|
|
|
|
return (
|
|
return (
|
|
|
<ErrorBoundary>
|
|
<ErrorBoundary>
|
|
|
<LanguageProvider>
|
|
<LanguageProvider>
|