feat(client): icon buttons, emoji picker, reactions and a redesigned voice room
- Replace every hand drawn symbol and unicode glyph with Lucide icons via Symbol, with tooltips on icon buttons (built-in Tooltip, which does not swallow clicks), a proper gear and a clear log-out button for leaving a server. - Center text and controls vertically in channel rows, headers, the user panel and friend rows. - Message actions: quick reactions, add reaction, reply, edit and delete as icons. The bar stays visible while the pointer is over its buttons. - Emoji picker with categories and Russian and English search for the composer and for reactions. Reactions are shown under the message and toggle on click (ReactionAdd or ReactionRemove). - Remove the keyboard hint under the composer, add a placeholder and a growing editor with emoji and send buttons. - Voice room: participant cards with avatar and speaking ring, round icon controls with off states in red, accent gradient background. - One AvatarView everywhere (including voice cards and members). The local user is listed as online in the member list. - Real checkbox on the connect screen, theme overlay colour for the trust dialog, accent primary button. - ui_smoke now renders screens in all four themes and checks the member status, the action bar and the picker with real pointer input.
This commit is contained in:
parent
4462ef4708
commit
220af2d6a4
24 changed files with 1120 additions and 258 deletions
|
|
@ -1,6 +1,64 @@
|
|||
import { Theme, ActionButton } from "theme.slint";
|
||||
import { AvatarView } from "avatar-view.slint";
|
||||
import { Theme, ActionButton, Symbol, TipBubble } from "theme.slint";
|
||||
|
||||
export struct VoiceMemberItem { user_id: string, nickname: string, speaking: bool, avatar_text: string }
|
||||
export struct VoiceMemberItem { user_id: string, nickname: string, speaking: bool, avatar_text: string, is_own: bool }
|
||||
|
||||
/// Round control of the voice room bar. `off` shows the muted state highlighted in red.
|
||||
component RoundControl inherits Rectangle {
|
||||
in property <string> icon;
|
||||
in property <string> tooltip;
|
||||
in property <bool> off: false;
|
||||
in property <bool> leave: false;
|
||||
callback clicked();
|
||||
width: 52px; height: 52px;
|
||||
border-radius: 26px;
|
||||
background: root.leave ? (touch.has-hover ? Theme.danger.darker(10%) : Theme.danger)
|
||||
: root.off ? Theme.danger.with-alpha(touch.has-hover ? 0.32 : 0.22)
|
||||
: touch.has-hover ? Theme.bg-hover : Theme.bg-interactive;
|
||||
border-width: keyboard.has-focus ? 2px : 1px;
|
||||
border-color: keyboard.has-focus ? Theme.accent : root.off ? Theme.danger.with-alpha(0.5) : Theme.border;
|
||||
accessible-role: button;
|
||||
accessible-label: root.tooltip;
|
||||
Symbol {
|
||||
kind: root.icon;
|
||||
ink: root.leave ? Theme.on-accent : root.off ? Theme.danger : Theme.text-primary;
|
||||
width: 22px; height: 22px;
|
||||
x: (parent.width - self.width) / 2; y: (parent.height - self.height) / 2;
|
||||
}
|
||||
touch := TouchArea { clicked => { keyboard.focus(); root.clicked(); } }
|
||||
keyboard := FocusScope {
|
||||
focus-on-click: false;
|
||||
key-pressed(event) => {
|
||||
if event.text == " " || event.text == "\n" { root.clicked(); return accept; }
|
||||
return reject;
|
||||
}
|
||||
}
|
||||
if root.tooltip != "" : Tooltip { TipBubble { text: root.tooltip; } }
|
||||
}
|
||||
|
||||
component ParticipantCard inherits Rectangle {
|
||||
in property <VoiceMemberItem> member;
|
||||
in property <image> own-avatar;
|
||||
in property <bool> has-own-avatar;
|
||||
border-radius: 16px;
|
||||
background: Theme.bg-elevated;
|
||||
border-width: root.member.speaking ? 2px : 1px;
|
||||
border-color: root.member.speaking ? Theme.success : Theme.border;
|
||||
VerticalLayout {
|
||||
padding: 18px; spacing: 10px; alignment: center;
|
||||
HorizontalLayout {
|
||||
alignment: center;
|
||||
AvatarView {
|
||||
width: 80px; height: 80px;
|
||||
source: root.own-avatar; has-source: root.has-own-avatar && root.member.is_own;
|
||||
initials: root.member.avatar_text; mask: Theme.bg-elevated;
|
||||
speaking: root.member.speaking;
|
||||
}
|
||||
}
|
||||
Text { text: root.member.nickname; color: Theme.text-primary; font-size: Math.max(11px, Theme.font-size * 0.9375); font-weight: 600; horizontal-alignment: center; overflow: elide; }
|
||||
Text { text: root.member.speaking ? @tr("Speaking") : @tr("In voice"); color: root.member.speaking ? Theme.success : Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.75); horizontal-alignment: center; }
|
||||
}
|
||||
}
|
||||
|
||||
export component VoicePanel inherits Rectangle {
|
||||
in-out property <[VoiceMemberItem]> members;
|
||||
|
|
@ -10,59 +68,53 @@ export component VoicePanel inherits Rectangle {
|
|||
in-out property <string> activity-banner;
|
||||
in property <bool> joining;
|
||||
in-out property <bool> push-to-talk;
|
||||
in property <image> own-avatar;
|
||||
in property <bool> has-own-avatar;
|
||||
private property <length> gap: 14px;
|
||||
private property <int> columns: Math.max(1, Math.floor((grid.width + root.gap) / (210px + root.gap)));
|
||||
private property <length> card-width: (grid.width - (root.columns - 1) * root.gap) / root.columns;
|
||||
callback preview-screen();
|
||||
callback ptt-held(bool);
|
||||
callback toggle-mic();
|
||||
callback toggle-deafen();
|
||||
callback leave-voice();
|
||||
background: Theme.bg-base;
|
||||
background: @linear-gradient(180deg, Theme.bg-base 0%, Theme.bg-surface 100%);
|
||||
VerticalLayout {
|
||||
spacing: 0;
|
||||
Rectangle {
|
||||
height: 56px; border-width: 1px; border-color: Theme.border;
|
||||
HorizontalLayout {
|
||||
padding-left: 22px; spacing: 12px;
|
||||
Text { text: "◖"; color: Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 1.4375); width: 20px; vertical-alignment: center; }
|
||||
padding-left: 22px; padding-right: 16px; spacing: 10px;
|
||||
Symbol { kind: "volume-2"; ink: Theme.text-muted; width: 20px; height: 20px; y: (parent.height - self.height) / 2; }
|
||||
Text { text: root.channel-name; color: Theme.text-primary; font-size: Math.max(11px, Theme.font-size * 1.0); font-weight: 600; vertical-alignment: center; }
|
||||
Text { text: @tr("{n} participant" | "{n} participants" % root.members.length); color: Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.8125); vertical-alignment: center; }
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
ActionButton { text: @tr("Screen preview"); clicked => { root.preview-screen(); } }
|
||||
}
|
||||
}
|
||||
VerticalLayout {
|
||||
padding: 24px; spacing: 16px;
|
||||
Text { text: @tr("{n} participant" | "{n} participants" % root.members.length); color: Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.8125); }
|
||||
Flickable {
|
||||
grid := Flickable {
|
||||
content-width: self.width;
|
||||
VerticalLayout {
|
||||
spacing: 12px;
|
||||
for member in root.members: Rectangle {
|
||||
height: 120px; border-radius: 12px;
|
||||
background: Theme.bg-interactive;
|
||||
border-width: member.speaking ? 2px : 1px;
|
||||
border-color: member.speaking ? Theme.success : Theme.border;
|
||||
HorizontalLayout {
|
||||
padding: 24px; spacing: 18px;
|
||||
Rectangle {
|
||||
width: 58px; height: 58px; border-radius: 20px; background: Theme.avatar-bg;
|
||||
Text { text: member.avatar_text; color: Theme.accent; font-size: Math.max(11px, Theme.font-size * 1.625); horizontal-alignment: center; vertical-alignment: center; }
|
||||
}
|
||||
VerticalLayout {
|
||||
spacing: 5px;
|
||||
Text { text: member.nickname; color: Theme.text-primary; font-size: Math.max(11px, Theme.font-size * 1.0625); }
|
||||
Text { text: member.speaking ? @tr("Speaking") : @tr("In voice"); color: member.speaking ? Theme.success : Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.75); }
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
}
|
||||
if root.joining : Text { text: @tr("Joining voice…"); color: Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.875); }
|
||||
Rectangle { vertical-stretch: 1; }
|
||||
content-height: Math.max(self.height, Math.ceil(root.members.length / root.columns) * (170px + root.gap));
|
||||
for member[index] in root.members: ParticipantCard {
|
||||
x: Math.mod(index, root.columns) * (root.card-width + root.gap);
|
||||
y: Math.floor(index / root.columns) * (170px + root.gap);
|
||||
width: root.card-width; height: 170px;
|
||||
member: member;
|
||||
own-avatar: root.own-avatar;
|
||||
has-own-avatar: root.has-own-avatar;
|
||||
}
|
||||
if root.members.length == 0 : Text { text: @tr("Joining voice…"); color: Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.875); }
|
||||
}
|
||||
if root.push-to-talk : Rectangle {
|
||||
height: 46px; background: ptt-area.pressed ? Theme.voice-bg : Theme.bg-interactive;
|
||||
border-radius: 8px; border-width: ptt-focus.has-focus ? 1px : 0px; border-color: Theme.accent;
|
||||
border-radius: 10px; border-width: ptt-focus.has-focus ? 1px : 0px; border-color: Theme.accent;
|
||||
accessible-role: button; accessible-label: @tr("Push to talk");
|
||||
Text { text: ptt-area.pressed ? @tr("Microphone is transmitting") : @tr("Hold here to talk"); color: Theme.text-primary; font-size: Math.max(11px, Theme.font-size * 0.875); horizontal-alignment: center; vertical-alignment: center; }
|
||||
HorizontalLayout {
|
||||
alignment: center; spacing: 10px;
|
||||
Symbol { kind: "mic"; ink: ptt-area.pressed ? Theme.success : Theme.text-secondary; width: 18px; height: 18px; y: (parent.height - self.height) / 2; }
|
||||
Text { text: ptt-area.pressed ? @tr("Microphone is transmitting") : @tr("Hold here to talk"); color: Theme.text-primary; font-size: Math.max(11px, Theme.font-size * 0.875); vertical-alignment: center; }
|
||||
}
|
||||
ptt-area := TouchArea {
|
||||
clicked => { ptt-focus.focus(); }
|
||||
changed pressed => { root.ptt-held(self.pressed); }
|
||||
|
|
@ -74,14 +126,13 @@ export component VoicePanel inherits Rectangle {
|
|||
changed has-focus => { if !self.has-focus { root.ptt-held(false); } }
|
||||
}
|
||||
}
|
||||
Text { text: root.activity-banner; color: Theme.success; font-size: Math.max(11px, Theme.font-size * 0.8125); height: 22px; }
|
||||
Text { text: root.joining ? @tr("Joining voice…") : root.activity-banner; color: root.joining ? Theme.text-muted : Theme.success; font-size: Math.max(11px, Theme.font-size * 0.8125); height: 22px; horizontal-alignment: center; }
|
||||
HorizontalLayout {
|
||||
spacing: 10px;
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
ActionButton { text: root.mic-enabled ? @tr("Mute microphone") : @tr("Unmute microphone"); danger: !root.mic-enabled; clicked => { root.toggle-mic(); } }
|
||||
ActionButton { text: root.deafened ? @tr("Undeafen") : @tr("Deafen"); danger: root.deafened; clicked => { root.toggle-deafen(); } }
|
||||
ActionButton { text: @tr("Leave room"); danger: true; clicked => { root.leave-voice(); } }
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
alignment: center; spacing: 14px;
|
||||
RoundControl { icon: root.mic-enabled ? "mic" : "mic-off"; off: !root.mic-enabled; tooltip: root.mic-enabled ? @tr("Mute microphone") : @tr("Unmute microphone"); clicked => { root.toggle-mic(); } }
|
||||
RoundControl { icon: root.deafened ? "headphone-off" : "headphones"; off: root.deafened; tooltip: root.deafened ? @tr("Undeafen") : @tr("Deafen"); clicked => { root.toggle-deafen(); } }
|
||||
RoundControl { icon: "screen-share"; tooltip: @tr("Screen preview"); clicked => { root.preview-screen(); } }
|
||||
RoundControl { icon: "phone-off"; leave: true; tooltip: @tr("Leave room"); clicked => { root.leave-voice(); } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue