diff --git a/crates/voelin-ui/src/chat.rs b/crates/voelin-ui/src/chat.rs index 84030c8..b275dc8 100644 --- a/crates/voelin-ui/src/chat.rs +++ b/crates/voelin-ui/src/chat.rs @@ -573,7 +573,18 @@ impl App { let Some(view) = self.view_mut() else { return }; let tab = &mut view.tabs[view.current_tab]; tab.marked = tab.pins.iter().find(|p| p.key == key).map(|p| p.message.id); + // The message is in the chat, not in an open topic. + if tab.topic.take().is_some() { + tab.topic_messages.clear(); + } + // Older than what is loaded: only highlighted once it is. + let row = tab.marked.and_then(|id| tab.messages.iter().position(|m| m.message.id == id)); self.refresh_chat(); + if let (Some(row), Some(ui)) = (row, self.ui.upgrade()) { + let bridge = ui.global::(); + bridge.set_jump_index(row as i32); + bridge.set_jump_requests(bridge.get_jump_requests().wrapping_add(1)); + } } /// The topics drawer's search. diff --git a/crates/voelin-ui/ui/app.slint b/crates/voelin-ui/ui/app.slint index fafa48e..071ab32 100644 --- a/crates/voelin-ui/ui/app.slint +++ b/crates/voelin-ui/ui/app.slint @@ -140,7 +140,8 @@ export component MainWindow inherits Window { if Nav.page == Page.server && root.side-panel: ResizeHandle { size <=> Nav.right-panel-width; minimum: Theme.right-panel-min; - maximum: Theme.right-panel-max; + // As wide as the window allows, leaving the chat 400 px. + maximum: max(Theme.right-panel-min, root.width - Theme.rail-width - Theme.sidebar-width - 400px); left: false; } if Nav.page == Page.server && root.side-panel: Panel { diff --git a/crates/voelin-ui/ui/bridge.slint b/crates/voelin-ui/ui/bridge.slint index 297e7b4..08db46d 100644 --- a/crates/voelin-ui/ui/bridge.slint +++ b/crates/voelin-ui/ui/bridge.slint @@ -338,6 +338,10 @@ export global Bridge { in property <[ChatLine]> topic-messages; // The member card over the members panel. in-out property member-card; + // Jumping to a pinned message: its row in `messages`, and a counter + // that changes with every jump. + in property jump-index: -1; + in property jump-requests; in property status-text; // Unread messages in all chats of the current server. in property unread-total; diff --git a/crates/voelin-ui/ui/screens/chat.slint b/crates/voelin-ui/ui/screens/chat.slint index a761942..c8a43a2 100644 --- a/crates/voelin-ui/ui/screens/chat.slint +++ b/crates/voelin-ui/ui/screens/chat.slint @@ -377,10 +377,36 @@ export component MessageRow inherits Rectangle { } } -// The messages of the current chat (or of an open topic). +// The messages of the current chat (or of an open topic). The list starts +// at the newest message and follows new ones while it is at the end; +// scrolling up stops that until the end is reached again. export component MessageList inherits VerticalLayout { in property <[ChatLine]> model; in property older; + property follow: true; + property end: min(0px, list.visible-height - list.content-height); + property scrolled: list.content-y; + changed end => { + if root.follow { + list.content-y = root.end; + } + } + changed scrolled => { root.follow = root.scrolled <= root.end + 2px; } + // Another chat: start at its end. + property tab: Bridge.current-tab; + changed tab => { + root.follow = true; + list.content-y = root.end; + } + // A pinned message was jumped to: scroll to where its row is. Rows + // differ in height, so this is the place of an average row (as the + // standard list estimates it); the row itself is highlighted. + property jumps: Bridge.jump-requests; + changed jumps => { + if root.older && root.model.length > 0 { + list.content-y = max(root.end, min(0px, list.visible-height / 3 - Bridge.jump-index * list.content-height / root.model.length)); + } + } if Bridge.local-history: Rectangle { height: 30px; background: Theme.warning-soft; @@ -415,7 +441,7 @@ export component MessageList inherits VerticalLayout { } } } - ListView { + list := ListView { vertical-stretch: 1; // A long chat must not make the window taller: the list scrolls. preferred-height: 0px; diff --git a/crates/voelin-ui/ui/theme.slint b/crates/voelin-ui/ui/theme.slint index 854a51d..e9fc528 100644 --- a/crates/voelin-ui/ui/theme.slint +++ b/crates/voelin-ui/ui/theme.slint @@ -136,7 +136,6 @@ export global Theme { out property sidebar-width: 264px * max(1.0, font-scale); out property topbar-height: 56px; out property right-panel-min: 220px; - out property right-panel-max: 420px; // Motion. out property fast: 120ms; diff --git a/docs/screenshots/desktop-about.png b/docs/screenshots/desktop-about.png index a505706..d09fc2f 100644 Binary files a/docs/screenshots/desktop-about.png and b/docs/screenshots/desktop-about.png differ diff --git a/docs/screenshots/desktop-add-server.png b/docs/screenshots/desktop-add-server.png index 3dfc86c..4ec09ad 100644 Binary files a/docs/screenshots/desktop-add-server.png and b/docs/screenshots/desktop-add-server.png differ diff --git a/docs/screenshots/desktop-client-volume.png b/docs/screenshots/desktop-client-volume.png index 19ba642..3b7f113 100644 Binary files a/docs/screenshots/desktop-client-volume.png and b/docs/screenshots/desktop-client-volume.png differ diff --git a/docs/screenshots/desktop-emoji-picker.png b/docs/screenshots/desktop-emoji-picker.png index 1fa4087..7a5f0d6 100644 Binary files a/docs/screenshots/desktop-emoji-picker.png and b/docs/screenshots/desktop-emoji-picker.png differ diff --git a/docs/screenshots/desktop-home.png b/docs/screenshots/desktop-home.png index 0a96abf..0ed2bcd 100644 Binary files a/docs/screenshots/desktop-home.png and b/docs/screenshots/desktop-home.png differ diff --git a/docs/screenshots/desktop-light.png b/docs/screenshots/desktop-light.png index b05669e..d7fa79d 100644 Binary files a/docs/screenshots/desktop-light.png and b/docs/screenshots/desktop-light.png differ diff --git a/docs/screenshots/desktop-member-card.png b/docs/screenshots/desktop-member-card.png index d4a03c1..c1e6e2e 100644 Binary files a/docs/screenshots/desktop-member-card.png and b/docs/screenshots/desktop-member-card.png differ diff --git a/docs/screenshots/desktop-pins.png b/docs/screenshots/desktop-pins.png index 74b3f4c..adec3a8 100644 Binary files a/docs/screenshots/desktop-pins.png and b/docs/screenshots/desktop-pins.png differ diff --git a/docs/screenshots/desktop-popout.png b/docs/screenshots/desktop-popout.png index 98161da..4c0cf6d 100644 Binary files a/docs/screenshots/desktop-popout.png and b/docs/screenshots/desktop-popout.png differ diff --git a/docs/screenshots/desktop-server.png b/docs/screenshots/desktop-server.png index be44a37..58c9e84 100644 Binary files a/docs/screenshots/desktop-server.png and b/docs/screenshots/desktop-server.png differ diff --git a/docs/screenshots/desktop-settings-appearance.png b/docs/screenshots/desktop-settings-appearance.png index 250f927..4c35058 100644 Binary files a/docs/screenshots/desktop-settings-appearance.png and b/docs/screenshots/desktop-settings-appearance.png differ diff --git a/docs/screenshots/desktop-settings-voice.png b/docs/screenshots/desktop-settings-voice.png index 35fd332..c218dc2 100644 Binary files a/docs/screenshots/desktop-settings-voice.png and b/docs/screenshots/desktop-settings-voice.png differ diff --git a/docs/screenshots/desktop-share-dialog.png b/docs/screenshots/desktop-share-dialog.png index d530e5f..35aa236 100644 Binary files a/docs/screenshots/desktop-share-dialog.png and b/docs/screenshots/desktop-share-dialog.png differ diff --git a/docs/screenshots/desktop-stream-viewer.png b/docs/screenshots/desktop-stream-viewer.png index 24f4721..0999fc0 100644 Binary files a/docs/screenshots/desktop-stream-viewer.png and b/docs/screenshots/desktop-stream-viewer.png differ diff --git a/docs/screenshots/desktop-topic.png b/docs/screenshots/desktop-topic.png index 289f19a..52da541 100644 Binary files a/docs/screenshots/desktop-topic.png and b/docs/screenshots/desktop-topic.png differ diff --git a/docs/screenshots/desktop-topics.png b/docs/screenshots/desktop-topics.png index fbfaedf..3219343 100644 Binary files a/docs/screenshots/desktop-topics.png and b/docs/screenshots/desktop-topics.png differ diff --git a/docs/screenshots/desktop-voice.png b/docs/screenshots/desktop-voice.png index fae4f61..a633051 100644 Binary files a/docs/screenshots/desktop-voice.png and b/docs/screenshots/desktop-voice.png differ diff --git a/docs/screenshots/mobile-chat.png b/docs/screenshots/mobile-chat.png index 1ad4fcf..33af444 100644 Binary files a/docs/screenshots/mobile-chat.png and b/docs/screenshots/mobile-chat.png differ diff --git a/docs/screenshots/mobile-home.png b/docs/screenshots/mobile-home.png index 3f07a62..f4d879c 100644 Binary files a/docs/screenshots/mobile-home.png and b/docs/screenshots/mobile-home.png differ diff --git a/docs/screenshots/mobile-servers.png b/docs/screenshots/mobile-servers.png index 34c295a..6c5c1ec 100644 Binary files a/docs/screenshots/mobile-servers.png and b/docs/screenshots/mobile-servers.png differ diff --git a/docs/screenshots/mobile-settings.png b/docs/screenshots/mobile-settings.png index 4af59ef..0c9a9ca 100644 Binary files a/docs/screenshots/mobile-settings.png and b/docs/screenshots/mobile-settings.png differ diff --git a/docs/screenshots/mobile-you.png b/docs/screenshots/mobile-you.png index 8145f60..21cec1e 100644 Binary files a/docs/screenshots/mobile-you.png and b/docs/screenshots/mobile-you.png differ