tangled
alpha
login
or
join now
leaflet.pub
/
leaflet
289
fork
atom
a tool for shared writing and social publishing
289
fork
atom
overview
issues
28
pulls
pipelines
added a check for mentions everywhere relavent
cozylittle.house
2 months ago
288d8123
645c26e1
+106
-59
13 changed files
expand all
collapse all
unified
split
app
[leaflet_id]
actions
PublishButton.tsx
lish
[did]
[publication]
[rkey]
CanvasPage.tsx
Interactions
Interactions.tsx
LinearDocumentPage.tsx
PostHeader
PostHeader.tsx
PostPages.tsx
QuoteHandler.tsx
dashboard
PublishedPostsLists.tsx
page.tsx
components
Canvas.tsx
InteractionsPreview.tsx
Pages
PublicationMetadata.tsx
PostListing.tsx
+3
-1
app/[leaflet_id]/actions/PublishButton.tsx
···
136
136
content: (
137
137
<div>
138
138
{pub.doc ? "Updated! " : "Published! "}
139
139
-
<SpeedyLink href={docUrl}>link</SpeedyLink>
139
139
+
<SpeedyLink className="underline" href={docUrl}>
140
140
+
See Published Post
141
141
+
</SpeedyLink>
140
142
</div>
141
143
),
142
144
type: "success",
+1
app/lish/[did]/[publication]/[rkey]/CanvasPage.tsx
···
217
217
quotesCount={props.quotesCount || 0}
218
218
commentsCount={props.commentsCount || 0}
219
219
showComments={props.preferences.showComments}
220
220
+
showMentions={props.preferences.showMentions}
220
221
pageId={props.pageId}
221
222
/>
222
223
{!props.isSubpage && (
+68
-44
app/lish/[did]/[publication]/[rkey]/Interactions/Interactions.tsx
···
108
108
commentsCount: number;
109
109
className?: string;
110
110
showComments?: boolean;
111
111
+
showMentions?: boolean;
111
112
pageId?: string;
112
113
}) => {
113
114
const data = useContext(PostPageContext);
···
131
132
<div className={`flex gap-2 text-tertiary text-sm ${props.className}`}>
132
133
{tagCount > 0 && <TagPopover tags={tags} tagCount={tagCount} />}
133
134
134
134
-
{props.quotesCount > 0 && (
135
135
+
{props.quotesCount === 0 || props.showMentions === false ? null : (
135
136
<button
136
137
className="flex w-fit gap-2 items-center"
137
138
onClick={() => {
···
168
169
commentsCount: number;
169
170
className?: string;
170
171
showComments?: boolean;
172
172
+
showMentions?: boolean;
171
173
pageId?: string;
172
174
}) => {
173
175
const data = useContext(PostPageContext);
···
189
191
const tags = (data?.data as any)?.tags as string[] | undefined;
190
192
const tagCount = tags?.length || 0;
191
193
194
194
+
let noInteractions = !props.showComments && !props.showMentions;
195
195
+
192
196
let subscribed =
193
197
identity?.atp_did &&
194
198
publication?.publication_subscriptions &&
···
229
233
<TagList tags={tags} className="mb-3" />
230
234
</>
231
235
)}
236
236
+
232
237
<hr className="border-border-light mb-3 " />
238
238
+
233
239
<div className="flex gap-2 justify-between">
234
234
-
<div className="flex gap-2">
235
235
-
{props.quotesCount > 0 && (
236
236
-
<button
237
237
-
className="flex w-fit gap-2 items-center px-1 py-0.5 border border-border-light rounded-lg trasparent-outline selected-outline"
238
238
-
onClick={() => {
239
239
-
if (!drawerOpen || drawer !== "quotes")
240
240
-
openInteractionDrawer("quotes", document_uri, props.pageId);
241
241
-
else setInteractionState(document_uri, { drawerOpen: false });
242
242
-
}}
243
243
-
onMouseEnter={handleQuotePrefetch}
244
244
-
onTouchStart={handleQuotePrefetch}
245
245
-
aria-label="Post quotes"
246
246
-
>
247
247
-
<QuoteTiny aria-hidden /> {props.quotesCount}{" "}
248
248
-
<span
249
249
-
aria-hidden
250
250
-
>{`Mention${props.quotesCount === 1 ? "" : "s"}`}</span>
251
251
-
</button>
252
252
-
)}
253
253
-
{props.showComments === false ? null : (
254
254
-
<button
255
255
-
className="flex gap-2 items-center w-fit px-1 py-0.5 border border-border-light rounded-lg trasparent-outline selected-outline"
256
256
-
onClick={() => {
257
257
-
if (
258
258
-
!drawerOpen ||
259
259
-
drawer !== "comments" ||
260
260
-
pageId !== props.pageId
261
261
-
)
262
262
-
openInteractionDrawer("comments", document_uri, props.pageId);
263
263
-
else setInteractionState(document_uri, { drawerOpen: false });
264
264
-
}}
265
265
-
aria-label="Post comments"
266
266
-
>
267
267
-
<CommentTiny aria-hidden />{" "}
268
268
-
{props.commentsCount > 0 ? (
269
269
-
<span aria-hidden>
270
270
-
{`${props.commentsCount} Comment${props.commentsCount === 1 ? "" : "s"}`}
271
271
-
</span>
272
272
-
) : (
273
273
-
"Comment"
240
240
+
{noInteractions ? (
241
241
+
<div />
242
242
+
) : (
243
243
+
<>
244
244
+
<div className="flex gap-2">
245
245
+
{props.quotesCount === 0 ||
246
246
+
props.showMentions === false ? null : (
247
247
+
<button
248
248
+
className="flex w-fit gap-2 items-center px-1 py-0.5 border border-border-light rounded-lg trasparent-outline selected-outline"
249
249
+
onClick={() => {
250
250
+
if (!drawerOpen || drawer !== "quotes")
251
251
+
openInteractionDrawer(
252
252
+
"quotes",
253
253
+
document_uri,
254
254
+
props.pageId,
255
255
+
);
256
256
+
else
257
257
+
setInteractionState(document_uri, { drawerOpen: false });
258
258
+
}}
259
259
+
onMouseEnter={handleQuotePrefetch}
260
260
+
onTouchStart={handleQuotePrefetch}
261
261
+
aria-label="Post quotes"
262
262
+
>
263
263
+
<QuoteTiny aria-hidden /> {props.quotesCount}{" "}
264
264
+
<span
265
265
+
aria-hidden
266
266
+
>{`Mention${props.quotesCount === 1 ? "" : "s"}`}</span>
267
267
+
</button>
274
268
)}
275
275
-
</button>
276
276
-
)}
277
277
-
</div>
269
269
+
{props.showComments === false ? null : (
270
270
+
<button
271
271
+
className="flex gap-2 items-center w-fit px-1 py-0.5 border border-border-light rounded-lg trasparent-outline selected-outline"
272
272
+
onClick={() => {
273
273
+
if (
274
274
+
!drawerOpen ||
275
275
+
drawer !== "comments" ||
276
276
+
pageId !== props.pageId
277
277
+
)
278
278
+
openInteractionDrawer(
279
279
+
"comments",
280
280
+
document_uri,
281
281
+
props.pageId,
282
282
+
);
283
283
+
else
284
284
+
setInteractionState(document_uri, { drawerOpen: false });
285
285
+
}}
286
286
+
aria-label="Post comments"
287
287
+
>
288
288
+
<CommentTiny aria-hidden />{" "}
289
289
+
{props.commentsCount > 0 ? (
290
290
+
<span aria-hidden>
291
291
+
{`${props.commentsCount} Comment${props.commentsCount === 1 ? "" : "s"}`}
292
292
+
</span>
293
293
+
) : (
294
294
+
"Comment"
295
295
+
)}
296
296
+
</button>
297
297
+
)}
298
298
+
</div>
299
299
+
</>
300
300
+
)}
301
301
+
278
302
<EditButton document={data} />
279
303
{subscribed && publication && (
280
304
<ManageSubscription
+1
-1
app/lish/[did]/[publication]/[rkey]/LinearDocumentPage.tsx
···
14
14
ExpandedInteractions,
15
15
getCommentCount,
16
16
getQuoteCount,
17
17
-
Interactions,
18
17
} from "./Interactions/Interactions";
19
18
import { PostContent } from "./PostContent";
20
19
import { PostHeader } from "./PostHeader/PostHeader";
···
92
91
<ExpandedInteractions
93
92
pageId={pageId}
94
93
showComments={preferences.showComments}
94
94
+
showMentions={preferences.showMentions}
95
95
commentsCount={getCommentCount(document, pageId) || 0}
96
96
quotesCount={getQuoteCount(document, pageId) || 0}
97
97
/>
+2
-1
app/lish/[did]/[publication]/[rkey]/PostHeader/PostHeader.tsx
···
23
23
export function PostHeader(props: {
24
24
data: PostPageData;
25
25
profile: ProfileViewDetailed;
26
26
-
preferences: { showComments?: boolean };
26
26
+
preferences: { showComments?: boolean; showMentions?: boolean };
27
27
}) {
28
28
let { identity } = useIdentityData();
29
29
let document = props.data;
···
91
91
</div>
92
92
<Interactions
93
93
showComments={props.preferences.showComments}
94
94
+
showMentions={props.preferences.showMentions}
94
95
quotesCount={getQuoteCount(document) || 0}
95
96
commentsCount={getCommentCount(document) || 0}
96
97
/>
+10
-2
app/lish/[did]/[publication]/[rkey]/PostPages.tsx
···
275
275
? []
276
276
: document.comments_on_documents
277
277
}
278
278
-
quotesAndMentions={quotesAndMentions}
278
278
+
quotesAndMentions={
279
279
+
pubRecord?.preferences?.showMentions === false
280
280
+
? []
281
281
+
: quotesAndMentions
282
282
+
}
279
283
did={did}
280
284
/>
281
285
)}
···
362
366
? []
363
367
: document.comments_on_documents
364
368
}
365
365
-
quotesAndMentions={quotesAndMentions}
369
369
+
quotesAndMentions={
370
370
+
pubRecord?.preferences?.showMentions === false
371
371
+
? []
372
372
+
: quotesAndMentions
373
373
+
}
366
374
did={did}
367
375
/>
368
376
)}
+3
-2
app/lish/[did]/[publication]/[rkey]/QuoteHandler.tsx
···
186
186
<BlueskyLinkTiny className="shrink-0" />
187
187
Bluesky
188
188
</a>
189
189
-
<Separator classname="h-4" />
189
189
+
<Separator classname="h-4!" />
190
190
<button
191
191
id="copy-quote-link"
192
192
className="flex gap-1 items-center hover:font-bold px-1"
···
211
211
</button>
212
212
{pubRecord?.preferences?.showComments !== false && identity?.atp_did && (
213
213
<>
214
214
-
<Separator classname="h-4" />
214
214
+
<Separator classname="h-4! " />
215
215
+
215
216
<button
216
217
className="flex gap-1 items-center hover:font-bold px-1"
217
218
onClick={() => {
+1
app/lish/[did]/[publication]/dashboard/PublishedPostsLists.tsx
···
140
140
commentsCount={comments}
141
141
tags={tags}
142
142
showComments={pubRecord?.preferences?.showComments}
143
143
+
showMentions={pubRecord?.preferences?.showMentions}
143
144
postUrl={`${getPublicationURL(publication)}/${uri.rkey}`}
144
145
/>
145
146
</div>
+1
app/lish/[did]/[publication]/page.tsx
···
167
167
tags={tags}
168
168
postUrl={`${getPublicationURL(publication)}/${uri.rkey}`}
169
169
showComments={record?.preferences?.showComments}
170
170
+
showMentions={record?.preferences?.showMentions}
170
171
/>
171
172
</div>
172
173
</div>
+6
-3
components/Canvas.tsx
···
170
170
171
171
let pubRecord = pub.publications.record as PubLeafletPublication.Record;
172
172
let showComments = pubRecord.preferences?.showComments;
173
173
+
let showMentions = pubRecord.preferences?.showMentions;
173
174
174
175
return (
175
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">
···
178
179
<CommentTiny className="text-border" /> —
179
180
</div>
180
181
)}
181
181
-
<div className="flex gap-1 text-tertiary items-center">
182
182
-
<QuoteTiny className="text-border" /> —
183
183
-
</div>
182
182
+
{showComments && (
183
183
+
<div className="flex gap-1 text-tertiary items-center">
184
184
+
<QuoteTiny className="text-border" /> —
185
185
+
</div>
186
186
+
)}
184
187
185
188
{!props.isSubpage && (
186
189
<>
+4
-2
components/InteractionsPreview.tsx
···
14
14
tags?: string[];
15
15
postUrl: string;
16
16
showComments: boolean | undefined;
17
17
+
showMentions: boolean | undefined;
18
18
+
17
19
share?: boolean;
18
20
}) => {
19
21
let smoker = useSmoker();
20
22
let interactionsAvailable =
21
21
-
props.quotesCount > 0 ||
23
23
+
(props.quotesCount > 0 && props.showMentions !== false) ||
22
24
(props.showComments !== false && props.commentsCount > 0);
23
25
24
26
const tagsCount = props.tags?.length || 0;
···
36
38
</>
37
39
)}
38
40
39
39
-
{props.quotesCount === 0 ? null : (
41
41
+
{props.showMentions === false || props.quotesCount === 0 ? null : (
40
42
<SpeedyLink
41
43
aria-label="Post quotes"
42
44
href={`${props.postUrl}?interactionDrawer=quotes`}
+5
-3
components/Pages/PublicationMetadata.tsx
···
121
121
<Separator classname="h-4!" />
122
122
</>
123
123
)}
124
124
-
<div className="flex gap-1 items-center">
125
125
-
<QuoteTiny />—
126
126
-
</div>
124
124
+
{pubRecord?.preferences?.showMentions && (
125
125
+
<div className="flex gap-1 items-center">
126
126
+
<QuoteTiny />—
127
127
+
</div>
128
128
+
)}
127
129
{pubRecord?.preferences?.showComments && (
128
130
<div className="flex gap-1 items-center">
129
131
<CommentTiny />—
+1
components/PostListing.tsx
···
97
97
commentsCount={comments}
98
98
tags={tags}
99
99
showComments={pubRecord?.preferences?.showComments}
100
100
+
showMentions={pubRecord?.preferences?.showMentions}
100
101
share
101
102
/>
102
103
</div>