From: abias Date: Mon, 15 May 2023 03:01:39 +0000 (-0400) Subject: Fix error page not showing when site not fetched and adjust styles X-Git-Url: http://these/git/%24%7B%60data:application/static/%7B%60https:/%7Brss%7D?a=commitdiff_plain;h=23d77515235937b8e7b6c2b8365fea2fd1dc67d5;p=lemmy-ui.git Fix error page not showing when site not fetched and adjust styles --- diff --git a/src/server/index.tsx b/src/server/index.tsx index 26f5cf9..5e9b319 100644 --- a/src/server/index.tsx +++ b/src/server/index.tsx @@ -167,7 +167,7 @@ server.get("/*", async (req, res) => { } } } catch (error) { - routeData = [getErrorRouteData(error)]; + routeData = getErrorRouteData(error, site); } // Redirect to the 404 if there's an API error @@ -177,13 +177,10 @@ server.get("/*", async (req, res) => { if (error === "instance_is_private") { return res.redirect(`/signup`); } else { - routeData = [getErrorRouteData(error, site)]; + routeData = getErrorRouteData(error, site); } } - console.log("Route Data"); - console.log(routeData); - const isoData: IsoDataOptionalSite = { path, site_res: site, diff --git a/src/shared/components/app/error-page.tsx b/src/shared/components/app/error-page.tsx index e093463..7c7bfce 100644 --- a/src/shared/components/app/error-page.tsx +++ b/src/shared/components/app/error-page.tsx @@ -16,31 +16,51 @@ export class ErrorPage extends Component { return (

{errorPageData ? "Error!" : "Page Not Found"}

-

- {errorPageData - ? 'There was an error on the server. Try refreshing your browser. If that doesn\'t work, come back at a later time. If the problem persists, consider opening an issue.' - : "The page you are looking for does not exist"} +

+ {errorPageData ? ( + <> + + There was an error on the server. Try refreshing your browser. + If that doesn't work, come back at a later time. If the + problem persists, + {" "} + + consider opening an issue. + + + ) : ( + "The page you are looking for does not exist." + )}

{!errorPageData && ( - Click here to return to your home page + + Click here to return to your home page. + )} {errorPageData?.adminMatrixIds && errorPageData.adminMatrixIds.length > 0 && ( -
+ <>
If you would like to reach out to one of{" "} {this.isoData.site_res?.site_view.site.name ?? "this instance"} 's admins for support, try the following Matrix addresses:
-
    +
      {errorPageData.adminMatrixIds.map(matrixId => ( -
    • {matrixId}
    • +
    • + {matrixId} +
    • ))}
    -
+ )} {errorPageData?.error && ( - {errorPageData.error} + + {errorPageData.error} + )}
); diff --git a/src/shared/components/common/auth-guard.tsx b/src/shared/components/common/auth-guard.tsx index bdddec7..e79a541 100644 --- a/src/shared/components/common/auth-guard.tsx +++ b/src/shared/components/common/auth-guard.tsx @@ -6,7 +6,7 @@ function AuthGuard(props: { children?: InfernoNode }) { if (!UserService.Instance.myUserInfo) { return ; } else { - return <>{props.children}; + return props.children; } }