voelin-ui: the phone's voice channel screen, and Home as the mockups show
The phone had no voice channel view: the people, the streams and the channel's chat were spread over three tabs, and watching replaced the Chat tab with a bare player. The voice channel now has a screen of its own (design mockup 02): the channel's name and topic with Leave, the stream we watch with LIVE, viewers, quality, volume and full screen (or a card to watch one), the people with talking and muted marks, crowns and LIVE, an Invite button that copies a ts3server:// link to the channel, the channel chat with its pins, topics and members, the composer with hold-to-talk when push-to-talk is the transmit mode, and Mute, Deafen, Go Live, Share and Leave in place of the navigation. It opens from the top bar's voice button, the voice card, the Activity tab and by watching a stream; back keeps a stream playing behind it. The navigation: Home's server cards and Open went nowhere on the phone (the Home tab stayed); a server now switches to the Servers tab. The Chat tab is Chats and stays the chat while watching. The studio, like the voice screen, goes without the bottom bar, as its mockup does. The pins, topics and server members (beside the chat on the desktop) open as pages over the phone's screen. Home gains what mockup 01 has and the engine knows: who is online on the current server, its chats with their last message and time (emoji left out of the one-line preview), the servers (side by side on the phone) and the streams of our channel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
28b2bb1925
commit
e0cc4fe76d
16 files changed
+1348
-35
No files matched your search
@@ -61,4 +61,5 @@ pub(super) fn wire(ui: &MainWindow) {
|
||||
bridge.on_client_audio_changed(|form| {
|
||||
with_app(|app| app.client_playback_changed(&form));
|
||||
});
|
||||
bridge.on_invite(|| with_app(|app| app.invite_link()).unwrap_or_default().into());
|
||||
}
|
||||
@@ -335,7 +335,17 @@ impl App {
|
||||
let tabs: Vec<ChatTab> = view
|
||||
.tabs
|
||||
.iter()
|
||||
.map(|t| ChatTab {
|
||||
.map(|t| {
|
||||
let (last, time) = t
|
||||
.messages
|
||||
.last()
|
||||
.map(|m| vm::chat::preview(&m.message.message))
|
||||
.unwrap_or_default();
|
||||
(t, last, time)
|
||||
})
|
||||
.map(|(t, last, time)| ChatTab {
|
||||
last: last.into(),
|
||||
time: time.into(),
|
||||
title: t.title.clone().into(),
|
||||
name: t.title.trim_start_matches(['#', '@']).into(),
|
||||
kind: match t.target {
|
||||
|
||||
@@ -15,7 +15,8 @@
|
||||
//! appearance, or 0-4), `about`, `share`, `bookmark` (add a server),
|
||||
//! `emoji` (the picker), `client` (the volume dialog of the first other
|
||||
//! client once connected), `panel` / `no-panel` (the members panel),
|
||||
//! `voice` (the voice channel view), `pins`, `topics` (the drawers),
|
||||
//! `voice` (the voice channel view; on the phone its own screen),
|
||||
//! `members` (the phone's members page), `pins`, `topics` (the drawers),
|
||||
//! `topic:<id>` (a topic's messages), `member` (the member card of the
|
||||
//! first other client), `watch` (the first stream; with sample data the
|
||||
//! local test pattern in its place), `popout` (the same, popped out),
|
||||
@@ -157,6 +158,8 @@ pub(crate) fn start(ui: &MainWindow, switches: &Switches) -> Running {
|
||||
"tab" => nav.set_mobile_tab(mobile_tab(arg)),
|
||||
"voice" => nav.invoke_show_voice(true),
|
||||
"pins" => nav.invoke_show_pins(true),
|
||||
// The phone's members page.
|
||||
"members" => nav.set_members_open(true),
|
||||
"topics" => nav.invoke_show_topics(true),
|
||||
"topic" => {
|
||||
with_app(|app| {
|
||||
|
||||
@@ -316,6 +316,33 @@ impl App {
|
||||
self.refresh_tree();
|
||||
}
|
||||
|
||||
/// A link to the voice channel we are in, for the Invite button (which
|
||||
/// copies it); empty, with a note, without one.
|
||||
pub(crate) fn invite_link(&mut self) -> String {
|
||||
let bookmark = self.current.and_then(|id| self.bookmark(id)).map(|b| b.address.clone());
|
||||
let path = self.view().and_then(|v| {
|
||||
let mut names = Vec::new();
|
||||
let mut channel = v.presence.channels.get(&v.state.own_channel?)?;
|
||||
loop {
|
||||
names.push(channel.name.clone());
|
||||
match v.presence.channels.get(&channel.parent) {
|
||||
Some(parent) if channel.parent != 0 && names.len() < 64 => channel = parent,
|
||||
_ => break,
|
||||
}
|
||||
}
|
||||
names.reverse();
|
||||
Some(names)
|
||||
});
|
||||
let (Some(address), Some(path)) = (bookmark, path) else {
|
||||
self.set_status("Join a voice channel to invite others to it");
|
||||
return String::new();
|
||||
};
|
||||
let path: Vec<&str> = path.iter().map(String::as_str).collect();
|
||||
let link = vm::servers::invite_link(&address, &path);
|
||||
self.set_status(format!("Copied an invite to {}: {link}", path.last().unwrap_or(&"")));
|
||||
link
|
||||
}
|
||||
|
||||
pub(crate) fn toggle_collapse(&mut self, channel: u64) {
|
||||
if let Some(view) = self.view_mut()
|
||||
&& !view.collapsed.remove(&channel)
|
||||
|
||||
@@ -346,6 +346,12 @@ impl App {
|
||||
.and_then(|v| v.streams.iter().find(|s| s.id == watch.stream_id))
|
||||
.map_or(-1, |s| i32::from(s.streamer.0));
|
||||
bridge.set_viewer_streamer_id(streamer);
|
||||
let members = &self.models.members;
|
||||
bridge.set_viewer_streamer_admin(
|
||||
(0..members.row_count())
|
||||
.filter_map(|i| members.row_data(i))
|
||||
.any(|m| m.id == streamer && m.admin),
|
||||
);
|
||||
bridge.set_viewer_elapsed(watch.elapsed().into());
|
||||
let viewers = self.view().and_then(|v| v.stream_viewers.get(&watch.stream_id)).copied();
|
||||
bridge.set_viewer_count(viewers.unwrap_or(0) as i32);
|
||||
|
||||
@@ -99,6 +99,29 @@ fn without_links(text: &str, files: &[FileRef]) -> String {
|
||||
out.replace("[/URL]", "").replace("[/url]", "").trim().to_owned()
|
||||
}
|
||||
|
||||
/// A chat's last message for a list of chats, on one line ("Mira: the
|
||||
/// banner I promised: guild-banner.png"), and when it came.
|
||||
pub fn preview(message: &ChatMessage) -> (String, String) {
|
||||
let text = if message.blocked {
|
||||
"Message from a blocked contact.".to_owned()
|
||||
} else {
|
||||
let files = message.file_refs();
|
||||
let names = files.iter().map(|f| f.name.as_str());
|
||||
let text = without_links(&message.text, &files);
|
||||
std::iter::once(text.as_str()).chain(names).collect::<Vec<_>>().join(" ")
|
||||
};
|
||||
// A one-line text cannot show emoji (they are pictures): left out.
|
||||
let plain = match emoji::runs(&text) {
|
||||
Some(runs) => runs.into_iter().filter(|r| r.emoji.is_none()).map(|r| r.text).collect(),
|
||||
None => text,
|
||||
};
|
||||
let mut text = plain.split_whitespace().collect::<Vec<_>>().join(" ");
|
||||
if text.is_empty() {
|
||||
text = "sent an emoji".into();
|
||||
}
|
||||
(format!("{}: {text}", message.author_name), time_of(message.ts_ms))
|
||||
}
|
||||
|
||||
fn runs_model(runs: &[emoji::Run]) -> ModelRc<TextRun> {
|
||||
ModelRc::from(Rc::new(VecModel::from(
|
||||
runs.iter()
|
||||
@@ -289,6 +312,23 @@ mod tests {
|
||||
assert!(line.text.starts_with("here you go"));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn previews_are_one_line() {
|
||||
let url = "ts3file://plan.pdf?channel=2&path=/&filename=plan.pdf&isDir=0&size=2048";
|
||||
let text = format!("route\nfor tonight: [URL={url}]plan.pdf[/URL]");
|
||||
let (last, time) = preview(&message("Mira", &text, 0));
|
||||
assert_eq!(last, "Mira: route for tonight: plan.pdf");
|
||||
assert!(!time.is_empty());
|
||||
assert_eq!(
|
||||
preview(&message("Ari", "co-op later? 👀 Posting", 0)).0,
|
||||
"Ari: co-op later? Posting"
|
||||
);
|
||||
assert_eq!(preview(&message("dex", "🎉🎉", 0)).0, "dex: sent an emoji");
|
||||
let mut blocked = message("X", "secret", 0);
|
||||
blocked.blocked = true;
|
||||
assert_eq!(preview(&blocked).0, "X: Message from a blocked contact.");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn stamps() {
|
||||
let at = |d: &str| chrono::NaiveDateTime::parse_from_str(d, "%Y-%m-%d %H:%M").unwrap();
|
||||
|
||||
@@ -31,10 +31,69 @@ pub fn item(bookmark: &Bookmark, state: &SessionState, unread: i32, live: bool)
|
||||
}
|
||||
}
|
||||
|
||||
/// A `ts3server://` link that joins the channel at `path` (its names from
|
||||
/// the top) on the server at `address` (`host`, `host:port` or
|
||||
/// `[v6]:port`), as TeamSpeak clients open them.
|
||||
pub fn invite_link(address: &str, path: &[&str]) -> String {
|
||||
fn encode(text: &str) -> String {
|
||||
text.bytes()
|
||||
.map(|b| match b {
|
||||
b'A'..=b'Z' | b'a'..=b'z' | b'0'..=b'9' | b'-' | b'.' | b'_' | b'~' => {
|
||||
char::from(b).to_string()
|
||||
}
|
||||
_ => format!("%{b:02X}"),
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
let address = address.trim();
|
||||
// A port follows the last colon, unless that colon is inside an IPv6
|
||||
// address without brackets.
|
||||
let (host, port) = match address.rsplit_once(':') {
|
||||
Some((host, port))
|
||||
if !port.is_empty()
|
||||
&& port.bytes().all(|b| b.is_ascii_digit())
|
||||
&& (!host.contains(':') || host.ends_with(']')) =>
|
||||
{
|
||||
(host, Some(port))
|
||||
}
|
||||
_ => (address, None),
|
||||
};
|
||||
let mut link = format!("ts3server://{host}");
|
||||
let mut query = Vec::new();
|
||||
if let Some(port) = port {
|
||||
query.push(format!("port={port}"));
|
||||
}
|
||||
if !path.is_empty() {
|
||||
let names: Vec<String> = path.iter().map(|n| encode(n)).collect();
|
||||
query.push(format!("channel={}", names.join("/")));
|
||||
}
|
||||
if !query.is_empty() {
|
||||
link.push('?');
|
||||
link.push_str(&query.join("&"));
|
||||
}
|
||||
link
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn invite_links() {
|
||||
assert_eq!(
|
||||
invite_link("ts.example.com:9988", &["Gaming", "Raid Night"]),
|
||||
"ts3server://ts.example.com?port=9988&channel=Gaming/Raid%20Night"
|
||||
);
|
||||
assert_eq!(invite_link(" ts.example.com ", &[]), "ts3server://ts.example.com");
|
||||
assert_eq!(
|
||||
invite_link("[2001:db8::1]:9987", &["Chill & Co"]),
|
||||
"ts3server://[2001:db8::1]?port=9987&channel=Chill%20%26%20Co"
|
||||
);
|
||||
// A bare IPv6 address has no port.
|
||||
assert_eq!(invite_link("2001:db8::1", &[]), "ts3server://2001:db8::1");
|
||||
assert_eq!(invite_link("h:x", &["Ä/b"]), "ts3server://h:x?channel=%C3%84%2Fb");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn states() {
|
||||
let mut s = SessionState::default();
|
||||
|
||||
@@ -25,7 +25,8 @@ import { VoiceView } from "screens/voice.slint";
|
||||
import { StreamViewer } from "screens/streams.slint";
|
||||
import { SettingsNav, SettingsPage } from "screens/settings.slint";
|
||||
import { HomeNav, HomePage } from "screens/home.slint";
|
||||
import { MobileServers, ActivityPage, YouPage } from "screens/mobile.slint";
|
||||
import { MobileServers, ActivityPage, YouPage, PhoneSheet } from "screens/mobile.slint";
|
||||
import { MobileVoice } from "screens/mobile-voice.slint";
|
||||
import { BookmarkDialog, ShareDialog, ClientAudioDialog, AboutDialog } from "screens/dialogs.slint";
|
||||
import { StudioBridge } from "studio-bridge.slint";
|
||||
import { StudioPage, MobileStudio } from "screens/studio.slint";
|
||||
@@ -171,26 +172,38 @@ export component MainWindow inherits Window {
|
||||
|
||||
if Nav.narrow && root.chrome: MobileShell {
|
||||
title: Nav.page == Page.settings ? @tr("Settings")
|
||||
: Nav.phone-voice ? Bridge.app-name
|
||||
: 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.phone-voice ? 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
|
||||
: Nav.page == Page.home || Nav.mobile-tab == MobileTab.home ? @tr("Talk. Watch. Share.") : "";
|
||||
back: Nav.page == Page.settings;
|
||||
unread: Bridge.unread-total;
|
||||
voice: Nav.phone-voice;
|
||||
// The voice channel and the studio bring their own controls.
|
||||
navigation: !Nav.phone-voice && Nav.page != Page.studio;
|
||||
go-back => { Nav.show(Page.server); }
|
||||
if Nav.page == Page.settings: SettingsPage {
|
||||
compact: true;
|
||||
}
|
||||
if Nav.page != Page.settings && Nav.page != Page.studio && (Nav.page == Page.home || Nav.mobile-tab == MobileTab.home): HomePage { }
|
||||
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.servers: MobileServers { }
|
||||
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.chat && Bridge.viewer-open: StreamViewer { }
|
||||
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.chat && !Bridge.viewer-open: ChatView {
|
||||
if Nav.page != Page.settings && Nav.page != Page.studio && !Nav.phone-voice && (Nav.page == Page.home || Nav.mobile-tab == MobileTab.home): HomePage { }
|
||||
if Nav.phone-voice: MobileVoice { }
|
||||
if Nav.page == Page.server && !Nav.phone-voice && Nav.mobile-tab == MobileTab.servers: MobileServers { }
|
||||
// Watching without voice (the local test stream): the player.
|
||||
if Nav.page == Page.server && !Nav.phone-voice && Nav.mobile-tab == MobileTab.chat && Bridge.viewer-open: StreamViewer { }
|
||||
if Nav.page == Page.server && !Nav.phone-voice && Nav.mobile-tab == MobileTab.chat && !Bridge.viewer-open: ChatView {
|
||||
header: false;
|
||||
}
|
||||
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.activity: ActivityPage { }
|
||||
if Nav.page == Page.server && Nav.mobile-tab == MobileTab.you: YouPage { }
|
||||
if Nav.page == Page.server && !Nav.phone-voice && Nav.mobile-tab == MobileTab.activity: ActivityPage { }
|
||||
if Nav.page == Page.server && !Nav.phone-voice && Nav.mobile-tab == MobileTab.you: YouPage { }
|
||||
if Nav.page == Page.studio && !StudioBridge.status.detached: MobileStudio { }
|
||||
// Pins, topics or the members, over the page.
|
||||
if Nav.page == Page.server && (Nav.pins-open || Nav.topics-open || Nav.members-open): PhoneSheet { }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -118,6 +118,9 @@ export struct ChatTab {
|
||||
unread: int,
|
||||
// The channel's topic (channel chats).
|
||||
topic: string,
|
||||
// The last message ("Mira: the banner I promised") and its time.
|
||||
last: string,
|
||||
time: string,
|
||||
}
|
||||
|
||||
// A piece of a chat line: text, or an emoji shown as an image (`emoji` is
|
||||
@@ -401,6 +404,8 @@ export global Bridge {
|
||||
in-out property <int> viewer-quality: 0;
|
||||
// What "Auto" picked ("720p · 2.4 Mbit/s").
|
||||
in property <string> viewer-quality-detail;
|
||||
// The streamer is in an admin group (the crown beside their name).
|
||||
in property <bool> viewer-streamer-admin;
|
||||
|
||||
// Settings.
|
||||
in property <[string]> input-devices;
|
||||
@@ -508,6 +513,9 @@ export global Bridge {
|
||||
callback delete-crash-reports();
|
||||
callback dismiss-crash-notice();
|
||||
callback open-about();
|
||||
// A link to our voice channel (`ts3server://`) to hand to others; the
|
||||
// caller copies it.
|
||||
callback invite() -> string;
|
||||
}
|
||||
|
||||
// Decoded images by key, from Rust's image cache (src/images.rs): each is
|
||||
|
||||
@@ -69,6 +69,14 @@ export global Nav {
|
||||
in-out property <BookmarkForm> bookmark-form;
|
||||
in-out property <ShareForm> share-form;
|
||||
|
||||
// The phone layout (narrow windows).
|
||||
// The server's members as a page of their own (the desktop shows them
|
||||
// beside the chat).
|
||||
in-out property <bool> members-open;
|
||||
// The voice channel screen (design mockup 02) instead of a tab: the
|
||||
// voice channel view, or a stream we watch.
|
||||
out property <bool> phone-voice: narrow && page == Page.server && Bridge.voice-connected && (voice-view || Bridge.viewer-open);
|
||||
|
||||
// Settings were opened (so leaving them tells Rust).
|
||||
property <bool> settings-active;
|
||||
|
||||
@@ -77,6 +85,10 @@ export global Nav {
|
||||
settings-active = false;
|
||||
Bridge.close-settings();
|
||||
}
|
||||
// The phone shows Home on its own tab: a server goes to Servers.
|
||||
if narrow && p == Page.server && mobile-tab == MobileTab.home {
|
||||
mobile-tab = MobileTab.servers;
|
||||
}
|
||||
page = p;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
// The home page: a welcome banner and the servers at a glance. Later
|
||||
// versions add friends, live rooms and activity here.
|
||||
// The home page: a welcome banner, who is online on the current server,
|
||||
// its chats with their last message, the servers, and the streams of our
|
||||
// channel (design mockups 01, desktop and phone).
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, ServerItem } from "../bridge.slint";
|
||||
import { Nav, Page, SettingsSection } from "../nav.slint";
|
||||
import { Bridge, ServerItem, MemberItem, StreamItem, ChatTab } from "../bridge.slint";
|
||||
import { Nav, Page, MobileTab, SettingsSection } from "../nav.slint";
|
||||
import { Icon, Button, ButtonKind, Avatar, Status, Chip, SectionHeader, NavItem, Divider, CountBadge, LiveBadge, ScrollView } from "../components/index.slint";
|
||||
|
||||
// The sidebar next to the home page.
|
||||
@@ -125,16 +126,211 @@ component ServerCard inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// Someone on the current server (the "Online now" row); a tap opens their
|
||||
// card.
|
||||
component PersonChip inherits VerticalLayout {
|
||||
in property <MemberItem> member;
|
||||
width: 76px;
|
||||
spacing: Theme.space-1;
|
||||
accessible-role: AccessibleRole.list-item;
|
||||
accessible-label: member.name;
|
||||
accessible-description: member.status;
|
||||
accessible-action-default => { Bridge.open-member(member.id); }
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
Avatar {
|
||||
size: 56px;
|
||||
initials: member.initials;
|
||||
tint: member.tint;
|
||||
image: member.avatar;
|
||||
label: member.name;
|
||||
speaking: member.talking;
|
||||
crown: member.admin;
|
||||
status: member.away ? Status.idle : member.streaming ? Status.info : Status.online;
|
||||
TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { Bridge.open-member(member.id); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: member.name;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-alignment: center;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: member.status;
|
||||
color: member.streaming ? Theme.live : Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
horizontal-alignment: center;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
|
||||
// A stream of our channel (the "Live now" row): LIVE, viewers, the title,
|
||||
// who; a tap watches it.
|
||||
component LiveCard inherits Rectangle {
|
||||
in property <StreamItem> stream;
|
||||
width: 224px;
|
||||
height: 136px;
|
||||
border-radius: Theme.radius-lg;
|
||||
clip: true;
|
||||
background: @linear-gradient(160deg, #26237a 0%, #0c1430 100%);
|
||||
border-width: 1px;
|
||||
border-color: stream.watching ? Theme.accent : area.has-hover ? Theme.border-strong : Theme.border;
|
||||
accessible-role: AccessibleRole.button;
|
||||
accessible-label: stream.name;
|
||||
accessible-action-default => { area.watch(); }
|
||||
area := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
function watch() {
|
||||
if stream.id == "" || stream.own {
|
||||
return;
|
||||
}
|
||||
Nav.show(Page.server);
|
||||
if stream.watching {
|
||||
Bridge.show-viewer();
|
||||
} else {
|
||||
Bridge.watch-stream(stream.id);
|
||||
}
|
||||
}
|
||||
clicked => { self.watch(); }
|
||||
}
|
||||
Icon {
|
||||
source: stream.kind == "Camera" ? Icons.video : Icons.monitor-up;
|
||||
size: 56px;
|
||||
tint: #ffffff1c;
|
||||
}
|
||||
HorizontalLayout {
|
||||
x: Theme.space-3;
|
||||
y: Theme.space-3;
|
||||
height: 22px;
|
||||
spacing: Theme.space-2;
|
||||
LiveBadge {
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if stream.viewers > 0: Chip {
|
||||
text: stream.viewers;
|
||||
icon: Icons.eye;
|
||||
tint: #ffffff;
|
||||
fill: #060a18a0;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
padding: Theme.space-3;
|
||||
alignment: end;
|
||||
spacing: 1px;
|
||||
Text {
|
||||
text: stream.id == "" ? @tr("{} is streaming", stream.streamer) : stream.name != "" ? stream.name : @tr("Untitled stream");
|
||||
color: #ffffff;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: stream.kind != "" ? stream.streamer + " • " + stream.kind : stream.streamer;
|
||||
color: #ffffffb0;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A chat of the current server with its last message ("Chats"); a tap
|
||||
// opens it.
|
||||
component ChatRow inherits Rectangle {
|
||||
in property <ChatTab> tab;
|
||||
in property <int> index;
|
||||
height: 60px;
|
||||
border-radius: Theme.radius-lg;
|
||||
background: area.has-hover ? Theme.surface-3 : Theme.surface-2;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border;
|
||||
accessible-role: AccessibleRole.button;
|
||||
accessible-label: tab.title;
|
||||
accessible-description: tab.last;
|
||||
accessible-action-default => { area.open(); }
|
||||
area := TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
function open() {
|
||||
Bridge.select-tab(root.index);
|
||||
Nav.mobile-tab = MobileTab.chat;
|
||||
Nav.show(Page.server);
|
||||
}
|
||||
clicked => { self.open(); }
|
||||
}
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-3;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
Rectangle {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
border-radius: 20px;
|
||||
background: Theme.surface-4;
|
||||
Icon {
|
||||
source: tab.kind == 1 ? Icons.hash : tab.kind == 2 ? Icons.at-sign : Icons.message-square;
|
||||
size: Theme.icon-md;
|
||||
tint: Theme.accent-text;
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
spacing: 1px;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
Text {
|
||||
text: tab.title;
|
||||
color: Theme.name-text;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
max-width: self.preferred-width;
|
||||
}
|
||||
Text {
|
||||
text: tab.time;
|
||||
color: Theme.text-muted;
|
||||
font-size: Theme.font-xs;
|
||||
vertical-alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: tab.last != "" ? tab.last : @tr("No messages yet");
|
||||
color: tab.last != "" ? Theme.text-secondary : Theme.text-muted;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if tab.unread > 0: CountBadge {
|
||||
count: tab.unread;
|
||||
fill: Theme.accent;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Icon {
|
||||
source: Icons.chevron-right;
|
||||
size: Theme.icon-sm;
|
||||
tint: Theme.text-muted;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component HomePage inherits Rectangle {
|
||||
sv := ScrollView {
|
||||
VerticalLayout {
|
||||
width: sv.visible-width;
|
||||
padding: Theme.space-6;
|
||||
spacing: Theme.space-6;
|
||||
padding: Nav.narrow ? Theme.space-4 : Theme.space-6;
|
||||
spacing: Nav.narrow ? Theme.space-5 : Theme.space-6;
|
||||
alignment: start;
|
||||
// Welcome banner.
|
||||
Rectangle {
|
||||
min-height: 220px;
|
||||
// Wrapped text is measured at an unknown width: room
|
||||
// for it on the phone.
|
||||
min-height: Nav.narrow ? 236px : 220px;
|
||||
border-radius: Theme.radius-xl;
|
||||
clip: true;
|
||||
background: @linear-gradient(115deg, #0e1d5c 0%, #1c1470 45%, #3a1f86 75%, #0b2a6b 100%);
|
||||
@@ -169,21 +365,21 @@ export component HomePage inherits Rectangle {
|
||||
background: #ffffffc0;
|
||||
}
|
||||
VerticalLayout {
|
||||
padding: Theme.space-7;
|
||||
padding: Nav.narrow ? Theme.space-5 : Theme.space-7;
|
||||
spacing: Theme.space-3;
|
||||
alignment: center;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-4;
|
||||
alignment: start;
|
||||
Image {
|
||||
width: 52px;
|
||||
height: 52px;
|
||||
width: Nav.narrow ? 40px : 52px;
|
||||
height: self.width;
|
||||
source: Icons.logo;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.app-name;
|
||||
color: #ffffff;
|
||||
font-size: 40px * Theme.font-scale;
|
||||
font-size: (Nav.narrow ? 30px : 40px) * Theme.font-scale;
|
||||
font-weight: Theme.weight-bold;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
@@ -211,12 +407,57 @@ export component HomePage inherits Rectangle {
|
||||
}
|
||||
if Bridge.servers.length > 0: Button {
|
||||
icon: Icons.arrow-right;
|
||||
text: @tr("Open {}", Bridge.server-title);
|
||||
text: Nav.narrow ? @tr("Open") : @tr("Open {}", Bridge.server-title);
|
||||
clicked => { Nav.show(Page.server); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// Who is on the current server.
|
||||
if Bridge.server-members.length > 0: SectionHeader {
|
||||
text: @tr("Online now");
|
||||
icon: Icons.users;
|
||||
count: Bridge.server-members.length;
|
||||
action: @tr("See All");
|
||||
action-clicked => {
|
||||
Nav.show(Page.server);
|
||||
if Nav.narrow {
|
||||
Nav.members-open = true;
|
||||
} else {
|
||||
Nav.right-panel-open = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
if Bridge.server-members.length > 0: ScrollView {
|
||||
height: 118px;
|
||||
HorizontalLayout {
|
||||
// Room for the crowns.
|
||||
padding-top: 6px;
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
for member in Bridge.server-members: PersonChip {
|
||||
member: member;
|
||||
}
|
||||
}
|
||||
}
|
||||
// The current server's chats with their last message.
|
||||
if Bridge.current-server >= 0 && Bridge.tabs.length > 0: SectionHeader {
|
||||
text: @tr("Chats");
|
||||
icon: Icons.message-square;
|
||||
count: Bridge.unread-total > 0 ? Bridge.unread-total : "";
|
||||
action: @tr("See All");
|
||||
action-clicked => {
|
||||
Nav.mobile-tab = MobileTab.chat;
|
||||
Nav.show(Page.server);
|
||||
}
|
||||
}
|
||||
if Bridge.current-server >= 0: VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
for tab[i] in Bridge.tabs: ChatRow {
|
||||
tab: tab;
|
||||
index: i;
|
||||
}
|
||||
}
|
||||
SectionHeader {
|
||||
text: @tr("Your servers");
|
||||
icon: Icons.server;
|
||||
@@ -228,13 +469,41 @@ export component HomePage inherits Rectangle {
|
||||
text: @tr("No servers yet. Add one with its address and your nickname.");
|
||||
color: Theme.text-muted;
|
||||
}
|
||||
FlexboxLayout {
|
||||
// The phone scrolls them sideways.
|
||||
if Nav.narrow && Bridge.servers.length > 0: ScrollView {
|
||||
height: 140px;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
alignment: start;
|
||||
for server in Bridge.servers: ServerCard {
|
||||
width: 236px;
|
||||
server: server;
|
||||
}
|
||||
}
|
||||
}
|
||||
if !Nav.narrow: FlexboxLayout {
|
||||
spacing: Theme.space-4;
|
||||
alignment: stretch;
|
||||
for server in Bridge.servers: ServerCard {
|
||||
server: server;
|
||||
}
|
||||
}
|
||||
// The streams of our channel.
|
||||
if Bridge.streams.length > 0: SectionHeader {
|
||||
text: @tr("Live now");
|
||||
icon: Icons.radio;
|
||||
count: Bridge.streams.length;
|
||||
}
|
||||
if Bridge.streams.length > 0: ScrollView {
|
||||
height: 140px;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-3;
|
||||
alignment: start;
|
||||
for stream in Bridge.streams: LiveCard {
|
||||
stream: stream;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,711 @@
|
||||
// The voice channel on the phone (design mockup 02): the channel's name
|
||||
// and Leave, the stream we watch (or a card to watch one), the people in
|
||||
// the channel, the channel's chat, and the voice controls at the bottom in
|
||||
// place of the navigation.
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, MemberItem, StreamItem } from "../bridge.slint";
|
||||
import { Nav, MobileTab } from "../nav.slint";
|
||||
import { Icon, IconButton, Button, ButtonKind, Avatar, LiveBadge, Select, Slider, SpeakingBars, ScrollView } from "../components/index.slint";
|
||||
import { MessageList, Composer } from "chat.slint";
|
||||
|
||||
// Back to the navigation; a stream we watch goes on behind it.
|
||||
export global PhoneVoice {
|
||||
public function close() {
|
||||
if Bridge.viewer-open {
|
||||
Bridge.hide-viewer();
|
||||
}
|
||||
Nav.show-voice(false);
|
||||
}
|
||||
}
|
||||
|
||||
// The channel's name and topic, back, and Leave.
|
||||
component ChannelBar inherits HorizontalLayout {
|
||||
padding-left: Theme.space-3;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
height: 56px;
|
||||
IconButton {
|
||||
icon: Icons.arrow-left;
|
||||
label: @tr("Back");
|
||||
round: true;
|
||||
filled: true;
|
||||
size: 40px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { PhoneVoice.close(); }
|
||||
}
|
||||
Icon {
|
||||
source: Icons.volume-2;
|
||||
size: 28px;
|
||||
tint: Theme.text-secondary;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
Text {
|
||||
text: Bridge.own-channel;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-lg;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
if Bridge.own-channel-topic != "": Text {
|
||||
text: Bridge.own-channel-topic;
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
Button {
|
||||
kind: ButtonKind.danger;
|
||||
icon: Icons.log-out;
|
||||
text: @tr("Leave");
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => {
|
||||
PhoneVoice.close();
|
||||
Bridge.disconnect-voice();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A translucent pill over the picture.
|
||||
component OverlayChip inherits Rectangle {
|
||||
in property <string> text;
|
||||
in property <image> icon;
|
||||
height: 26px;
|
||||
width: row.preferred-width;
|
||||
border-radius: Theme.radius-pill;
|
||||
background: #060a18b0;
|
||||
border-width: 1px;
|
||||
border-color: #ffffff24;
|
||||
row := HorizontalLayout {
|
||||
padding-left: Theme.space-3;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-2;
|
||||
if root.icon.width > 0: Icon {
|
||||
source: root.icon;
|
||||
size: 14px;
|
||||
tint: #ffffff;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: root.text;
|
||||
color: #ffffff;
|
||||
font-size: Theme.font-sm;
|
||||
font-weight: Theme.weight-medium;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The stream we watch: the picture with LIVE, the viewers and the quality
|
||||
// over its top, the title and who streams it over its bottom, and volume
|
||||
// and full screen below them.
|
||||
component PhonePlayer inherits Rectangle {
|
||||
border-radius: Theme.radius-lg;
|
||||
clip: true;
|
||||
background: #000000;
|
||||
border-width: 1px;
|
||||
border-color: Theme.accent.transparentize(0.45);
|
||||
accessible-role: AccessibleRole.groupbox;
|
||||
accessible-label: Bridge.viewer-title;
|
||||
Image {
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
source: Bridge.viewer-frame;
|
||||
image-fit: contain;
|
||||
visible: Bridge.viewer-has-frame;
|
||||
accessible-role: AccessibleRole.image;
|
||||
accessible-label: @tr("Stream picture");
|
||||
}
|
||||
if Bridge.viewer-status != "": Text {
|
||||
width: parent.width - 48px;
|
||||
text: Bridge.viewer-status;
|
||||
color: #ffffff;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
wrap: word-wrap;
|
||||
accessible-live-region: polite;
|
||||
}
|
||||
// Shades for what is drawn over the picture.
|
||||
Rectangle {
|
||||
y: 0;
|
||||
height: 64px;
|
||||
background: @linear-gradient(180deg, #000000b0 0%, #00000000 100%);
|
||||
}
|
||||
Rectangle {
|
||||
y: parent.height - self.height;
|
||||
height: 104px;
|
||||
background: @linear-gradient(180deg, #00000000 0%, #000000d0 100%);
|
||||
}
|
||||
// LIVE, viewers; the quality and full screen.
|
||||
HorizontalLayout {
|
||||
y: Theme.space-3;
|
||||
height: 30px;
|
||||
padding-left: Theme.space-3;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-2;
|
||||
if !Bridge.viewer-ended: LiveBadge {
|
||||
large: true;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if Bridge.viewer-count > 0: OverlayChip {
|
||||
icon: Icons.eye;
|
||||
text: Bridge.viewer-count;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
// Simulcast layers the streamer offers ("Auto" follows the
|
||||
// bandwidth estimate); otherwise the height of what arrives.
|
||||
if Bridge.viewer-qualities.length > 1: Select {
|
||||
width: 116px;
|
||||
horizontal-stretch: 0;
|
||||
label: @tr("Quality");
|
||||
model: Bridge.viewer-qualities;
|
||||
current-index <=> Bridge.viewer-quality;
|
||||
selected(_) => { Bridge.set-stream-quality(Bridge.viewer-quality); }
|
||||
}
|
||||
if Bridge.viewer-qualities.length <= 1 && Bridge.viewer-has-frame: OverlayChip {
|
||||
text: @tr("{}p", Bridge.viewer-frame.height);
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.maximize;
|
||||
label: @tr("Full screen");
|
||||
size: 30px;
|
||||
icon-size: 16px;
|
||||
tint: #ffffff;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.toggle-fullscreen(); }
|
||||
}
|
||||
}
|
||||
// The title, who streams it, and the controls.
|
||||
VerticalLayout {
|
||||
height: self.preferred-height;
|
||||
y: parent.height - self.height;
|
||||
padding-left: Theme.space-4;
|
||||
padding-right: Theme.space-3;
|
||||
padding-bottom: Theme.space-1;
|
||||
spacing: 1px;
|
||||
Text {
|
||||
text: Bridge.viewer-title;
|
||||
color: #ffffff;
|
||||
font-size: Theme.font-md;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
Text {
|
||||
text: Bridge.viewer-streamer;
|
||||
color: #ffffffd0;
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
overflow: elide;
|
||||
}
|
||||
if Bridge.viewer-streamer-admin: Icon {
|
||||
source: Icons.crown;
|
||||
size: 14px;
|
||||
tint: Theme.gold;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if !Bridge.viewer-ended: Text {
|
||||
text: "• " + Bridge.viewer-elapsed;
|
||||
color: #ffffffa0;
|
||||
font-size: Theme.font-sm;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
height: 40px;
|
||||
spacing: Theme.space-2;
|
||||
IconButton {
|
||||
icon: Bridge.viewer-volume > 0 ? Icons.volume-2 : Icons.volume-x;
|
||||
label: Bridge.viewer-volume > 0 ? @tr("Mute") : @tr("Unmute");
|
||||
size: 34px;
|
||||
tint: #ffffff;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.set-stream-volume(Bridge.viewer-volume > 0 ? 0 : 100); }
|
||||
}
|
||||
Slider {
|
||||
y: (parent.height - self.height) / 2;
|
||||
minimum: 0;
|
||||
maximum: 200;
|
||||
step: 5;
|
||||
value <=> Bridge.viewer-volume;
|
||||
enabled: !Bridge.viewer-ended;
|
||||
label: @tr("Stream volume");
|
||||
changed(v) => { Bridge.set-stream-volume(v); }
|
||||
}
|
||||
IconButton {
|
||||
icon: Bridge.viewer-ended ? Icons.x : Icons.log-out;
|
||||
label: Bridge.viewer-ended ? @tr("Close") : @tr("Stop watching");
|
||||
size: 34px;
|
||||
tint: #ffffff;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Bridge.leave-stream(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A stream in the channel that we do not show: LIVE, the title, who, and
|
||||
// Watch (or Show, if we watch it already).
|
||||
component StreamPrompt inherits Rectangle {
|
||||
in property <StreamItem> stream;
|
||||
height: 76px;
|
||||
border-radius: Theme.radius-lg;
|
||||
clip: true;
|
||||
background: @linear-gradient(160deg, #26237a 0%, #0c1430 100%);
|
||||
border-width: 1px;
|
||||
border-color: stream.watching ? Theme.accent : Theme.border-strong;
|
||||
accessible-role: AccessibleRole.groupbox;
|
||||
accessible-label: stream.name;
|
||||
HorizontalLayout {
|
||||
padding: Theme.space-3;
|
||||
padding-left: Theme.space-4;
|
||||
spacing: Theme.space-3;
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
spacing: Theme.space-1;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
if stream.id != "": LiveBadge {
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: stream.id == "" ? @tr("{} is streaming", stream.streamer) : stream.name != "" ? stream.name : @tr("Untitled stream");
|
||||
color: #ffffff;
|
||||
font-weight: Theme.weight-semibold;
|
||||
vertical-alignment: center;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: stream.id == "" ? @tr("Looking it up…")
|
||||
: stream.own ? @tr("Your stream")
|
||||
: stream.viewers > 0 ? @tr("{} · {} watching", stream.streamer, stream.viewers)
|
||||
: stream.streamer;
|
||||
color: #ffffffb0;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if stream.id != "" && !stream.own: Button {
|
||||
kind: ButtonKind.primary;
|
||||
small: true;
|
||||
icon: stream.watching ? Icons.monitor : Icons.eye;
|
||||
text: stream.watching ? @tr("Show") : @tr("Watch");
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => {
|
||||
if stream.watching {
|
||||
Bridge.show-viewer();
|
||||
} else {
|
||||
Bridge.watch-stream(stream.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// One person: an avatar ringed green while talking (blue while
|
||||
// streaming), the muted mark, the name with the crown, LIVE below.
|
||||
component VoiceMember inherits VerticalLayout {
|
||||
in property <MemberItem> member;
|
||||
property <length> size: 54px;
|
||||
width: 68px;
|
||||
spacing: Theme.space-1;
|
||||
accessible-role: AccessibleRole.list-item;
|
||||
accessible-label: member.name;
|
||||
accessible-description: member.status;
|
||||
accessible-action-default => { Bridge.open-member(member.id); }
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
Rectangle {
|
||||
width: root.size + 8px;
|
||||
height: root.size + 8px;
|
||||
border-radius: self.width / 2;
|
||||
border-width: member.talking || member.streaming ? 2px : 0px;
|
||||
border-color: member.talking ? Theme.success : Theme.accent;
|
||||
Avatar {
|
||||
size: root.size;
|
||||
initials: member.initials;
|
||||
tint: member.tint;
|
||||
image: member.avatar;
|
||||
label: member.name;
|
||||
}
|
||||
if member.talking || member.muted || member.sound-off: Rectangle {
|
||||
x: parent.width - self.width;
|
||||
y: parent.height - self.height;
|
||||
width: 22px;
|
||||
height: 22px;
|
||||
border-radius: 11px;
|
||||
background: member.talking ? Theme.accent : Theme.surface;
|
||||
border-width: 2px;
|
||||
border-color: Theme.surface;
|
||||
if member.talking: SpeakingBars {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
tint: #ffffff;
|
||||
}
|
||||
if !member.talking: Icon {
|
||||
source: member.sound-off ? Icons.headphone-off : Icons.mic-off;
|
||||
size: 12px;
|
||||
tint: Theme.danger;
|
||||
}
|
||||
}
|
||||
TouchArea {
|
||||
clicked => { Bridge.open-member(member.id); }
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
spacing: Theme.space-1;
|
||||
Text {
|
||||
text: member.name;
|
||||
color: member.myself ? Theme.accent-text : Theme.text;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
max-width: root.width - (member.admin ? 16px : 0px);
|
||||
}
|
||||
if member.admin: Icon {
|
||||
source: Icons.crown;
|
||||
size: 13px;
|
||||
tint: Theme.gold;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
if member.streaming: HorizontalLayout {
|
||||
alignment: center;
|
||||
LiveBadge { }
|
||||
}
|
||||
}
|
||||
|
||||
// "# Chill Zone Chat · Linked to this voice channel", with the pins, the
|
||||
// topics and the members.
|
||||
component ChatHeader inherits Rectangle {
|
||||
height: 56px;
|
||||
border-radius: Theme.radius-lg;
|
||||
background: Theme.surface-2;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border;
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-4;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
Icon {
|
||||
source: Icons.hash;
|
||||
size: 24px;
|
||||
tint: Theme.text-secondary;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
VerticalLayout {
|
||||
alignment: center;
|
||||
horizontal-stretch: 1;
|
||||
Text {
|
||||
text: @tr("{} Chat", Bridge.own-channel);
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-md;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: @tr("Linked to this voice channel");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-xs;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if Bridge.has-pins: IconButton {
|
||||
icon: Icons.pin;
|
||||
label: @tr("Pinned Messages");
|
||||
filled: true;
|
||||
size: 36px;
|
||||
icon-size: 18px;
|
||||
tint: Theme.accent-text;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.show-pins(true); }
|
||||
}
|
||||
if Bridge.has-topics: IconButton {
|
||||
icon: Icons.book-open;
|
||||
label: @tr("Topics");
|
||||
filled: true;
|
||||
size: 36px;
|
||||
icon-size: 18px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.show-topics(true); }
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.users;
|
||||
label: @tr("Members");
|
||||
filled: true;
|
||||
size: 36px;
|
||||
icon-size: 18px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.members-open = true; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A round control with its caption, for the voice bar.
|
||||
component VoiceControl inherits VerticalLayout {
|
||||
in property <image> icon;
|
||||
in property <string> text;
|
||||
in property <bool> checked;
|
||||
in property <bool> danger;
|
||||
in property <bool> enabled: true;
|
||||
// Filled red (Leave).
|
||||
in property <bool> alarm;
|
||||
callback clicked();
|
||||
horizontal-stretch: 1;
|
||||
spacing: Theme.space-1;
|
||||
alignment: center;
|
||||
accessible-role: AccessibleRole.button;
|
||||
accessible-label: text;
|
||||
accessible-enabled: enabled;
|
||||
accessible-checkable: !alarm;
|
||||
accessible-checked: checked;
|
||||
accessible-action-default => { if enabled { clicked(); } }
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
Rectangle {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 24px;
|
||||
background: root.alarm ? (touch.pressed ? Theme.danger.darker(0.2) : Theme.danger)
|
||||
: root.checked ? (root.danger ? Theme.danger-soft : Theme.accent-soft)
|
||||
: touch.pressed ? Theme.surface-4 : Theme.surface-2;
|
||||
border-width: root.alarm ? 0px : 1px;
|
||||
border-color: root.checked ? (root.danger ? Theme.danger.transparentize(0.5) : Theme.accent) : Theme.border-strong;
|
||||
opacity: root.enabled ? 1.0 : 0.45;
|
||||
Icon {
|
||||
source: root.icon;
|
||||
size: 22px;
|
||||
tint: root.alarm ? #ffffff : root.checked ? (root.danger ? Theme.danger : Theme.accent-text) : Theme.icon;
|
||||
}
|
||||
touch := TouchArea {
|
||||
enabled: root.enabled;
|
||||
clicked => { root.clicked(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: root.text;
|
||||
color: root.checked && root.danger ? Theme.danger : Theme.text-secondary;
|
||||
font-size: Theme.font-xs;
|
||||
horizontal-alignment: center;
|
||||
accessible-role: AccessibleRole.none;
|
||||
}
|
||||
}
|
||||
|
||||
// Mute, Deafen, Go Live (the Stream Studio), Share (the screen, at once)
|
||||
// and Leave.
|
||||
component VoiceBar inherits Rectangle {
|
||||
height: 84px;
|
||||
background: Theme.surface;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border;
|
||||
accessible-role: AccessibleRole.groupbox;
|
||||
accessible-label: @tr("Voice");
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-2;
|
||||
padding-right: Theme.space-2;
|
||||
padding-top: Theme.space-3;
|
||||
padding-bottom: Theme.space-3;
|
||||
VoiceControl {
|
||||
icon: Bridge.input-muted ? Icons.mic-off : Icons.mic;
|
||||
text: Bridge.input-muted ? @tr("Unmute") : @tr("Mute");
|
||||
checked: Bridge.input-muted;
|
||||
danger: true;
|
||||
clicked => { Bridge.set-input-muted(!Bridge.input-muted); }
|
||||
}
|
||||
VoiceControl {
|
||||
icon: Bridge.output-muted ? Icons.headphone-off : Icons.headphones;
|
||||
text: Bridge.output-muted ? @tr("Undeafen") : @tr("Deafen");
|
||||
checked: Bridge.output-muted;
|
||||
danger: true;
|
||||
clicked => { Bridge.set-output-muted(!Bridge.output-muted); }
|
||||
}
|
||||
// The big one: the Stream Studio, or live there.
|
||||
if Bridge.streams-available && Bridge.can-share: VerticalLayout {
|
||||
horizontal-stretch: 1.6;
|
||||
spacing: Theme.space-1;
|
||||
alignment: center;
|
||||
accessible-role: AccessibleRole.button;
|
||||
accessible-label: @tr("Go Live");
|
||||
accessible-action-default => { Nav.open-studio(); }
|
||||
Rectangle {
|
||||
height: 48px;
|
||||
border-radius: 24px;
|
||||
background: live.pressed ? Theme.accent-pressed : Theme.accent;
|
||||
border-width: 2px;
|
||||
border-color: Theme.glow;
|
||||
Icon {
|
||||
source: Icons.radio;
|
||||
size: 26px;
|
||||
tint: Theme.on-accent;
|
||||
}
|
||||
live := TouchArea {
|
||||
clicked => { Nav.open-studio(); }
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: Bridge.share-state == "live" ? @tr("Live") : @tr("Go Live");
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-xs;
|
||||
font-weight: Theme.weight-semibold;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
if Bridge.streams-available && Bridge.can-share: VoiceControl {
|
||||
icon: Icons.screen-share;
|
||||
text: Bridge.share-state == "live" ? @tr("Sharing") : @tr("Share");
|
||||
checked: Bridge.share-state == "live";
|
||||
clicked => { Nav.open-share(); }
|
||||
}
|
||||
VoiceControl {
|
||||
icon: Icons.phone-off;
|
||||
text: @tr("Leave");
|
||||
alarm: true;
|
||||
clicked => {
|
||||
PhoneVoice.close();
|
||||
Bridge.disconnect-voice();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Push-to-talk at the end of the composer: talks while held.
|
||||
component TalkButton inherits Rectangle {
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
border-radius: 24px;
|
||||
background: Bridge.transmitting ? Theme.success : touch.pressed ? Theme.accent-pressed : Theme.accent;
|
||||
border-width: 2px;
|
||||
border-color: Bridge.transmitting ? Theme.success.transparentize(0.4) : Theme.glow;
|
||||
accessible-role: AccessibleRole.button;
|
||||
accessible-label: @tr("Hold to talk");
|
||||
accessible-checkable: true;
|
||||
accessible-checked: Bridge.transmitting;
|
||||
accessible-action-default => { Bridge.push-to-talk(!Bridge.transmitting); }
|
||||
Icon {
|
||||
source: Icons.mic;
|
||||
size: 22px;
|
||||
tint: Theme.on-accent;
|
||||
}
|
||||
touch := TouchArea {
|
||||
pointer-event(e) => {
|
||||
if e.kind == PointerEventKind.down {
|
||||
Bridge.push-to-talk(true);
|
||||
} else if e.kind == PointerEventKind.up || e.kind == PointerEventKind.cancel {
|
||||
Bridge.push-to-talk(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The whole screen.
|
||||
export component MobileVoice inherits VerticalLayout {
|
||||
// A topic opened from the drawer shows in the chat page.
|
||||
property <int> topic: Bridge.current-topic;
|
||||
changed topic => {
|
||||
if topic >= 0 {
|
||||
PhoneVoice.close();
|
||||
Nav.mobile-tab = MobileTab.chat;
|
||||
}
|
||||
}
|
||||
clip := TextInput {
|
||||
visible: false;
|
||||
width: 0;
|
||||
height: 0;
|
||||
}
|
||||
ChannelBar { }
|
||||
sv := ScrollView {
|
||||
// The stream, the people and the chat header scroll away together
|
||||
// when the window is short; the messages always keep some room.
|
||||
vertical-stretch: 0;
|
||||
height: min(content.preferred-height, root.height * 0.55);
|
||||
content := VerticalLayout {
|
||||
width: sv.visible-width;
|
||||
padding-left: Theme.space-3;
|
||||
padding-right: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
if Bridge.viewer-open: PhonePlayer {
|
||||
height: (sv.visible-width - 2 * Theme.space-3) * 9 / 16;
|
||||
}
|
||||
if !Bridge.viewer-open: VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
for stream in Bridge.streams: StreamPrompt {
|
||||
stream: stream;
|
||||
}
|
||||
}
|
||||
people := ScrollView {
|
||||
height: 112px;
|
||||
HorizontalLayout {
|
||||
padding-top: Theme.space-2;
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
for member in Bridge.members: VoiceMember {
|
||||
member: member;
|
||||
}
|
||||
VerticalLayout {
|
||||
width: 68px;
|
||||
spacing: Theme.space-1;
|
||||
alignment: start;
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
IconButton {
|
||||
icon: Icons.user-plus;
|
||||
label: @tr("Invite: copy a link to this channel");
|
||||
round: true;
|
||||
filled: true;
|
||||
size: 62px;
|
||||
icon-size: 24px;
|
||||
// Through a text field: Slint copies only
|
||||
// what is selected in one.
|
||||
clicked => {
|
||||
clip.text = Bridge.invite();
|
||||
clip.select-all();
|
||||
clip.copy();
|
||||
}
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: @tr("Invite");
|
||||
color: Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
ChatHeader { }
|
||||
}
|
||||
}
|
||||
MessageList {
|
||||
vertical-stretch: 1;
|
||||
min-height: 96px;
|
||||
model: Bridge.messages;
|
||||
older: true;
|
||||
}
|
||||
HorizontalLayout {
|
||||
padding-right: Bridge.audio.transmit == 0 ? Theme.space-4 : 0px;
|
||||
Composer {
|
||||
placeholder: @tr("Message #{}…", Bridge.own-channel);
|
||||
padding: Theme.space-3;
|
||||
padding-right: Bridge.audio.transmit == 0 ? Theme.space-3 : Theme.space-5;
|
||||
}
|
||||
// Push-to-talk is the transmit mode: talking is at hand.
|
||||
if Bridge.audio.transmit == 0: TalkButton {
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
VoiceBar { }
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
// Pages of the narrow (phone) layout that the desktop shows elsewhere:
|
||||
// the server list with the channels, activity, and the "You" page.
|
||||
// the server list with the channels, activity, the "You" page, and the
|
||||
// pins, topics and members over the page.
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
@@ -8,6 +9,8 @@ import { Nav, Page, SettingsSection } from "../nav.slint";
|
||||
import { Icon, Button, ButtonKind, IconButton, Avatar, Status, CountBadge, LiveBadge, NavItem, ListItem, SectionHeader, Card, Banner, ScrollView, ActionButton } from "../components/index.slint";
|
||||
import { ServerHeader, ConnectActions, ChannelTree } from "channels.slint";
|
||||
import { StreamsPanel } from "streams.slint";
|
||||
import { PinsDrawer, TopicsDrawer } from "drawers.slint";
|
||||
import { MembersPanel } from "members.slint";
|
||||
import { VoiceCard, VoiceButtons } from "../shells/common.slint";
|
||||
|
||||
// Servers as a horizontal strip, the current server, its channels.
|
||||
@@ -224,3 +227,32 @@ export component YouPage inherits ScrollView {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// The pins, the topics or the server's members as a page over the current
|
||||
// one (the desktop shows them beside the chat).
|
||||
export component PhoneSheet inherits Rectangle {
|
||||
background: Theme.bg-app;
|
||||
// Nothing below takes clicks while it is shown.
|
||||
TouchArea { }
|
||||
if Nav.pins-open: PinsDrawer { }
|
||||
if Nav.topics-open && !Nav.pins-open: TopicsDrawer { }
|
||||
if Nav.members-open && !Nav.pins-open && !Nav.topics-open: VerticalLayout {
|
||||
HorizontalLayout {
|
||||
padding-left: Theme.space-3;
|
||||
padding-top: Theme.space-3;
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
IconButton {
|
||||
icon: Icons.arrow-left;
|
||||
label: @tr("Back");
|
||||
round: true;
|
||||
filled: true;
|
||||
size: 36px;
|
||||
clicked => { Nav.members-open = false; }
|
||||
}
|
||||
}
|
||||
MembersPanel {
|
||||
vertical-stretch: 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -105,12 +105,13 @@ export component StreamsPanel inherits VerticalLayout {
|
||||
overflow: elide;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.x;
|
||||
label: @tr("Close the panel");
|
||||
// The phone's voice channel screen.
|
||||
if Bridge.voice-connected: IconButton {
|
||||
icon: Icons.chevron-right;
|
||||
label: @tr("Open the voice channel");
|
||||
size: 28px;
|
||||
icon-size: Theme.icon-sm;
|
||||
clicked => { Nav.right-panel-open = false; }
|
||||
clicked => { Nav.show-voice(true); }
|
||||
}
|
||||
}
|
||||
if Bridge.members.length == 0: Text {
|
||||
|
||||
@@ -67,6 +67,10 @@ export component VoiceCard inherits Rectangle {
|
||||
border-color: Theme.border;
|
||||
accessible-role: AccessibleRole.groupbox;
|
||||
accessible-label: @tr("Voice");
|
||||
// The phone: a tap opens the voice channel screen.
|
||||
if Nav.narrow && Bridge.voice-connected: TouchArea {
|
||||
clicked => { Nav.show-voice(true); }
|
||||
}
|
||||
VerticalLayout {
|
||||
padding: Theme.space-3;
|
||||
spacing: Theme.space-3;
|
||||
@@ -95,6 +99,14 @@ export component VoiceCard inherits Rectangle {
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
if Nav.narrow && Bridge.voice-connected: IconButton {
|
||||
icon: Icons.chevron-right;
|
||||
label: @tr("Open the voice channel");
|
||||
size: 32px;
|
||||
icon-size: Theme.icon-sm;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.show-voice(true); }
|
||||
}
|
||||
IconButton {
|
||||
icon: Icons.phone-off;
|
||||
label: @tr("Disconnect");
|
||||
|
||||
@@ -1,12 +1,13 @@
|
||||
// The narrow (phone) frame: a top bar, one page at a time (@children), and
|
||||
// the bottom navigation (Home, Servers, Chat, Activity, You). Used while
|
||||
// the bottom navigation (Home, Servers, Chats, Activity, You). Used while
|
||||
// the window is narrower than `Nav.narrow-breakpoint`.
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge } from "../bridge.slint";
|
||||
import { Nav, Page, MobileTab, SettingsSection } from "../nav.slint";
|
||||
import { Icon, IconButton, CountBadge } from "../components/index.slint";
|
||||
import { Icon, IconButton, CountBadge, PopupMenu, MenuEntry } from "../components/index.slint";
|
||||
import { PhoneVoice } from "../screens/mobile-voice.slint";
|
||||
|
||||
// One entry of the bottom navigation.
|
||||
component NavTab inherits Rectangle {
|
||||
@@ -68,6 +69,40 @@ component NavTab inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// The people in our channel, as a pill (the voice channel screen's top bar).
|
||||
component PeoplePill inherits Rectangle {
|
||||
callback clicked();
|
||||
width: row.preferred-width;
|
||||
height: 40px;
|
||||
border-radius: 20px;
|
||||
background: touch.pressed ? Theme.surface-4 : Theme.surface-2;
|
||||
border-width: 1px;
|
||||
border-color: Theme.border;
|
||||
accessible-role: AccessibleRole.button;
|
||||
accessible-label: @tr("{} in voice", Bridge.members.length);
|
||||
accessible-action-default => { root.clicked(); }
|
||||
touch := TouchArea {
|
||||
clicked => { root.clicked(); }
|
||||
}
|
||||
row := HorizontalLayout {
|
||||
padding-left: Theme.space-4;
|
||||
padding-right: Theme.space-4;
|
||||
spacing: Theme.space-2;
|
||||
Icon {
|
||||
source: Icons.users;
|
||||
size: 18px;
|
||||
tint: Theme.icon;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: Bridge.members.length;
|
||||
color: Theme.text;
|
||||
font-size: Theme.font-md;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export component MobileShell inherits Rectangle {
|
||||
in property <string> title;
|
||||
in property <string> subtitle;
|
||||
@@ -75,6 +110,12 @@ export component MobileShell inherits Rectangle {
|
||||
in property <int> unread;
|
||||
// Show a back arrow (sub-pages such as the settings).
|
||||
in property <bool> back;
|
||||
// The bottom navigation; pages with their own controls there (the
|
||||
// voice channel, the Stream Studio) go without.
|
||||
in property <bool> navigation: true;
|
||||
// The voice channel screen's buttons in the top bar: the people, the
|
||||
// chats and a menu.
|
||||
in property <bool> voice;
|
||||
callback go-back();
|
||||
background: Theme.backdrop;
|
||||
VerticalLayout {
|
||||
@@ -117,7 +158,21 @@ export component MobileShell inherits Rectangle {
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
IconButton {
|
||||
// The voice channel we are in, from any page.
|
||||
if !root.voice && Bridge.voice-connected: IconButton {
|
||||
icon: Icons.volume-2;
|
||||
label: @tr("Voice channel");
|
||||
round: true;
|
||||
filled: true;
|
||||
dot: true;
|
||||
dot-color: Theme.success;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => {
|
||||
Nav.show(Page.server);
|
||||
Nav.show-voice(true);
|
||||
}
|
||||
}
|
||||
if !root.voice: IconButton {
|
||||
icon: Icons.radio;
|
||||
label: @tr("Stream Studio");
|
||||
round: true;
|
||||
@@ -126,7 +181,7 @@ export component MobileShell inherits Rectangle {
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.open-studio(); }
|
||||
}
|
||||
IconButton {
|
||||
if !root.voice: IconButton {
|
||||
icon: Icons.bell;
|
||||
label: @tr("Notifications");
|
||||
round: true;
|
||||
@@ -135,6 +190,60 @@ export component MobileShell inherits Rectangle {
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.mobile-tab = MobileTab.activity; Nav.show(Page.server); }
|
||||
}
|
||||
if root.voice: PeoplePill {
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { Nav.members-open = true; }
|
||||
}
|
||||
if root.voice: Rectangle {
|
||||
width: 40px;
|
||||
height: 40px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
IconButton {
|
||||
icon: Icons.message-square;
|
||||
label: @tr("Chats");
|
||||
round: true;
|
||||
filled: true;
|
||||
size: 40px;
|
||||
clicked => {
|
||||
PhoneVoice.close();
|
||||
Nav.mobile-tab = MobileTab.chat;
|
||||
}
|
||||
}
|
||||
if root.unread > 0: CountBadge {
|
||||
x: parent.width - self.width / 2 - 4px;
|
||||
y: -4px;
|
||||
count: root.unread;
|
||||
}
|
||||
}
|
||||
if root.voice: IconButton {
|
||||
icon: Icons.more-horizontal;
|
||||
label: @tr("More");
|
||||
round: true;
|
||||
filled: true;
|
||||
y: (parent.height - self.height) / 2;
|
||||
clicked => { more.show(self.x + self.width - 220px, self.y + self.height + 4px); }
|
||||
}
|
||||
}
|
||||
more := PopupMenu {
|
||||
entries: [
|
||||
{ text: @tr("Stream Studio"), icon: Icons.radio, enabled: Bridge.streams-available },
|
||||
{ text: @tr("Voice Settings"), icon: Icons.settings, enabled: true },
|
||||
{ text: @tr("Activity"), icon: Icons.activity, enabled: true },
|
||||
{ text: @tr("Leave Voice"), icon: Icons.phone-off, danger: true, enabled: true, separator: true },
|
||||
];
|
||||
activated(i) => {
|
||||
if i == 0 {
|
||||
Nav.open-studio();
|
||||
} else if i == 1 {
|
||||
Nav.open-settings(SettingsSection.voice);
|
||||
} else if i == 2 {
|
||||
PhoneVoice.close();
|
||||
Nav.mobile-tab = MobileTab.activity;
|
||||
} else {
|
||||
PhoneVoice.close();
|
||||
Bridge.disconnect-voice();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
@@ -142,7 +251,7 @@ export component MobileShell inherits Rectangle {
|
||||
@children
|
||||
}
|
||||
// Bottom navigation.
|
||||
Rectangle {
|
||||
if root.navigation: Rectangle {
|
||||
height: 64px;
|
||||
background: Theme.surface;
|
||||
border-width: 1px;
|
||||
@@ -166,8 +275,8 @@ export component MobileShell inherits Rectangle {
|
||||
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");
|
||||
icon: Icons.message-circle;
|
||||
text: @tr("Chats");
|
||||
selected: Nav.mobile-tab == MobileTab.chat && Nav.page != Page.settings;
|
||||
badge: root.unread;
|
||||
clicked => { Nav.show(Page.server); Nav.mobile-tab = MobileTab.chat; }
|
||||
|
||||
Reference in new issue
Block a user