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 some spacing for replies
cozylittle.house
4 months ago
d2d722bd
0e361727
+66
-44
2 changed files
expand all
collapse all
unified
split
app
lish
[did]
[publication]
[rkey]
Interactions
Comments
CommentBox.tsx
index.tsx
+2
-1
app/lish/[did]/[publication]/[rkey]/Interactions/Comments/CommentBox.tsx
···
43
43
replyTo?: string;
44
44
onSubmit?: () => void;
45
45
autoFocus?: boolean;
46
46
+
className?: string;
46
47
}) {
47
48
let mountRef = useRef<HTMLPreElement | null>(null);
48
49
let {
···
216
217
}, []);
217
218
218
219
return (
219
219
-
<div className=" flex flex-col">
220
220
+
<div className={`flex flex-col grow ${props.className}`}>
220
221
{quote && (
221
222
<div className="relative mt-2 mb-2">
222
223
<QuoteContent position={quote} did="" index={-1} />
+64
-43
app/lish/[did]/[publication]/[rkey]/Interactions/Comments/index.tsx
···
162
162
163
163
let [replyBoxOpen, setReplyBoxOpen] = useState(false);
164
164
let [repliesOpen, setRepliesOpen] = useState(true);
165
165
+
165
166
let replies = props.comments
166
167
.filter(
167
168
(comment) =>
···
176
177
new Date(aRecord.createdAt).getTime()
177
178
);
178
179
});
180
180
+
181
181
+
let repliesOrReplyBoxOpen =
182
182
+
replyBoxOpen || (repliesOpen && replies.length > 0);
179
183
return (
180
184
<>
181
185
<div className="flex gap-2 items-center">
···
203
207
</>
204
208
)}
205
209
</div>
206
206
-
<div className="flex flex-col gap-2">
207
207
-
{replyBoxOpen && (
208
208
-
<CommentBox
209
209
-
pageId={props.pageId}
210
210
-
doc_uri={props.document}
211
211
-
replyTo={props.comment_uri}
212
212
-
autoFocus={true}
213
213
-
onSubmit={() => {
214
214
-
setReplyBoxOpen(false);
215
215
-
}}
216
216
-
/>
217
217
-
)}
218
218
-
{repliesOpen && replies.length > 0 && (
219
219
-
<div className="repliesWrapper flex">
220
220
-
<button
221
221
-
className="repliesCollapse pr-[14px] ml-[7px] pt-0.5"
222
222
-
onClick={() => {
223
223
-
setReplyBoxOpen(false);
224
224
-
setRepliesOpen(false);
225
225
-
}}
226
226
-
>
227
227
-
<div className="bg-border-light w-[2px] h-full" />
228
228
-
</button>
229
229
-
<div className="repliesContent flex flex-col gap-3 pt-2 w-full">
230
230
-
{replies.map((reply) => {
231
231
-
return (
232
232
-
<Comment
233
233
-
pageId={props.pageId}
234
234
-
document={props.document}
235
235
-
key={reply.uri}
236
236
-
comment={reply}
237
237
-
profile={
238
238
-
reply.bsky_profiles?.record as AppBskyActorProfile.Record
239
239
-
}
240
240
-
record={reply.record as PubLeafletComment.Record}
241
241
-
comments={props.comments}
242
242
-
/>
243
243
-
);
244
244
-
})}
210
210
+
{repliesOrReplyBoxOpen && (
211
211
+
<div className="flex flex-col pt-1">
212
212
+
{replyBoxOpen && (
213
213
+
<div className="repliesWrapper flex w-full">
214
214
+
<button
215
215
+
className="repliesCollapse pr-[14px] ml-[7px]"
216
216
+
onClick={() => {
217
217
+
setReplyBoxOpen(false);
218
218
+
setRepliesOpen(false);
219
219
+
}}
220
220
+
>
221
221
+
<div className="bg-border-light w-[2px] h-full" />
222
222
+
</button>
223
223
+
<CommentBox
224
224
+
className="pt-3"
225
225
+
pageId={props.pageId}
226
226
+
doc_uri={props.document}
227
227
+
replyTo={props.comment_uri}
228
228
+
autoFocus={true}
229
229
+
onSubmit={() => {
230
230
+
setReplyBoxOpen(false);
231
231
+
}}
232
232
+
/>
233
233
+
</div>
234
234
+
)}
235
235
+
{repliesOpen && replies.length > 0 && (
236
236
+
<div className="repliesWrapper flex">
237
237
+
<button
238
238
+
className="repliesCollapse pr-[14px] ml-[7px]"
239
239
+
onClick={() => {
240
240
+
setReplyBoxOpen(false);
241
241
+
setRepliesOpen(false);
242
242
+
}}
243
243
+
>
244
244
+
<div className="bg-border-light w-[2px] h-full" />
245
245
+
</button>
246
246
+
<div className="repliesContent flex flex-col gap-3 pt-2 w-full">
247
247
+
{replies.map((reply) => {
248
248
+
return (
249
249
+
<Comment
250
250
+
pageId={props.pageId}
251
251
+
document={props.document}
252
252
+
key={reply.uri}
253
253
+
comment={reply}
254
254
+
profile={
255
255
+
reply.bsky_profiles
256
256
+
?.record as AppBskyActorProfile.Record
257
257
+
}
258
258
+
record={reply.record as PubLeafletComment.Record}
259
259
+
comments={props.comments}
260
260
+
/>
261
261
+
);
262
262
+
})}
263
263
+
</div>
245
264
</div>
246
246
-
</div>
247
247
-
)}
248
248
-
</div>
265
265
+
)}
266
266
+
</div>
267
267
+
)}
249
268
</>
250
269
);
251
270
};
···
263
282
return (
264
283
<Popover
265
284
trigger={
266
266
-
<div className="italic text-sm text-tertiary hover:underline">{timeAgoText}</div>
285
285
+
<div className="italic text-sm text-tertiary hover:underline">
286
286
+
{timeAgoText}
287
287
+
</div>
267
288
}
268
289
>
269
290
<div className="text-sm text-secondary">{fullDate}</div>