From 632d56737bf64fb8b0f7e3a207de06d06b5cf04e42ad360bdf4da5b406a4e5cd Mon Sep 17 00:00:00 2001 From: AidarKC Date: Tue, 1 Sep 2026 15:24:39 +0400 Subject: [PATCH] =?UTF-8?q?UI:=20=D0=B4=D0=BE=D1=80=D0=B0=D0=B1=D0=BE?= =?UTF-8?q?=D1=82=D0=B0=D1=82=D1=8C=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB?= =?UTF-8?q?=D1=8C=20=D0=B8=20=D1=81=D0=B2=D1=8F=D0=B7=D0=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- VERSION.properties | 2 +- .../assets/shine-status-not-interested.svg | 5 + shine-UI/js/pages/profile-edit-view.js | 161 ++++++++++++------ shine-UI/js/pages/profile-view.js | 59 +++---- shine-UI/js/pages/user-profile-view.js | 15 +- shine-UI/js/services/user-connections.js | 9 +- shine-UI/js/services/user-profile-params.js | 73 +++++--- shine-UI/styles/components.css | 31 ++++ 8 files changed, 240 insertions(+), 115 deletions(-) create mode 100644 shine-UI/assets/shine-status-not-interested.svg diff --git a/VERSION.properties b/VERSION.properties index 46011b76..a9da8404 100644 --- a/VERSION.properties +++ b/VERSION.properties @@ -1,2 +1,2 @@ -client.version=1.10.1 +client.version=1.10.2 server.version=1.8.1 diff --git a/shine-UI/assets/shine-status-not-interested.svg b/shine-UI/assets/shine-status-not-interested.svg new file mode 100644 index 00000000..fe3cc6be --- /dev/null +++ b/shine-UI/assets/shine-status-not-interested.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/shine-UI/js/pages/profile-edit-view.js b/shine-UI/js/pages/profile-edit-view.js index 26828c56..0ac428c0 100644 --- a/shine-UI/js/pages/profile-edit-view.js +++ b/shine-UI/js/pages/profile-edit-view.js @@ -5,10 +5,15 @@ import { PROFILE_GENDER_FEMALE, PROFILE_GENDER_MALE, PROFILE_GENDER_UNKNOWN, + PROFILE_ACCOUNT_ROLE_PRIMARY, + PROFILE_ACCOUNT_ROLE_NON_VOTING, + PROFILE_SHINE_SHINING, + PROFILE_SHINE_UNKNOWN, + PROFILE_SHINE_NOT_INTERESTED, loadProfileSnapshot, saveProfileGender, saveProfileParamBlock, - saveProfileToggle, + saveProfileStatus, } from '../services/user-profile-params.js'; import { buildIdentityLines, loadUserProfileCard } from '../services/user-connections.js'; import { openAvatarWizard } from '../components/avatar-wizard.js'; @@ -16,8 +21,17 @@ import { renderUserAvatar } from '../components/avatar-image.js'; export const pageMeta = { id: 'profile-edit-view', title: 'Редактирование профиля' }; -function toggleText(enabled) { - return enabled ? 'Yes' : 'No'; +function accountRoleLabel(value) { + if (value === PROFILE_ACCOUNT_ROLE_PRIMARY) return 'Основной аккаунт'; + if (value === PROFILE_ACCOUNT_ROLE_NON_VOTING) return 'Не учитывать мой голос'; + return 'Не указано'; +} + +function shineStatusLabel(value) { + if (value === PROFILE_SHINE_SHINING) return 'Сияющий'; + if (value === PROFILE_SHINE_NOT_INTERESTED) return 'Сияние неинтересно'; + if (value === PROFILE_SHINE_UNKNOWN) return 'Неизвестно'; + return 'Не указано'; } function showLocalErrorAlert(prefix, error) { @@ -119,8 +133,8 @@ export function render({ navigate, chrome }) { const badgesRow = document.createElement('div'); badgesRow.className = 'row'; badgesRow.innerHTML = ` - - + + `; const status = document.createElement('div'); @@ -142,13 +156,14 @@ export function render({ navigate, chrome }) { `; const reloadBtn = topRow.querySelector('[data-reload="true"]'); - const officialBtn = badgesRow.querySelector('[data-toggle="official"]'); - const shineBtn = badgesRow.querySelector('[data-toggle="shine"]'); + const accountRoleBtn = badgesRow.querySelector('[data-status="account_role"]'); + const shineBtn = badgesRow.querySelector('[data-status="shine"]'); const addRelativeBtn = relativesCard.querySelector('[data-add-relative="true"]'); const avatarActionEl = topRow.querySelector('[data-change-avatar="true"]'); let currentFields = []; - let currentToggles = []; + let currentAccountRole = ''; + let currentShineStatus = ''; let currentGender = PROFILE_GENDER_UNKNOWN; let currentAvatar = { value: '', source: '', txId: '', sha256Hex: '', timeMs: 0 }; const identityEl = topRow.querySelector('[data-profile-identity="true"]'); @@ -233,50 +248,76 @@ export function render({ navigate, chrome }) { })); } - function updateToggleButton(button, prefix, enabled) { - button.textContent = `${prefix}: ${toggleText(enabled)}`; - button.classList.remove('is-no', 'is-yes-official', 'is-yes-shine'); - - if (!enabled) { - button.classList.add('is-no'); - return; + function updateStatusesUi() { + if (accountRoleBtn) { + accountRoleBtn.textContent = `Аккаунт: ${accountRoleLabel(currentAccountRole)}`; + accountRoleBtn.classList.remove('is-no', 'is-yes-official', 'is-yes-shine', 'is-not-interested'); + accountRoleBtn.classList.add(currentAccountRole === PROFILE_ACCOUNT_ROLE_PRIMARY ? 'is-yes-official' : 'is-no'); } - - if (prefix === 'Официальный') { - button.classList.add('is-yes-official'); - } else { - button.classList.add('is-yes-shine'); + if (shineBtn) { + shineBtn.textContent = `Сияние: ${shineStatusLabel(currentShineStatus)}`; + shineBtn.classList.remove('is-no', 'is-yes-official', 'is-yes-shine', 'is-not-interested'); + if (currentShineStatus === PROFILE_SHINE_SHINING) shineBtn.classList.add('is-yes-shine'); + else if (currentShineStatus === PROFILE_SHINE_NOT_INTERESTED) shineBtn.classList.add('is-not-interested'); + else shineBtn.classList.add('is-no'); } } - function updateTogglesUi() { - const official = currentToggles.find((item) => item.key === 'official') || { enabled: false }; - const shine = currentToggles.find((item) => item.key === 'shine') || { enabled: false }; - updateToggleButton(officialBtn, 'Официальный', official.enabled); - updateToggleButton(shineBtn, 'Сияющий', shine.enabled); - } - function updateGenderUi() { const genderValueEl = listWrap.querySelector('[data-gender-value]'); if (!genderValueEl) return; genderValueEl.textContent = genderLabel(currentGender); } - function openFieldEditModal({ label, value, placeholder = '' }) { + function openStatusPickerModal({ title, value, options }) { + const root = document.getElementById('modal-root'); + if (!root) return Promise.resolve(null); + root.innerHTML = ` + `; + return new Promise((resolve) => { + const modal = root.querySelector('#profile-status-modal'); + const selectEl = root.querySelector('#profile-status-select'); + const close = (next = null) => { root.innerHTML = ''; resolve(next); }; + modal?.addEventListener('click', (event) => { if (event.target === modal) close(null); }); + root.querySelector('#profile-status-cancel')?.addEventListener('click', () => close(null)); + root.querySelector('#profile-status-save')?.addEventListener('click', () => close(selectEl?.value || null)); + window.setTimeout(() => selectEl?.focus(), 0); + }); + } + + function openFieldEditModal({ label, value, placeholder = '', maxLength = 300, multiline = false }) { const root = document.getElementById('modal-root'); if (!root) return Promise.resolve(null); root.innerHTML = `