Files
VoelinClient/crates/voelin-ui/ui/nav.slint
T
faumarayandClaude Opus 5 e219a38c46 voelin-ui: the server screens of the new design
The server page had one layout: a channel tree, a chat and a panel of
members and streams. The design asks for more of it at once, so the same
page now carries the pieces it was missing.

The chat shows reactions, a pin marker, file cards and older messages,
and every message can be reacted to, pinned or made into a topic where
the gateway offers it. A compact voice bar sits over it with the
connected channel, who is talking and the voice controls, so the sidebar
card is no longer the only way to leave or mute.

The members panel groups people by server group with the group's icon,
shows the badges and talk power a TeamSpeak client expects, and opens a
card with the person's description, groups, private chat, poke, contact
and volume. Its width is the setting `ui.members_width`, so dragging the
handle keeps it.

Pins and topics are drawers over the chat, the voice channel can be seen
as a grid of tiles with the streams in it, and the stream viewer gained
the elapsed time, the viewer count, a quality picker, a mute button, the
chat beside the player and a pop-out that hides the shell.

The quality picker stays hidden for now: the engine tells a viewer
neither which simulcast layers a streamer offers nor lets it ask for
one, so there is nothing to choose between.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-29 18:38:04 +03:00

147 lines
4.1 KiB
Plaintext

// Where the user is: the page, open dialogs, panel sizes. Any screen can
// navigate through these functions; Rust sets the same properties for the
// development switch VOELIN_OPEN (src/dev.rs).
import { Bridge, BookmarkForm, ShareForm } from "bridge.slint";
export enum Page {
// Welcome page: servers at a glance.
home,
// A server: channels, chat or the stream viewer, members and streams.
server,
settings,
}
// Sections of the settings page, in the order of its navigation.
export enum SettingsSection {
voice,
keybinds,
streaming,
privacy,
appearance,
}
// Tabs of the bottom navigation in the narrow (mobile) layout.
export enum MobileTab {
home,
servers,
chat,
activity,
you,
}
export global Nav {
in-out property <Page> page: Page.server;
in-out property <SettingsSection> settings-section: SettingsSection.voice;
in-out property <MobileTab> mobile-tab: MobileTab.chat;
// Narrow windows use the mobile layout; the breakpoint is the setting
// `ui.narrow_breakpoint`.
in-out property <bool> narrow: false;
in-out property <length> narrow-breakpoint: 800px;
in-out property <bool> right-panel-open: true;
in-out property <length> right-panel-width: 280px;
// Incremented to focus the search field (Ctrl+K).
in-out property <int> search-requests;
// The voice channel's grid instead of the chat.
in-out property <bool> voice-grid: false;
// Drawers over the chat (gateway features).
in-out property <bool> pins-open;
in-out property <bool> topics-open;
// The message the emoji picker reacts to; 0: it fills the composer.
in-out property <int> react-key;
// "Start a topic" asks for a title first.
in-out property <bool> topic-form-open;
in-out property <int> topic-form-key;
in-out property <string> topic-form-title;
// Dialogs.
in-out property <bool> about-open;
in-out property <bool> share-open;
in-out property <bool> client-open;
in-out property <bool> bookmark-open;
// The emoji picker over the composer, and the composer's text.
in-out property <bool> emoji-open;
in-out property <string> draft;
in-out property <BookmarkForm> bookmark-form;
in-out property <ShareForm> share-form;
// Settings were opened (so leaving them tells Rust).
property <bool> settings-active;
public function show(p: Page) {
if p != Page.settings && settings-active {
settings-active = false;
Bridge.close-settings();
}
page = p;
}
public function open-settings(section: SettingsSection) {
if !settings-active {
settings-active = true;
Bridge.open-settings();
}
settings-section = section;
page = Page.settings;
}
public function close-settings() {
show(Page.server);
}
public function open-about() {
Bridge.open-about();
about-open = true;
}
public function open-share() {
share-form = Bridge.open-share();
share-open = true;
}
public function add-server() {
bookmark-form = Bridge.edit-bookmark(-1);
bookmark-open = true;
}
public function edit-server(id: int) {
bookmark-form = Bridge.edit-bookmark(id);
bookmark-open = true;
}
public function open-client(id: int) {
if Bridge.open-client(id) {
client-open = true;
}
}
// The pins and the topics share the drawer, so opening one closes the
// other.
public function show-pins(on: bool) {
pins-open = on;
if on {
topics-open = false;
Bridge.open-pins();
}
}
public function show-topics(on: bool) {
topics-open = on;
if on {
pins-open = false;
Bridge.open-topics();
}
}
public function start-topic(key: int) {
topic-form-key = key;
topic-form-title = "";
topic-form-open = true;
}
public function select-server(id: int) {
show(Page.server);
Bridge.select-server(id);
}
}