2024-12-20 00:34:54 +08:00
|
|
|
import React, { memo, useState, useEffect } from "react";
|
|
|
|
import { ModuleManager } from "core/moulde";
|
|
|
|
import SetupPage from "app/init";
|
2024-12-18 21:54:37 +08:00
|
|
|
|
2024-12-08 00:55:12 +08:00
|
|
|
const Routes = memo(() => {
|
2024-12-20 00:34:54 +08:00
|
|
|
const [manager, setManager] = useState<ModuleManager | null>(null);
|
2024-12-05 02:13:54 +08:00
|
|
|
|
2024-12-20 00:34:54 +08:00
|
|
|
useEffect(() => {
|
|
|
|
ModuleManager.getInstance().then(instance => {
|
|
|
|
setManager(instance);
|
|
|
|
});
|
2024-12-08 00:55:12 +08:00
|
|
|
}, []);
|
2024-12-05 16:58:57 +08:00
|
|
|
|
2024-12-20 00:34:54 +08:00
|
|
|
if (!manager?.isInitialized()) {
|
|
|
|
return null;
|
|
|
|
}
|
2024-12-08 19:19:54 +08:00
|
|
|
|
2024-12-20 00:34:54 +08:00
|
|
|
const step = manager.getStep();
|
2024-12-12 23:27:36 +08:00
|
|
|
|
2024-12-20 00:34:54 +08:00
|
|
|
if (step < 3) {
|
|
|
|
return <SetupPage />;
|
2024-12-05 16:58:57 +08:00
|
|
|
}
|
2024-12-20 00:34:54 +08:00
|
|
|
|
|
|
|
const currentPath = window.location.pathname;
|
|
|
|
return manager.getPage(currentPath);
|
2024-12-08 00:55:12 +08:00
|
|
|
});
|
|
|
|
|
|
|
|
export default Routes;
|