diff --git a/TODO.md b/TODO.md index 7bea2c9..7108f2b 100644 --- a/TODO.md +++ b/TODO.md @@ -13,7 +13,6 @@ - [Bugs] Make sure uploads name are slug-like and with an extension. - [Bugs] Nyupun can't upload subtitles files - [Bugs] https://v3.accords-library.com/en/collectibles/dod-original-soundtrack/scans obi is way too big -- [Feat] 404, 500 pages - [Feat] [RichTextContent] Handle relationship - [Feat] [Timeline] Improve layout/spacing on mobile - [Bugs] Number of audio players seems limited (on Chrome and Firefox) diff --git a/public/img/500-illustration.webp b/public/img/500-illustration.webp new file mode 100644 index 0000000..6dff8bc Binary files /dev/null and b/public/img/500-illustration.webp differ diff --git a/public/img/search-empty.webp b/public/img/search-empty.webp new file mode 100644 index 0000000..c4a7819 Binary files /dev/null and b/public/img/search-empty.webp differ diff --git a/src/pages/404.astro b/src/pages/404.astro index 4e98923..f7d7b2e 100644 --- a/src/pages/404.astro +++ b/src/pages/404.astro @@ -1,12 +1,81 @@ --- import AppLayout from "components/AppLayout/AppLayout.astro"; -import AppLayoutTitle from "components/AppLayout/components/AppLayoutTitle.astro"; +import Button from "components/Button.astro"; +import { getI18n } from "src/i18n/i18n"; Astro.locals.notFound = true; + +const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale); --- {/* ------------------------------------------- HTML ------------------------------------------- */} - - + +
+

404

+

Not found

+ +
+
+ +
+ + diff --git a/src/pages/500.astro b/src/pages/500.astro new file mode 100644 index 0000000..d6390f0 --- /dev/null +++ b/src/pages/500.astro @@ -0,0 +1,120 @@ +--- +import AppLayout from "components/AppLayout/AppLayout.astro"; +import Button from "components/Button.astro"; +import Card from "components/Card.astro"; +import { getI18n } from "src/i18n/i18n"; + +interface Props { + error: unknown; +} +const { error } = Astro.props; + +const { t, getLocalizedUrl } = await getI18n(Astro.locals.currentLocale); +--- + +{/* ------------------------------------------- HTML ------------------------------------------- */} + + +
+
+

500

+

Server Error

+

Please contact website technical administrator.

+ +
+
+ +
+
+ + { + error instanceof Error && ( + +

{error.message}

+

Call stack

+ {error.stack?.replaceAll(import.meta.env.PWD, "███████████████")} +
+ ) + } +
+ + diff --git a/src/pages/[locale]/dev/index.astro b/src/pages/[locale]/dev/index.astro index ee9f421..ad53312 100644 --- a/src/pages/[locale]/dev/index.astro +++ b/src/pages/[locale]/dev/index.astro @@ -22,6 +22,14 @@ const { getLocalizedUrl } = await getI18n(Astro.locals.currentLocale);
  • CJK fonts Testing Ground
  • +
  • + + 500: Internal Server Error + +
  • +
  • + 404: Not Found +
  • diff --git a/src/pages/[locale]/dev/trigger-404.astro b/src/pages/[locale]/dev/trigger-404.astro new file mode 100644 index 0000000..6c1d194 --- /dev/null +++ b/src/pages/[locale]/dev/trigger-404.astro @@ -0,0 +1,5 @@ +--- +import FourOFour from "src/pages/404.astro"; +--- + + diff --git a/src/pages/[locale]/dev/trigger-500.astro b/src/pages/[locale]/dev/trigger-500.astro new file mode 100644 index 0000000..26f961b --- /dev/null +++ b/src/pages/[locale]/dev/trigger-500.astro @@ -0,0 +1,14 @@ +--- +import FiveOFive from "src/pages/500.astro"; +import { payload } from "src/utils/payload"; + +let error; + +try { + await payload.getAudioByID("bad-id"); +} catch (e) { + error = e; +} +--- + +