Skip to content

Commit 820d637

Browse files
fix: add loadmf route to load login flow of microapp, add pagenotfound microapp
1 parent dfc816b commit 820d637

File tree

7 files changed

+114
-5
lines changed

7 files changed

+114
-5
lines changed

apps/OpenSign/src/App.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import PageNotFound from "./routes/PageNotFound";
1414
import ForgetPassword from "./routes/ForgetPassword";
1515
import ChangePassword from "./routes/ChangePassword";
1616
import ReportMicroapp from "./components/ReportMicroapp";
17+
import LoadMf from "./routes/LoadMf";
1718

1819
function App() {
1920
const [isloading, setIsLoading] = useState(true);
@@ -59,6 +60,7 @@ function App() {
5960
<Routes>
6061
<Route exact path="/" element={<Login />} />
6162
<Route exact path="/signup" element={<Signup />} />
63+
<Route exact path="/loadmf/:remoteApp/*" element={<LoadMf />} />
6264
<Route exact path="/forgetpassword" element={<ForgetPassword />} />
6365
{process.env.REACT_APP_ENABLE_SUBSCRIPTION && (
6466
<>

apps/OpenSign/src/primitives/GetReportDisplay.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -93,7 +93,7 @@ const ReportTable = ({
9393
{List?.length > 0 ? (
9494
<>
9595
{currentLists.map((item, index) => (
96-
<tr className="border-t-[1px]" key={index}>
96+
<tr className="border-y-[1px]" key={index}>
9797
<td className="px-4 py-2">{index + 1}</td>
9898
<td className="px-4 py-2 font-semibold">{item?.Name} </td>
9999
<td className="px-4 py-2">{item?.Note || "-"}</td>
@@ -153,7 +153,7 @@ const ReportTable = ({
153153
)}
154154
</tbody>
155155
</table>
156-
<div className="flex flex-wrap items-center gap-2 p-2 border-t-[1px]">
156+
<div className="flex flex-wrap items-center gap-2 p-2 ">
157157
{List.length > 10 && (
158158
<>
159159
{currentPage > 1 && (

apps/OpenSign/src/routes/LoadMf.js

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
import { Suspense } from "react";
2+
import { useParams } from "react-router-dom";
3+
import useFederatedComponent from "mf-cra";
4+
import React from "react";
5+
import Title from "../components/Title";
6+
function RemoteApp({ app }) {
7+
// console.log("app ", app);
8+
const { Component: RemoteComponent } = useFederatedComponent(app);
9+
// console.log("RemoteComponent ", RemoteComponent);
10+
return (
11+
<>
12+
<Title title={app.remoteName} />
13+
<Suspense
14+
fallback={
15+
<div style={{ height: "300px" }}>
16+
<div
17+
style={{
18+
marginLeft: "45%",
19+
marginTop: "150px",
20+
fontSize: "45px",
21+
color: "#3dd3e0"
22+
}}
23+
className="loader-37"
24+
></div>
25+
</div>
26+
}
27+
>
28+
<div
29+
style={{
30+
boxShadow: "0 1px 3px 0 rgba(0, 0, 0, 0.33)",
31+
backgroundColor: "#ffffff",
32+
width: "100%",
33+
overflow: "hidden",
34+
borderRadius: 3,
35+
minHeight: "70vh"
36+
}}
37+
>
38+
{RemoteComponent && <RemoteComponent />}
39+
</div>
40+
</Suspense>
41+
</>
42+
);
43+
}
44+
function checkObjectProperties(obj) {
45+
// Check if all three properties exist in the object
46+
if (
47+
obj &&
48+
obj.remoteName !== undefined &&
49+
obj.remoteUrl !== undefined &&
50+
obj.moduleToLoad !== undefined
51+
) {
52+
return true; // All properties are present
53+
} else {
54+
return false; // At least one property is missing
55+
}
56+
}
57+
export default function RemoteAppContainer() {
58+
const { remoteApp } = useParams();
59+
60+
const obj = {
61+
remoteUrl: window.location.origin + "/mfbuild/remoteEntry.js",
62+
moduleToLoad: "./AppRoutes",
63+
remoteName: remoteApp
64+
};
65+
// console.log("obj ", obj);
66+
const isMf = checkObjectProperties(obj);
67+
if (isMf) {
68+
const appToLoad = obj;
69+
return <RemoteApp app={appToLoad} />;
70+
} else {
71+
return (
72+
<div className="flex items-center justify-center h-screen w-full bg-white rounded">
73+
<div className="text-center">
74+
<h1 className="text-[60px] lg:text-[120px] font-semibold text-black">
75+
404
76+
</h1>
77+
<p className="text-[30px] lg:text-[50px] text-black">
78+
Page Not Found
79+
</p>
80+
</div>
81+
</div>
82+
);
83+
}
84+
}

apps/OpenSign/src/routes/PlanSubscriptions.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ const PlanSubscriptions = () => {
6464
style={{
6565
backgroundColor: "white",
6666
overflowY: "auto",
67-
maxHeight: "600px",
67+
maxHeight: "100%",
6868
"--theme-color": "#7952b3",
6969
"--plan-width": 30
7070
}}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import React from "react";
2+
3+
const PageNotFound = () => {
4+
return (
5+
<div className="flex items-center justify-center h-screen w-full bg-white rounded">
6+
<div className="text-center">
7+
<h1 className="text-[60px] lg:text-[120px] font-semibold text-black">
8+
404
9+
</h1>
10+
<p className="text-[30px] lg:text-[50px] text-black">Page Not Found</p>
11+
</div>
12+
</div>
13+
);
14+
};
15+
16+
export default PageNotFound;

microfrontends/SignDocuments/src/Component/login.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ function Login() {
116116
localStorage.setItem("accesstoken", _user.sessionToken);
117117
setLoading(false);
118118
//navigate user to on signature page
119-
navigate(`/recipientSignPdf/${id}/${contactBookId}`);
119+
// navigate(`/recipientSignPdf/${id}/${contactBookId}`);
120+
navigate(`/loadmf/signmicroapp/recipientSignPdf/${id}/${contactBookId}`);
120121
}
121122
} catch (error) {}
122123
} else {

microfrontends/SignDocuments/src/Routes.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import Login from "./Component/login";
88
import DraftDocument from "./Component/DraftDocument";
99
import PdfRequestFiles from "./Component/PdfRequestFiles";
1010
import LegaDrive from "./Component/LegaDrive/LegaDrive";
11+
import PageNotFound from "./Component/PageNotFound";
1112

1213
// `AppRoutes` is used to define route path of app and
1314
// it expose to host app, check moduleFederation.config.js for more
@@ -33,7 +34,10 @@ function AppRoutes() {
3334
{/*Add default signature of user route */}
3435
<Route path="/managesign" element={<ManageSign />} />
3536
{/* login page route */}
36-
<Route path="/login/:id/:userMail/:contactBookId/:serverUrl" element={<Login />} />
37+
<Route
38+
path="/login/:id/:userMail/:contactBookId/:serverUrl"
39+
element={<Login />}
40+
/>
3741
{/* draft document route to handle and navigate route page accordiing to document status */}
3842
<Route path="/draftDocument" element={<DraftDocument />} />
3943
{/* for user signature (need your sign route) with row level data */}
@@ -42,6 +46,8 @@ function AppRoutes() {
4246
<Route path="/pdfRequestFiles/:docId" element={<PdfRequestFiles />} />
4347
{/* lega drive route */}
4448
<Route path="/legadrive" element={<LegaDrive />} />
49+
{/* Page Not Found */}
50+
<Route path="*" element={<PageNotFound />} />
4551
</Routes>
4652
</div>
4753
);

0 commit comments

Comments
 (0)