Files
VoelinClient/crates/voelin-ui/ui/shells/desktop.slint
T
selikhovandClaude Opus 5.5 cacb023ccf voelin-ui: open the Stream Studio from the Share button
The studio had a button of its own in the top bar (and the phone's
header), apart from the Share button. The Share buttons (the voice
buttons on the desktop, Go Live on the phone) now open a small menu:
"Share screen", the quick share of a screen or a window as before, or
"Stream Studio". While a share runs they open its dialog directly, as
before; while the studio is live, "Share screen" is off and the button
shows the live state. The separate studio buttons are gone.

Checked headless on the demo UI: the menu opens above the button, and
each entry opens the share dialog or the studio.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-03 18:59:51 +03:00

287 lines
9.6 KiB
Plaintext

// The desktop frame: the server rail at the far left, the top bar, and the
// page's panels (@children: a sidebar, the main area, a right panel). The
// window keeps its native decorations.
import { Theme } from "../theme.slint";
import { Icons } from "../icons.slint";
import { Bridge, ServerItem } from "../bridge.slint";
import { Nav, Page, SettingsSection } from "../nav.slint";
import { Icon, IconButton, Avatar, Status, CountBadge, SearchBox, ScrollView, Tooltip } from "../components/index.slint";
import { Panel, VoiceCard, UserCard } from "common.slint";
// A server in the rail: its icon (initials), the selection pill, state and
// unread marks.
component RailServer inherits Rectangle {
in property <ServerItem> server;
in property <bool> selected;
callback clicked();
callback edit();
width: Theme.rail-width;
height: 56px;
accessible-role: AccessibleRole.list-item;
accessible-label: server.name;
accessible-description: server.address;
accessible-item-selectable: true;
accessible-item-selected: selected;
accessible-action-default => { clicked(); }
// Selection pill.
Rectangle {
x: 0;
width: 4px;
height: selected ? 36px : touch.has-hover ? 18px : 0px;
border-radius: 2px;
background: Theme.text;
animate height { duration: Theme.fast; }
}
// Ring of the selected server.
if selected: Rectangle {
width: 52px;
height: 52px;
border-radius: Theme.radius-lg + 2px;
border-width: 2px;
border-color: Theme.accent;
background: Theme.glow.transparentize(0.6);
}
Avatar {
size: 46px;
square: true;
initials: server.initials;
tint: server.tint;
label: server.name;
status: server.status == "connected" ? Status.online : server.status == "observing" ? Status.info : server.status == "connecting" ? Status.idle : Status.none;
}
if server.unread > 0: CountBadge {
x: min(parent.width - self.width - 4px, 50px);
y: 0px;
count: server.unread;
}
if server.live && server.unread == 0: Rectangle {
x: parent.width - 20px;
y: 4px;
width: 12px;
height: 12px;
border-radius: 6px;
background: Theme.live;
border-width: 2px;
border-color: Theme.bg-rail;
}
touch := TouchArea {
mouse-cursor: MouseCursor.pointer;
clicked => { root.clicked(); }
double-clicked => { root.edit(); }
}
}
// The column of servers.
export component ServerRail inherits Rectangle {
width: Theme.rail-width;
background: Theme.bg-rail.transparentize(0.1);
accessible-role: AccessibleRole.list;
accessible-label: @tr("Servers");
Rectangle {
x: parent.width - 1px;
width: 1px;
background: Theme.border;
}
VerticalLayout {
padding-top: Theme.space-3;
padding-bottom: Theme.space-3;
spacing: Theme.space-2;
// App mark: home.
HorizontalLayout {
alignment: center;
Rectangle {
width: 48px;
height: 48px;
border-radius: Theme.radius-lg;
background: Nav.page == Page.home ? Theme.accent-soft : logo-touch.has-hover ? Theme.surface-3 : Theme.surface-2;
border-width: 1px;
border-color: Nav.page == Page.home ? Theme.accent : Theme.border;
accessible-role: AccessibleRole.button;
accessible-label: @tr("Home");
accessible-action-default => { Nav.show(Page.home); }
Image {
width: 30px;
height: 30px;
source: Icons.logo;
}
logo-touch := TouchArea {
mouse-cursor: MouseCursor.pointer;
clicked => { Nav.show(Page.home); }
}
}
}
HorizontalLayout {
alignment: center;
padding-top: Theme.space-2;
padding-bottom: Theme.space-2;
Rectangle {
width: 32px;
height: 2px;
border-radius: 1px;
background: Theme.border-strong;
}
}
ScrollView {
vertical-stretch: 1;
VerticalLayout {
alignment: start;
spacing: Theme.space-2;
for server in Bridge.servers: RailServer {
server: server;
selected: Nav.page == Page.server && Bridge.current-server == server.id;
clicked => { Nav.select-server(server.id); }
edit => { Nav.edit-server(server.id); }
}
HorizontalLayout {
alignment: center;
padding-top: Theme.space-2;
IconButton {
icon: Icons.plus;
label: @tr("Add server");
round: true;
filled: true;
size: 46px;
tint: Theme.success;
clicked => { Nav.add-server(); }
}
}
}
}
HorizontalLayout {
alignment: center;
IconButton {
icon: Icons.settings;
label: @tr("Settings");
round: true;
size: 46px;
checked: Nav.page == Page.settings;
clicked => { Nav.open-settings(SettingsSection.voice); }
}
}
}
}
// The bar at the top: the app name and page, search, notifications.
export component TopBar inherits Rectangle {
in property <string> context;
height: Theme.topbar-height;
accessible-role: AccessibleRole.banner;
HorizontalLayout {
padding-left: Theme.space-4;
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;
search := SearchBox {
max-width: 680px;
height: 40px;
y: (parent.height - self.height) / 2;
placeholder: Bridge.current-server >= 0 ? @tr("Search channels and people in {}…", Bridge.server-title) : @tr("Search channels and people…");
label: @tr("Search");
edited(text) => { Bridge.search(text); }
}
}
IconButton {
icon: Icons.bell;
label: Bridge.share-requests > 0 ? @tr("{} requests to watch your stream", Bridge.share-requests) : @tr("Notifications");
dot: Bridge.share-requests > 0 || Bridge.crash-notice != "";
y: (parent.height - self.height) / 2;
clicked => {
if Bridge.share-requests > 0 {
Nav.open-share();
}
}
}
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(); }
}
}
// Ctrl+K focuses the search.
property <int> requests: Nav.search-requests;
changed requests => { search.focus(); }
}
// A sidebar panel: the page's navigation (@children) above the voice card
// and the user card.
export component Sidebar inherits Panel {
width: Theme.sidebar-width;
horizontal-stretch: 0;
VerticalLayout {
padding: Theme.space-3;
spacing: Theme.space-3;
VerticalLayout {
vertical-stretch: 1;
spacing: Theme.space-3;
@children
}
if Bridge.voice-connected || Bridge.voice-connecting: VoiceCard { }
UserCard { }
}
}
// The frame: rail | (top bar / panels).
export component DesktopShell inherits Rectangle {
in property <string> context;
background: Theme.backdrop;
HorizontalLayout {
ServerRail { }
VerticalLayout {
TopBar {
context: root.context;
}
HorizontalLayout {
padding-left: Theme.space-3;
padding-right: Theme.space-3;
padding-bottom: Theme.space-3;
spacing: Theme.space-3;
@children
}
}
}
}