Pictures in chat as inline cards; navigate after callbacks

A linked picture whose bytes arrived shows as a picture card in the
message (a click opens it larger) instead of the file card.

Navigating from the app (opening a conversation, a notification, a
search result) ran Nav's functions inside a callback, and Nav calls back
into the app, which was borrowed: the app panicked. Such navigation now
runs after the callback, as the Stream Studio's does.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
selikhovandClaude Opus 5.5 committed 2026-10-03 12:29:25 +03:00
1 parent 673e41542c
commit c7455977f6
5 files changed
+72 -24

No files matched your search

+42 -4
View File
@@ -202,6 +202,37 @@ component FileCard inherits Rectangle {
}
}
// A picture a message links, shown inline (downloaded into memory); a
// click opens it larger.
component ImageCard inherits Rectangle {
in property <int> key;
in property <FileItem> file;
// As wide as the column allows, up to 520 px, keeping the picture's
// shape (at most 340 px high).
property <float> ratio: file.preview.height > 0 ? file.preview.width / file.preview.height : 1.6;
max-width: min(520px, 340px * ratio);
preferred-width: self.max-width;
height: min(self.width, self.max-width) / ratio;
border-radius: Theme.radius-lg;
clip: true;
background: Theme.surface-2;
border-width: 1px;
border-color: touch.has-hover ? Theme.border-strong : Theme.border;
accessible-role: AccessibleRole.image;
accessible-label: file.name;
accessible-action-default => { Nav.open-picture(root.key, root.file.index); }
Image {
width: parent.width;
height: parent.height;
source: root.file.preview;
image-fit: cover;
}
touch := TouchArea {
mouse-cursor: MouseCursor.pointer;
clicked => { Nav.open-picture(root.key, root.file.index); }
}
}
// Quick reactions, pin and "start a topic" on a hovered message.
component MessageActions inherits Rectangle {
in property <int> key;
@@ -353,10 +384,17 @@ export component MessageRow inherits Rectangle {
padding-top: Theme.space-2;
padding-bottom: Theme.space-1;
spacing: Theme.space-2;
for file in line.files: FileCard {
key: line.key;
file: file;
max-width: 440px;
for file in line.files: HorizontalLayout {
alignment: start;
if file.preview.width > 0: ImageCard {
key: line.key;
file: file;
}
if file.preview.width == 0: FileCard {
key: line.key;
file: file;
max-width: 440px;
}
}
}
if line.reactions.length > 0: VerticalLayout {