2023-05-14 15:08:06 +00:00
|
|
|
import { Component } from "inferno";
|
2023-05-21 18:13:06 +00:00
|
|
|
import { T } from "inferno-i18next-dess";
|
2023-05-14 15:08:06 +00:00
|
|
|
import { Link } from "inferno-router";
|
2023-05-21 18:13:06 +00:00
|
|
|
import { i18n } from "../../i18next";
|
|
|
|
import { IsoDataOptionalSite } from "../../interfaces";
|
2023-05-17 00:34:15 +00:00
|
|
|
import { setIsoData } from "../../utils";
|
2023-05-14 15:08:06 +00:00
|
|
|
|
|
|
|
export class ErrorPage extends Component<any, any> {
|
2023-05-14 23:49:55 +00:00
|
|
|
private isoData: IsoDataOptionalSite = setIsoData(this.context);
|
2023-05-14 15:08:06 +00:00
|
|
|
|
|
|
|
constructor(props: any, context: any) {
|
|
|
|
super(props, context);
|
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
2023-05-17 00:34:15 +00:00
|
|
|
const { errorPageData } = this.isoData;
|
2023-05-14 15:08:06 +00:00
|
|
|
|
|
|
|
return (
|
2023-05-14 20:25:03 +00:00
|
|
|
<div className="container-lg text-center">
|
2023-05-21 18:13:06 +00:00
|
|
|
<h1>
|
|
|
|
{errorPageData
|
|
|
|
? i18n.t("error_page_title")
|
|
|
|
: i18n.t("not_found_page_title")}
|
|
|
|
</h1>
|
2023-05-15 03:01:39 +00:00
|
|
|
<p className="p-4">
|
|
|
|
{errorPageData ? (
|
2023-05-21 18:13:06 +00:00
|
|
|
<T i18nKey="error_page_paragraph" class="d-inline">
|
|
|
|
#<a href="https://lemmy.ml/c/lemmy_support">#</a>#
|
|
|
|
<a href="https://matrix.to/#/#lemmy-space:matrix.org">#</a>#
|
|
|
|
</T>
|
2023-05-15 03:01:39 +00:00
|
|
|
) : (
|
2023-05-21 18:42:17 +00:00
|
|
|
i18n.t("not_found_page_message")
|
2023-05-15 03:01:39 +00:00
|
|
|
)}
|
2023-05-14 15:08:06 +00:00
|
|
|
</p>
|
|
|
|
{!errorPageData && (
|
2023-05-15 03:01:39 +00:00
|
|
|
<Link to="/" replace>
|
2023-05-21 18:13:06 +00:00
|
|
|
{i18n.t("not_found_return_home_button")}
|
2023-05-15 03:01:39 +00:00
|
|
|
</Link>
|
2023-05-14 15:08:06 +00:00
|
|
|
)}
|
|
|
|
{errorPageData?.adminMatrixIds &&
|
|
|
|
errorPageData.adminMatrixIds.length > 0 && (
|
2023-05-15 03:01:39 +00:00
|
|
|
<>
|
2023-05-14 15:08:06 +00:00
|
|
|
<div>
|
2023-05-21 18:13:06 +00:00
|
|
|
{i18n.t("error_page_admin_matrix", {
|
|
|
|
instance:
|
|
|
|
this.isoData.site_res?.site_view.site.name ??
|
|
|
|
"this instance",
|
|
|
|
})}
|
2023-05-14 15:08:06 +00:00
|
|
|
</div>
|
2023-05-15 03:01:39 +00:00
|
|
|
<ul className="mx-auto mt-2" style={{ width: "fit-content" }}>
|
2023-05-14 15:08:06 +00:00
|
|
|
{errorPageData.adminMatrixIds.map(matrixId => (
|
2023-05-15 03:01:39 +00:00
|
|
|
<li key={matrixId} className="text-info">
|
|
|
|
{matrixId}
|
|
|
|
</li>
|
2023-05-14 15:08:06 +00:00
|
|
|
))}
|
|
|
|
</ul>
|
2023-05-15 03:01:39 +00:00
|
|
|
</>
|
2023-05-14 15:08:06 +00:00
|
|
|
)}
|
2023-05-14 20:25:03 +00:00
|
|
|
{errorPageData?.error && (
|
2023-05-15 03:01:39 +00:00
|
|
|
<code
|
|
|
|
style={{ "text-align": "start" }}
|
|
|
|
className="d-block bg-dark text-light p-2 mt-4"
|
|
|
|
>
|
|
|
|
{errorPageData.error}
|
|
|
|
</code>
|
2023-05-14 20:25:03 +00:00
|
|
|
)}
|
2023-05-14 15:08:06 +00:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|