a tool for shared writing and social publishing

add option to toggle comments off

+56 -13
+14 -11
app/lish/[did]/[publication]/[rkey]/Interactions/Interactions.tsx
··· 34 34 commentsCount: number; 35 35 compact?: boolean; 36 36 className?: string; 37 + showComments?: boolean; 37 38 }) => { 38 39 let { drawerOpen, drawer } = useInteractionState(); 39 40 ··· 52 53 <QuoteTiny /> {props.quotesCount}{" "} 53 54 {!props.compact && `Quote${props.quotesCount === 1 ? "" : "s"}`} 54 55 </button> 55 - <button 56 - className={`flex gap-1 items-center ${!props.compact && "px-1 py-0.5 border border-border-light rounded-lg trasparent-outline selected-outline"}`} 57 - onClick={() => { 58 - if (!drawerOpen || drawer !== "comments") 59 - openInteractionDrawer("comments"); 60 - else useInteractionState.setState({ drawerOpen: false }); 61 - }} 62 - > 63 - <CommentTiny /> {props.commentsCount}{" "} 64 - {!props.compact && `Comment${props.commentsCount === 1 ? "" : "s"}`} 65 - </button> 56 + {props.showComments === false ? null : ( 57 + <button 58 + className={`flex gap-1 items-center ${!props.compact && "px-1 py-0.5 border border-border-light rounded-lg trasparent-outline selected-outline"}`} 59 + onClick={() => { 60 + if (!drawerOpen || drawer !== "comments") 61 + openInteractionDrawer("comments"); 62 + else useInteractionState.setState({ drawerOpen: false }); 63 + }} 64 + > 65 + <CommentTiny /> {props.commentsCount}{" "} 66 + {!props.compact && `Comment${props.commentsCount === 1 ? "" : "s"}`} 67 + </button> 68 + )} 66 69 </div> 67 70 ); 68 71 };
+2
app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx
··· 14 14 data: PostPageData; 15 15 name: string; 16 16 profile: ProfileViewDetailed; 17 + preferences: { showComments?: boolean }; 17 18 }) { 18 19 let { identity } = useIdentityData(); 19 20 let document = props.data; ··· 92 93 ) : null} 93 94 |{" "} 94 95 <Interactions 96 + showComments={props.preferences.showComments} 95 97 compact 96 98 quotesCount={document.document_mentions_in_bsky.length} 97 99 commentsCount={document.comments_on_documents.length}
+9 -1
app/lish/[did]/[publication]/[rkey]/PostPage.tsx
··· 20 20 name, 21 21 did, 22 22 profile, 23 + preferences, 23 24 pubRecord, 24 25 prerenderedCodeBlocks, 25 26 bskyPostData, ··· 32 33 did: string; 33 34 prerenderedCodeBlocks?: Map<string, string>; 34 35 bskyPostData: AppBskyFeedDefs.PostView[]; 36 + preferences: { showComments?: boolean }; 35 37 }) { 36 38 let { identity } = useIdentityData(); 37 39 let { drawerOpen } = useInteractionState(); ··· 62 64 <div 63 65 className={`postPageContent sm:max-w-prose mx-auto h-fit w-full px-3 sm:px-4 ${hasPageBackground ? " pt-2 pb-3 sm:pb-6" : "py-6 sm:py-9"}`} 64 66 > 65 - <PostHeader data={document} profile={profile} name={name} /> 67 + <PostHeader 68 + data={document} 69 + profile={profile} 70 + name={name} 71 + preferences={preferences} 72 + /> 66 73 <PostContent 67 74 bskyPostData={bskyPostData} 68 75 blocks={blocks} ··· 70 77 prerenderedCodeBlocks={prerenderedCodeBlocks} 71 78 /> 72 79 <Interactions 80 + showComments={preferences.showComments} 73 81 quotesCount={document.document_mentions_in_bsky.length} 74 82 commentsCount={document.comments_on_documents.length} 75 83 />
+6 -1
app/lish/[did]/[publication]/[rkey]/page.tsx
··· 160 160 */} 161 161 <PageLayout> 162 162 <PostPage 163 + preferences={pubRecord.preferences || {}} 163 164 pubRecord={pubRecord} 164 165 profile={JSON.parse(JSON.stringify(profile.data))} 165 166 document={document} ··· 171 172 /> 172 173 <InteractionDrawer 173 174 document_uri={document.uri} 174 - comments={document.comments_on_documents} 175 + comments={ 176 + pubRecord.preferences?.showComments === false 177 + ? [] 178 + : document.comments_on_documents 179 + } 175 180 quotes={document.document_mentions_in_bsky} 176 181 did={did} 177 182 />
+15
app/lish/createPub/UpdatePubForm.tsx
··· 31 31 ? true 32 32 : record.preferences.showInDiscover, 33 33 ); 34 + let [showComments, setShowComments] = useState( 35 + record?.preferences?.showComments === undefined 36 + ? true 37 + : record.preferences.showComments, 38 + ); 34 39 let [descriptionValue, setDescriptionValue] = useState( 35 40 record?.description || "", 36 41 ); ··· 62 67 iconFile: iconFile, 63 68 preferences: { 64 69 showInDiscover: showInDiscover, 70 + showComments: showComments, 65 71 }, 66 72 }); 67 73 toast({ type: "success", content: "Updated!" }); ··· 153 159 <p className="text-xs text-tertiary font-normal"> 154 160 This publication will appear on our public Discover page 155 161 </p> 162 + </div> 163 + </Checkbox> 164 + 165 + <Checkbox 166 + checked={showComments} 167 + onChange={(e) => setShowComments(e.target.checked)} 168 + > 169 + <div className=" pt-0.5 flex flex-col text-sm italic text-tertiary "> 170 + <p className="font-bold">Show comments on posts</p> 156 171 </div> 157 172 </Checkbox> 158 173 <hr className="border-border-light" />
+4
lexicons/api/lexicons.ts
··· 160 160 type: 'boolean', 161 161 default: true, 162 162 }, 163 + showComments: { 164 + type: 'boolean', 165 + default: true, 166 + }, 163 167 }, 164 168 }, 165 169 theme: {
+1
lexicons/api/types/pub/leaflet/publication.ts
··· 36 36 export interface Preferences { 37 37 $type?: 'pub.leaflet.publication#preferences' 38 38 showInDiscover: boolean 39 + showComments: boolean 39 40 } 40 41 41 42 const hashPreferences = 'preferences'
+4
lexicons/pub/leaflet/publication.json
··· 48 48 "showInDiscover": { 49 49 "type": "boolean", 50 50 "default": true 51 + }, 52 + "showComments": { 53 + "type": "boolean", 54 + "default": true 51 55 } 52 56 } 53 57 },
+1
lexicons/src/publication.ts
··· 26 26 type: "object", 27 27 properties: { 28 28 showInDiscover: { type: "boolean", default: true }, 29 + showComments: { type: "boolean", default: true }, 29 30 }, 30 31 }, 31 32 theme: {