on master help sign in
pages/group, id: add 404 fallbacks
76065d9Matilde Park
components/gateway/Gateway404.jsnew file+45
@@ -0,0 +1,45 @@
1+import GatewayHeader from "./GatewayHeader";
2+import Container from "../Container";
3+import SingleColumn from "../SingleColumn";
4+import Section from "../Section";
5+import Link from "next/link";
6+
7+const Gateway404 = ({ type }) => {
8+ const error = (
9+ <div className="overflow-hidden rounded-xl">
10+ <svg
11+ width="100"
12+ height="100"
13+ viewBox="0 0 100 100"
14+ fill="none"
15+ xmlns="http://www.w3.org/2000/svg"
16+ >
17+ <rect width="100" height="100" rx="10" fill="#24201E" />
18+ <path
19+ d="M28.8906 27.9844C28.5019 28.0215 28.1699 28.2833 28.043 28.6524C27.914 29.0235 28.0137 29.4336 28.2969 29.7032L70.2969 71.7032C70.4844 71.8965 70.7402 72.0059 71.0098 72.0059C71.2773 72.0079 71.5352 71.9004 71.7246 71.709C71.9141 71.5176 72.0176 71.2598 72.0137 70.9903C72.0098 70.7227 71.8984 70.4668 71.7031 70.2813L66.2501 64.8283C69.8204 60.9181 72.0001 55.7073 72.0001 50.0003C72.0001 37.8618 62.1386 28.0003 50.0001 28.0003C44.2931 28.0003 39.0976 30.1956 35.1876 33.7658L29.7031 28.2813C29.4922 28.0645 29.1934 27.9551 28.8906 27.9844L28.8906 27.9844ZM50.0001 30C61.0566 30 70.0001 38.9435 70.0001 50C70.0001 55.17 68.0411 59.8575 64.8281 63.406L36.5936 35.1715C40.1405 31.9606 44.8336 29.9995 49.9996 29.9995L50.0001 30ZM32.1721 37.8125C31.842 37.8321 31.5452 38.0137 31.3752 38.2969C29.2424 41.6856 28.0002 45.7029 28.0002 49.9999C28.0002 62.1384 37.8617 71.9999 50.0002 71.9999C54.2951 71.9999 58.3147 70.7558 61.7032 68.6249C62.1739 68.3319 62.3165 67.7128 62.0235 67.2421C61.7305 66.7714 61.1114 66.6288 60.6407 66.9218C57.5587 68.8593 53.9122 69.9999 50.0002 69.9999C38.9437 69.9999 30.0002 61.0564 30.0002 49.9999C30.0002 46.0878 31.1233 42.4414 33.0627 39.3594C33.2697 39.043 33.2815 38.6387 33.092 38.3125C32.9045 37.9844 32.5491 37.7929 32.1721 37.8125L32.1721 37.8125Z"
20+ fill="white"
21+ />
22+ </svg>
23+ </div>
24+ );
25+
26+ return (
27+ <Container>
28+ <SingleColumn>
29+ <Section narrow className="space-y-12">
30+ <GatewayHeader
31+ title="Error 404"
32+ error={error}
33+ item={`No ${type} at this address`}
34+ />
35+ <hr className="text-wall-200" />
36+ <Link href="/">
37+ <a className="text-xl block font-semibold">Urbit.org</a>
38+ </Link>
39+ </Section>
40+ </SingleColumn>
41+ </Container>
42+ );
43+};
44+
45+export default Gateway404;
components/gateway/GatewayHeader.js+4−2
@@ -1,10 +1,11 @@
1−const GatewayHeader = ({ image, sigil, title, item }) => {
1+const GatewayHeader = ({ image, sigil, error, title, item }) => {
2 return (
2 return (
3 <div className="flex items-center space-x-4">
3 <div className="flex items-center space-x-4">
4 {image ? (
4 {image ? (
5 <img className="rounded-xl" src={image} height={100} width={100} />
5 <img className="rounded-xl" src={image} height={100} width={100} />
6 ) : (
6 ) : (
7− !sigil && (
7+ !sigil &&
8+ !error && (
8 <img
9 <img
9 className="object-contain shadow-sm rounded-xl"
10 className="object-contain shadow-sm rounded-xl"
10 style={{ height: 100, width: 100 }}
11 style={{ height: 100, width: 100 }}
@@ -12,6 +13,7 @@ const GatewayHeader = ({ image, sigil, title, item }) => {
12 />
13 />
13 )
14 )
14 )}
15 )}
16+ {error && error}
15 {sigil && sigil}
17 {sigil && sigil}
16 <div className="flex flex-col">
18 <div className="flex flex-col">
17 <h2>{title}</h2>
19 <h2>{title}</h2>
pages/group/[[...group]].js+7−9
@@ -6,11 +6,11 @@ import Meta from "../../components/Meta";
6import CopyLink from "../../components/CopyLink";
6import CopyLink from "../../components/CopyLink";
7import Container from "../../components/Container";
7import Container from "../../components/Container";
8import SingleColumn from "../../components/SingleColumn";
8import SingleColumn from "../../components/SingleColumn";
9−import ErrorPage from "../404";
10import Section from "../../components/Section";
9import Section from "../../components/Section";
11import ob from "urbit-ob";
10import ob from "urbit-ob";
12import Markdown from "../../components/Markdown";
11import Markdown from "../../components/Markdown";
13import GatewayHeader from "../../components/gateway/GatewayHeader";
12import GatewayHeader from "../../components/gateway/GatewayHeader";
13+import Gateway404 from "../../components/gateway/Gateway404";
14import MetadataBlock from "../../components/gateway/MetadataBlock";
14import MetadataBlock from "../../components/gateway/MetadataBlock";
15import MetadataLink from "../../components/gateway/MetadataLink";
15import MetadataLink from "../../components/gateway/MetadataLink";
16import Description from "../../components/gateway/Description";
16import Description from "../../components/gateway/Description";
@@ -18,7 +18,7 @@ import Description from "../../components/gateway/Description";
18const GroupPage = ({ data, markdown, params }) => {
18const GroupPage = ({ data, markdown, params }) => {
19 const { group } = params;
19 const { group } = params;
20 if (!ob.isValidPatp(group[0])) {
20 if (!ob.isValidPatp(group[0])) {
21− return <ErrorPage />;
21+ return <Gateway404 type="group" />;
22 }
22 }
23 const image = `https://urbit-id-og-cards-ltjw3771z-urbit.vercel.app/${
23 const image = `https://urbit-id-og-cards-ltjw3771z-urbit.vercel.app/${
24 data.title
24 data.title
@@ -52,13 +52,11 @@ const GroupPage = ({ data, markdown, params }) => {
52 </Head>
52 </Head>
53 <SingleColumn>
53 <SingleColumn>
54 <Section className="space-y-12" narrow>
54 <Section className="space-y-12" narrow>
55− <div className="flex items-center space-x-4">
56− <GatewayHeader
55+ <GatewayHeader
57− title={data.title}
56+ title={data.title}
58− image={data?.image}
57+ image={data?.image}
59− item="Urbit ID"
58+ item="Urbit ID"
60− />
59+ />
61− </div>
62 <div className="flex flex-wrap md:flex-nowrap justify-between">
60 <div className="flex flex-wrap md:flex-nowrap justify-between">
63 <MetadataBlock
61 <MetadataBlock
64 title="Group Type"
62 title="Group Type"
pages/id/[id].js+9−10
@@ -11,6 +11,7 @@ import ob from "urbit-ob";
11import Markdown from "../../components/Markdown";
11import Markdown from "../../components/Markdown";
12import Sigil from "../../components/Sigil";
12import Sigil from "../../components/Sigil";
13import GatewayHeader from "../../components/gateway/GatewayHeader";
13import GatewayHeader from "../../components/gateway/GatewayHeader";
14+import Gateway404 from "../../components/gateway/Gateway404";
14import MetadataBlock from "../../components/gateway/MetadataBlock";
15import MetadataBlock from "../../components/gateway/MetadataBlock";
15import MetadataLink from "../../components/gateway/MetadataLink";
16import MetadataLink from "../../components/gateway/MetadataLink";
16import Description from "../../components/gateway/Description";
17import Description from "../../components/gateway/Description";
@@ -19,7 +20,7 @@ import axios from "axios";
19const IdPage = ({ data, markdown, network, params }) => {
20const IdPage = ({ data, markdown, network, params }) => {
20 const { id } = params;
21 const { id } = params;
21 if (!ob.isValidPatp(id) || id.length > 14) {
22 if (!ob.isValidPatp(id) || id.length > 14) {
22− return <ErrorPage />;
23+ return <Gateway404 type="ID" />;
23 }
24 }
24
25
25 const image = `https://urbit-id-og-cards-kappa.vercel.app/${deSig(id)}.png`;
26 const image = `https://urbit-id-og-cards-kappa.vercel.app/${deSig(id)}.png`;
@@ -63,15 +64,13 @@ const IdPage = ({ data, markdown, network, params }) => {
63 <meta property="twitter:image" content={image} key="image" />
64 <meta property="twitter:image" content={image} key="image" />
64 </Head>
65 </Head>
65 <SingleColumn>
66 <SingleColumn>
66− <Section className="space-y-12" narrow>
67+ <Section className="space-y-12 w-full" narrow>
67− <div className="flex items-center space-x-4">
68− <GatewayHeader
68+ <GatewayHeader
69− title={id}
69+ title={id}
70− image={data?.image || false}
70+ image={data?.image || false}
71− sigil={sigil}
71+ sigil={sigil}
72− item="Urbit ID"
72+ item="Urbit ID"
73− />
73+ />
74− </div>
75 <div className="flex flex-wrap md:flex-nowrap justify-between">
74 <div className="flex flex-wrap md:flex-nowrap justify-between">
76 <MetadataBlock
75 <MetadataBlock
77 title="ID Type"
76 title="ID Type"