a tool for shared writing and social publishing

doing a pass to make the show mention, comment, and prev/next cleaner

+85 -52
+2 -2
app/lish/[did]/[publication]/[rkey]/CanvasPage.tsx
··· 216 216 <Interactions 217 217 quotesCount={props.quotesCount || 0} 218 218 commentsCount={props.commentsCount || 0} 219 - showComments={props.preferences.showComments} 220 - showMentions={props.preferences.showMentions} 219 + showComments={props.preferences.showComments !== false} 220 + showMentions={props.preferences.showMentions !== false} 221 221 pageId={props.pageId} 222 222 /> 223 223 {!props.isSubpage && (
+6 -23
app/lish/[did]/[publication]/[rkey]/Interactions/Interactions.tsx
··· 107 107 quotesCount: number; 108 108 commentsCount: number; 109 109 className?: string; 110 - showComments?: boolean; 111 - showMentions?: boolean; 110 + showComments: boolean; 111 + showMentions: boolean; 112 112 pageId?: string; 113 113 }) => { 114 114 const data = useContext(PostPageContext); ··· 168 168 quotesCount: number; 169 169 commentsCount: number; 170 170 className?: string; 171 - showComments?: boolean; 172 - showMentions?: boolean; 171 + showComments: boolean; 172 + showMentions: boolean; 173 173 pageId?: string; 174 174 }) => { 175 175 const data = useContext(PostPageContext); ··· 210 210 <div 211 211 className={`text-tertiary px-3 sm:px-4 flex flex-col ${props.className}`} 212 212 > 213 - {!subscribed && !isAuthor && publication && publication.record && ( 214 - <div className="text-center flex flex-col accent-container rounded-md mb-3"> 215 - <div className="flex flex-col py-4"> 216 - <div className="leading-snug flex flex-col pb-2 text-sm"> 217 - <div className="font-bold">Subscribe to {publication.name}</div>{" "} 218 - to get updates in Reader, RSS, or via Bluesky Feed 219 - </div> 220 - <SubscribeWithBluesky 221 - pubName={publication.name} 222 - pub_uri={publication.uri} 223 - base_url={getPublicationURL(publication)} 224 - subscribers={publication?.publication_subscriptions} 225 - /> 226 - </div> 227 - </div> 228 - )} 229 213 {tagCount > 0 && ( 230 214 <> 231 215 <hr className="border-border-light mb-3" /> ··· 242 226 ) : ( 243 227 <> 244 228 <div className="flex gap-2"> 245 - {props.quotesCount === 0 || 246 - props.showMentions === false ? null : ( 229 + {props.quotesCount === 0 || !props.showMentions ? null : ( 247 230 <button 248 231 className="flex w-fit gap-2 items-center px-1 py-0.5 border border-border-light rounded-lg trasparent-outline selected-outline" 249 232 onClick={() => { ··· 266 249 >{`Mention${props.quotesCount === 1 ? "" : "s"}`}</span> 267 250 </button> 268 251 )} 269 - {props.showComments === false ? null : ( 252 + {!props.showComments ? null : ( 270 253 <button 271 254 className="flex gap-2 items-center w-fit px-1 py-0.5 border border-border-light rounded-lg trasparent-outline selected-outline" 272 255 onClick={() => {
+5 -5
app/lish/[did]/[publication]/[rkey]/LinearDocumentPage.tsx
··· 25 25 import { PollData } from "./fetchPollData"; 26 26 import { SharedPageProps } from "./PostPages"; 27 27 import { PostPrevNextButtons } from "./PostPrevNextButtons"; 28 + import { PostSubscribe } from "./PostSubscribe"; 28 29 29 30 export function LinearDocumentPage({ 30 31 blocks, ··· 56 57 57 58 const isSubpage = !!pageId; 58 59 59 - console.log("prev/next?: " + preferences.showPrevNext); 60 - 61 60 return ( 62 61 <> 63 62 <PageWrapper ··· 85 84 did={did} 86 85 prerenderedCodeBlocks={prerenderedCodeBlocks} 87 86 /> 87 + <PostSubscribe /> 88 88 <PostPrevNextButtons 89 - showPrevNext={preferences.showPrevNext && !isSubpage} 89 + showPrevNext={preferences.showPrevNext !== false && !isSubpage} 90 90 /> 91 91 <ExpandedInteractions 92 92 pageId={pageId} 93 - showComments={preferences.showComments} 94 - showMentions={preferences.showMentions} 93 + showComments={preferences.showComments !== false} 94 + showMentions={preferences.showMentions !== false} 95 95 commentsCount={getCommentCount(document, pageId) || 0} 96 96 quotesCount={getQuoteCount(document, pageId) || 0} 97 97 />
+2 -2
app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx
··· 90 90 ) : null} 91 91 </div> 92 92 <Interactions 93 - showComments={props.preferences.showComments} 94 - showMentions={props.preferences.showMentions} 93 + showComments={props.preferences.showComments !== false} 94 + showMentions={props.preferences.showMentions !== false} 95 95 quotesCount={getQuoteCount(document) || 0} 96 96 commentsCount={getCommentCount(document) || 0} 97 97 />
+1 -3
app/lish/[did]/[publication]/[rkey]/PostPrevNextButtons.tsx
··· 10 10 import { SpeedyLink } from "components/SpeedyLink"; 11 11 import { ArrowRightTiny } from "components/Icons/ArrowRightTiny"; 12 12 13 - export const PostPrevNextButtons = (props: { 14 - showPrevNext: boolean | undefined; 15 - }) => { 13 + export const PostPrevNextButtons = (props: { showPrevNext: boolean }) => { 16 14 let postData = useContext(PostPageContext); 17 15 let pub = postData?.documents_in_publications[0]?.publications; 18 16
+45
app/lish/[did]/[publication]/[rkey]/PostSubscribe.tsx
··· 1 + "use client"; 2 + import { useContext } from "react"; 3 + import { PostPageContext } from "./PostPageContext"; 4 + import { useIdentityData } from "components/IdentityProvider"; 5 + import { SubscribeWithBluesky } from "app/lish/Subscribe"; 6 + import { getPublicationURL } from "app/lish/createPub/getPublicationURL"; 7 + 8 + export const PostSubscribe = () => { 9 + const data = useContext(PostPageContext); 10 + let { identity } = useIdentityData(); 11 + 12 + let publication = data?.documents_in_publications[0]?.publications; 13 + 14 + let subscribed = 15 + identity?.atp_did && 16 + publication?.publication_subscriptions && 17 + publication?.publication_subscriptions.find( 18 + (s) => s.identity === identity.atp_did, 19 + ); 20 + 21 + let isAuthor = 22 + identity && 23 + identity.atp_did === 24 + data?.documents_in_publications[0]?.publications?.identity_did && 25 + data?.leaflets_in_publications[0]; 26 + 27 + if (!subscribed && !isAuthor && publication && publication.record) 28 + return ( 29 + <div className="text-center flex flex-col accent-container rounded-md mb-3 mx-3 sm:mx-4"> 30 + <div className="flex flex-col py-4"> 31 + <div className="leading-snug flex flex-col pb-2 "> 32 + <div className="font-bold">Subscribe to {publication.name}</div> to 33 + get updates in Reader, RSS, or via Bluesky Feed 34 + </div> 35 + <SubscribeWithBluesky 36 + pubName={publication.name} 37 + pub_uri={publication.uri} 38 + base_url={getPublicationURL(publication)} 39 + subscribers={publication?.publication_subscriptions} 40 + /> 41 + </div> 42 + </div> 43 + ); 44 + else return; 45 + };
+6 -2
app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx
··· 139 139 quotesCount={quotes} 140 140 commentsCount={comments} 141 141 tags={tags} 142 - showComments={pubRecord?.preferences?.showComments} 143 - showMentions={pubRecord?.preferences?.showMentions} 142 + showComments={ 143 + pubRecord?.preferences?.showComments !== false 144 + } 145 + showMentions={ 146 + pubRecord?.preferences?.showMentions !== false 147 + } 144 148 postUrl={`${getPublicationURL(publication)}/${uri.rkey}`} 145 149 /> 146 150 </div>
-1
app/lish/[did]/[publication]/dashboard/settings/PostOptions.tsx
··· 54 54 }, 55 55 }); 56 56 toast({ type: "success", content: <strong>Posts Updated!</strong> }); 57 - console.log(record.preferences?.showPrevNext); 58 57 props.setLoading(false); 59 58 mutate("publication-data"); 60 59 }}
+6 -2
app/lish/[did]/[publication]/page.tsx
··· 171 171 commentsCount={comments} 172 172 tags={tags} 173 173 postUrl={`${getPublicationURL(publication)}/${uri.rkey}`} 174 - showComments={record?.preferences?.showComments} 175 - showMentions={record?.preferences?.showMentions} 174 + showComments={ 175 + record?.preferences?.showComments !== false 176 + } 177 + showMentions={ 178 + record?.preferences?.showMentions !== false 179 + } 176 180 /> 177 181 </div> 178 182 </div>
+1 -1
app/lish/createPub/CreatePubForm.tsx
··· 57 57 showInDiscover, 58 58 showComments: true, 59 59 showMentions: true, 60 - showPrevNext: false, 60 + showPrevNext: true, 61 61 }, 62 62 }); 63 63
+2 -2
components/Canvas.tsx
··· 169 169 if (!pub || !pub.publications) return null; 170 170 171 171 let pubRecord = pub.publications.record as PubLeafletPublication.Record; 172 - let showComments = pubRecord.preferences?.showComments; 173 - let showMentions = pubRecord.preferences?.showMentions; 172 + let showComments = pubRecord.preferences?.showComments !== false; 173 + let showMentions = pubRecord.preferences?.showMentions !== false; 174 174 175 175 return ( 176 176 <div className="flex flex-row gap-3 items-center absolute top-6 right-3 sm:top-4 sm:right-4 bg-bg-page border-border-light rounded-md px-2 py-1 h-fit z-20">
+4 -4
components/InteractionsPreview.tsx
··· 13 13 commentsCount: number; 14 14 tags?: string[]; 15 15 postUrl: string; 16 - showComments: boolean | undefined; 17 - showMentions: boolean | undefined; 16 + showComments: boolean; 17 + showMentions: boolean; 18 18 19 19 share?: boolean; 20 20 }) => { 21 21 let smoker = useSmoker(); 22 22 let interactionsAvailable = 23 - (props.quotesCount > 0 && props.showMentions !== false) || 23 + (props.quotesCount > 0 && props.showMentions) || 24 24 (props.showComments !== false && props.commentsCount > 0); 25 25 26 26 const tagsCount = props.tags?.length || 0; ··· 38 38 </> 39 39 )} 40 40 41 - {props.showMentions === false || props.quotesCount === 0 ? null : ( 41 + {props.showMentions || props.quotesCount === 0 ? null : ( 42 42 <SpeedyLink 43 43 aria-label="Post quotes" 44 44 href={`${props.postUrl}?interactionDrawer=quotes`}
+2 -2
components/PostListing.tsx
··· 96 96 quotesCount={quotes} 97 97 commentsCount={comments} 98 98 tags={tags} 99 - showComments={pubRecord?.preferences?.showComments} 100 - showMentions={pubRecord?.preferences?.showMentions} 99 + showComments={pubRecord?.preferences?.showComments !== false} 100 + showMentions={pubRecord?.preferences?.showMentions !== false} 101 101 share 102 102 /> 103 103 </div>
+1 -1
lexicons/api/lexicons.ts
··· 1816 1816 }, 1817 1817 showPrevNext: { 1818 1818 type: 'boolean', 1819 - default: false, 1819 + default: true, 1820 1820 }, 1821 1821 }, 1822 1822 },
+1 -1
lexicons/pub/leaflet/publication.json
··· 58 58 }, 59 59 "showPrevNext": { 60 60 "type": "boolean", 61 - "default": false 61 + "default": true 62 62 } 63 63 } 64 64 },
+1 -1
lexicons/src/publication.ts
··· 28 28 showInDiscover: { type: "boolean", default: true }, 29 29 showComments: { type: "boolean", default: true }, 30 30 showMentions: { type: "boolean", default: true }, 31 - showPrevNext: { type: "boolean", default: false }, 31 + showPrevNext: { type: "boolean", default: true }, 32 32 }, 33 33 }, 34 34 theme: {