[feat] Integrate new Image component into ChatView and MediaView
Become a 10x Instagrammer and Escape Brainrot with Instagram CLI
Brought to you by:
jetc
Originally created by: supreme-gg-gg
<Image> component to ChatView to close [#104]Will update to use the library once its published instead of in-house 😄
The next PR will be merging ts-migration/main into main for a development release and a bunch of devops updates
Originally posted by: supreme-gg-gg
@endernoke can you test this as well, I noted that sometimes in Message List the next text message overlaps with the image box but this only happened on iTerm2 it works fine on Kitty, I also cannot figure out why this would happen because the Box component is directly above Text and the Image rendering itself is fine.
Plus, do we have a way to figure out the proper width and height of the
<Box>component wrapping the<Image>currently I just took the constant value from thetest-imagecommand lolOriginally posted by: endernoke
Sure I'll test tonight
Bro the image component will dynamically resize to fit within the parent container if not provided with a explicit width and height value lmao
Originally posted by: supreme-gg-gg
Yes I mean do we have a way to figure out the size of the parent container lol (which is
Box). When I just let the Image component rot by itself like<Text>apparently it just resized to the default minimum size of one col and one row, it only works if I wrap it in a Box with a defined (either static or dynamic) sizeOriginally posted by: endernoke
wait what 💀 I think if the default image shrinks to 1x1 then it's an issue with the
flexGrowof the parent box container not the image itselfIf you really need to know the dimensions of a box you can use
measureElement(node)from official Ink or theusePositioncustom hook I wrote for image, you can find example usages in halfBlock and sixel components.Originally posted by: endernoke
Overlap issue might be related to https://github.com/vadimdemedes/ink/issues/602
Originally posted by: endernoke
Turns out we need to manually set flexGrow to 1 AND flexShrink to 0 so container boxes won't try to shrink beyond width of its children if there's insufficient space.
Originally posted by: endernoke
@supreme-gg-gg should be ready for review and merge now
Originally posted by: supreme-gg-gg
Bro I think technical debt creditors just hate me lmao 😠ğŸ˜
When I run everything directly sometimes the Input Box is overlapped, but if I resize the terminal properly it will work fine, idk if this can be fixed:
Ok then I tried to remove the width and height hardcoded to the Box wrapping image as I said above:
So it seems like we cannot remove the width and height hardcoded since it just makes the image disappear / extremely small if we don't specify a width and height?
By that I mean:
Even more funny is that when running feed it just broke saying cannot get terminal context, but obviously nothing was changed in the file.
Seems like the query just timed out or was null? But this was working fine before.
Would appreciate if you can send me some screenshot of how it looks like on your side or if it's also broken. I'm extremely confused because a few weeks back they all work fine, now it's broken after just sitting there lmao
Originally posted by: supreme-gg-gg
EDIT: I was able to workaround the terminal provider info error by adding:
@endernoke if this bug also happens on your terminal perhaps it is caused by some underlying mistake / technical debt I left when I changed
queryEscapeSequence, but otherwise I think we can just add something like this to patch debt with debt lmao (if this is not reproducible)Originally posted by: endernoke
Reproduceable, I think this is technical debt of Ink not ours ğŸ˜
Assuming I implemented the image resizing correctly (maybe I didn't 💀 ), I guess Ink's flexbox decided images should be that small by default when distributing space.
This is weird lmao I tried feed yesterday and it was working...
Originally posted by: supreme-gg-gg
Ok let's assume the first two are technical debt of Ink cuz if it works it works, it's really hard to see where Ink breaks since we have custom implementation everywhere lol
The last one sounds like black magic tho cuz obviously no code change was made to that, and the endpoint works cuz if I add the code for fallback it works fine
Originally posted by: endernoke
I couldn't reproduce the feed escape sequence issue, heisenbug discovered lmao
Did you experience this every time, or it's like 1 in 10 of the times, I guess when there're user input exactly when the escape sequence is being queried the listener might pick up the wrong data.
Could u commit the fallback thx
Originally posted by: supreme-gg-gg
the bug is gone now. All the other UI related issues can be solved by literally just resizing your terminal lmao (verified). Will merge after resolving conflicts 😄
Ticket changed by: endernoke