better for github pages

This commit is contained in:
bvn13 2023-04-30 01:17:48 +03:00
parent 8c925473cb
commit c8f5e2245c
2 changed files with 20 additions and 6 deletions

View File

@ -46656,7 +46656,8 @@ Please use another name.` : formatMuiErrorMessage(18));
// src/resources/routes-constants.ts // src/resources/routes-constants.ts
var ROUTES = { var ROUTES = {
HOMEPAGE_ROUTE: "/" HOMEPAGE_ROUTE: "/",
GITHUB_PAGES_ROUTE: "tl-esa-tools/"
}; };
// src/pages/NotFoundPage.tsx // src/pages/NotFoundPage.tsx
@ -46664,9 +46665,21 @@ Please use another name.` : formatMuiErrorMessage(18));
var NotFoundPage = () => { var NotFoundPage = () => {
const navigate = useNavigate(); const navigate = useNavigate();
const redirectToHomePage = () => { const redirectToHomePage = () => {
const url = new URL(window.location.href);
if (url.host.indexOf("github.io") > 0) {
navigate(ROUTES.GITHUB_PAGES_ROUTE);
} else {
navigate(ROUTES.HOMEPAGE_ROUTE); navigate(ROUTES.HOMEPAGE_ROUTE);
}
}; };
return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: { position: "relative", width: "100%", display: "flex", justifyContent: "center", alignItems: "center", flexDirection: "column" }, children: [ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { style: {
position: "relative",
width: "100%",
display: "flex",
justifyContent: "center",
alignItems: "center",
flexDirection: "column"
}, children: [
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h1", { style: { fontSize: "4em" }, children: "Oops 404!" }), /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h1", { style: { fontSize: "4em" }, children: "Oops 404!" }),
/* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { cursor: "pointer" }, onClick: () => redirectToHomePage(), children: "Homepage" }) /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("span", { style: { cursor: "pointer" }, onClick: () => redirectToHomePage(), children: "Homepage" })
] }); ] });
@ -46678,7 +46691,8 @@ Please use another name.` : formatMuiErrorMessage(18));
var RootComponent = () => { var RootComponent = () => {
return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BrowserRouter, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Routes, { children: [ return /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(BrowserRouter, { children: /* @__PURE__ */ (0, import_jsx_runtime30.jsxs)(Routes, { children: [
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(NotFoundPage_default, {}) }), /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Route, { path: "*", element: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(NotFoundPage_default, {}) }),
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Route, { path: ROUTES.HOMEPAGE_ROUTE, element: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(HomePage_default, {}) }) /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Route, { path: ROUTES.HOMEPAGE_ROUTE, element: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(HomePage_default, {}) }),
/* @__PURE__ */ (0, import_jsx_runtime30.jsx)(Route, { path: ROUTES.GITHUB_PAGES_ROUTE, element: /* @__PURE__ */ (0, import_jsx_runtime30.jsx)(HomePage_default, {}) })
] }) }); ] }) });
}; };
var RootComponent_default = RootComponent; var RootComponent_default = RootComponent;

File diff suppressed because one or more lines are too long