a tool for shared writing and social publishing

created profile page, 404s

+44 -7
+9 -7
app/p/[didOrHandle]/[rkey]/page.tsx
··· 5 5 import { Metadata } from "next"; 6 6 import { idResolver } from "app/(home-pages)/reader/idResolver"; 7 7 import { DocumentPageRenderer } from "app/lish/[did]/[publication]/[rkey]/DocumentPageRenderer"; 8 + import { NotFoundLayout } from "components/PageLayouts/NotFoundLayout"; 8 9 9 10 export async function generateMetadata(props: { 10 11 params: Promise<{ didOrHandle: string; rkey: string }>; ··· 34 35 let docRecord = document.data as PubLeafletDocument.Record; 35 36 36 37 // For documents in publications, include publication name 37 - let publicationName = document.documents_in_publications[0]?.publications?.name; 38 + let publicationName = 39 + document.documents_in_publications[0]?.publications?.name; 38 40 39 41 return { 40 42 icons: { ··· 63 65 let resolved = await idResolver.handle.resolve(didOrHandle); 64 66 if (!resolved) { 65 67 return ( 66 - <div className="p-4 text-lg text-center flex flex-col gap-4"> 67 - <p>Sorry, can&apos;t resolve handle.</p> 68 + <NotFoundLayout> 69 + <p className="font-bold">Sorry, we can't find this handle!</p> 68 70 <p> 69 71 This may be a glitch on our end. If the issue persists please{" "} 70 72 <a href="mailto:contact@leaflet.pub">send us a note</a>. 71 73 </p> 72 - </div> 74 + </NotFoundLayout> 73 75 ); 74 76 } 75 77 did = resolved; 76 78 } catch (e) { 77 79 return ( 78 - <div className="p-4 text-lg text-center flex flex-col gap-4"> 79 - <p>Sorry, can&apos;t resolve handle.</p> 80 + <NotFoundLayout> 81 + <p className="font-bold">Sorry, we can't find this leaflet!</p> 80 82 <p> 81 83 This may be a glitch on our end. If the issue persists please{" "} 82 84 <a href="mailto:contact@leaflet.pub">send us a note</a>. 83 85 </p> 84 - </div> 86 + </NotFoundLayout> 85 87 ); 86 88 } 87 89 }
+35
app/p/[didOrHandle]/page.tsx
··· 1 + import { supabaseServerClient } from "supabase/serverClient"; 2 + import { AtUri } from "@atproto/syntax"; 3 + import { ids } from "lexicons/api/lexicons"; 4 + import { PubLeafletDocument } from "lexicons/api"; 5 + import { Metadata } from "next"; 6 + import { idResolver } from "app/(home-pages)/reader/idResolver"; 7 + import { DocumentPageRenderer } from "app/lish/[did]/[publication]/[rkey]/DocumentPageRenderer"; 8 + import { NotFoundLayout } from "components/PageLayouts/NotFoundLayout"; 9 + 10 + export default async function ProfilePage(props: { 11 + params: Promise<{ didOrHandle: string }>; 12 + }) { 13 + let params = await props.params; 14 + let didOrHandle = decodeURIComponent(params.didOrHandle); 15 + 16 + // Resolve handle to DID if necessary 17 + let did = didOrHandle; 18 + if (!didOrHandle.startsWith("did:")) { 19 + let resolved = await idResolver.handle.resolve(didOrHandle); 20 + if (!resolved) { 21 + return ( 22 + <NotFoundLayout> 23 + <p className="font-bold">Sorry, can&apos;t resolve handle!</p> 24 + <p> 25 + This may be a glitch on our end. If the issue persists please{" "} 26 + <a href="mailto:contact@leaflet.pub">send us a note</a>. 27 + </p> 28 + </NotFoundLayout> 29 + ); 30 + } 31 + did = resolved; 32 + } 33 + 34 + return <DocumentPageRenderer did={did} rkey={params.rkey} />; 35 + }