diff --git a/CHANGELOG.md b/CHANGELOG.md index 06bbdd9..eb1b651 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -75,6 +75,11 @@ User-visible changes of the apps and the `tsgw` gateway. The format follows - One dialog adds a server, with Save and Connect (Enter connects); Home's Join a Server opens it too. Connect connects only a server it saved (Join connected the server shown before when saving failed). +- A slimmer top bar on desktop: only the search and the bell. The bell's + panel opens under the bell and is as tall as its notices; the members + button is in the voice channel's header (as in the chat's), About in + Settings. The user card has no settings gear (the rail's stays); its + avatar and name open your account. ### Fixed diff --git a/crates/voelin-ui/ui/app.slint b/crates/voelin-ui/ui/app.slint index 71e5db4..1f20cb6 100644 --- a/crates/voelin-ui/ui/app.slint +++ b/crates/voelin-ui/ui/app.slint @@ -135,7 +135,6 @@ export component MainWindow inherits Window { if !Bridge.myts.prompt && !root.chrome: StreamViewer { } if !Bridge.myts.prompt && !Nav.narrow && root.chrome: DesktopShell { - context: Nav.page == Page.settings ? @tr("Settings") : Nav.page == Page.studio ? @tr("Stream Studio") : ""; if Nav.page == Page.home: Sidebar { HomeNav { } } @@ -331,17 +330,18 @@ export component MainWindow inherits Window { } } - // The bell's panel, under the bell (the phone: the whole width). + // The bell's panel, under the bell (the phone: the whole width), as + // tall as its notices up to 560 px. if !Bridge.myts.prompt && (Nav.notifications-open): Rectangle { background: Theme.scrim-light; TouchArea { clicked => { Nav.notifications-open = false; } } NotificationsPanel { - x: Nav.narrow ? 8px : parent.width - self.width - 100px; + x: Nav.narrow ? 8px : parent.width - self.width - Theme.space-4; y: Nav.narrow ? 64px : Theme.topbar-height; width: Nav.narrow ? parent.width - 16px : 400px; - height: min(parent.height - self.y - 16px, 560px); + height: min(parent.height - self.y - 16px, 560px, self.preferred-height); } } diff --git a/crates/voelin-ui/ui/screens/mobile.slint b/crates/voelin-ui/ui/screens/mobile.slint index dedb282..a80029a 100644 --- a/crates/voelin-ui/ui/screens/mobile.slint +++ b/crates/voelin-ui/ui/screens/mobile.slint @@ -11,7 +11,7 @@ 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"; +import { VoiceCard } from "../shells/common.slint"; import { StudioBridge } from "../studio-bridge.slint"; import { ShareMenu } from "../share-menu.slint"; diff --git a/crates/voelin-ui/ui/screens/overlays.slint b/crates/voelin-ui/ui/screens/overlays.slint index 17340e4..b12fe95 100644 --- a/crates/voelin-ui/ui/screens/overlays.slint +++ b/crates/voelin-ui/ui/screens/overlays.slint @@ -5,12 +5,14 @@ import { Theme } from "../theme.slint"; import { Icons } from "../icons.slint"; import { Bridge, NoticeItem, SearchItem } from "../bridge.slint"; import { Nav, Page, SettingsSection } from "../nav.slint"; -import { Icon, Button, ButtonKind, IconButton, Avatar, Status, Chip, CountBadge, TextField, Kbd, Divider, ListView, ScrollView } from "../components/index.slint"; +import { Icon, Button, ButtonKind, IconButton, Avatar, Status, Chip, CountBadge, TextField, Kbd, Divider, ScrollView } from "../components/index.slint"; // One notification. component NoticeRow inherits Rectangle { in property notice; - min-height: 64px; + // Never shorter than its text, so a long list scrolls instead of + // squeezing the rows. + min-height: max(64px, body.preferred-height); border-radius: Theme.radius-md; background: touch.has-hover ? Theme.surface-4 : notice.unread ? Theme.accent-soft.transparentize(0.6) : transparent; accessible-role: AccessibleRole.list-item; @@ -24,7 +26,7 @@ component NoticeRow inherits Rectangle { Nav.notifications-open = false; } } - HorizontalLayout { + body := HorizontalLayout { padding: Theme.space-3; spacing: Theme.space-3; VerticalLayout { @@ -229,11 +231,17 @@ export component NotificationsPanel inherits Rectangle { wrap: word-wrap; } } - ListView { + // All the rows (there are at most 100), so the panel can be as + // tall as they are; it scrolls when they need more room. + if Bridge.notifications.length > 0: list := ScrollView { vertical-stretch: 1; - min-height: Bridge.notifications.length > 0 ? 200px : 0px; - for notice in Bridge.notifications: NoticeRow { - notice: notice; + preferred-height: rows.preferred-height; + min-height: min(rows.preferred-height, 200px); + rows := VerticalLayout { + width: list.visible-width; + for notice in Bridge.notifications: NoticeRow { + notice: notice; + } } } } diff --git a/crates/voelin-ui/ui/screens/voice.slint b/crates/voelin-ui/ui/screens/voice.slint index 724056a..1106fd9 100644 --- a/crates/voelin-ui/ui/screens/voice.slint +++ b/crates/voelin-ui/ui/screens/voice.slint @@ -250,6 +250,13 @@ export component VoiceView inherits VerticalLayout { y: (parent.height - self.height) / 2; clicked => { Nav.copy(Bridge.invite()); } } + IconButton { + icon: Icons.users; + label: @tr("Members"); + checked: Nav.right-panel-open && !Nav.pins-open && !Nav.topics-open; + y: (parent.height - self.height) / 2; + clicked => { Nav.toggle-members(); } + } IconButton { icon: Icons.message-square; label: @tr("Chat only"); diff --git a/crates/voelin-ui/ui/shells/common.slint b/crates/voelin-ui/ui/shells/common.slint index 0a59664..07e7548 100644 --- a/crates/voelin-ui/ui/shells/common.slint +++ b/crates/voelin-ui/ui/shells/common.slint @@ -6,7 +6,7 @@ import { Bridge } from "../bridge.slint"; import { Nav, SettingsSection } from "../nav.slint"; import { StudioBridge } from "../studio-bridge.slint"; import { ShareMenu } from "../share-menu.slint"; -import { Icon, IconButton, Avatar, Status } from "../components/index.slint"; +import { Icon, IconButton, FocusRing, Avatar, Status } from "../components/index.slint"; // A rounded panel of the frame (sidebar, main area, right panel). export component Panel inherits Rectangle { @@ -123,9 +123,11 @@ export component VoiceCard inherits Rectangle { } } -// Mute, deafen, share, settings. +// Mute, deafen, share, and with `gear` the voice settings. export component VoiceButtons inherits HorizontalLayout { in property size: 34px; + // The rail has the settings; the user card leaves them out. + in property gear: false; spacing: Theme.space-1; IconButton { icon: Bridge.input-muted ? Icons.mic-off : Icons.mic; @@ -156,7 +158,7 @@ export component VoiceButtons inherits HorizontalLayout { } share-menu := ShareMenu { } } - IconButton { + if root.gear: IconButton { icon: Icons.settings; label: @tr("Settings"); size: root.size; @@ -165,6 +167,7 @@ export component VoiceButtons inherits HorizontalLayout { } // The primary app profile, with current server voice status and controls. +// The avatar and the name open Settings › Account. export component UserCard inherits Rectangle { min-height: 60px; border-radius: Theme.radius-lg; @@ -173,42 +176,76 @@ export component UserCard inherits Rectangle { accessible-label: @tr("You"); HorizontalLayout { padding: Theme.space-2; - padding-left: Theme.space-3; - spacing: Theme.space-3; - VerticalLayout { - alignment: center; - Avatar { - size: 38px; - initials: Bridge.myts.signed-in || Bridge.nickname != "" ? "" : "?"; - // The server's avatar for us, else the account's. - image: Bridge.own-avatar.width > 0 ? Bridge.own-avatar : Bridge.myts.avatar; - tint: Theme.accent; - label: Bridge.primary-name; - // Green ring while our voice goes out. - speaking: Bridge.transmitting; - status: Bridge.voice-connected ? Status.online : Bridge.observing ? Status.info : Status.offline; - Icon { - source: Icons.user; - size: 20px; - tint: #ffffff; - visible: (Bridge.myts.signed-in || Bridge.nickname != "") && Bridge.own-avatar.width == 0 && Bridge.myts.avatar.width == 0; + spacing: Theme.space-2; + profile := Rectangle { + horizontal-stretch: 1; + border-radius: Theme.radius-md; + background: profile-touch.pressed ? Theme.surface-4 : profile-touch.has-hover ? Theme.surface-3 : transparent; + accessible-role: AccessibleRole.button; + accessible-label: @tr("Your profile"); + accessible-description: Bridge.primary-name; + accessible-action-default => { Nav.open-settings(SettingsSection.account); } + FocusRing { + shown: profile-focus.has-focus; + w: profile.width; + h: profile.height; + } + profile-focus := FocusScope { + key-pressed(event) => { + if event.text == " " || event.text == "\n" { + Nav.open-settings(SettingsSection.account); + return accept; + } + reject + } + profile-touch := TouchArea { + mouse-cursor: MouseCursor.pointer; + clicked => { + profile-focus.focus(); + Nav.open-settings(SettingsSection.account); + } } } - } - VerticalLayout { - alignment: center; - horizontal-stretch: 1; - Text { - text: Bridge.primary-name; - color: Theme.text; - font-weight: Theme.weight-semibold; - overflow: elide; - } - Text { - text: Bridge.voice-connected ? @tr("Online") : Bridge.observing ? @tr("Observing") : @tr("Offline"); - color: Theme.text-muted; - font-size: Theme.font-xs; - overflow: elide; + HorizontalLayout { + padding-left: Theme.space-2; + padding-right: Theme.space-2; + spacing: Theme.space-3; + VerticalLayout { + alignment: center; + Avatar { + size: 38px; + initials: Bridge.myts.signed-in || Bridge.nickname != "" ? "" : "?"; + // The server's avatar for us, else the account's. + image: Bridge.own-avatar.width > 0 ? Bridge.own-avatar : Bridge.myts.avatar; + tint: Theme.accent; + label: Bridge.primary-name; + // Green ring while our voice goes out. + speaking: Bridge.transmitting; + status: Bridge.voice-connected ? Status.online : Bridge.observing ? Status.info : Status.offline; + Icon { + source: Icons.user; + size: 20px; + tint: #ffffff; + visible: (Bridge.myts.signed-in || Bridge.nickname != "") && Bridge.own-avatar.width == 0 && Bridge.myts.avatar.width == 0; + } + } + } + VerticalLayout { + alignment: center; + horizontal-stretch: 1; + Text { + text: Bridge.primary-name; + color: Theme.text; + font-weight: Theme.weight-semibold; + overflow: elide; + } + Text { + text: Bridge.voice-connected ? @tr("Online") : Bridge.observing ? @tr("Observing") : @tr("Offline"); + color: Theme.text-muted; + font-size: Theme.font-xs; + overflow: elide; + } + } } } VoiceButtons { } diff --git a/crates/voelin-ui/ui/shells/desktop.slint b/crates/voelin-ui/ui/shells/desktop.slint index cc38fd6..785f044 100644 --- a/crates/voelin-ui/ui/shells/desktop.slint +++ b/crates/voelin-ui/ui/shells/desktop.slint @@ -163,46 +163,24 @@ export component ServerRail inherits Rectangle { } } -// The bar at the top: the app name and page, search, notifications. +// The bar at the top: the search over the main panel, the bell at the +// right. export component TopBar inherits Rectangle { - in property context; height: Theme.topbar-height; accessible-role: AccessibleRole.banner; HorizontalLayout { - padding-left: Theme.space-4; + // Where the main panel starts: the panels below have a space-3 + // margin and gap around the sidebar. + padding-left: Theme.sidebar-width + 2 * Theme.space-3; padding-right: Theme.space-4; spacing: Theme.space-4; - HorizontalLayout { - width: Theme.sidebar-width - Theme.space-4; - spacing: Theme.space-3; - Image { - width: 30px; - height: 30px; - y: (parent.height - self.height) / 2; - source: Icons.logo; - } - Text { - text: Bridge.app-name; - color: Theme.text; - font-size: Theme.font-xl; - font-weight: Theme.weight-semibold; - vertical-alignment: center; - } - if root.context != "": Text { - text: root.context; - color: Theme.accent-text; - font-size: Theme.font-md; - vertical-alignment: center; - overflow: elide; - } - } HorizontalLayout { horizontal-stretch: 1; alignment: center; // Opens the search (Ctrl+K does too). Rectangle { max-width: 680px; - height: 40px; + height: Theme.control-height; y: (parent.height - self.height) / 2; SearchBox { read-only: true; @@ -223,28 +201,6 @@ export component TopBar inherits Rectangle { y: (parent.height - self.height) / 2; clicked => { Nav.notifications-open = !Nav.notifications-open; } } - IconButton { - icon: Icons.users; - label: @tr("Members"); - checked: Nav.right-panel-open && !Nav.pins-open && !Nav.topics-open && Nav.page == Page.server; - y: (parent.height - self.height) / 2; - clicked => { - Nav.show(Page.server); - Nav.toggle-members(); - } - } - Rectangle { - width: 1px; - height: 24px; - y: (parent.height - self.height) / 2; - background: Theme.border-strong; - } - IconButton { - icon: Icons.help; - label: @tr("About {}", Bridge.app-name); - y: (parent.height - self.height) / 2; - clicked => { Nav.open-about(); } - } } } @@ -268,14 +224,11 @@ export component Sidebar inherits Panel { // The frame: rail | (top bar / panels). export component DesktopShell inherits Rectangle { - in property context; background: Theme.backdrop; HorizontalLayout { ServerRail { } VerticalLayout { - TopBar { - context: root.context; - } + TopBar { } HorizontalLayout { padding-left: Theme.space-3; padding-right: Theme.space-3; diff --git a/crates/voelin-ui/ui/theme.slint b/crates/voelin-ui/ui/theme.slint index c7a67f5..145d9a5 100644 --- a/crates/voelin-ui/ui/theme.slint +++ b/crates/voelin-ui/ui/theme.slint @@ -139,7 +139,8 @@ export global Theme { // Shell dimensions. out property rail-width: 72px; out property sidebar-width: 264px * max(1.0, font-scale); - out property topbar-height: 56px; + // Taller only when large text makes the controls in it taller. + out property topbar-height: max(44px, control-height + space-3); out property right-panel-min: 220px; // Motion. diff --git a/docs/ui.md b/docs/ui.md index 04e9b41..5162da2 100644 --- a/docs/ui.md +++ b/docs/ui.md @@ -73,7 +73,7 @@ literal colours. | Radii | `radius-xs` 4, `radius-sm` 6, `radius-md` 8, `radius-lg` 12, `radius-xl` 16, `radius-pill` | | Spacing | `space-1` 2 … `space-8` 32 (2, 4, 8, 12, 16, 20, 24, 32) | | Type (scaled) | `font-xs` 11, `font-sm` 12, `font-body` 14, `font-md` 15, `font-lg` 17, `font-xl` 20, `font-2xl` 24, `font-3xl` 30; `weight-regular` … `weight-bold` | -| Sizes | `row-height`, `control-height` 36, `control-height-sm` 28, `icon-sm/md/lg` 16/20/24, `rail-width` 72, `sidebar-width` 264 (grows with the font scale), `topbar-height` 56, `right-panel-min` | +| Sizes | `row-height`, `control-height` 36, `control-height-sm` 28, `icon-sm/md/lg` 16/20/24, `rail-width` 72, `sidebar-width` 264 (grows with the font scale), `topbar-height` 44 (more when large text makes the controls taller), `right-panel-min` | | Motion | `fast` 120 ms, `normal` 200 ms | A light palette is filled in for every colour; `mode` switches at runtime. @@ -136,8 +136,13 @@ puts them on an inner `face`). Shell pieces (ui/shells/): `DesktopShell` (rail + top bar + panels as @children), `Sidebar` (page navigation above the voice card and user card), -`Panel`, `ServerRail`, `TopBar`, `MobileShell` (top bar, page, bottom -navigation), `VoiceCard`, `VoiceButtons`, `UserCard`, `HoldToTalk`. +`Panel`, `ServerRail` (Home, the servers, Add a server, the settings), +`TopBar` (the search, starting over the main panel, opens the search like +Ctrl+K; the bell at the right), `MobileShell` (top bar, page, bottom +navigation), `VoiceCard`, `VoiceButtons` (mute, deafen, share; `gear` adds +the voice settings), `UserCard` (its avatar and name open Settings → My +Account), `HoldToTalk`. Pages bring their own title; About is in the +settings (and on the phone's You page). ## The server page @@ -153,7 +158,7 @@ comes from the engine's events; what a gateway adds is hidden without it. | Channel password | `channel-password`, `channel-password:wrong` | Joining a channel (a double-click in the tree, joining a friend) moves there with voice, or connects into it (by its id) without; when the server puts us elsewhere on connecting, as it does for a wrong password, it is joined again, which says why. A locked channel first asks for its password in `ChannelPasswordDialog`, unless one was given since voice connected; a refused one asks again under "Wrong password". A full channel or another refusal is a toast | `Presence` (`has_password`), `JoinFailed`; `Command::MoveToChannel`, `ConnectVoice` (`channel_password`) | | Pinned messages | `pins` | In the members panel's place: cards with author, time, text, files and reactions; the pin unpins, a click jumps to the message | `Gateway` `Pins`, `Pinned`, `Unpinned`; `GatewayRequest::Pins`, `Unpin` | | Topics | `topics`, `topic:` | In the members panel's place: search, cards with the message count, creator and last activity, Create Topic; an open topic replaces the chat's messages and takes replies | `Gateway` `Topics`, `Topic`, `TopicHistory`; `GatewayRequest::Topics`, `TopicHistory`, `CreateTopic`, `Post` | -| Voice channel | `voice` | Title, topic, "5 in voice / 50 total", Copy invite link (a `ts3server://` link to the channel; the phone's Invite button does the same), Chat only, Voice Settings, Leave; the people as large avatars (talking ring and bars, muted, crown, streaming); the streams as cards (LIVE, viewers, kind, bitrate, sound, Watch Stream); the channel's chat | `Presence`, `Talking`, `StreamsChanged`, viewer counts from `StreamsChanged`, else the `Gateway` stream directory | +| Voice channel | `voice` | Title, topic, "5 in voice / 50 total", Copy invite link (a `ts3server://` link to the channel; the phone's Invite button does the same), the members button, Chat only, Voice Settings, Leave; the people as large avatars (talking ring and bars, muted, crown, streaming); the streams as cards (LIVE, viewers, kind, bitrate, sound, Watch Stream); the channel's chat | `Presence`, `Talking`, `StreamsChanged`, viewer counts from `StreamsChanged`, else the `Gateway` stream directory | | Watching a stream | `watch`, `popout` | The channel's header with "5 in voice" and Leave; the player with the streamer, title, viewers, LIVE, the picture's height (the simulcast picker when a Voelin streamer offers layers), volume, elapsed time, what arrives (codec, size, frame rate, bitrate), back to the chat, pop out, full screen; a note that the stream belongs to the channel; the channel's chat and a Stream Info tab. Popped out (and in full screen) it fills the window | `WatchState`, `WatchLayers`, decoded frames and their stats (`src/video.rs`), `StreamsChanged` (viewer counts; the `Gateway` stream directory where the server gives none) | The pins and topics share the place of the members panel: opening one @@ -178,7 +183,7 @@ where a server has it. | Library | `library` | The Stream Studio's recordings and clips (the files in `studio.recording_dir`, newest first) with Play and Open Folder | the folder | | Friends | `friends[:]` | Online, All and Blocked tabs, a search; each contact with where they are (server, channel, away, live), message, poke, join, watch. The selected one at the right: relation, where, a note, our volume and mute for them, friend, block, forget | `ContactsChanged`, `FriendPresence`; `Command::SetContact`, `RemoveContact`, `Poke`, `MoveToChannel` | | Direct messages | `messages[:]`, `inbox`, `offline` | The private chats of every server and of the store (peers by unique id) with the last message and unread counts, All, Unread and Inbox (offline messages); the conversation with the chat's message list, pokes among the messages, pictures and files, a composer, and a clear state when the peer cannot be reached (an offline message instead, where the server keeps them); the peer at the right: relation, note, the servers they are on, shared pictures and files, our volume for them | `ChatHistory` (`ChatTarget::Private` by unique id), `Command::LoadOlderHistory`, `Poke`, offline messages (`ListOfflineMessages`, `GetOfflineMessage`, `SendOfflineMessage`, `DeleteOfflineMessage`, `SetOfflineMessageRead`) | -| The bell | `notifications` | Mentions, pokes, private messages, event reminders and friends coming online, newest first, unread marked; Mark all read, clear, the settings. Each kind is off, in the app or also a desktop notification (`notify.*`) | `Chat` and `ChatHistory` (mentions, private messages), `Poke`, `GatewayUpdate::EventReminder`, `FriendPresence`; `voelin_platform::notify` | +| The bell | `notifications` | A panel under the bell, as tall as its notices (up to 560 px, then it scrolls): mentions, pokes, private messages, event reminders and friends coming online, newest first, unread marked; Mark all read, clear, the settings. Each kind is off, in the app or also a desktop notification (`notify.*`) | `Chat` and `ChatHistory` (mentions, private messages), `Poke`, `GatewayUpdate::EventReminder`, `FriendPresence`; `voelin_platform::notify` | | Search | `search[:]` | Ctrl+K: servers, channels of every server, people (on the servers and the contacts) and the settings pages; arrows choose, Enter opens | the sessions, contacts, bookmarks | | Events | `events`, `event-form` | Above the channel tree (gateway `events`): a server's events with date, time, channel, scheduled stream, Going, Maybe and Not going with counts, who answered, reminders, Watch while live; create, edit and delete. Members (above the tree too) opens the members panel | `Gateway` events; `GatewayRequest::Events`, `CreateEvent`, `UpdateEvent`, `DeleteEvent`, `Rsvp` | | Pictures in chat | `picture` | A linked png, jpg, gif or webp up to `ui.image_preview_kb` is downloaded into memory, decoded once into the image cache and shown as a card in the message; a click opens it larger. A picture on the web a message shows (`[img]`) comes into the engine's picture cache like banners, up to the same size and only with `cache.fetch_images`; until then, or without it, the message shows its address as a link | `Command::DownloadChatFile` with `DownloadTo::Memory`, `Transfer`; `Command::FetchPicture`, `PictureReady` |