From a8a2409cb897a74c14e484f885a50c4e17ab7653 Mon Sep 17 00:00:00 2001 From: selikhov Date: Sat, 3 Oct 2026 13:57:08 +0300 Subject: [PATCH] Private chat tabs named after the peer; form, Library and phone fixes A private chat's tab took the name of whoever wrote the first message of a batch (our own name when we wrote first) or the raw unique id: it is the peer's name now. The event form's fields keep together, the Library shows sample recordings without the user's folder in sample mode, and the phone's Friends page is not titled twice. Co-Authored-By: Claude Opus 5.5 --- crates/voelin-ui/src/chat.rs | 15 +++++++++++++-- crates/voelin-ui/src/home.rs | 7 +++++++ crates/voelin-ui/ui/screens/events.slint | 2 ++ crates/voelin-ui/ui/screens/friends.slint | 3 ++- 4 files changed, 24 insertions(+), 3 deletions(-) diff --git a/crates/voelin-ui/src/chat.rs b/crates/voelin-ui/src/chat.rs index 4040b99..7b59bd2 100644 --- a/crates/voelin-ui/src/chat.rs +++ b/crates/voelin-ui/src/chat.rs @@ -67,7 +67,7 @@ impl App { format!("#{}", name.unwrap_or_else(|| cid.to_string())) } ChatTarget::Server => "Server".into(), - ChatTarget::Private(uid) => format!("@{uid}"), + ChatTarget::Private(uid) => format!("@{}", self.peer_name(uid, None)), }; let view = self.sessions.entry(id).or_default(); let index = match view.tabs.iter().position(|t| t.target == target) { @@ -186,9 +186,20 @@ impl App { complete: bool, ) { let current = self.current == Some(id); + // A private chat is named after the peer, whoever wrote first. + let peer = match target { + ChatTarget::Private(uid) => Some(format!( + "@{}", + self.peer_name( + uid, + messages.iter().find(|m| m.message.author_uid.as_deref() == Some(uid.as_str())) + ) + )), + _ => None, + }; let view = self.sessions.entry(id).or_default(); let author = messages.first().map_or("", |m| m.message.author_name.as_str()); - let title = Self::tab_title(view, target, author); + let title = peer.unwrap_or_else(|| Self::tab_title(view, target, author)); let index = Self::tab_for(view, target, || title); let shown = current && view.current_tab == index; let tab = &mut view.tabs[index]; diff --git a/crates/voelin-ui/src/home.rs b/crates/voelin-ui/src/home.rs index 66377ec..cb39da8 100644 --- a/crates/voelin-ui/src/home.rs +++ b/crates/voelin-ui/src/home.rs @@ -253,6 +253,13 @@ impl App { /// List the recordings and clips (when the Library opens). pub(crate) fn load_library(&mut self) { + // Sample data shows sample recordings, not the user's. + if self.demo_ui { + if let Some(ui) = self.ui.upgrade() { + ui.global::().set_recordings_dir("~/Videos/Voelin".into()); + } + return; + } let dir = self.recordings_dir(); let items = recordings_in(&dir); vm::list::sync(&self.models.social.recordings, &items); diff --git a/crates/voelin-ui/ui/screens/events.slint b/crates/voelin-ui/ui/screens/events.slint index 98f1c75..bacff99 100644 --- a/crates/voelin-ui/ui/screens/events.slint +++ b/crates/voelin-ui/ui/screens/events.slint @@ -359,6 +359,7 @@ export component EventDialog inherits Modal { VerticalLayout { spacing: Theme.space-4; padding-right: Theme.space-3; + alignment: start; Field { label: @tr("Title"); TextField { text <=> form.title; placeholder: @tr("Raid night"); label: @tr("Title"); } @@ -376,6 +377,7 @@ export component EventDialog inherits Modal { } Field { label: @tr("Ends (optional)"); + hint: @tr("Empty: no end"); TextField { text <=> form.end; placeholder: "2026-10-04 21:00"; icon: Icons.clock; label: @tr("Ends"); } } } diff --git a/crates/voelin-ui/ui/screens/friends.slint b/crates/voelin-ui/ui/screens/friends.slint index b05be63..af7db7c 100644 --- a/crates/voelin-ui/ui/screens/friends.slint +++ b/crates/voelin-ui/ui/screens/friends.slint @@ -133,7 +133,8 @@ export component FriendsPage inherits VerticalLayout { in property compact; padding: compact ? Theme.space-4 : Theme.space-6; spacing: Theme.space-4; - HorizontalLayout { + // The phone's top bar names the page. + if !root.compact: HorizontalLayout { spacing: Theme.space-4; if !root.compact: Icon { source: Icons.users;