feat(client): redesign native UI, themes, settings and avatars
Separate conversation drafts and voice view state, add native settings and restricted CSS themes, implement validated avatar cropping, and refresh dependencies with documented desktop compatibility backports.
This commit is contained in:
parent
44d284a568
commit
8e5ab56611
276 changed files with 53546 additions and 3399 deletions
|
|
@ -1,98 +1,83 @@
|
|||
import { Theme } from "theme.slint";
|
||||
import { Theme, ActionButton } from "theme.slint";
|
||||
|
||||
export struct VoiceMemberItem {
|
||||
user_id: string,
|
||||
nickname: string,
|
||||
speaking: bool,
|
||||
}
|
||||
export struct VoiceMemberItem { user_id: string, nickname: string, speaking: bool, avatar_text: string }
|
||||
|
||||
export component VoicePanel {
|
||||
export component VoicePanel inherits Rectangle {
|
||||
in-out property <[VoiceMemberItem]> members;
|
||||
in-out property <bool> mic-enabled;
|
||||
in-out property <bool> deafened;
|
||||
in-out property <string> channel-name;
|
||||
in-out property <string> activity-banner;
|
||||
|
||||
in-out property <bool> push-to-talk;
|
||||
callback ptt-held(bool);
|
||||
callback toggle-mic();
|
||||
callback toggle-deafen();
|
||||
callback leave-voice();
|
||||
|
||||
background: Theme.bg-base;
|
||||
VerticalLayout {
|
||||
padding: 16px;
|
||||
spacing: 8px;
|
||||
|
||||
Text {
|
||||
text: "🔊 " + channel-name;
|
||||
color: Theme.text-primary;
|
||||
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; }
|
||||
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; }
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
}
|
||||
Text {
|
||||
text: activity-banner;
|
||||
color: Theme.text-muted;
|
||||
}
|
||||
Flickable {
|
||||
VerticalLayout {
|
||||
for m in members: Rectangle {
|
||||
height: 48px;
|
||||
HorizontalLayout {
|
||||
padding: 8px;
|
||||
spacing: 8px;
|
||||
Rectangle {
|
||||
width: 12px;
|
||||
height: 12px;
|
||||
border-radius: 6px;
|
||||
background: m.speaking ? Theme.success : Theme.text-muted;
|
||||
}
|
||||
Text {
|
||||
text: m.nickname;
|
||||
color: Theme.text-primary;
|
||||
VerticalLayout {
|
||||
padding: 24px; spacing: 16px;
|
||||
Text { text: root.members.length + " участников"; color: Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.8125); }
|
||||
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 ? "Говорит" : "В голосовой комнате"; color: member.speaking ? Theme.success : Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.75); }
|
||||
}
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
}
|
||||
if root.members.length == 0 : Text { text: "Подключение к голосовой комнате…"; color: Theme.text-muted; font-size: Math.max(11px, Theme.font-size * 0.875); }
|
||||
Rectangle { vertical-stretch: 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
HorizontalLayout {
|
||||
spacing: 8px;
|
||||
Rectangle {
|
||||
height: 32px;
|
||||
background: Theme.accent;
|
||||
border-radius: Theme.radius;
|
||||
TouchArea {
|
||||
clicked => { toggle-mic(); }
|
||||
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;
|
||||
accessible-role: button; accessible-label: "Удерживать для разговора";
|
||||
Text { text: ptt-area.pressed ? "Микрофон передаёт звук" : "Удерживай здесь, чтобы говорить"; color: Theme.text-primary; font-size: Math.max(11px, Theme.font-size * 0.875); horizontal-alignment: center; vertical-alignment: center; }
|
||||
ptt-area := TouchArea {
|
||||
clicked => { ptt-focus.focus(); }
|
||||
changed pressed => { root.ptt-held(self.pressed); }
|
||||
}
|
||||
Text {
|
||||
text: mic-enabled ? "Mute" : "Unmute";
|
||||
color: Theme.text-primary;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
ptt-focus := FocusScope {
|
||||
key-pressed(event) => { if event.text == " " { root.ptt-held(true); return accept; } return reject; }
|
||||
key-released(event) => { if event.text == " " { root.ptt-held(false); return accept; } return reject; }
|
||||
changed has-focus => { if !self.has-focus { root.ptt-held(false); } }
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
height: 32px;
|
||||
background: Theme.accent;
|
||||
border-radius: Theme.radius;
|
||||
TouchArea {
|
||||
clicked => { toggle-deafen(); }
|
||||
}
|
||||
Text {
|
||||
text: deafened ? "Undeafen" : "Deafen";
|
||||
color: Theme.text-primary;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
}
|
||||
Rectangle {
|
||||
height: 32px;
|
||||
background: Theme.danger;
|
||||
border-radius: Theme.radius;
|
||||
TouchArea {
|
||||
clicked => { leave-voice(); }
|
||||
}
|
||||
Text {
|
||||
text: "Leave";
|
||||
color: Theme.text-primary;
|
||||
horizontal-alignment: center;
|
||||
vertical-alignment: center;
|
||||
}
|
||||
Text { text: root.activity-banner; color: Theme.success; font-size: Math.max(11px, Theme.font-size * 0.8125); height: 22px; }
|
||||
HorizontalLayout {
|
||||
spacing: 10px;
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
ActionButton { text: root.mic-enabled ? "Выключить микрофон" : "Включить микрофон"; danger: !root.mic-enabled; clicked => { root.toggle-mic(); } }
|
||||
ActionButton { text: root.deafened ? "Включить звук" : "Выключить звук"; danger: root.deafened; clicked => { root.toggle-deafen(); } }
|
||||
ActionButton { text: "Покинуть комнату"; danger: true; clicked => { root.leave-voice(); } }
|
||||
Rectangle { horizontal-stretch: 1; }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue