ui: one Participant and StreamCard for desktop and phone voice
Participant and StreamCard move into screens/voice-parts.slint with a `compact` look that replaces the phone's VoiceMember and StreamPrompt, so the compact stage and the phone's voice screen can share them. The phone's VoiceControl goes: IconButton and ActionButton get `alarm`, the filled red Leave, and `edge`; ActionButton also gets `icon-size` and `checkable`. The screenshots are unchanged. The phone's voice-bar buttons now behave like the You page's: hover, keyboard focus, surface-4 while pressed, and an accent caption while Sharing. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
This commit is contained in:
5 files changed
+297
-404
No files matched your search
@@ -139,9 +139,13 @@ export component IconButton inherits Rectangle {
|
||||
in property <bool> filled;
|
||||
// Red while checked (muted microphone).
|
||||
in property <bool> danger;
|
||||
// Filled red, with a white icon (Leave).
|
||||
in property <bool> alarm;
|
||||
// The edge while filled and not checked.
|
||||
in property <color> edge: Theme.border;
|
||||
in property <length> size: Theme.control-height;
|
||||
in property <length> icon-size: Theme.icon-md;
|
||||
in property <brush> tint: checked ? (danger ? Theme.danger : Theme.accent-text) : Theme.icon;
|
||||
in property <brush> tint: alarm ? Theme.on-accent : checked ? (danger ? Theme.danger : Theme.accent-text) : Theme.icon;
|
||||
// A small dot at the top right (unread, live).
|
||||
in property <bool> dot;
|
||||
in property <color> dot-color: Theme.live;
|
||||
@@ -159,12 +163,13 @@ export component IconButton inherits Rectangle {
|
||||
|
||||
face := Rectangle {
|
||||
border-radius: root.round ? root.size / 2 : Theme.radius-md;
|
||||
background: touch.pressed ? Theme.surface-4
|
||||
background: root.alarm ? (touch.pressed ? Theme.danger.darker(0.2) : touch.has-hover ? Theme.danger.brighter(0.1) : Theme.danger)
|
||||
: touch.pressed ? Theme.surface-4
|
||||
: root.checked ? (root.danger ? Theme.danger-soft : Theme.accent-soft)
|
||||
: touch.has-hover ? Theme.surface-3
|
||||
: root.filled ? Theme.surface-2 : transparent;
|
||||
border-width: root.filled || root.checked ? 1px : 0px;
|
||||
border-color: root.checked ? (root.danger ? Theme.danger.transparentize(50%) : Theme.accent) : Theme.border;
|
||||
border-width: !root.alarm && (root.filled || root.checked) ? 1px : 0px;
|
||||
border-color: root.checked ? (root.danger ? Theme.danger.transparentize(50%) : Theme.accent) : root.edge;
|
||||
opacity: root.enabled ? 1.0 : 0.45;
|
||||
animate background { duration: Theme.fast; }
|
||||
|
||||
@@ -222,14 +227,22 @@ export component IconButton inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// A round control with a caption below (voice bar: Mute, Deafen, Go Live).
|
||||
// A round control with a caption below (the phone's voice bar and You page:
|
||||
// Mute, Deafen, Go Live, Leave).
|
||||
export component ActionButton inherits VerticalLayout {
|
||||
in property <image> icon;
|
||||
in property <string> text;
|
||||
in property <bool> checked;
|
||||
in property <bool> danger;
|
||||
// Filled red (Leave).
|
||||
in property <bool> alarm;
|
||||
// A toggle for screen readers, which are told `checked`.
|
||||
in property <bool> checkable;
|
||||
in property <bool> enabled: true;
|
||||
in property <length> size: 40px;
|
||||
in property <length> icon-size: Theme.icon-md;
|
||||
// The circle's edge while not checked.
|
||||
in property <color> edge: Theme.border;
|
||||
callback clicked();
|
||||
spacing: Theme.space-1;
|
||||
alignment: center;
|
||||
@@ -242,10 +255,15 @@ export component ActionButton inherits VerticalLayout {
|
||||
tooltip: "";
|
||||
checked: root.checked;
|
||||
danger: root.danger;
|
||||
alarm: root.alarm;
|
||||
enabled: root.enabled;
|
||||
round: true;
|
||||
filled: true;
|
||||
size: root.size;
|
||||
icon-size: root.icon-size;
|
||||
edge: root.edge;
|
||||
accessible-checkable: root.checkable;
|
||||
accessible-checked: root.checked;
|
||||
clicked => { root.clicked(); }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, MemberItem, StreamItem } from "../bridge.slint";
|
||||
import { Bridge } from "../bridge.slint";
|
||||
import { Nav, MobileTab } from "../nav.slint";
|
||||
import { Icon, IconButton, Button, ButtonKind, Avatar, LiveBadge, Select, Slider, SpeakingBars, ScrollView, BannerPicture } from "../components/index.slint";
|
||||
import { Icon, IconButton, Button, ButtonKind, ActionButton, LiveBadge, Select, Slider, ScrollView, BannerPicture } from "../components/index.slint";
|
||||
import { MessageList, Composer } from "chat.slint";
|
||||
import { Participant, StreamCard } from "voice-parts.slint";
|
||||
import { StudioBridge } from "../studio-bridge.slint";
|
||||
|
||||
// Back to the navigation; a stream we watch goes on behind it.
|
||||
@@ -262,142 +263,6 @@ component PhonePlayer inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// 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 == "" ? (stream.channel == "" ? @tr("Looking it up…") : @tr("In {}; looking it up…", stream.channel))
|
||||
: stream.own ? @tr("Your stream")
|
||||
: stream.channel != "" ? @tr("{} · in {}", stream.streamer, stream.channel)
|
||||
: 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 {
|
||||
@@ -464,55 +329,13 @@ component ChatHeader inherits Rectangle {
|
||||
}
|
||||
}
|
||||
|
||||
// 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();
|
||||
// The voice bar's controls: larger, on a stronger edge, sharing the width.
|
||||
component BarButton inherits ActionButton {
|
||||
size: 48px;
|
||||
icon-size: 22px;
|
||||
edge: Theme.border-strong;
|
||||
checkable: !root.alarm;
|
||||
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; "Live" while it or a share
|
||||
@@ -529,14 +352,14 @@ component VoiceBar inherits Rectangle {
|
||||
padding-right: Theme.space-2;
|
||||
padding-top: Theme.space-3;
|
||||
padding-bottom: Theme.space-3;
|
||||
VoiceControl {
|
||||
BarButton {
|
||||
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 {
|
||||
BarButton {
|
||||
icon: Bridge.output-muted ? Icons.headphone-off : Icons.headphones;
|
||||
text: Bridge.output-muted ? @tr("Undeafen") : @tr("Deafen");
|
||||
checked: Bridge.output-muted;
|
||||
@@ -574,13 +397,13 @@ component VoiceBar inherits Rectangle {
|
||||
horizontal-alignment: center;
|
||||
}
|
||||
}
|
||||
if Bridge.streams-available && Bridge.can-share: VoiceControl {
|
||||
if Bridge.streams-available && Bridge.can-share: BarButton {
|
||||
icon: Icons.screen-share;
|
||||
text: Bridge.share-state == "live" ? @tr("Sharing") : @tr("Share");
|
||||
checked: Bridge.share-state == "live";
|
||||
clicked => { Nav.open-share(); }
|
||||
}
|
||||
VoiceControl {
|
||||
BarButton {
|
||||
icon: Icons.phone-off;
|
||||
text: @tr("Leave");
|
||||
alarm: true;
|
||||
@@ -647,8 +470,9 @@ export component MobileVoice inherits VerticalLayout {
|
||||
}
|
||||
if !Bridge.viewer-open: VerticalLayout {
|
||||
spacing: Theme.space-2;
|
||||
for stream in Bridge.streams: StreamPrompt {
|
||||
for stream in Bridge.streams: StreamCard {
|
||||
stream: stream;
|
||||
compact: true;
|
||||
}
|
||||
}
|
||||
people := ScrollView {
|
||||
@@ -657,8 +481,9 @@ export component MobileVoice inherits VerticalLayout {
|
||||
padding-top: Theme.space-2;
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
for member in Bridge.members: VoiceMember {
|
||||
for member in Bridge.members: Participant {
|
||||
member: member;
|
||||
compact: true;
|
||||
}
|
||||
VerticalLayout {
|
||||
width: 68px;
|
||||
|
||||
@@ -0,0 +1,244 @@
|
||||
// The people and the streams of the voice channel we are in, shared by the
|
||||
// desktop's voice view (voice.slint) and the phone's voice screen
|
||||
// (mobile-voice.slint). `compact` is the phone's smaller look.
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, MemberItem, StreamItem } from "../bridge.slint";
|
||||
import { Icon, Button, ButtonKind, Avatar, LiveBadge, Chip, SpeakingBars } from "../components/index.slint";
|
||||
|
||||
// One person: an avatar with a ring (green while talking, blue while
|
||||
// streaming), the muted mark, the name with the crown, and what they do.
|
||||
// Compact: ringed only while talking or streaming, LIVE below the name.
|
||||
export component Participant inherits VerticalLayout {
|
||||
in property <MemberItem> member;
|
||||
in property <bool> compact;
|
||||
// The avatar's.
|
||||
in property <length> size: compact ? 54px : 80px;
|
||||
width: compact ? 68px : 120px;
|
||||
spacing: compact ? Theme.space-1 : Theme.space-2;
|
||||
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 ? (root.compact ? 2px : 3px) : (root.compact ? 0px : 2px);
|
||||
border-color: member.talking ? Theme.success : member.streaming ? Theme.accent : Theme.border-strong;
|
||||
Avatar {
|
||||
size: root.size;
|
||||
initials: member.initials;
|
||||
tint: member.tint;
|
||||
image: member.avatar;
|
||||
label: member.name;
|
||||
}
|
||||
// Talking, or the microphone off, at the bottom right.
|
||||
if member.talking || member.muted || member.sound-off: Rectangle {
|
||||
x: parent.width - self.width - (root.compact ? 0px : 2px);
|
||||
y: parent.height - self.height - (root.compact ? 0px : 2px);
|
||||
width: root.compact ? 22px : 26px;
|
||||
height: self.width;
|
||||
border-radius: self.width / 2;
|
||||
background: root.compact && member.talking ? Theme.accent : Theme.surface;
|
||||
border-width: 2px;
|
||||
border-color: Theme.surface;
|
||||
if member.talking: SpeakingBars {
|
||||
width: root.compact ? 12px : 14px;
|
||||
height: self.width;
|
||||
tint: root.compact ? Theme.on-accent : Theme.success;
|
||||
}
|
||||
if !member.talking: Icon {
|
||||
source: member.sound-off ? Icons.headphone-off : Icons.mic-off;
|
||||
size: root.compact ? 12px : 15px;
|
||||
tint: Theme.danger;
|
||||
}
|
||||
}
|
||||
TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { Bridge.open-member(member.id); }
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
spacing: root.compact ? Theme.space-1 : Theme.space-2;
|
||||
Text {
|
||||
text: member.name;
|
||||
color: member.myself ? Theme.accent-text : Theme.text;
|
||||
font-size: root.compact ? Theme.font-sm : Theme.font-md;
|
||||
font-weight: root.compact ? Theme.weight-regular : Theme.weight-medium;
|
||||
overflow: elide;
|
||||
max-width: root.width - (member.admin ? 16px : 0px);
|
||||
}
|
||||
if member.admin: Icon {
|
||||
source: Icons.crown;
|
||||
size: root.compact ? 13px : 15px;
|
||||
tint: Theme.gold;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
if !root.compact: HorizontalLayout {
|
||||
alignment: center;
|
||||
spacing: Theme.space-2;
|
||||
if member.talking: SpeakingBars {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: member.talking ? @tr("Speaking") : member.streaming ? @tr("Streaming") : member.away ? @tr("Away") : "";
|
||||
color: member.talking ? Theme.success : Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
if member.streaming && !member.talking: Icon {
|
||||
source: Icons.monitor;
|
||||
size: 14px;
|
||||
tint: Theme.text-secondary;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
if root.compact && member.streaming: HorizontalLayout {
|
||||
alignment: center;
|
||||
LiveBadge { }
|
||||
}
|
||||
}
|
||||
|
||||
// A stream in the channel: LIVE, the title, who streams it, and Watch (or
|
||||
// Show, while we watch it). A large card with the picture while we watch
|
||||
// it, the viewers, the kind, the bitrate and the sound; compact, a row that
|
||||
// says where it is.
|
||||
export component StreamCard inherits Rectangle {
|
||||
in property <StreamItem> stream;
|
||||
in property <bool> compact;
|
||||
height: compact ? 76px : 236px;
|
||||
border-radius: Theme.radius-lg;
|
||||
clip: true;
|
||||
// Two stops: the software renderer draws a seam at a middle stop.
|
||||
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;
|
||||
if !root.compact: Rectangle {
|
||||
// The picture while we watch it (the viewer hidden behind the chat).
|
||||
if stream.watching && Bridge.viewer-has-frame: Image {
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
source: Bridge.viewer-frame;
|
||||
image-fit: cover;
|
||||
}
|
||||
if !(stream.watching && Bridge.viewer-has-frame): Icon {
|
||||
source: stream.kind == "Camera" ? Icons.video : Icons.monitor-up;
|
||||
size: 72px;
|
||||
tint: #ffffff22;
|
||||
}
|
||||
// Darker at the bottom, for the text.
|
||||
Rectangle {
|
||||
y: parent.height * 0.4;
|
||||
height: parent.height * 0.6;
|
||||
background: @linear-gradient(180deg, #00000000 0%, #060a18e0 100%);
|
||||
}
|
||||
HorizontalLayout {
|
||||
x: Theme.space-4;
|
||||
y: Theme.space-4;
|
||||
height: 28px;
|
||||
spacing: Theme.space-3;
|
||||
LiveBadge {
|
||||
large: true;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if stream.viewers > 0: Chip {
|
||||
text: @tr("{} watching", stream.viewers);
|
||||
icon: Icons.eye;
|
||||
tint: #ffffff;
|
||||
fill: #060a18a0;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Not conditional, so the card keeps its minimum size.
|
||||
HorizontalLayout {
|
||||
padding: root.compact ? Theme.space-3 : Theme.space-4;
|
||||
padding-left: Theme.space-4;
|
||||
padding-top: root.compact ? Theme.space-3 : 0px;
|
||||
spacing: Theme.space-3;
|
||||
VerticalLayout {
|
||||
alignment: root.compact ? LayoutAlignment.center : LayoutAlignment.end;
|
||||
horizontal-stretch: 1;
|
||||
spacing: Theme.space-1;
|
||||
HorizontalLayout {
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
// The large card has LIVE at its top.
|
||||
if root.compact && 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-size: root.compact ? Theme.font-body : Theme.font-lg;
|
||||
font-weight: Theme.weight-semibold;
|
||||
// Beside LIVE in the row.
|
||||
vertical-alignment: root.compact ? TextVerticalAlignment.center : TextVerticalAlignment.top;
|
||||
overflow: elide;
|
||||
}
|
||||
}
|
||||
// Who streams what; compact, where it is (or that it is ours).
|
||||
Text {
|
||||
text: !root.compact ? (stream.kind != "" ? stream.streamer + " • " + stream.kind : stream.streamer)
|
||||
: stream.id == "" ? (stream.channel == "" ? @tr("Looking it up…") : @tr("In {}; looking it up…", stream.channel))
|
||||
: stream.own ? @tr("Your stream")
|
||||
: stream.channel != "" ? @tr("{} · in {}", stream.streamer, stream.channel)
|
||||
: stream.viewers > 0 ? @tr("{} · {} watching", stream.streamer, stream.viewers)
|
||||
: stream.streamer;
|
||||
color: root.compact ? #ffffffb0 : #ffffffc0;
|
||||
font-size: root.compact ? Theme.font-sm : Theme.font-body;
|
||||
overflow: elide;
|
||||
}
|
||||
if !root.compact: HorizontalLayout {
|
||||
padding-top: Theme.space-2;
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
if stream.bitrate != "": Chip {
|
||||
text: stream.bitrate;
|
||||
tint: #ffffffe0;
|
||||
fill: #ffffff1a;
|
||||
}
|
||||
if stream.audio: Chip {
|
||||
text: @tr("Sound");
|
||||
icon: Icons.volume-2;
|
||||
tint: #ffffffe0;
|
||||
fill: #ffffff1a;
|
||||
}
|
||||
if stream.own: Chip {
|
||||
text: @tr("Your stream");
|
||||
tint: #ffffffe0;
|
||||
fill: #ffffff1a;
|
||||
}
|
||||
}
|
||||
}
|
||||
// At the top of the row, at the bottom of the card.
|
||||
if stream.id != "" && !stream.own: VerticalLayout {
|
||||
alignment: root.compact ? LayoutAlignment.start : LayoutAlignment.end;
|
||||
Button {
|
||||
kind: root.compact ? ButtonKind.primary : ButtonKind.secondary;
|
||||
small: root.compact;
|
||||
checked: !root.compact;
|
||||
icon: stream.watching ? Icons.monitor : root.compact ? Icons.eye : Icons.external-link;
|
||||
text: stream.watching ? (root.compact ? @tr("Show") : @tr("Show Stream")) : root.compact ? @tr("Watch") : @tr("Watch Stream");
|
||||
clicked => {
|
||||
if stream.watching {
|
||||
Bridge.show-viewer();
|
||||
} else {
|
||||
Bridge.watch-stream(stream.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,212 +3,11 @@
|
||||
|
||||
import { Theme } from "../theme.slint";
|
||||
import { Icons } from "../icons.slint";
|
||||
import { Bridge, MemberItem, StreamItem } from "../bridge.slint";
|
||||
import { Bridge } from "../bridge.slint";
|
||||
import { Nav, SettingsSection } from "../nav.slint";
|
||||
import { Icon, IconButton, Button, ButtonKind, Avatar, LiveBadge, Chip, SpeakingBars, BannerPicture } from "../components/index.slint";
|
||||
import { Icon, IconButton, Button, ButtonKind, BannerPicture } from "../components/index.slint";
|
||||
import { MessageList, Composer } from "chat.slint";
|
||||
|
||||
// One person: a large avatar with a ring (green while talking, blue while
|
||||
// streaming), the muted mark, the name and what they do.
|
||||
component Participant inherits VerticalLayout {
|
||||
in property <MemberItem> member;
|
||||
property <length> size: 80px;
|
||||
width: 120px;
|
||||
spacing: Theme.space-2;
|
||||
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 ? 3px : 2px;
|
||||
border-color: member.talking ? Theme.success : member.streaming ? Theme.accent : Theme.border-strong;
|
||||
Avatar {
|
||||
size: root.size;
|
||||
initials: member.initials;
|
||||
tint: member.tint;
|
||||
image: member.avatar;
|
||||
label: member.name;
|
||||
}
|
||||
// Talking, or the microphone off, at the bottom right.
|
||||
if member.talking || member.muted || member.sound-off: Rectangle {
|
||||
x: parent.width - self.width - 2px;
|
||||
y: parent.height - self.height - 2px;
|
||||
width: 26px;
|
||||
height: 26px;
|
||||
border-radius: 13px;
|
||||
background: Theme.surface;
|
||||
border-width: 2px;
|
||||
border-color: Theme.surface;
|
||||
if member.talking: SpeakingBars {
|
||||
width: 14px;
|
||||
height: 14px;
|
||||
}
|
||||
if !member.talking: Icon {
|
||||
source: member.sound-off ? Icons.headphone-off : Icons.mic-off;
|
||||
size: 15px;
|
||||
tint: Theme.danger;
|
||||
}
|
||||
}
|
||||
TouchArea {
|
||||
mouse-cursor: MouseCursor.pointer;
|
||||
clicked => { Bridge.open-member(member.id); }
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
spacing: Theme.space-2;
|
||||
Text {
|
||||
text: member.name;
|
||||
color: member.myself ? Theme.accent-text : Theme.text;
|
||||
font-size: Theme.font-md;
|
||||
font-weight: Theme.weight-medium;
|
||||
overflow: elide;
|
||||
}
|
||||
if member.admin: Icon {
|
||||
source: Icons.crown;
|
||||
size: 15px;
|
||||
tint: Theme.gold;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
spacing: Theme.space-2;
|
||||
if member.talking: SpeakingBars {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
Text {
|
||||
text: member.talking ? @tr("Speaking") : member.streaming ? @tr("Streaming") : member.away ? @tr("Away") : "";
|
||||
color: member.talking ? Theme.success : Theme.text-secondary;
|
||||
font-size: Theme.font-sm;
|
||||
overflow: elide;
|
||||
}
|
||||
if member.streaming && !member.talking: Icon {
|
||||
source: Icons.monitor;
|
||||
size: 14px;
|
||||
tint: Theme.text-secondary;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// A stream in the channel as a large card: LIVE, the title, who streams
|
||||
// what, and Watch.
|
||||
component StreamCard inherits Rectangle {
|
||||
in property <StreamItem> stream;
|
||||
height: 236px;
|
||||
border-radius: Theme.radius-lg;
|
||||
clip: true;
|
||||
// Two stops: the software renderer draws a seam at a middle stop.
|
||||
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;
|
||||
// The picture while we watch it (the viewer hidden behind the chat).
|
||||
if stream.watching && Bridge.viewer-has-frame: Image {
|
||||
width: parent.width;
|
||||
height: parent.height;
|
||||
source: Bridge.viewer-frame;
|
||||
image-fit: cover;
|
||||
}
|
||||
if !(stream.watching && Bridge.viewer-has-frame): Icon {
|
||||
source: stream.kind == "Camera" ? Icons.video : Icons.monitor-up;
|
||||
size: 72px;
|
||||
tint: #ffffff22;
|
||||
}
|
||||
// Darker at the bottom, for the text.
|
||||
Rectangle {
|
||||
y: parent.height * 0.4;
|
||||
height: parent.height * 0.6;
|
||||
background: @linear-gradient(180deg, #00000000 0%, #060a18e0 100%);
|
||||
}
|
||||
HorizontalLayout {
|
||||
x: Theme.space-4;
|
||||
y: Theme.space-4;
|
||||
height: 28px;
|
||||
spacing: Theme.space-3;
|
||||
LiveBadge {
|
||||
large: true;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
if stream.viewers > 0: Chip {
|
||||
text: @tr("{} watching", stream.viewers);
|
||||
icon: Icons.eye;
|
||||
tint: #ffffff;
|
||||
fill: #060a18a0;
|
||||
y: (parent.height - self.height) / 2;
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
padding: Theme.space-4;
|
||||
padding-top: 0px;
|
||||
spacing: Theme.space-3;
|
||||
alignment: stretch;
|
||||
VerticalLayout {
|
||||
alignment: end;
|
||||
horizontal-stretch: 1;
|
||||
spacing: Theme.space-1;
|
||||
Text {
|
||||
text: stream.id == "" ? @tr("{} is streaming", stream.streamer) : stream.name != "" ? stream.name : @tr("Untitled stream");
|
||||
color: #ffffff;
|
||||
font-size: Theme.font-lg;
|
||||
font-weight: Theme.weight-semibold;
|
||||
overflow: elide;
|
||||
}
|
||||
Text {
|
||||
text: stream.kind != "" ? stream.streamer + " • " + stream.kind : stream.streamer;
|
||||
color: #ffffffc0;
|
||||
font-size: Theme.font-body;
|
||||
overflow: elide;
|
||||
}
|
||||
HorizontalLayout {
|
||||
padding-top: Theme.space-2;
|
||||
spacing: Theme.space-2;
|
||||
alignment: start;
|
||||
if stream.bitrate != "": Chip {
|
||||
text: stream.bitrate;
|
||||
tint: #ffffffe0;
|
||||
fill: #ffffff1a;
|
||||
}
|
||||
if stream.audio: Chip {
|
||||
text: @tr("Sound");
|
||||
icon: Icons.volume-2;
|
||||
tint: #ffffffe0;
|
||||
fill: #ffffff1a;
|
||||
}
|
||||
if stream.own: Chip {
|
||||
text: @tr("Your stream");
|
||||
tint: #ffffffe0;
|
||||
fill: #ffffff1a;
|
||||
}
|
||||
}
|
||||
}
|
||||
if stream.id != "" && !stream.own: VerticalLayout {
|
||||
alignment: end;
|
||||
Button {
|
||||
icon: stream.watching ? Icons.monitor : Icons.external-link;
|
||||
text: stream.watching ? @tr("Show Stream") : @tr("Watch Stream");
|
||||
checked: true;
|
||||
clicked => {
|
||||
if stream.watching {
|
||||
Bridge.show-viewer();
|
||||
} else {
|
||||
Bridge.watch-stream(stream.id);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
import { Participant, StreamCard } from "voice-parts.slint";
|
||||
|
||||
// The voice channel view (desktop): header, people, streams, chat.
|
||||
export component VoiceView inherits VerticalLayout {
|
||||
|
||||
+10
-3
@@ -25,7 +25,8 @@ crates/voelin-ui/
|
||||
shells/ desktop.slint (rail, top bar, Sidebar), mobile.slint (bottom
|
||||
navigation), common.slint (Panel, VoiceCard, UserCard, ...)
|
||||
screens/ channels, chat, members (panel, card), drawers (pins, topics),
|
||||
voice (the voice channel), streams (viewer; the phone's
|
||||
voice (the voice channel), voice-parts (its people and
|
||||
streams, also the phone's), streams (viewer; the phone's
|
||||
panel), settings, settings-pages (its sections), home,
|
||||
friends, messages (direct messages), events, overlays
|
||||
(the bell, the search, a picture), dialogs, mobile and
|
||||
@@ -94,8 +95,8 @@ puts them on an inner `face`).
|
||||
| `Icon` | icon.slint | `source` (an `Icons.*`), `size`, `tint` |
|
||||
| `Spinner` | icon.slint | `size`, `tint`, `running` |
|
||||
| `Button` | button.slint | `text`, `icon`, `kind` (`ButtonKind.primary/secondary/danger/ghost`), `enabled`, `checked`, `small`; `clicked` |
|
||||
| `IconButton` | button.slint | `icon`, `label` (screen readers), `tooltip` (default `label`, "" for none; on hover, also while disabled, desktop only), `checked`, `danger`, `round`, `filled`, `size`, `icon-size`, `tint`, `dot`, `count` (a neutral number at the top right, hidden at 0 or less); `clicked` |
|
||||
| `ActionButton` | button.slint | round button with a caption (Mute, Deafen, Go Live), no tooltip: `icon`, `text`, `checked`, `danger` |
|
||||
| `IconButton` | button.slint | `icon`, `label` (screen readers), `tooltip` (default `label`, "" for none; on hover, also while disabled, desktop only), `checked`, `danger`, `alarm` (filled red with a white icon: Leave), `round`, `filled`, `edge` (the border of a filled one while not checked), `size`, `icon-size`, `tint`, `dot`, `count` (a neutral number at the top right, hidden at 0 or less); `clicked` |
|
||||
| `ActionButton` | button.slint | round button with a caption (the phone's voice bar and You page: Mute, Deafen, Go Live, Leave), no tooltip: `icon`, `text`, `checked`, `danger`, `alarm`, `checkable` (screen readers hear `checked`), `size`, `icon-size`, `edge` |
|
||||
| `FocusRing` | button.slint | the accent ring of focused controls |
|
||||
| `TextField` | text-field.slint | `text`, `placeholder`, `input-type`, `icon`, `label`, `bare`, `read-only`; out `has-focus`, `text-height` (the height of its lines); `accepted`, `edited`, `key-pressed`; `clear()`, `select-all()`, `focus-end()` (the cursor after the text) |
|
||||
| `SearchBox` | text-field.slint | a TextField with a magnifier and the Ctrl K hint (`show-shortcut`) |
|
||||
@@ -146,6 +147,12 @@ 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).
|
||||
|
||||
Voice parts (ui/screens/voice-parts.slint), for the desktop's voice view and
|
||||
the phone's voice screen: `Participant` (`member`, `size`: the avatar's) and
|
||||
`StreamCard` (`stream`), both with `compact`, the phone's smaller look (a
|
||||
person ringed only while talking or streaming, LIVE below the name; a stream
|
||||
as a row).
|
||||
|
||||
## The server page
|
||||
|
||||
The server page follows the design mockups 03 to 08 (desktop). Each part
|
||||
|
||||
Reference in new issue
Block a user