a tool for shared writing and social publishing

fix type errors

+10 -11
+8 -9
app/lish/[did]/[publication]/[rkey]/PostSubscribe.tsx
··· 1 1 "use client"; 2 - import { useContext } from "react"; 3 - import { PostPageContext } from "./PostPageContext"; 2 + import { useDocumentOptional } from "contexts/DocumentContext"; 4 3 import { useIdentityData } from "components/IdentityProvider"; 5 4 import { SubscribeWithBluesky } from "app/lish/Subscribe"; 6 5 import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; 7 6 8 7 export const PostSubscribe = () => { 9 - const data = useContext(PostPageContext); 8 + const data = useDocumentOptional(); 10 9 let { identity } = useIdentityData(); 11 10 12 - let publication = data?.documents_in_publications[0]?.publications; 11 + let publication = data?.publication; 12 + let normalizedPublication = data?.normalizedPublication; 13 13 14 14 let subscribed = 15 15 identity?.atp_did && ··· 20 20 21 21 let isAuthor = 22 22 identity && 23 - identity.atp_did === 24 - data?.documents_in_publications[0]?.publications?.identity_did && 25 - data?.leaflets_in_publications[0]; 23 + identity.atp_did === publication?.identity_did && 24 + data?.leafletId; 26 25 27 - if (!subscribed && !isAuthor && publication && publication.record) 26 + if (!subscribed && !isAuthor && publication && normalizedPublication) 28 27 return ( 29 28 <div className="text-center flex flex-col accent-container rounded-md mb-3 mx-3 sm:mx-4"> 30 29 <div className="flex flex-col py-4"> ··· 41 40 </div> 42 41 </div> 43 42 ); 44 - else return; 43 + else return null; 45 44 };
+2 -2
components/Pages/PublicationMetadata.tsx
··· 113 113 {tags && ( 114 114 <> 115 115 <AddTags /> 116 - {pubRecord?.preferences?.showMentions || 117 - pubRecord?.preferences?.showComments ? ( 116 + {normalizedPublication?.preferences?.showMentions || 117 + normalizedPublication?.preferences?.showComments ? ( 118 118 <Separator classname="h-4!" /> 119 119 ) : null} 120 120 </>