VNOX-Client/src/ui/slint/settings/identity.slint
loki5512344 220af2d6a4
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.
2026-10-25 10:28:02 +01:00

147 lines
10 KiB
Text

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: @tr("Profile photo"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: @tr("Choose an image and crop it for your avatar."); 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: @tr("Photo"); mask: Theme.bg-base; }
VerticalLayout {
spacing: 9px; alignment: center;
HorizontalLayout {
spacing: 9px;
ActionButton { text: root.has-avatar ? @tr("Change photo") : @tr("Choose photo"); clicked => { root.choose-avatar(); } }
if root.has-avatar : ActionButton { text: @tr("Delete"); quiet: true; danger: true; clicked => { root.remove-avatar(); } }
Rectangle { horizontal-stretch: 1; }
}
Text { text: @tr("Currently stored only on this device."); 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: @tr("Your key"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: @tr("Your public key identifies your profile. You can share it; your secret key stays on this device."); 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: @tr("Device security"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; horizontal-stretch: 1; }
Text { text: root.vault-enabled ? @tr("Passphrase protected") : @tr("No passphrase"); 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 ? @tr("Vnox will ask for your passphrase to unlock your keys on startup.") : @tr("Add a passphrase to encrypt your saved secret key."); 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 ? @tr("Change passphrase") : @tr("Add passphrase");
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: @tr("Remove passphrase"); danger: true; quiet: true; clicked => { root.confirm-remove = true; } }
Rectangle { horizontal-stretch: 1; }
}
if root.confirm-remove : VerticalLayout {
spacing: 10px; alignment: start;
Text { text: @tr("Your key will be stored without encryption. Remove the passphrase?"); color: Theme.danger; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: @tr("Cancel"); quiet: true; clicked => { root.confirm-remove = false; } }
ActionButton { text: @tr("Remove passphrase"); 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: @tr("New passphrase · at least 8 characters"); }
ThemeInput { input-type: InputType.password; text <=> root.passphrase-confirm; placeholder-text: @tr("Repeat passphrase"); 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: @tr("Save passphrase"); active: true; clicked => { root.set-passphrase(root.passphrase-input, root.passphrase-confirm); } }
ActionButton { text: @tr("Collapse"); 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: @tr("Backup"); color: Theme.text-primary; font-size: Theme.font-size + 2px; font-weight: 600; }
Text { text: @tr("Keep your keys in a safe place to restore your profile on another device."); color: Theme.text-muted; font-size: Math.max(Theme.font-size - 3px, 11px); wrap: word-wrap; }
Rectangle { height: 15px; }
HorizontalLayout {
spacing: 9px;
ActionButton { text: @tr("Export keys"); clicked => { root.export-modal-open = !root.export-modal-open; root.passphrase-modal-open = false; root.import-modal-open = false; } }
ActionButton { text: @tr("Import"); 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: @tr("The backup passphrase is optional. Without it, your backup contains an unprotected secret key."); 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: @tr("Backup passphrase · optional"); }
ThemeInput { input-type: InputType.password; text <=> root.export-pass-confirm; placeholder-text: @tr("Repeat backup passphrase"); }
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: @tr("Create backup"); active: true; clicked => { root.export-keyfile(root.export-pass-input, root.export-pass-confirm); } }
ActionButton { text: @tr("Collapse"); quiet: true; clicked => { root.export-modal-open = false; } }
Rectangle { horizontal-stretch: 1; }
}
if root.export-output != "" : VerticalLayout {
spacing: 8px;
Text { text: @tr("Copy this content into a file and keep it separately from this device."); 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: @tr("Importing replaces your saved profile. Back up your current keys first."); 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: @tr("Backup passphrase, if set"); }
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: @tr("Import and replace"); danger: true; clicked => { root.import-keyfile(root.import-keyfile-input, root.import-pass-input); } }
ActionButton { text: @tr("Collapse"); quiet: true; clicked => { root.import-modal-open = false; } }
Rectangle { horizontal-stretch: 1; }
}
}
Rectangle { height: 28px; }
}
}