The desktop voice view gets mute, deafen, share, the voice settings and Leave under the people and streams (VoiceButtons gains round and filled); Voice Settings and Leave leave the header, which gets a Smaller stage / Larger stage button. The smaller stage, one row of compact people and the streams as rows, gives the chat about 200 px back and is stored as ui.voice_compact. Windows under 800 px tall always use it: the larger stage and the bar left no room for the chat or the composer there. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
186 lines
7.1 KiB
Plaintext
186 lines
7.1 KiB
Plaintext
// The voice channel we are in: who is there (and who talks), the streams
|
|
// in it, the call's controls, and the channel's chat below.
|
|
|
|
import { Theme } from "../theme.slint";
|
|
import { Icons } from "../icons.slint";
|
|
import { Bridge } from "../bridge.slint";
|
|
import { Nav } from "../nav.slint";
|
|
import { Icon, IconButton, Button, ButtonKind, BannerPicture, ScrollView } from "../components/index.slint";
|
|
import { VoiceButtons } from "../shells/common.slint";
|
|
import { MessageList, Composer } from "chat.slint";
|
|
import { Participant, StreamCard } from "voice-parts.slint";
|
|
|
|
// Under the stage: mute, deafen, share, the voice settings and Leave.
|
|
component CallBar inherits HorizontalLayout {
|
|
alignment: center;
|
|
padding-left: Theme.space-6;
|
|
padding-right: Theme.space-6;
|
|
padding-bottom: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: @tr("Call");
|
|
VoiceButtons {
|
|
size: 44px;
|
|
round: true;
|
|
filled: true;
|
|
gear: true;
|
|
spacing: Theme.space-3;
|
|
}
|
|
Button {
|
|
kind: ButtonKind.danger;
|
|
icon: Icons.phone-off;
|
|
text: @tr("Leave");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => {
|
|
Nav.show-voice(false);
|
|
Bridge.disconnect-voice();
|
|
}
|
|
}
|
|
}
|
|
|
|
// The voice channel view (desktop): header, people, streams, the call bar,
|
|
// chat. The smaller stage (`Nav.voice-compact`, and in short windows) is a
|
|
// strip of people and stream rows.
|
|
export component VoiceView inherits VerticalLayout {
|
|
// The smaller stage: chosen, or the window too short for the larger.
|
|
property <bool> compact: Nav.voice-compact || Nav.short;
|
|
// Banner shares the header; it does not push people and streams down.
|
|
Rectangle {
|
|
clip: true;
|
|
if Bridge.own-channel-banner.width > 0: BannerPicture {
|
|
source: Bridge.own-channel-banner;
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-7;
|
|
padding-right: Theme.space-5;
|
|
padding-top: Theme.space-5;
|
|
padding-bottom: Theme.space-3;
|
|
spacing: Theme.space-5;
|
|
Icon {
|
|
source: Icons.channel;
|
|
size: 40px;
|
|
tint: Theme.text-secondary;
|
|
y: Theme.space-1;
|
|
}
|
|
VerticalLayout {
|
|
horizontal-stretch: 1;
|
|
spacing: Theme.space-1;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
Text {
|
|
text: Bridge.own-channel;
|
|
color: Theme.text;
|
|
font-size: Theme.font-3xl;
|
|
font-weight: Theme.weight-semibold;
|
|
vertical-alignment: center;
|
|
horizontal-stretch: 1;
|
|
overflow: elide;
|
|
}
|
|
IconButton {
|
|
icon: Icons.user-plus;
|
|
label: @tr("Copy invite link");
|
|
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: root.compact ? Icons.chevron-down : Icons.chevron-up;
|
|
label: root.compact ? @tr("Larger stage") : @tr("Smaller stage");
|
|
tooltip: Nav.short ? @tr("The window is too short for the larger stage") : self.label;
|
|
enabled: !Nav.short;
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Nav.toggle-voice-compact(); }
|
|
}
|
|
IconButton {
|
|
icon: Icons.message-square;
|
|
label: @tr("Chat only");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Nav.show-voice(false); }
|
|
}
|
|
}
|
|
if Bridge.own-channel-topic != "": Text {
|
|
text: Bridge.own-channel-topic;
|
|
color: Bridge.own-channel-banner.width > 0 ? Theme.text : Theme.text-secondary;
|
|
font-size: Theme.font-md;
|
|
overflow: elide;
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
alignment: start;
|
|
Icon {
|
|
source: Icons.users;
|
|
size: 16px;
|
|
tint: Theme.text-secondary;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Text {
|
|
text: Bridge.own-channel-limit >= 0
|
|
? @tr("{} in voice / {} total", Bridge.members.length, Bridge.own-channel-limit)
|
|
: @tr("{} in voice", Bridge.members.length);
|
|
color: Bridge.own-channel-banner.width > 0 ? Theme.text : Theme.text-secondary;
|
|
font-size: Theme.font-body;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// The people, centred, wrapping into more rows when there are many.
|
|
if !root.compact: FlexboxLayout {
|
|
padding-left: Theme.space-6;
|
|
padding-right: Theme.space-6;
|
|
padding-top: Theme.space-3;
|
|
padding-bottom: Theme.space-4;
|
|
alignment: center;
|
|
spacing-horizontal: Theme.space-6;
|
|
spacing-vertical: Theme.space-4;
|
|
accessible-role: AccessibleRole.list;
|
|
accessible-label: @tr("In voice");
|
|
for member in Bridge.members: Participant {
|
|
member: member;
|
|
}
|
|
}
|
|
// Smaller: one row of people, scrolling sideways when there are many.
|
|
if root.compact: ScrollView {
|
|
height: 112px;
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-6;
|
|
padding-right: Theme.space-6;
|
|
padding-top: Theme.space-2;
|
|
spacing: Theme.space-3;
|
|
alignment: center;
|
|
accessible-role: AccessibleRole.list;
|
|
accessible-label: @tr("In voice");
|
|
for member in Bridge.members: Participant {
|
|
member: member;
|
|
compact: true;
|
|
}
|
|
}
|
|
}
|
|
if Bridge.streams.length > 0: HorizontalLayout {
|
|
padding-left: Theme.space-6;
|
|
padding-right: Theme.space-6;
|
|
padding-bottom: Theme.space-3;
|
|
spacing: Theme.space-4;
|
|
for stream in Bridge.streams: StreamCard {
|
|
horizontal-stretch: 1;
|
|
stream: stream;
|
|
compact: root.compact;
|
|
}
|
|
}
|
|
CallBar { }
|
|
MessageList {
|
|
vertical-stretch: 1;
|
|
model: Bridge.messages;
|
|
older: true;
|
|
}
|
|
Composer {
|
|
placeholder: @tr("Message {}", Bridge.own-channel);
|
|
}
|
|
}
|