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:
Loki 2026-10-24 14:23:48 +02:00
parent 44d284a568
commit 8e5ab56611
Signed by: boba
GPG key ID: 253067914055423B
276 changed files with 53546 additions and 3399 deletions

View file

@ -0,0 +1,147 @@
import { AvatarView } from "../avatar-view.slint";
import { Theme, ActionButton } from "../theme.slint";
import { ThemeInput, ThemeEditor } from "../controls.slint";
export component IdentitySettings inherits Rectangle {
in property <image> own-avatar;
in property <bool> has-avatar;
in property <string> avatar-error;
callback choose-avatar();
callback remove-avatar();
in-out property <string> identity-pubkey;
in-out property <bool> vault-enabled;
in-out property <bool> passphrase-modal-open;
in-out property <string> passphrase-input;
in-out property <string> passphrase-confirm;
in-out property <string> passphrase-error;
in-out property <bool> export-modal-open;
in-out property <string> export-pass-input;
in-out property <string> export-pass-confirm;
in-out property <string> export-output;
in-out property <string> export-error;
in-out property <bool> import-modal-open;
in-out property <string> import-keyfile-input;
in-out property <string> import-pass-input;
in-out property <string> import-error;
private property <bool> confirm-remove;
callback set-passphrase(string, string);
callback remove-passphrase();
callback export-keyfile(string, string);
callback import-keyfile(string, string);
VerticalLayout {
spacing: 0; alignment: start;
Text { text: "Фото профиля"; color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: "Выбери изображение и обрежь его под аватар."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 18px; }
HorizontalLayout {
spacing: 20px;
AvatarView { width: 82px; height: 82px; source: root.own-avatar; has-source: root.has-avatar; initials: "Фото"; mask: Theme.bg-base; }
VerticalLayout {
spacing: 9px; alignment: center;
HorizontalLayout {
spacing: 9px;
ActionButton { text: root.has-avatar ? "Изменить фото" : "Выбрать фото"; clicked => { root.choose-avatar(); } }
if root.has-avatar : ActionButton { text: "Удалить"; quiet: true; danger: true; clicked => { root.remove-avatar(); } }
Rectangle { horizontal-stretch: 1; }
}
Text { text: "Пока хранится только на этом устройстве."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 4px, 11px); wrap: word-wrap; }
}
}
Rectangle { height: 26px; }
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 24px; }
Text { text: "Твой ключ"; color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: "Открытый ключ определяет твой профиль. Им можно поделиться; секретный ключ остаётся на устройстве."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 16px; }
ThemeEditor { text: root.identity-pubkey; read-only: true; height: 78px; }
if root.avatar-error != "" : Text { text: root.avatar-error; color: Theme.danger; font-size: Math.max(11px, Theme.font-size - 3px); wrap: word-wrap; }
Rectangle { height: 28px; }
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 24px; }
HorizontalLayout {
Text { text: "Защита на устройстве"; color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; horizontal-stretch: 1; }
Text { text: root.vault-enabled ? "● Защищено паролем" : "Без пароля"; color: root.vault-enabled ? Theme.success : Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); vertical-alignment: center; }
}
Rectangle { height: 6px; }
Text { text: root.vault-enabled ? "При запуске Vnox потребуется пароль для доступа к ключам." : "Добавь пароль, чтобы зашифровать сохранённый секретный ключ."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 15px; }
HorizontalLayout {
spacing: 9px;
ActionButton {
text: root.vault-enabled ? "Изменить пароль" : "Добавить пароль";
clicked => { root.passphrase-modal-open = !root.passphrase-modal-open; root.export-modal-open = false; root.import-modal-open = false; }
}
if root.vault-enabled : ActionButton { text: "Убрать пароль"; danger: true; quiet: true; clicked => { root.confirm-remove = true; } }
Rectangle { horizontal-stretch: 1; }
}
if root.confirm-remove : VerticalLayout {
spacing: 10px; alignment: start;
Text { text: "Ключ будет сохранён без шифрования. Убрать пароль?"; color: Theme.danger; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Отмена"; quiet: true; clicked => { root.confirm-remove = false; } }
ActionButton { text: "Убрать пароль"; danger: true; clicked => { root.remove-passphrase(); root.confirm-remove = false; } }
Rectangle { horizontal-stretch: 1; }
}
}
if root.passphrase-modal-open : VerticalLayout {
spacing: 10px; alignment: start;
Rectangle { height: 8px; }
ThemeInput { input-type: InputType.password; text <=> root.passphrase-input; placeholder-text: "Новый пароль · минимум 8 символов"; }
ThemeInput { input-type: InputType.password; text <=> root.passphrase-confirm; placeholder-text: "Повтори пароль"; accepted => { root.set-passphrase(root.passphrase-input, root.passphrase-confirm); } }
if root.passphrase-error != "" : Text { text: root.passphrase-error; color: Theme.danger; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Сохранить пароль"; active: true; clicked => { root.set-passphrase(root.passphrase-input, root.passphrase-confirm); } }
ActionButton { text: "Свернуть"; quiet: true; clicked => { root.passphrase-modal-open = false; } }
Rectangle { horizontal-stretch: 1; }
}
}
Rectangle { height: 28px; }
Rectangle { height: 1px; background: Theme.border; }
Rectangle { height: 24px; }
Text { text: "Резервная копия"; color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: "Сохрани ключи в безопасном месте, чтобы восстановить профиль на другом устройстве."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 15px; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Экспортировать ключи"; clicked => { root.export-modal-open = !root.export-modal-open; root.passphrase-modal-open = false; root.import-modal-open = false; } }
ActionButton { text: "Импортировать"; quiet: true; clicked => { root.import-modal-open = !root.import-modal-open; root.passphrase-modal-open = false; root.export-modal-open = false; } }
Rectangle { horizontal-stretch: 1; }
}
if root.export-modal-open : VerticalLayout {
spacing: 10px; alignment: start;
Rectangle { height: 8px; }
Text { text: "Пароль резервной копии можно оставить пустым. Такая копия содержит секретный ключ без защиты."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
ThemeInput { input-type: InputType.password; text <=> root.export-pass-input; placeholder-text: "Пароль копии · необязательно"; }
ThemeInput { input-type: InputType.password; text <=> root.export-pass-confirm; placeholder-text: "Повтори пароль копии"; }
if root.export-error != "" : Text { text: root.export-error; color: Theme.danger; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Создать копию"; active: true; clicked => { root.export-keyfile(root.export-pass-input, root.export-pass-confirm); } }
ActionButton { text: "Свернуть"; quiet: true; clicked => { root.export-modal-open = false; } }
Rectangle { horizontal-stretch: 1; }
}
if root.export-output != "" : VerticalLayout {
spacing: 8px;
Text { text: "Скопируй содержимое в файл и сохрани отдельно от устройства."; color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
ThemeEditor { text: root.export-output; read-only: true; height: 180px; }
}
}
if root.import-modal-open : VerticalLayout {
spacing: 10px; alignment: start;
Rectangle { height: 8px; }
Text { text: "Импорт заменит сохранённый профиль. Сначала сделай резервную копию текущих ключей."; color: Theme.danger; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
ThemeEditor { text <=> root.import-keyfile-input; height: 150px; }
ThemeInput { input-type: InputType.password; text <=> root.import-pass-input; placeholder-text: "Пароль резервной копии, если он задан"; }
if root.import-error != "" : Text { text: root.import-error; color: Theme.danger; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: "Импортировать и заменить"; danger: true; clicked => { root.import-keyfile(root.import-keyfile-input, root.import-pass-input); } }
ActionButton { text: "Свернуть"; quiet: true; clicked => { root.import-modal-open = false; } }
Rectangle { horizontal-stretch: 1; }
}
}
Rectangle { height: 28px; }
}
}