diff --git a/crates/voelin-ui/src/app.rs b/crates/voelin-ui/src/app.rs index d09ca52..cf84c2d 100644 --- a/crates/voelin-ui/src/app.rs +++ b/crates/voelin-ui/src/app.rs @@ -893,6 +893,8 @@ impl App { Event::Transfer { session, transfer, state } => { self.transfer_progress(session as i64, transfer, state); } + // The engine's contacts would replace the sample ones. + Event::ContactsChanged { .. } if self.demo_ui && !self.contacts.is_empty() => {} Event::ContactsChanged { contacts } => { self.contacts = contacts.iter().map(|c| (c.uid.clone(), c.clone())).collect(); self.refresh_member_card(); diff --git a/crates/voelin-ui/src/vm/social.rs b/crates/voelin-ui/src/vm/social.rs index a919a0d..79023de 100644 --- a/crates/voelin-ui/src/vm/social.rs +++ b/crates/voelin-ui/src/vm/social.rs @@ -66,9 +66,17 @@ pub fn plain(text: &str) -> String { } } out.push_str(rest); + // Plain text draws no emoji (they are pictures in the chat): leave + // them out of one-line previews. + let out: String = out.chars().filter(|c| !is_emoji(*c)).collect(); out.split_whitespace().collect::>().join(" ") } +/// Pictographs, symbols and their joiners and variation selectors. +fn is_emoji(c: char) -> bool { + matches!(u32::from(c), 0x1F000..=0x1FAFF | 0x2600..=0x27BF | 0xFE0F | 0x200D) +} + /// `b`, `/url`, `URL=https://…`, `color=#f00`: a BBCode tag. fn is_tag(inside: &str) -> bool { let name = inside.strip_prefix('/').unwrap_or(inside); @@ -195,6 +203,7 @@ mod tests { assert_eq!(plain("see [URL=https://x.org]this[/URL]"), "see this"); assert_eq!(plain("a [not a tag here] b"), "a [not a tag here] b"); assert_eq!(plain("[1] item"), "[1] item"); + assert_eq!(plain("later? 👀 Posting ❤️"), "later? Posting"); assert_eq!(preview("Hello", true, &[]), "You: Hello"); let file = |name: &str| voelin_model::FileRef { name: name.into(), ..Default::default() }; assert_eq!( diff --git a/crates/voelin-ui/ui/app.slint b/crates/voelin-ui/ui/app.slint index ba349ac..76606cb 100644 --- a/crates/voelin-ui/ui/app.slint +++ b/crates/voelin-ui/ui/app.slint @@ -219,11 +219,14 @@ export component MainWindow inherits Window { : Nav.page == Page.messages ? @tr("Messages") : Nav.page == Page.library ? @tr("Library") : Nav.page == Page.events ? @tr("Events") - : Nav.mobile-tab == MobileTab.home ? Bridge.app-name + : Nav.page == Page.home || Nav.mobile-tab == MobileTab.home ? Bridge.app-name : Nav.mobile-tab == MobileTab.you ? @tr("You") : Nav.mobile-tab == MobileTab.activity ? @tr("Activity") : Bridge.server-title; - subtitle: Nav.page == Page.settings ? "" : Nav.mobile-tab == MobileTab.chat && Bridge.current-tab >= 0 && Bridge.current-tab < Bridge.tabs.length ? Bridge.tabs[Bridge.current-tab].title : Nav.mobile-tab == MobileTab.servers ? Bridge.server-stats : ""; + subtitle: Nav.page == Page.settings || Nav.page == Page.friends || Nav.page == Page.messages || Nav.page == Page.library ? "" + : Nav.page == Page.home || Nav.mobile-tab == MobileTab.home ? @tr("Find your people. Talk beyond.") + : Nav.page == Page.events ? Bridge.server-title + : Nav.mobile-tab == MobileTab.chat && Bridge.current-tab >= 0 && Bridge.current-tab < Bridge.tabs.length ? Bridge.tabs[Bridge.current-tab].title : Nav.mobile-tab == MobileTab.servers ? Bridge.server-stats : ""; back: Nav.page == Page.settings || Nav.page == Page.friends || Nav.page == Page.messages || Nav.page == Page.library || Nav.page == Page.events; unread: Bridge.unread-total; go-back => { diff --git a/crates/voelin-ui/ui/assets/icons/bell-ring.svg b/crates/voelin-ui/ui/assets/icons/bell-ring.svg index 347ac74..b77fd05 100644 --- a/crates/voelin-ui/ui/assets/icons/bell-ring.svg +++ b/crates/voelin-ui/ui/assets/icons/bell-ring.svg @@ -13,5 +13,6 @@ > + diff --git a/crates/voelin-ui/ui/assets/icons/clapperboard.svg b/crates/voelin-ui/ui/assets/icons/clapperboard.svg index 2b4d641..6128479 100644 --- a/crates/voelin-ui/ui/assets/icons/clapperboard.svg +++ b/crates/voelin-ui/ui/assets/icons/clapperboard.svg @@ -11,6 +11,7 @@ stroke-linecap="round" stroke-linejoin="round" > + diff --git a/crates/voelin-ui/ui/assets/icons/flask-conical.svg b/crates/voelin-ui/ui/assets/icons/flask-conical.svg index 4e0ee85..7b36873 100644 --- a/crates/voelin-ui/ui/assets/icons/flask-conical.svg +++ b/crates/voelin-ui/ui/assets/icons/flask-conical.svg @@ -11,6 +11,7 @@ stroke-linecap="round" stroke-linejoin="round" > + diff --git a/crates/voelin-ui/ui/assets/icons/folder.svg b/crates/voelin-ui/ui/assets/icons/folder.svg index 772a2ad..ccb2809 100644 --- a/crates/voelin-ui/ui/assets/icons/folder.svg +++ b/crates/voelin-ui/ui/assets/icons/folder.svg @@ -11,5 +11,5 @@ stroke-linecap="round" stroke-linejoin="round" > - + diff --git a/crates/voelin-ui/ui/assets/icons/inbox.svg b/crates/voelin-ui/ui/assets/icons/inbox.svg index cf8b87f..8362d0c 100644 --- a/crates/voelin-ui/ui/assets/icons/inbox.svg +++ b/crates/voelin-ui/ui/assets/icons/inbox.svg @@ -12,4 +12,5 @@ stroke-linejoin="round" > + diff --git a/crates/voelin-ui/ui/assets/icons/key-round.svg b/crates/voelin-ui/ui/assets/icons/key-round.svg index a88cb19..48d6885 100644 --- a/crates/voelin-ui/ui/assets/icons/key-round.svg +++ b/crates/voelin-ui/ui/assets/icons/key-round.svg @@ -11,5 +11,6 @@ stroke-linecap="round" stroke-linejoin="round" > + diff --git a/crates/voelin-ui/ui/assets/icons/megaphone.svg b/crates/voelin-ui/ui/assets/icons/megaphone.svg index f052b8a..9d83c1a 100644 --- a/crates/voelin-ui/ui/assets/icons/megaphone.svg +++ b/crates/voelin-ui/ui/assets/icons/megaphone.svg @@ -11,6 +11,7 @@ stroke-linecap="round" stroke-linejoin="round" > + diff --git a/crates/voelin-ui/ui/assets/icons/message-square-plus.svg b/crates/voelin-ui/ui/assets/icons/message-square-plus.svg index 9abd144..0730809 100644 --- a/crates/voelin-ui/ui/assets/icons/message-square-plus.svg +++ b/crates/voelin-ui/ui/assets/icons/message-square-plus.svg @@ -11,6 +11,7 @@ stroke-linecap="round" stroke-linejoin="round" > + diff --git a/crates/voelin-ui/ui/assets/icons/plug.svg b/crates/voelin-ui/ui/assets/icons/plug.svg index 77ac5f7..d2268a7 100644 --- a/crates/voelin-ui/ui/assets/icons/plug.svg +++ b/crates/voelin-ui/ui/assets/icons/plug.svg @@ -13,5 +13,6 @@ > + diff --git a/crates/voelin-ui/ui/assets/icons/scroll-text.svg b/crates/voelin-ui/ui/assets/icons/scroll-text.svg index 367f747..789e83e 100644 --- a/crates/voelin-ui/ui/assets/icons/scroll-text.svg +++ b/crates/voelin-ui/ui/assets/icons/scroll-text.svg @@ -14,4 +14,5 @@ + diff --git a/crates/voelin-ui/ui/assets/icons/wand-sparkles.svg b/crates/voelin-ui/ui/assets/icons/wand-sparkles.svg index 3bc9f74..ace8826 100644 --- a/crates/voelin-ui/ui/assets/icons/wand-sparkles.svg +++ b/crates/voelin-ui/ui/assets/icons/wand-sparkles.svg @@ -11,6 +11,7 @@ stroke-linecap="round" stroke-linejoin="round" > + diff --git a/crates/voelin-ui/ui/assets/icons/zap.svg b/crates/voelin-ui/ui/assets/icons/zap.svg index 666410d..8bd7195 100644 --- a/crates/voelin-ui/ui/assets/icons/zap.svg +++ b/crates/voelin-ui/ui/assets/icons/zap.svg @@ -11,5 +11,5 @@ stroke-linecap="round" stroke-linejoin="round" > - + diff --git a/crates/voelin-ui/ui/screens/home.slint b/crates/voelin-ui/ui/screens/home.slint index 1a5abe0..51641ad 100644 --- a/crates/voelin-ui/ui/screens/home.slint +++ b/crates/voelin-ui/ui/screens/home.slint @@ -208,7 +208,7 @@ component HomeBanner inherits Rectangle { property slide: 0; property count: Bridge.servers.length + 1; property server: Bridge.servers[max(0, root.slide - 1)]; - min-height: compact ? 200px : 236px; + min-height: compact ? 200px : 212px; border-radius: Theme.radius-xl; clip: true; background: root.slide == 0 @@ -363,8 +363,10 @@ component HomeBanner inherits Rectangle { // A friend in the "Friends Online" row. component FriendBubble inherits Rectangle { in property friend; - width: 88px; - height: 128px; + // The phone: smaller, the name only. + in property compact; + width: compact ? 62px : 88px; + height: compact ? 80px : 118px; accessible-role: AccessibleRole.button; accessible-label: friend.name; accessible-description: friend.status; @@ -382,7 +384,7 @@ component FriendBubble inherits Rectangle { HorizontalLayout { alignment: center; Avatar { - size: 60px; + size: root.compact ? 50px : 60px; initials: root.friend.initials; tint: root.friend.tint; image: root.friend.avatar; @@ -401,14 +403,19 @@ component FriendBubble inherits Rectangle { horizontal-alignment: center; overflow: elide; } - Text { - text: root.friend.status; - color: Theme.text-muted; - font-size: Theme.font-xs; - horizontal-alignment: center; - wrap: word-wrap; - overflow: elide; - max-height: 30px * Theme.font-scale; + // Two lines at most. + if !root.compact: Rectangle { + height: 27px * Theme.font-scale; + clip: true; + Text { + y: 0; + width: parent.width; + text: root.friend.status; + color: Theme.text-muted; + font-size: Theme.font-xs; + horizontal-alignment: center; + wrap: word-wrap; + } } } } @@ -417,7 +424,7 @@ component FriendBubble inherits Rectangle { component LiveCard inherits Rectangle { in property room; width: 256px; - height: 182px; + height: 170px; border-radius: Theme.radius-lg; clip: true; background: Theme.surface-2; @@ -434,7 +441,7 @@ component LiveCard inherits Rectangle { // The picture: the server's colour, a sky and the kind of stream. Rectangle { y: 0; - height: 112px; + height: 104px; background: @linear-gradient(150deg, root.room.backdrop.darker(0.2) 0%, #1c1470 60%, #070c1d 100%); Stars { } Icon { @@ -490,8 +497,8 @@ component LiveCard inherits Rectangle { } } VerticalLayout { - y: 112px; - height: parent.height - 112px; + y: 104px; + height: parent.height - 104px; padding: Theme.space-3; spacing: Theme.space-2; HorizontalLayout { @@ -537,7 +544,7 @@ component ServerCard inherits Rectangle { min-width: 180px; max-width: 280px; horizontal-stretch: 1; - height: 172px; + height: 158px; border-radius: Theme.radius-lg; clip: true; background: Theme.surface-2; @@ -770,7 +777,7 @@ export component HomePage inherits Rectangle { VerticalLayout { width: sv.visible-width; padding: root.compact ? Theme.space-4 : Theme.space-4; - spacing: root.compact ? Theme.space-4 : Theme.space-5; + spacing: Theme.space-4; alignment: start; HomeBanner { compact: root.compact; @@ -778,7 +785,7 @@ export component HomePage inherits Rectangle { Section { text: @tr("Friends Online"); icon: Icons.users; - action: @tr("View All ({})", Bridge.contacts-online); + action: @tr("View All ({})", Bridge.friends-online.length); action-clicked => { Nav.friends-tab = 0; Bridge.friends-tab(0); @@ -792,7 +799,7 @@ export component HomePage inherits Rectangle { wrap: word-wrap; } if Bridge.friends-online.length > 0: Flickable { - height: 128px; + height: root.compact ? 80px : 118px; content-width: max(self.width, friends-row.preferred-width); content-height: self.height; friends-row := HorizontalLayout { @@ -800,9 +807,10 @@ export component HomePage inherits Rectangle { alignment: start; for friend in Bridge.friends-online: FriendBubble { friend: friend; + compact: root.compact; } // Find friends. - Rectangle { + if !root.compact: Rectangle { width: 88px; accessible-role: AccessibleRole.button; accessible-label: @tr("Find Friends"); @@ -861,7 +869,7 @@ export component HomePage inherits Rectangle { wrap: word-wrap; } live-list := Flickable { - height: Bridge.live-rooms.length > 0 ? 182px : 0px; + height: Bridge.live-rooms.length > 0 ? 170px : 0px; content-width: max(self.width, live-row.preferred-width); content-height: self.height; live-row := HorizontalLayout { diff --git a/crates/voelin-ui/ui/screens/settings.slint b/crates/voelin-ui/ui/screens/settings.slint index 5998407..011f310 100644 --- a/crates/voelin-ui/ui/screens/settings.slint +++ b/crates/voelin-ui/ui/screens/settings.slint @@ -387,11 +387,6 @@ component CameraCard inherits Card { Bridge.video-changed(Bridge.video); } } - Button { - icon: Icons.settings; - text: @tr("Camera Settings"); - clicked => { Nav.open-settings(SettingsSection.devices); } - } } } diff --git a/crates/voelin-ui/ui/shells/mobile.slint b/crates/voelin-ui/ui/shells/mobile.slint index c0a9cd0..718426e 100644 --- a/crates/voelin-ui/ui/shells/mobile.slint +++ b/crates/voelin-ui/ui/shells/mobile.slint @@ -164,34 +164,34 @@ export component MobileShell inherits Rectangle { NavTab { icon: Icons.home; text: @tr("Home"); - selected: Nav.mobile-tab == MobileTab.home && Nav.page != Page.settings; + selected: Nav.page == Page.home || Nav.page == Page.friends || Nav.page == Page.messages || Nav.page == Page.library || (Nav.mobile-tab == MobileTab.home && Nav.page == Page.server); clicked => { Nav.show(Page.home); Nav.mobile-tab = MobileTab.home; } } NavTab { icon: Icons.server; text: @tr("Servers"); - selected: Nav.mobile-tab == MobileTab.servers && Nav.page != Page.settings; + selected: (Nav.mobile-tab == MobileTab.servers && Nav.page == Page.server) || Nav.page == Page.events; dot: Bridge.voice-connected; clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.servers; } } NavTab { icon: Bridge.viewer-open ? Icons.monitor : Icons.message-circle; text: Bridge.viewer-open ? @tr("Stream") : @tr("Chat"); - selected: Nav.mobile-tab == MobileTab.chat && Nav.page != Page.settings; + selected: Nav.mobile-tab == MobileTab.chat && Nav.page == Page.server; badge: root.unread; clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.chat; } } NavTab { icon: Icons.activity; text: @tr("Activity"); - selected: Nav.mobile-tab == MobileTab.activity && Nav.page != Page.settings; + selected: Nav.mobile-tab == MobileTab.activity && Nav.page == Page.server; badge: Bridge.share-requests; clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.activity; } } NavTab { icon: Icons.user; text: @tr("You"); - selected: Nav.mobile-tab == MobileTab.you || Nav.page == Page.settings; + selected: (Nav.mobile-tab == MobileTab.you && Nav.page == Page.server) || Nav.page == Page.settings; clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.you; } } }