feat: group images into a gallery #639

Merged
Kieran merged 1 commits from fernandoporazzi/snort:group-post-images into main 2023-10-05 13:10:46 +00:00
Contributor

Solves #626

Results can be found in the attachments and also externally on video: https://streamable.com/q492ui

I've done some testing with different types of combinations, such as:
text -> gallery -> text -> gallery
gallery -> video -> gallery
link -> text -> gallery
hashtag -> gallery -> video -> gallery

and it seems to be working fine. If the <Text /> component is used elsewhere other than the timeline and the post itself, it might need some extra testing.

This npub was created in order to test all those combinations: npub1027c702nhecpzy6jt3wyvjpw6j8m7n9x0xyvn00xt69zlljv8fts5c34hd

Solves #626 Results can be found in the attachments and also externally on video: https://streamable.com/q492ui I've done some testing with different types of combinations, such as: text -> gallery -> text -> gallery gallery -> video -> gallery link -> text -> gallery hashtag -> gallery -> video -> gallery and it seems to be working fine. If the `<Text />` component is used elsewhere other than the timeline and the post itself, it might need some extra testing. This npub was created in order to test all those combinations: `npub1027c702nhecpzy6jt3wyvjpw6j8m7n9x0xyvn00xt69zlljv8fts5c34hd`
fernandoporazzi requested review from Kieran 2023-10-03 22:11:32 +00:00
Kieran reviewed 2023-10-05 09:55:50 +00:00
@ -86,3 +130,1 @@
} else if (lenCtr + a.content.length > truncate) {
lenCtr += a.content.length;
return <div className="text-frag">{a.content.slice(0, truncate - lenCtr)}...</div>;
chunks = chunks.concat(null);
Owner

This should be continue instead

This should be `continue` instead
Author
Contributor

Solved

Solved
fernandoporazzi marked this conversation as resolved
@ -190,3 +190,3 @@
.map(a => {
if (typeof a === "string") {
if (a.length > 0) {
if (a.trim().length > 0) {
Owner

Should not trim because empty text frag is important for spacing

Should not trim because empty `text` frag is important for spacing
Author
Contributor

Keeping that empty text fragment might be a bit of an issue when grouping images. It would break the grouping for loop if the next element is not a media of type image.

We could keep on grouping images if there is an empty text fragment between them, but that would increase the complexity of the code as well.

Maybe we can find a proper way to handle spacing using a CSS-only solution.

Currently the space is not so messed up, I just think the line-height is a bit too high. If we lower that value, it might remove the space between the text you see on the video attached.

Keeping that empty text fragment might be a bit of an issue when grouping images. It would break the grouping for loop if the next element is not a media of type image. We could keep on grouping images if there is an empty text fragment between them, but that would increase the complexity of the code as well. Maybe we can find a proper way to handle spacing using a CSS-only solution. Currently the space is not so messed up, I just think the line-height is a bit too high. If we lower that value, it might remove the space between the text you see on the video attached.
Owner

Ok we can keep it trimmed for now, but i used to have this and it messed up some of the layout on posts

Ok we can keep it trimmed for now, but i used to have this and it messed up some of the layout on posts
Kieran marked this conversation as resolved
fernandoporazzi force-pushed group-post-images from 18c54877d5 to 8e34a7a078 2023-10-05 12:18:27 +00:00 Compare
Kieran merged commit 7c839ae3a8 into main 2023-10-05 13:10:46 +00:00
Kieran deleted branch group-post-images 2023-10-05 13:10:47 +00:00
Owner

Ah yes here it is, its the hashtags: image

Ah yes here it is, its the hashtags: ![image](/attachments/1a75b403-b08e-4ffa-808d-1caf990568ce)
Sign in to join this conversation.
No description provided.