From a156ed343d387799e6ae9753a9e520e3ec162c4f Mon Sep 17 00:00:00 2001 From: Tong Li Date: Sat, 12 Oct 2024 21:08:15 +1100 Subject: [PATCH] Add error pages --- package-lock.json | 88 ++-- package.json | 2 +- src/app/assets/404-error-character.svg | 438 ++++++++++++++++++ src/app/assets/generic-error-character.svg | 115 +++++ src/app/components/Error/GenericError.tsx | 44 ++ .../components/Header/SimplifiedHeader.tsx | 28 ++ src/app/components/Meta/MetaTags.tsx | 23 + src/app/error.tsx | 7 + src/app/global-error.tsx | 34 ++ src/app/layout.tsx | 36 +- src/app/not-found.tsx | 15 + src/app/page.tsx | 13 +- 12 files changed, 770 insertions(+), 73 deletions(-) create mode 100644 src/app/assets/404-error-character.svg create mode 100644 src/app/assets/generic-error-character.svg create mode 100644 src/app/components/Error/GenericError.tsx create mode 100644 src/app/components/Header/SimplifiedHeader.tsx create mode 100644 src/app/components/Meta/MetaTags.tsx create mode 100644 src/app/error.tsx create mode 100644 src/app/global-error.tsx create mode 100644 src/app/not-found.tsx diff --git a/package-lock.json b/package-lock.json index e6bebe45..07380f44 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "date-fns": "^3.6.0", "decimal.js-light": "^2.5.1", "framer-motion": "^11.1.9", - "next": "14.2.12", + "next": "14.2.15", "next-themes": "^0.3.0", "react": "^18", "react-dom": "^18", @@ -4503,9 +4503,9 @@ } }, "node_modules/@next/env": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.12.tgz", - "integrity": "sha512-3fP29GIetdwVIfIRyLKM7KrvJaqepv+6pVodEbx0P5CaMLYBtx+7eEg8JYO5L9sveJO87z9eCReceZLi0hxO1Q==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/env/-/env-14.2.15.tgz", + "integrity": "sha512-S1qaj25Wru2dUpcIZMjxeMVSwkt8BK4dmWHHiBuRstcIyOsMapqT4A4jSB6onvqeygkSSmOkyny9VVx8JIGamQ==", "license": "MIT" }, "node_modules/@next/eslint-plugin-next": { @@ -4552,9 +4552,9 @@ } }, "node_modules/@next/swc-darwin-arm64": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.12.tgz", - "integrity": "sha512-crHJ9UoinXeFbHYNok6VZqjKnd8rTd7K3Z2zpyzF1ch7vVNKmhjv/V7EHxep3ILoN8JB9AdRn/EtVVyG9AkCXw==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-arm64/-/swc-darwin-arm64-14.2.15.tgz", + "integrity": "sha512-Rvh7KU9hOUBnZ9TJ28n2Oa7dD9cvDBKua9IKx7cfQQ0GoYUwg9ig31O2oMwH3wm+pE3IkAQ67ZobPfEgurPZIA==", "cpu": [ "arm64" ], @@ -4568,9 +4568,9 @@ } }, "node_modules/@next/swc-darwin-x64": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.12.tgz", - "integrity": "sha512-JbEaGbWq18BuNBO+lCtKfxl563Uw9oy2TodnN2ioX00u7V1uzrsSUcg3Ep9ce+P0Z9es+JmsvL2/rLphz+Frcw==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-darwin-x64/-/swc-darwin-x64-14.2.15.tgz", + "integrity": "sha512-5TGyjFcf8ampZP3e+FyCax5zFVHi+Oe7sZyaKOngsqyaNEpOgkKB3sqmymkZfowy3ufGA/tUgDPPxpQx931lHg==", "cpu": [ "x64" ], @@ -4584,9 +4584,9 @@ } }, "node_modules/@next/swc-linux-arm64-gnu": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.12.tgz", - "integrity": "sha512-qBy7OiXOqZrdp88QEl2H4fWalMGnSCrr1agT/AVDndlyw2YJQA89f3ttR/AkEIP9EkBXXeGl6cC72/EZT5r6rw==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-gnu/-/swc-linux-arm64-gnu-14.2.15.tgz", + "integrity": "sha512-3Bwv4oc08ONiQ3FiOLKT72Q+ndEMyLNsc/D3qnLMbtUYTQAmkx9E/JRu0DBpHxNddBmNT5hxz1mYBphJ3mfrrw==", "cpu": [ "arm64" ], @@ -4600,9 +4600,9 @@ } }, "node_modules/@next/swc-linux-arm64-musl": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.12.tgz", - "integrity": "sha512-EfD9L7o9biaQxjwP1uWXnk3vYZi64NVcKUN83hpVkKocB7ogJfyH2r7o1pPnMtir6gHZiGCeHKagJ0yrNSLNHw==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-linux-arm64-musl/-/swc-linux-arm64-musl-14.2.15.tgz", + "integrity": "sha512-k5xf/tg1FBv/M4CMd8S+JL3uV9BnnRmoe7F+GWC3DxkTCD9aewFRH1s5rJ1zkzDa+Do4zyN8qD0N8c84Hu96FQ==", "cpu": [ "arm64" ], @@ -4616,9 +4616,9 @@ } }, "node_modules/@next/swc-linux-x64-gnu": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.12.tgz", - "integrity": "sha512-iQ+n2pxklJew9IpE47hE/VgjmljlHqtcD5UhZVeHICTPbLyrgPehaKf2wLRNjYH75udroBNCgrSSVSVpAbNoYw==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-gnu/-/swc-linux-x64-gnu-14.2.15.tgz", + "integrity": "sha512-kE6q38hbrRbKEkkVn62reLXhThLRh6/TvgSP56GkFNhU22TbIrQDEMrO7j0IcQHcew2wfykq8lZyHFabz0oBrA==", "cpu": [ "x64" ], @@ -4632,9 +4632,9 @@ } }, "node_modules/@next/swc-linux-x64-musl": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.12.tgz", - "integrity": "sha512-rFkUkNwcQ0ODn7cxvcVdpHlcOpYxMeyMfkJuzaT74xjAa5v4fxP4xDk5OoYmPi8QNLDs3UgZPMSBmpBuv9zKWA==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-linux-x64-musl/-/swc-linux-x64-musl-14.2.15.tgz", + "integrity": "sha512-PZ5YE9ouy/IdO7QVJeIcyLn/Rc4ml9M2G4y3kCM9MNf1YKvFY4heg3pVa/jQbMro+tP6yc4G2o9LjAz1zxD7tQ==", "cpu": [ "x64" ], @@ -4648,9 +4648,9 @@ } }, "node_modules/@next/swc-win32-arm64-msvc": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.12.tgz", - "integrity": "sha512-PQFYUvwtHs/u0K85SG4sAdDXYIPXpETf9mcEjWc0R4JmjgMKSDwIU/qfZdavtP6MPNiMjuKGXHCtyhR/M5zo8g==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-win32-arm64-msvc/-/swc-win32-arm64-msvc-14.2.15.tgz", + "integrity": "sha512-2raR16703kBvYEQD9HNLyb0/394yfqzmIeyp2nDzcPV4yPjqNUG3ohX6jX00WryXz6s1FXpVhsCo3i+g4RUX+g==", "cpu": [ "arm64" ], @@ -4664,9 +4664,9 @@ } }, "node_modules/@next/swc-win32-ia32-msvc": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.12.tgz", - "integrity": "sha512-FAj2hMlcbeCV546eU2tEv41dcJb4NeqFlSXU/xL/0ehXywHnNpaYajOUvn3P8wru5WyQe6cTZ8fvckj/2XN4Vw==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-win32-ia32-msvc/-/swc-win32-ia32-msvc-14.2.15.tgz", + "integrity": "sha512-fyTE8cklgkyR1p03kJa5zXEaZ9El+kDNM5A+66+8evQS5e/6v0Gk28LqA0Jet8gKSOyP+OTm/tJHzMlGdQerdQ==", "cpu": [ "ia32" ], @@ -4680,9 +4680,9 @@ } }, "node_modules/@next/swc-win32-x64-msvc": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.12.tgz", - "integrity": "sha512-yu8QvV53sBzoIVRHsxCHqeuS8jYq6Lrmdh0briivuh+Brsp6xjg80MAozUsBTAV9KNmY08KlX0KYTWz1lbPzEg==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/@next/swc-win32-x64-msvc/-/swc-win32-x64-msvc-14.2.15.tgz", + "integrity": "sha512-SzqGbsLsP9OwKNUG9nekShTwhj6JSB9ZLMWQ8g1gG6hdE5gQLncbnbymrwy2yVmH9nikSLYRYxYMFu78Ggp7/g==", "cpu": [ "x64" ], @@ -13320,12 +13320,12 @@ "license": "MIT" }, "node_modules/next": { - "version": "14.2.12", - "resolved": "https://registry.npmjs.org/next/-/next-14.2.12.tgz", - "integrity": "sha512-cDOtUSIeoOvt1skKNihdExWMTybx3exnvbFbb9ecZDIxlvIbREQzt9A5Km3Zn3PfU+IFjyYGsHS+lN9VInAGKA==", + "version": "14.2.15", + "resolved": "https://registry.npmjs.org/next/-/next-14.2.15.tgz", + "integrity": "sha512-h9ctmOokpoDphRvMGnwOJAedT6zKhwqyZML9mDtspgf4Rh3Pn7UTYKqePNoDvhsWBAO5GoPNYshnAUGIazVGmw==", "license": "MIT", "dependencies": { - "@next/env": "14.2.12", + "@next/env": "14.2.15", "@swc/helpers": "0.5.5", "busboy": "1.6.0", "caniuse-lite": "^1.0.30001579", @@ -13340,15 +13340,15 @@ "node": ">=18.17.0" }, "optionalDependencies": { - "@next/swc-darwin-arm64": "14.2.12", - "@next/swc-darwin-x64": "14.2.12", - "@next/swc-linux-arm64-gnu": "14.2.12", - "@next/swc-linux-arm64-musl": "14.2.12", - "@next/swc-linux-x64-gnu": "14.2.12", - "@next/swc-linux-x64-musl": "14.2.12", - "@next/swc-win32-arm64-msvc": "14.2.12", - "@next/swc-win32-ia32-msvc": "14.2.12", - "@next/swc-win32-x64-msvc": "14.2.12" + "@next/swc-darwin-arm64": "14.2.15", + "@next/swc-darwin-x64": "14.2.15", + "@next/swc-linux-arm64-gnu": "14.2.15", + "@next/swc-linux-arm64-musl": "14.2.15", + "@next/swc-linux-x64-gnu": "14.2.15", + "@next/swc-linux-x64-musl": "14.2.15", + "@next/swc-win32-arm64-msvc": "14.2.15", + "@next/swc-win32-ia32-msvc": "14.2.15", + "@next/swc-win32-x64-msvc": "14.2.15" }, "peerDependencies": { "@opentelemetry/api": "^1.1.0", diff --git a/package.json b/package.json index c78586e2..e3daf24b 100644 --- a/package.json +++ b/package.json @@ -40,7 +40,7 @@ "date-fns": "^3.6.0", "decimal.js-light": "^2.5.1", "framer-motion": "^11.1.9", - "next": "14.2.12", + "next": "14.2.15", "next-themes": "^0.3.0", "react": "^18", "react-dom": "^18", diff --git a/src/app/assets/404-error-character.svg b/src/app/assets/404-error-character.svg new file mode 100644 index 00000000..ce8eb154 --- /dev/null +++ b/src/app/assets/404-error-character.svg @@ -0,0 +1,438 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/assets/generic-error-character.svg b/src/app/assets/generic-error-character.svg new file mode 100644 index 00000000..30261228 --- /dev/null +++ b/src/app/assets/generic-error-character.svg @@ -0,0 +1,115 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/app/components/Error/GenericError.tsx b/src/app/components/Error/GenericError.tsx new file mode 100644 index 00000000..cd530ee4 --- /dev/null +++ b/src/app/components/Error/GenericError.tsx @@ -0,0 +1,44 @@ +import Image from "next/image"; + +import GenericErrorCharacter from "@/app/assets/generic-error-character.svg"; + +import { Footer } from "../Footer/Footer"; +import { SimplifiedHeader } from "../Header/SimplifiedHeader"; + +interface Props { + title?: string; + message?: string; + image?: any; +} + +export default function GenericError({ + title = "Something goes wrong", + message = "There was an unexpected error that caused the website to crash. You can report the issue in our forum, or reach out via email for assistance. Together, we can enhance our platform’s reliability!", + image = GenericErrorCharacter, +}: Props) { + return ( +
+ +
+
+
+
{title}
+
+ Generic Error +
+
+
{message}
+
+ + +
+
+
+ Generic Error +
+
+
+
+
+ ); +} diff --git a/src/app/components/Header/SimplifiedHeader.tsx b/src/app/components/Header/SimplifiedHeader.tsx new file mode 100644 index 00000000..2cb8064e --- /dev/null +++ b/src/app/components/Header/SimplifiedHeader.tsx @@ -0,0 +1,28 @@ +import { shouldDisplayTestingMsg } from "@/config"; + +import { Logo } from "../Logo/Logo"; +import { TestingInfo } from "../TestingInfo/TestingInfo"; + +export const SimplifiedHeader = () => { + return ( + + ); +}; diff --git a/src/app/components/Meta/MetaTags.tsx b/src/app/components/Meta/MetaTags.tsx new file mode 100644 index 00000000..556b5a51 --- /dev/null +++ b/src/app/components/Meta/MetaTags.tsx @@ -0,0 +1,23 @@ +import { getNetworkAppUrl } from "@/config"; + +export default function MetaTags() { + return ( + <> + + + + + + + + + + + + + + + + + ); +} diff --git a/src/app/error.tsx b/src/app/error.tsx new file mode 100644 index 00000000..725a0cef --- /dev/null +++ b/src/app/error.tsx @@ -0,0 +1,7 @@ +"use client"; // Error components must be Client Components + +import GenericError from "./components/Error/GenericError"; + +export default function Error() { + return ; +} diff --git a/src/app/global-error.tsx b/src/app/global-error.tsx new file mode 100644 index 00000000..97c382be --- /dev/null +++ b/src/app/global-error.tsx @@ -0,0 +1,34 @@ +"use client"; + +import { Inter } from "next/font/google"; +import { twJoin } from "tailwind-merge"; + +import { network } from "@/config/network.config"; +import { Network } from "@/utils/wallet/wallet_provider"; + +import GenericError from "./components/Error/GenericError"; +import MetaTags from "./components/Meta/MetaTags"; + +const inter = Inter({ subsets: ["latin"], variable: "--font-inter" }); + +export default function GlobalError() { + return ( + + + + + +
+ +
+ + + ); +} diff --git a/src/app/layout.tsx b/src/app/layout.tsx index f26cb516..b27fa47c 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -1,8 +1,11 @@ import type { Metadata } from "next"; import { Inter } from "next/font/google"; +import { twJoin } from "tailwind-merge"; -import { getNetworkAppUrl } from "@/config"; +import { network } from "@/config/network.config"; +import { Network } from "@/utils/wallet/wallet_provider"; +import MetaTags from "./components/Meta/MetaTags"; import "./globals.css"; import Providers from "./providers"; @@ -20,23 +23,22 @@ export default function RootLayout({ }>) { return ( - - - - - - - - - - - - - - - + + + - {children} + +
+ {children} +
+
); diff --git a/src/app/not-found.tsx b/src/app/not-found.tsx new file mode 100644 index 00000000..82880b44 --- /dev/null +++ b/src/app/not-found.tsx @@ -0,0 +1,15 @@ +"use client"; // Error components must be Client Components + +import FourOFourErrorCharacter from "@/app/assets/404-error-character.svg"; + +import GenericError from "./components/Error/GenericError"; + +export default function Error() { + return ( + + ); +} diff --git a/src/app/page.tsx b/src/app/page.tsx index 6663b85c..9877d947 100644 --- a/src/app/page.tsx +++ b/src/app/page.tsx @@ -2,10 +2,6 @@ import { initBTCCurve } from "@babylonlabs-io/btc-staking-ts"; import { useEffect } from "react"; -import { twJoin } from "tailwind-merge"; - -import { network } from "@/config/network.config"; -import { Network } from "@/utils/wallet/wallet_provider"; import { Delegations } from "./components/Delegations/Delegations"; import { FAQ } from "./components/FAQ/FAQ"; @@ -22,12 +18,7 @@ const Home = () => { }, []); return ( -
+ <>
@@ -40,7 +31,7 @@ const Home = () => {
+ ); };