36 lines
1.1 KiB
Plaintext
36 lines
1.1 KiB
Plaintext
---
|
|
import { alternatePath, type Locale, t } from "@app/i18n";
|
|
import { ErrorView } from "~/components/errors/ErrorView";
|
|
import { createAppError, type AppErrorStatus } from "~/lib/errors";
|
|
import AppLayout from "~/layouts/AppLayout.astro";
|
|
|
|
export interface Props {
|
|
locale: Locale;
|
|
status: AppErrorStatus;
|
|
}
|
|
|
|
const { locale, status } = Astro.props;
|
|
const other: Locale = locale === "zh-CN" ? "en" : "zh-CN";
|
|
const error = createAppError(status);
|
|
const homeHref = locale === "zh-CN" ? "/zh-CN" : "/en";
|
|
const titleKey = `error.${error.kind}.title` as never;
|
|
const pageTitle = t(locale, titleKey);
|
|
---
|
|
|
|
<AppLayout
|
|
title={`${pageTitle} · ${t(locale, "meta.brand")}`}
|
|
locale={locale}
|
|
nav={[]}
|
|
switchHref={alternatePath(Astro.url.pathname, other)}
|
|
switchLabel={t(other, `locale.${other}` as never)}
|
|
seo={{
|
|
title: `${pageTitle} · ${t(locale, "meta.brand")}`,
|
|
path: Astro.url.pathname,
|
|
robots: ["noindex", "nofollow"],
|
|
}}
|
|
>
|
|
<div class="flex min-h-[55vh] items-center justify-center px-4 py-16">
|
|
<ErrorView error={error} locale={locale} homeHref={homeHref} />
|
|
</div>
|
|
</AppLayout>
|