TeamSpeak streams carry no thumbnail, and a peek would be a join request the streamer sees, so a stream card not being watched now shows the streamer: their avatar, ringed, with what they share, on the art scene tinted with their colour (Art moves from home.slint to components). The compact rows and the phone's Activity cards show the avatar too, and our own stream from the Stream Studio shows the studio's picture while live. StreamItem gets avatar, initials, tint and studio; the kind label is the pure vm::streams::kind_label, used by Home as well. In the demo, the studio going live announces our stream, and studio:live starts the studio itself, so studio:live,server,voice shows the card. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AVRENKftQqGoEeswiR9TDQ
1221 lines
43 KiB
Plaintext
1221 lines
43 KiB
Plaintext
// The home page (design mockup 01): where we were with voice last and the
|
|
// unread mentions (before the first server, a banner with Voelin), friends
|
|
// online, live streams on our servers, the servers, the latest chats; at
|
|
// the right what friends do and what is happening (events, scheduled
|
|
// streams, server news). Also the sidebar that leads to Friends, Direct
|
|
// Messages and the Library, with the newest private chats; and the
|
|
// Library.
|
|
|
|
import { Theme } from "../theme.slint";
|
|
import { Icons } from "../icons.slint";
|
|
import { Bridge, ServerItem, ContactItem, LiveItem, ConversationItem, HappeningItem, RecordingItem, ResumeItem } from "../bridge.slint";
|
|
import { Nav, Page, SettingsSection } from "../nav.slint";
|
|
import { Icon, Button, ButtonKind, IconButton, Avatar, Status, Chip, SectionHeader, NavItem, Divider, CountBadge, LiveBadge, Art, ScrollView, ListView } from "../components/index.slint";
|
|
import { ConversationRow } from "messages.slint";
|
|
import { NoticeRow } from "overlays.slint";
|
|
|
|
// The sidebar next to the home page, the friends, the messages and the
|
|
// Library. Under its links the newest private chats, except on the
|
|
// messages page, which lists them all.
|
|
export component HomeNav inherits VerticalLayout {
|
|
property <bool> dms: Nav.page != Page.messages && Bridge.sidebar-dms.length > 0;
|
|
spacing: Theme.space-2;
|
|
NavItem {
|
|
icon: Icons.home;
|
|
text: @tr("Home");
|
|
selected: Nav.page == Page.home;
|
|
clicked => { Nav.show(Page.home); }
|
|
}
|
|
NavItem {
|
|
icon: Icons.users;
|
|
text: @tr("Friends");
|
|
selected: Nav.page == Page.friends;
|
|
clicked => { Nav.show(Page.friends); }
|
|
}
|
|
NavItem {
|
|
icon: Icons.message-square;
|
|
text: @tr("Direct Messages");
|
|
selected: Nav.page == Page.messages;
|
|
badge: Bridge.dm-unread + Bridge.inbox-unread;
|
|
clicked => { Nav.show(Page.messages); }
|
|
}
|
|
NavItem {
|
|
icon: Icons.library;
|
|
text: @tr("Library");
|
|
selected: Nav.page == Page.library;
|
|
clicked => { Nav.show(Page.library); }
|
|
}
|
|
if root.dms: Divider { }
|
|
if root.dms: VerticalLayout {
|
|
padding-top: Theme.space-2;
|
|
padding-left: Theme.space-3;
|
|
Text {
|
|
text: @tr("Recent Messages");
|
|
font-size: Theme.font-body;
|
|
font-weight: Theme.weight-medium;
|
|
color: Theme.text;
|
|
}
|
|
}
|
|
// Scrolls when the window is low, so it never makes the window taller.
|
|
if root.dms: dm-list := ScrollView {
|
|
vertical-stretch: 1;
|
|
VerticalLayout {
|
|
width: dm-list.visible-width;
|
|
alignment: start;
|
|
spacing: Theme.space-1;
|
|
for chat in Bridge.sidebar-dms: ConversationRow {
|
|
chat: chat;
|
|
}
|
|
}
|
|
}
|
|
if !root.dms: Rectangle {
|
|
vertical-stretch: 1;
|
|
}
|
|
}
|
|
|
|
// An arrow over the live streams' row: a dark round button with a light
|
|
// ring.
|
|
component BannerArrow inherits Rectangle {
|
|
in property <image> icon;
|
|
in property <string> label;
|
|
callback clicked();
|
|
width: 28px;
|
|
height: 28px;
|
|
IconButton {
|
|
icon: root.icon;
|
|
label: root.label;
|
|
round: true;
|
|
filled: true;
|
|
size: root.width;
|
|
icon-size: Theme.icon-sm;
|
|
tint: #ffffff;
|
|
clicked => { root.clicked(); }
|
|
}
|
|
Rectangle {
|
|
border-radius: self.width / 2;
|
|
border-width: 1px;
|
|
border-color: #ffffff48;
|
|
}
|
|
}
|
|
|
|
// The banner before the first server: Voelin, what it does, Add a Server.
|
|
component HomeBanner inherits Rectangle {
|
|
in property <bool> compact;
|
|
min-height: compact ? 200px : 212px;
|
|
border-radius: Theme.radius-xl;
|
|
clip: true;
|
|
background: @linear-gradient(115deg, #0e1d5c 0%, #1c1470 45%, #3a1f86 75%, #0b2a6b 100%);
|
|
border-width: 1px;
|
|
border-color: Theme.border-strong;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: Bridge.app-name;
|
|
// The night landscape, cut at the left on narrow screens (the moon
|
|
// stays).
|
|
Art {
|
|
source: Icons.art-banner;
|
|
cover-width: parent.width;
|
|
cover-height: parent.height;
|
|
align-x: 1;
|
|
}
|
|
if root.compact: Rectangle {
|
|
background: @linear-gradient(90deg, #060c2cc0 0%, #060c2c50 55%, transparent 85%);
|
|
}
|
|
// Words down a slope at the right, as written on the sky.
|
|
if !root.compact && root.width > 640px: Rectangle {
|
|
x: parent.width - 180px;
|
|
y: 24px;
|
|
width: 160px;
|
|
height: 120px;
|
|
for word[i] in [@tr("Talk."), @tr("Watch."), @tr("Share."), @tr("Together.")]: Text {
|
|
x: i * 14px;
|
|
y: i * 26px;
|
|
text: word;
|
|
color: #e4e9ffd8;
|
|
font-size: Theme.font-xl;
|
|
font-italic: true;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
padding: Theme.space-5;
|
|
padding-left: root.compact ? Theme.space-5 : 44px;
|
|
spacing: Theme.space-3;
|
|
alignment: center;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
alignment: start;
|
|
Image {
|
|
width: root.compact ? 40px : 54px;
|
|
height: self.width;
|
|
source: Icons.logo;
|
|
}
|
|
Text {
|
|
text: Bridge.app-name;
|
|
color: #ffffff;
|
|
font-size: (root.compact ? 30px : 44px) * Theme.font-scale;
|
|
font-weight: Theme.weight-bold;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
Text {
|
|
text: @tr("Voice, chat and streams\non TeamSpeak servers.");
|
|
color: #ffffff;
|
|
font-size: root.compact ? Theme.font-lg : Theme.font-2xl;
|
|
font-weight: Theme.weight-medium;
|
|
wrap: word-wrap;
|
|
}
|
|
Text {
|
|
text: @tr("Talk. Watch. Share. Or look in without joining.");
|
|
color: #c9d4ff;
|
|
wrap: word-wrap;
|
|
}
|
|
HorizontalLayout {
|
|
alignment: start;
|
|
padding-top: Theme.space-2;
|
|
Button {
|
|
kind: ButtonKind.primary;
|
|
icon: Icons.arrow-right;
|
|
text: @tr("Add a Server");
|
|
clicked => { Nav.add-server(); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Where we were with voice last: the channel and its server, Join (Open
|
|
// while voice is there).
|
|
component ResumeCard inherits Rectangle {
|
|
in property <ResumeItem> place;
|
|
in property <bool> compact;
|
|
border-radius: Theme.radius-lg;
|
|
clip: true;
|
|
background: Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: touch.has-hover ? Theme.border-strong : Theme.border;
|
|
accessible-role: AccessibleRole.groupbox;
|
|
accessible-label: @tr("Continue where you left off");
|
|
accessible-description: place.channel + " · " + place.server;
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
enabled: !root.place.connecting;
|
|
clicked => { Bridge.resume(); }
|
|
}
|
|
// The server's colour, fading out to the right.
|
|
Rectangle {
|
|
background: @linear-gradient(90deg, root.place.tint.with-alpha(0.3) 0%, root.place.tint.with-alpha(0) 65%);
|
|
}
|
|
HorizontalLayout {
|
|
padding: root.compact ? Theme.space-3 : Theme.space-4;
|
|
padding-left: root.compact ? Theme.space-3 : Theme.space-5;
|
|
spacing: root.compact ? Theme.space-3 : Theme.space-4;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: root.compact ? 44px : 52px;
|
|
square: true;
|
|
initials: root.place.initials;
|
|
image: root.place.icon;
|
|
tint: root.place.tint;
|
|
label: root.place.server;
|
|
status: root.place.open ? Status.online : root.place.connecting ? Status.idle : Status.none;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
spacing: 2px;
|
|
Text {
|
|
text: @tr("Continue where you left off");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
Icon {
|
|
source: Icons.channel;
|
|
size: Theme.icon-sm;
|
|
tint: Theme.text-secondary;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Text {
|
|
text: root.place.channel;
|
|
color: Theme.text;
|
|
font-size: root.compact ? Theme.font-md : Theme.font-lg;
|
|
font-weight: Theme.weight-semibold;
|
|
horizontal-stretch: 1;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Text {
|
|
text: root.place.server;
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Button {
|
|
small: root.compact;
|
|
kind: root.place.open ? ButtonKind.secondary : ButtonKind.primary;
|
|
icon: root.place.open ? Icons.arrow-right : Icons.log-in;
|
|
text: root.place.connecting ? @tr("Connecting…") : root.place.open ? @tr("Open") : @tr("Join");
|
|
enabled: !root.place.connecting;
|
|
clicked => { Bridge.resume(); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A friend in the "Friends Online" row.
|
|
component FriendBubble inherits Rectangle {
|
|
in property <ContactItem> friend;
|
|
// The phone: smaller, the name only.
|
|
in property <bool> compact;
|
|
width: compact ? 62px : 82px;
|
|
height: compact ? 80px : 118px;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: friend.name;
|
|
accessible-description: friend.status;
|
|
accessible-action-default => { Bridge.select-contact(friend.uid); Nav.show(Page.friends); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => {
|
|
Bridge.select-contact(root.friend.uid);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
spacing: Theme.space-1;
|
|
alignment: start;
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: root.compact ? 50px : 60px;
|
|
initials: root.friend.initials;
|
|
tint: root.friend.tint;
|
|
image: root.friend.avatar;
|
|
label: root.friend.name;
|
|
status: root.friend.away ? Status.idle : Status.online;
|
|
}
|
|
}
|
|
Rectangle {
|
|
height: Theme.space-2;
|
|
}
|
|
Text {
|
|
text: root.friend.name;
|
|
color: Theme.text;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-semibold;
|
|
horizontal-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
// Two lines at most.
|
|
if !root.compact: Rectangle {
|
|
height: 27px * Theme.font-scale;
|
|
clip: true;
|
|
Text {
|
|
y: 0;
|
|
width: parent.width;
|
|
text: root.friend.status;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
horizontal-alignment: center;
|
|
wrap: word-wrap;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A live stream on one of our servers: the picture fills the card, the
|
|
// title, the streamer and where it is over its darker lower part.
|
|
component LiveCard inherits Rectangle {
|
|
in property <LiveItem> room;
|
|
// The phone: smaller, two in view.
|
|
in property <bool> compact;
|
|
width: compact ? 200px : 256px;
|
|
height: compact ? 150px : 170px;
|
|
border-radius: Theme.radius-lg;
|
|
clip: true;
|
|
background: Theme.surface-2;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: room.title;
|
|
accessible-description: room.streamer;
|
|
accessible-action-default => { Bridge.watch-live(room.session, room.id); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Bridge.watch-live(root.room.session, root.room.id); }
|
|
}
|
|
// A painted scene in the server's colour.
|
|
Art {
|
|
source: Icons.art-scenes[mod(root.room.session + root.room.streamer.character-count, 3)];
|
|
cover-width: parent.width;
|
|
cover-height: parent.height;
|
|
align-y: 0.3;
|
|
}
|
|
Rectangle {
|
|
background: root.room.backdrop.with-alpha(0.2);
|
|
}
|
|
Rectangle {
|
|
y: parent.height * 0.3;
|
|
height: parent.height * 0.7;
|
|
background: @linear-gradient(180deg, transparent 0%, #060a18b0 45%, #060a18f0 100%);
|
|
}
|
|
HorizontalLayout {
|
|
x: Theme.space-3;
|
|
y: Theme.space-3;
|
|
height: 22px;
|
|
spacing: Theme.space-2;
|
|
LiveBadge {
|
|
large: true;
|
|
height: 22px;
|
|
}
|
|
if root.room.viewers > 0: Rectangle {
|
|
width: views.preferred-width + 14px;
|
|
border-radius: Theme.radius-xs;
|
|
background: #060a18a0;
|
|
views := HorizontalLayout {
|
|
padding-left: 7px;
|
|
spacing: Theme.space-2;
|
|
Icon {
|
|
source: Icons.eye;
|
|
size: 13px;
|
|
tint: #ffffff;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
Text {
|
|
text: root.room.viewers;
|
|
color: #ffffff;
|
|
font-size: Theme.font-xs;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: end;
|
|
padding: Theme.space-3;
|
|
spacing: Theme.space-2;
|
|
Text {
|
|
text: root.room.title;
|
|
color: #ffffff;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
Avatar {
|
|
size: 22px;
|
|
initials: root.room.initials;
|
|
tint: root.room.tint;
|
|
image: root.room.avatar;
|
|
label: root.room.streamer;
|
|
}
|
|
Text {
|
|
text: root.room.streamer;
|
|
color: #8fb4ff;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-medium;
|
|
vertical-alignment: center;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
// Where it is: the server, the channel, what is shared; cut at
|
|
// the card's edge.
|
|
Rectangle {
|
|
height: 22px;
|
|
clip: true;
|
|
HorizontalLayout {
|
|
x: 0;
|
|
width: self.preferred-width;
|
|
spacing: Theme.space-2;
|
|
Chip {
|
|
text: root.room.server;
|
|
tint: #dce4ff;
|
|
fill: #ffffff1c;
|
|
}
|
|
if root.room.channel != "": Chip {
|
|
text: root.room.channel;
|
|
tint: #dce4ff;
|
|
fill: #ffffff1c;
|
|
}
|
|
if root.room.kind != "": Chip {
|
|
text: root.room.kind;
|
|
tint: #dce4ff;
|
|
fill: #ffffff1c;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
// The hover ring over the picture.
|
|
Rectangle {
|
|
border-radius: parent.border-radius;
|
|
border-width: 1px;
|
|
border-color: touch.has-hover ? Theme.border-strong : #ffffff14;
|
|
}
|
|
}
|
|
|
|
// A server as a card: its picture, name, who is there, and Join.
|
|
component ServerCard inherits Rectangle {
|
|
in property <ServerItem> server;
|
|
min-width: 180px;
|
|
max-width: 280px;
|
|
horizontal-stretch: 1;
|
|
height: 170px;
|
|
border-radius: Theme.radius-lg;
|
|
clip: true;
|
|
background: Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: area.has-hover ? Theme.border-strong : Theme.border;
|
|
accessible-role: AccessibleRole.list-item;
|
|
accessible-label: server.name;
|
|
accessible-description: server.detail;
|
|
accessible-action-default => { Nav.select-server(server.id); }
|
|
area := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Nav.select-server(root.server.id); }
|
|
}
|
|
Rectangle {
|
|
y: 0;
|
|
height: 58px;
|
|
clip: true;
|
|
Art {
|
|
source: Icons.art-scenes[mod(root.server.id, 3)];
|
|
cover-width: parent.width;
|
|
cover-height: parent.height;
|
|
align-y: 0.7;
|
|
}
|
|
Rectangle {
|
|
background: root.server.tint.with-alpha(0.22);
|
|
}
|
|
if root.server.live: LiveBadge {
|
|
x: parent.width - self.width - Theme.space-3;
|
|
y: Theme.space-3;
|
|
}
|
|
if root.server.unread > 0: CountBadge {
|
|
x: Theme.space-3;
|
|
y: Theme.space-3;
|
|
count: root.server.unread;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
y: 58px;
|
|
height: parent.height - 58px;
|
|
padding: Theme.space-3;
|
|
padding-top: Theme.space-2;
|
|
spacing: Theme.space-1;
|
|
Text {
|
|
text: root.server.name;
|
|
color: Theme.text;
|
|
font-size: Theme.font-body;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
HorizontalLayout {
|
|
spacing: Theme.space-2;
|
|
Rectangle {
|
|
width: 8px;
|
|
height: 8px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: 4px;
|
|
background: root.server.status == "connected" ? Theme.success : root.server.status == "observing" ? Theme.info : root.server.status == "connecting" ? Theme.warning : Theme.offline;
|
|
}
|
|
Text {
|
|
text: root.server.detail;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
// As tall without chips, so the buttons line up.
|
|
HorizontalLayout {
|
|
height: 26px;
|
|
spacing: Theme.space-2;
|
|
alignment: start;
|
|
padding-top: Theme.space-1;
|
|
if root.server.flavor != "": Chip {
|
|
text: root.server.flavor;
|
|
outlined: true;
|
|
}
|
|
if root.server.gateway: Chip {
|
|
text: @tr("Invisible");
|
|
outlined: true;
|
|
}
|
|
}
|
|
Rectangle {
|
|
vertical-stretch: 1;
|
|
}
|
|
Button {
|
|
small: true;
|
|
kind: root.server.status == "connected" ? ButtonKind.secondary : ButtonKind.primary;
|
|
text: root.server.status == "connected" ? @tr("Open") : root.server.status == "connecting" ? @tr("Connecting…") : @tr("Join");
|
|
enabled: root.server.status != "connecting";
|
|
horizontal-stretch: 1;
|
|
clicked => {
|
|
if root.server.status == "connected" {
|
|
Nav.select-server(root.server.id);
|
|
} else {
|
|
Bridge.connect-server(root.server.id);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A recent chat as a small card.
|
|
component ChatCard inherits Rectangle {
|
|
in property <ConversationItem> chat;
|
|
// The four share the row evenly.
|
|
min-width: 120px;
|
|
preferred-width: 120px;
|
|
horizontal-stretch: 1;
|
|
height: 70px;
|
|
border-radius: Theme.radius-lg;
|
|
background: touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: chat.title;
|
|
accessible-description: chat.preview;
|
|
accessible-action-default => { Bridge.open-conversation(chat.key); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Bridge.open-conversation(root.chat.key); }
|
|
}
|
|
HorizontalLayout {
|
|
padding: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: 40px;
|
|
initials: root.chat.initials;
|
|
tint: root.chat.tint;
|
|
image: root.chat.avatar;
|
|
square: root.chat.kind < 2;
|
|
label: root.chat.title;
|
|
status: root.chat.kind == 2 ? (root.chat.online ? Status.online : Status.none) : Status.none;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.chat.title;
|
|
color: Theme.accent-text;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.chat.preview;
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.chat.ago;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if root.chat.unread > 0: VerticalLayout {
|
|
alignment: center;
|
|
CountBadge {
|
|
count: root.chat.unread;
|
|
fill: Theme.accent;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// A recent chat as a row (the phone): name and time, the last message,
|
|
// unread, a chevron.
|
|
component ChatRow inherits Rectangle {
|
|
in property <ConversationItem> chat;
|
|
height: 62px * Theme.font-scale;
|
|
border-radius: Theme.radius-lg;
|
|
background: touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: chat.title;
|
|
accessible-description: chat.preview;
|
|
accessible-action-default => { Bridge.open-conversation(chat.key); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Bridge.open-conversation(root.chat.key); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: 42px;
|
|
initials: root.chat.initials;
|
|
tint: root.chat.tint;
|
|
image: root.chat.avatar;
|
|
square: root.chat.kind < 2;
|
|
label: root.chat.title;
|
|
status: root.chat.kind == 2 && root.chat.online ? Status.online : Status.none;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
spacing: 2px;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
Text {
|
|
text: root.chat.title;
|
|
color: Theme.accent-text;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-semibold;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.chat.time;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
vertical-alignment: center;
|
|
}
|
|
}
|
|
Text {
|
|
text: root.chat.preview;
|
|
color: Theme.text;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if root.chat.unread > 0: VerticalLayout {
|
|
alignment: center;
|
|
CountBadge {
|
|
count: root.chat.unread;
|
|
fill: Theme.accent;
|
|
}
|
|
}
|
|
Icon {
|
|
source: Icons.chevron-right;
|
|
size: Theme.icon-sm;
|
|
tint: Theme.text-muted;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
// A section title with an icon and a "See All" link, as low as its text so
|
|
// the home page fits a window as in the design.
|
|
component Section inherits SectionHeader {
|
|
small: false;
|
|
min-height: 26px;
|
|
}
|
|
|
|
// What a friend does (the right column).
|
|
component ActivityRow inherits Rectangle {
|
|
in property <ContactItem> friend;
|
|
height: 56px;
|
|
border-radius: Theme.radius-md;
|
|
background: touch.has-hover ? Theme.surface-3 : transparent;
|
|
accessible-role: AccessibleRole.list-item;
|
|
accessible-label: friend.name;
|
|
accessible-description: friend.status;
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => {
|
|
Bridge.select-contact(root.friend.uid);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-2;
|
|
padding-right: Theme.space-2;
|
|
spacing: Theme.space-3;
|
|
VerticalLayout {
|
|
alignment: center;
|
|
Avatar {
|
|
size: 42px;
|
|
initials: root.friend.initials;
|
|
tint: root.friend.tint;
|
|
image: root.friend.avatar;
|
|
label: root.friend.name;
|
|
status: root.friend.online ? (root.friend.away ? Status.idle : Status.online) : Status.offline;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.friend.name;
|
|
color: Theme.accent-text;
|
|
font-size: Theme.font-md;
|
|
font-weight: Theme.weight-medium;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.friend.status;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
if root.friend.streaming: LiveBadge {
|
|
large: true;
|
|
}
|
|
if !root.friend.streaming: Text {
|
|
text: root.friend.when;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
horizontal-alignment: right;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// The main column of the home page.
|
|
export component HomePage inherits Rectangle {
|
|
// The phone layout: one column with the messages and the servers.
|
|
in property <bool> compact;
|
|
// No server yet (or VOELIN_OPEN=first-run): the banner with Add a
|
|
// Server, in place of where we were last and the mentions.
|
|
property <bool> first-run: Bridge.servers.length == 0 || Nav.first-run;
|
|
// Friends once: the bubbles where the right column with what friends
|
|
// do is hidden.
|
|
property <bool> bubbles: root.compact || !Nav.wide;
|
|
// The column inside its padding; a friend's bubble and the gap after it.
|
|
property <length> row-width: sv.visible-width - 2 * Theme.space-4;
|
|
property <length> friend-gap: 6px;
|
|
property <length> friend-step: 82px + root.friend-gap;
|
|
// The next live stream into view.
|
|
function more-live() {
|
|
live-list.content-x = max(live-list.width - live-list.content-width, live-list.content-x - 268px);
|
|
}
|
|
sv := ScrollView {
|
|
VerticalLayout {
|
|
width: sv.visible-width;
|
|
padding: Theme.space-4;
|
|
spacing: Theme.space-4;
|
|
alignment: start;
|
|
if root.first-run: HomeBanner {
|
|
compact: root.compact;
|
|
}
|
|
if !root.first-run && Bridge.last-place.shown: ResumeCard {
|
|
place: Bridge.last-place;
|
|
compact: root.compact;
|
|
}
|
|
if !root.first-run && Bridge.home-mentions.length > 0: Section {
|
|
text: @tr("Unread Mentions");
|
|
icon: Icons.at-sign;
|
|
action: @tr("See All");
|
|
action-clicked => { Nav.notifications-open = true; }
|
|
}
|
|
if !root.first-run && Bridge.home-mentions.length > 0: VerticalLayout {
|
|
spacing: Theme.space-1;
|
|
for notice in Bridge.home-mentions: NoticeRow {
|
|
notice: notice;
|
|
}
|
|
}
|
|
if root.bubbles: Section {
|
|
text: @tr("Friends Online");
|
|
icon: Icons.users;
|
|
action: @tr("View All ({})", Bridge.friends-online.length);
|
|
action-clicked => {
|
|
Nav.friends-tab = 0;
|
|
Bridge.friends-tab(0);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
if root.bubbles && Bridge.friends-online.length == 0: Text {
|
|
text: @tr("No friends online. Add friends from a person's card on a server: they show up here, wherever they are.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
if root.bubbles && Bridge.friends-online.length > 0: HorizontalLayout {
|
|
spacing: root.friend-gap;
|
|
alignment: start;
|
|
// On the desktop as many whole bubbles as fit (the rest
|
|
// scroll in), Find Friends right after the last one; the
|
|
// phone swipes through them all.
|
|
Flickable {
|
|
width: root.compact ? root.row-width
|
|
: min(Bridge.friends-online.length, max(1, floor((root.row-width - root.friend-step) / root.friend-step))) * root.friend-step - root.friend-gap;
|
|
height: root.compact ? 80px : 118px;
|
|
content-width: max(self.width, friends-row.preferred-width);
|
|
content-height: self.height;
|
|
friends-row := HorizontalLayout {
|
|
spacing: root.compact ? Theme.space-3 : root.friend-gap;
|
|
alignment: start;
|
|
for friend in Bridge.friends-online: FriendBubble {
|
|
friend: friend;
|
|
compact: root.compact;
|
|
}
|
|
}
|
|
}
|
|
if !root.compact: Rectangle {
|
|
width: root.friend-step - root.friend-gap;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: @tr("Find Friends");
|
|
accessible-action-default => { Nav.show(Page.friends); }
|
|
VerticalLayout {
|
|
alignment: start;
|
|
spacing: Theme.space-3;
|
|
HorizontalLayout {
|
|
alignment: center;
|
|
IconButton {
|
|
icon: Icons.plus;
|
|
label: @tr("Find Friends");
|
|
round: true;
|
|
filled: true;
|
|
size: 60px;
|
|
icon-size: Theme.icon-lg;
|
|
clicked => {
|
|
Nav.friends-tab = 1;
|
|
Bridge.friends-tab(1);
|
|
Nav.show(Page.friends);
|
|
}
|
|
}
|
|
}
|
|
Text {
|
|
text: @tr("Find Friends");
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
horizontal-alignment: center;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if root.compact && Bridge.recent-chats.length > 0: Section {
|
|
text: @tr("Messages");
|
|
icon: Icons.message-square;
|
|
action: @tr("See All");
|
|
action-clicked => { Nav.show(Page.messages); }
|
|
}
|
|
if root.compact: VerticalLayout {
|
|
spacing: Theme.space-2;
|
|
for chat in Bridge.recent-chats: ChatRow {
|
|
chat: chat;
|
|
}
|
|
}
|
|
// The phone: the servers come before the live streams, a row
|
|
// to swipe through.
|
|
if root.compact: Section {
|
|
text: @tr("Your Servers");
|
|
icon: Icons.layout-grid;
|
|
action: @tr("Add a Server");
|
|
action-clicked => { Nav.add-server(); }
|
|
}
|
|
if root.compact && Bridge.servers.length == 0: Text {
|
|
text: @tr("No servers yet. Add one with its address.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
if root.compact && Bridge.servers.length > 0: Flickable {
|
|
height: 170px;
|
|
content-width: max(self.width, servers-row.preferred-width);
|
|
content-height: self.height;
|
|
servers-row := HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
for server in Bridge.servers: ServerCard {
|
|
width: 220px;
|
|
server: server;
|
|
}
|
|
}
|
|
}
|
|
Section {
|
|
text: root.compact ? @tr("Live Now") : @tr("Featured Live Rooms");
|
|
icon: Icons.radio;
|
|
action: Bridge.live-rooms.length > 0 ? @tr("See More Live") : "";
|
|
action-clicked => { root.more-live(); }
|
|
}
|
|
if Bridge.live-rooms.length == 0: Text {
|
|
text: @tr("No one is live on your servers right now. Streams on your servers show up here.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
Rectangle {
|
|
height: Bridge.live-rooms.length == 0 ? 0px : root.compact ? 150px : 170px;
|
|
live-list := Flickable {
|
|
content-width: max(self.width, live-row.preferred-width);
|
|
content-height: self.height;
|
|
live-row := HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
for room in Bridge.live-rooms: LiveCard {
|
|
room: room;
|
|
compact: root.compact;
|
|
}
|
|
}
|
|
}
|
|
// More to the right: a round arrow over the edge.
|
|
if !root.compact && live-list.content-x > live-list.width - live-list.content-width + 1px: BannerArrow {
|
|
width: 34px;
|
|
height: 34px;
|
|
x: parent.width - self.width - Theme.space-2;
|
|
y: (parent.height - self.height) / 2;
|
|
icon: Icons.chevron-right;
|
|
label: @tr("See More Live");
|
|
clicked => { root.more-live(); }
|
|
}
|
|
}
|
|
if !root.compact: Section {
|
|
text: @tr("Your Servers");
|
|
icon: Icons.layout-grid;
|
|
action: @tr("Add a Server");
|
|
action-clicked => { Nav.add-server(); }
|
|
}
|
|
if !root.compact && Bridge.servers.length == 0: Text {
|
|
text: @tr("No servers yet. Add one with its address.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
if !root.compact: FlexboxLayout {
|
|
spacing: Theme.space-3;
|
|
alignment: stretch;
|
|
for server in Bridge.servers: ServerCard {
|
|
server: server;
|
|
}
|
|
}
|
|
if !root.compact: Section {
|
|
text: @tr("Recent Chats");
|
|
icon: Icons.messages-square;
|
|
action: @tr("View All");
|
|
action-clicked => { Nav.show(Page.messages); }
|
|
}
|
|
if !root.compact && Bridge.recent-chats.length == 0: Text {
|
|
text: @tr("Chats you had show up here, from every server.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
}
|
|
if !root.compact: HorizontalLayout {
|
|
spacing: Theme.space-3;
|
|
for chat in Bridge.recent-chats: ChatCard {
|
|
chat: chat;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// An event, a scheduled stream or server news.
|
|
component HappeningRow inherits Rectangle {
|
|
in property <HappeningItem> item;
|
|
in property <int> index;
|
|
height: 62px;
|
|
border-radius: Theme.radius-md;
|
|
background: touch.has-hover ? Theme.surface-3 : Theme.surface-2;
|
|
border-width: 1px;
|
|
border-color: Theme.border;
|
|
accessible-role: AccessibleRole.button;
|
|
accessible-label: item.title;
|
|
accessible-description: item.subtitle;
|
|
accessible-action-default => { Bridge.open-happening(index); }
|
|
touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
clicked => { Bridge.open-happening(root.index); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-3;
|
|
Rectangle {
|
|
width: 40px;
|
|
height: 40px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: Theme.radius-md;
|
|
background: root.item.kind == "news" ? Theme.surface-4 : root.item.kind == "stream" ? Theme.live-soft : Theme.accent-soft;
|
|
Icon {
|
|
source: root.item.kind == "news" ? Icons.megaphone : root.item.kind == "stream" ? Icons.radio : Icons.calendar-days;
|
|
size: Theme.icon-md;
|
|
tint: root.item.kind == "stream" ? Theme.live : Theme.accent-text;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: root.item.title;
|
|
color: Theme.text;
|
|
font-size: Theme.font-sm;
|
|
font-weight: Theme.weight-medium;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: root.item.subtitle;
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
if root.item.when != "": Text {
|
|
text: root.item.when;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-xs;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
if root.item.live: VerticalLayout {
|
|
alignment: center;
|
|
LiveBadge { }
|
|
}
|
|
Icon {
|
|
source: Icons.chevron-right;
|
|
size: Theme.icon-sm;
|
|
tint: Theme.text-muted;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
}
|
|
}
|
|
|
|
// The right column of the home page.
|
|
export component HomeAside inherits Rectangle {
|
|
sv := ScrollView {
|
|
VerticalLayout {
|
|
width: sv.visible-width;
|
|
padding: Theme.space-4;
|
|
spacing: Theme.space-3;
|
|
alignment: start;
|
|
Section {
|
|
text: @tr("Friend Activity");
|
|
action: @tr("See All");
|
|
action-clicked => { Nav.show(Page.friends); }
|
|
}
|
|
if Bridge.friend-activity.length == 0: Text {
|
|
text: @tr("What your friends do shows up here.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
// Close together, as in the design (each row lights up under
|
|
// the pointer).
|
|
VerticalLayout {
|
|
for friend in Bridge.friend-activity: ActivityRow {
|
|
friend: friend;
|
|
}
|
|
}
|
|
Divider { }
|
|
Section {
|
|
text: @tr("What's Happening");
|
|
}
|
|
if Bridge.happenings.length == 0: Text {
|
|
text: @tr("Events, scheduled streams and news of your servers show up here.");
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
wrap: word-wrap;
|
|
}
|
|
for item[i] in Bridge.happenings: HappeningRow {
|
|
item: item;
|
|
index: i;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// Recordings and clips of the Stream Studio.
|
|
export component LibraryPage inherits VerticalLayout {
|
|
// The phone: its top bar has the title.
|
|
in property <bool> compact;
|
|
padding: compact ? Theme.space-4 : Theme.space-6;
|
|
spacing: Theme.space-4;
|
|
HorizontalLayout {
|
|
spacing: Theme.space-4;
|
|
if !root.compact: Icon {
|
|
source: Icons.library;
|
|
size: 30px;
|
|
tint: Theme.accent-text;
|
|
y: (parent.height - self.height) / 2;
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
if !root.compact: Text {
|
|
text: @tr("Library");
|
|
font-size: Theme.font-2xl;
|
|
font-weight: Theme.weight-bold;
|
|
color: Theme.text;
|
|
}
|
|
Text {
|
|
text: root.compact ? Bridge.recordings-dir : @tr("Recordings and clips from the Stream Studio, in {}", Bridge.recordings-dir);
|
|
color: Theme.text-secondary;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Button {
|
|
icon: Icons.folder-open;
|
|
text: @tr("Open Folder");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.open-recordings-folder(); }
|
|
}
|
|
}
|
|
if Bridge.recordings.length == 0: Text {
|
|
text: @tr("Nothing recorded yet. Recordings and clips saved in the Stream Studio appear here.");
|
|
color: Theme.text-muted;
|
|
wrap: word-wrap;
|
|
}
|
|
ListView {
|
|
vertical-stretch: 1;
|
|
for item in Bridge.recordings: Rectangle {
|
|
height: 60px;
|
|
border-radius: Theme.radius-md;
|
|
background: row-touch.has-hover ? Theme.surface-3 : transparent;
|
|
accessible-role: AccessibleRole.list-item;
|
|
accessible-label: item.name;
|
|
accessible-description: item.detail;
|
|
accessible-action-default => { Bridge.open-recording(item.path); }
|
|
row-touch := TouchArea {
|
|
mouse-cursor: MouseCursor.pointer;
|
|
double-clicked => { Bridge.open-recording(item.path); }
|
|
}
|
|
HorizontalLayout {
|
|
padding-left: Theme.space-3;
|
|
padding-right: Theme.space-3;
|
|
spacing: Theme.space-4;
|
|
Rectangle {
|
|
width: 44px;
|
|
height: 44px;
|
|
y: (parent.height - self.height) / 2;
|
|
border-radius: Theme.radius-md;
|
|
background: Theme.surface-4;
|
|
Icon {
|
|
source: item.clip ? Icons.clapperboard : Icons.film;
|
|
tint: Theme.accent-text;
|
|
}
|
|
}
|
|
VerticalLayout {
|
|
alignment: center;
|
|
horizontal-stretch: 1;
|
|
Text {
|
|
text: item.name;
|
|
color: Theme.text;
|
|
font-weight: Theme.weight-medium;
|
|
overflow: elide;
|
|
}
|
|
Text {
|
|
text: item.detail;
|
|
color: Theme.text-muted;
|
|
font-size: Theme.font-sm;
|
|
overflow: elide;
|
|
}
|
|
}
|
|
Button {
|
|
small: true;
|
|
icon: Icons.play;
|
|
text: @tr("Play");
|
|
y: (parent.height - self.height) / 2;
|
|
clicked => { Bridge.open-recording(item.path); }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|