a tool for shared writing and social publishing
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

add edit link to post page

+22 -10
+22 -10
app/lish/[did]/[publication]/[rkey]/page.tsx
··· 12 12 import { BskyAgent } from "@atproto/api"; 13 13 import { SubscribeWithBluesky } from "app/lish/Subscribe"; 14 14 import { PostContent } from "./PostContent"; 15 + import { getIdentityData } from "actions/getIdentityData"; 15 16 16 17 export async function generateMetadata(props: { 17 18 params: Promise<{ publication: string; did: string; rkey: string }>; ··· 55 56 </div> 56 57 ); 57 58 let agent = new BskyAgent({ service: "https://public.api.bsky.app" }); 59 + let identity = await getIdentityData(); 58 60 let [{ data: document }, { data: profile }] = await Promise.all([ 59 61 supabaseServerClient 60 62 .from("documents") 61 63 .select( 62 - "*, documents_in_publications(publications(*, publication_subscriptions(*)))", 64 + "*, leaflets_in_publications(*), documents_in_publications(publications(*, publication_subscriptions(*)))", 63 65 ) 64 66 .eq( 65 67 "uri", ··· 134 136 </div> 135 137 <PostContent blocks={blocks} did={did} /> 136 138 <hr className="border-border-light mb-4 mt-2" /> 137 - <SubscribeWithBluesky 138 - isPost 139 - pub_uri={document.documents_in_publications[0].publications.uri} 140 - subscribers={ 141 - document.documents_in_publications[0].publications 142 - .publication_subscriptions 143 - } 144 - pubName={decodeURIComponent((await props.params).publication)} 145 - /> 139 + {identity && 140 + identity.atp_did === 141 + document.documents_in_publications[0]?.publications.identity_did ? ( 142 + <a 143 + href={`https://leaflet.pub/${document.leaflets_in_publications[0].leaflet}`} 144 + > 145 + edit post 146 + </a> 147 + ) : ( 148 + <SubscribeWithBluesky 149 + isPost 150 + pub_uri={document.documents_in_publications[0].publications.uri} 151 + subscribers={ 152 + document.documents_in_publications[0].publications 153 + .publication_subscriptions 154 + } 155 + pubName={decodeURIComponent((await props.params).publication)} 156 + /> 157 + )} 146 158 </div> 147 159 </div> 148 160 </ThemeProvider>