From 9ea276ba77e81b5fc102c6a707ff64a8b0d8dedf48f1b12dc897ca3ce64fefdb Mon Sep 17 00:00:00 2001 From: q Date: Mon, 12 Oct 2026 09:37:32 +0300 Subject: [PATCH] =?UTF-8?q?UI:=20=D1=81=D0=B8=D1=8F=D0=BD=D0=B8=D0=B5=20?= =?UTF-8?q?=D0=B2=20=D0=BF=D1=80=D0=BE=D1=84=D0=B8=D0=BB=D0=B5,=20=D1=81?= =?UTF-8?q?=D0=B2=D1=8F=D0=B7=D1=8C=20=D0=B1=D0=B5=D0=B7=20=D1=81=D0=B4?= =?UTF-8?q?=D0=B2=D0=B8=D0=B3=D0=B0=20=D1=8D=D0=BA=D1=80=D0=B0=D0=BD=D0=B0?= =?UTF-8?q?,=20=D0=B0=D0=B2=D0=B0=D1=82=D0=B0=D1=80=D1=8B=20=D0=BA=D0=B0?= =?UTF-8?q?=D0=BD=D0=B0=D0=BB=D0=BE=D0=B2=20=D0=B1=D0=B5=D0=B7=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BB=D1=8C=D1=86=D0=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Профиль: золотая «дышащая» аура вокруг аватара сияющего, бейджи «Сияющий» / «Официальный» под именем, разделы «Сияние» и «Официальный аккаунт» со списками «кто подтвердил» и «кого подтвердил» (видны у сияющих и у всех, у кого есть подтверждения). - Кнопки подтверждения на экране связи – по тем же правилам, что проверяет сервер (голосует основной аккаунт, за сияние – основной и сияющий; цель не отказалась). - Экран связи: сохранение показывается на нажатой кнопке, без строки «Сохранение…», которая сдвигала экран; после выбора – сообщение и возврат на страницу пользователя. - В каналах и обсуждениях аватары без стеклянного кольца «Связей» (готовый avatar-plain). - Локальный сервер UI отдаёт Cache-Control: no-cache – иначе браузер брал старый router.js. --- scripts/local_spa_server.py | 6 ++ shine-UI/js/components/profile-card.js | 86 +++++++++++------- shine-UI/js/pages/channel-about-view.js | 6 +- shine-UI/js/pages/channel-thread-view.js | 12 +-- shine-UI/js/pages/channel-view.js | 4 +- shine-UI/js/pages/profile-view.js | 1 + shine-UI/js/pages/user-profile-view.js | 1 + .../js/pages/user-relation-manage-view.js | 61 +++++++++---- shine-UI/styles/features/profile-page.css | 91 +++++++------------ shine-UI/styles/features/profile.css | 2 - 10 files changed, 150 insertions(+), 120 deletions(-) diff --git a/scripts/local_spa_server.py b/scripts/local_spa_server.py index 0199eeab..370edea1 100644 --- a/scripts/local_spa_server.py +++ b/scripts/local_spa_server.py @@ -14,6 +14,12 @@ class SpaHandler(SimpleHTTPRequestHandler): rel = Path(translated).relative_to(Path.cwd()) return str(ROOT / rel) + def end_headers(self): + # Локальная разработка: модули без версии в адресе (./router.js) иначе берутся из эвристического + # кэша браузера – новый app.js встречается со старым router.js и приложение не стартует. + self.send_header("Cache-Control", "no-cache") + super().end_headers() + def do_GET(self): file_path = Path(self.translate_path(self.path.split("?", 1)[0])) if file_path.exists() and file_path.is_file(): diff --git a/shine-UI/js/components/profile-card.js b/shine-UI/js/components/profile-card.js index 3d91a2a5..25e0c60a 100644 --- a/shine-UI/js/components/profile-card.js +++ b/shine-UI/js/components/profile-card.js @@ -12,29 +12,35 @@ export function escapeProfileHtml(text) { const esc = escapeProfileHtml; -function statusCardHtml({ kind, title, received, given }) { +// Раздел статуса («Сияние», «Официальный»): кто подтвердил этот аккаунт и кого подтвердил он сам. +function statusSectionHtml({ kind, title, received, given, receivedLabel, givenLabel }) { const receivedCount = Number(received || 0); const givenCount = Number(given || 0); const isOfficial = kind === 'primary'; - const receivedKind = isOfficial ? 'primary_received' : 'shine_received'; - const givenKind = isOfficial ? 'primary_given' : 'shine_given'; - const receivedTitle = isOfficial ? 'Кто подтвердил этот официальный аккаунт' : 'Кто подтвердил, что этот аккаунт сияющий'; - const givenTitle = isOfficial ? 'Какие официальные аккаунты подтвердил этот пользователь' : 'Кого этот пользователь подтвердил как сияющего'; - return ` -
-
${esc(title)}
- - +
+ +
`; } +function peopleCount(count) { + if (!count) return 'Пока никого'; + const mod10 = count % 10; + const mod100 = count % 100; + const word = mod10 === 1 && mod100 !== 11 ? 'человек' : (mod10 >= 2 && mod10 <= 4 && (mod100 < 12 || mod100 > 14)) ? 'человека' : 'человек'; + return `${count} ${word}`; +} + function statHtml({ kind, label, valueHtml, ariaLabel }) { return ` `).join(''); } -function officialBlockHtml(flags = {}) { +function officialBlockHtml(flags = {}, targetIsOfficial = false) { return `
Основной аккаунт - Этот аккаунт — основной + ${targetIsOfficial ? 'Этот аккаунт отмечен как основной' : 'Подтвердите, если это основной аккаунт этого человека'}
${flags.outOfficialAccount ? '
✓ Вы подтвердили его основной аккаунт
' : ''} @@ -79,12 +81,12 @@ function officialBlockHtml(flags = {}) {
`; } -function shineBlockHtml(flags = {}) { +function shineBlockHtml(flags = {}, targetIsShining = false) { return `
Сияющий - Этот аккаунт — сияющий + ${targetIsShining ? 'Этот человек отмечен как сияющий' : 'Подтвердите, если считаете этого человека сияющим'}
${flags.outShineConfirmed ? '
✓ Вы подтверждаете его сияющим
' : ''} @@ -152,8 +154,11 @@ export function render({ route, chrome }) { } function renderBody() { - const canPrimary = selfCard?.accountRole === 'primary' && targetCard?.accountRole === 'primary'; - const canShine = selfCard?.shineStatus === 'shining' && targetCard?.shineStatus === 'shining'; + // Те же правила, что проверяет сервер (validateConnectionVotingRights): голосует основной аккаунт, + // за сияние – основной и сам сияющий; цель не должна отказываться от подтверждений. + const selfPrimary = selfCard?.accountRole === 'primary'; + const canPrimary = selfPrimary && targetCard?.accountRole !== 'non_voting'; + const canShine = selfPrimary && selfCard?.shineStatus === 'shining' && targetCard?.shineStatus !== 'not_interested'; body.innerHTML = `
- ${canPrimary ? officialBlockHtml(flags) : ''} - ${canShine ? shineBlockHtml(flags) : ''} + ${canPrimary ? officialBlockHtml(flags, targetCard?.accountRole === 'primary') : ''} + ${canShine ? shineBlockHtml(flags, targetCard?.shineStatus === 'shining') : ''} `; } async function refresh({ loading = true } = {}) { - if (loading) { - status.className = 'status-line relation-manage-status'; - status.textContent = 'Загрузка...'; - } + // «Загрузка…» – только если ответ задержался, иначе строка мелькает и сдвигает экран. + const loadingTimer = loading ? window.setTimeout(() => { + if (screen.isConnected && !body.childElementCount) status.textContent = 'Загрузка…'; + }, 500) : 0; [selfCard, targetCard, flags] = await Promise.all([ loadUserProfileCard(selfLogin), loadUserProfileCard(targetLogin), loadRelationsForPair({ currentLogin: selfLogin, targetLogin }), ]); + window.clearTimeout(loadingTimer); renderBody(); status.className = 'status-line relation-manage-status'; status.textContent = ''; } + const SOCIAL_DONE = { + none: 'Связь убрана', + contact: 'Добавлен в контакты', + friend: 'Добавлен в друзья', + close_friend: 'Добавлен в близкие друзья', + }; + + // Выбор сохраняется прямо на нажатой кнопке (без строки статуса, которая сдвигала экран), + // после сохранения – короткое сообщение и возврат на страницу пользователя. body.addEventListener('click', async (event) => { const button = event.target.closest('button'); if (!button || busy) return; @@ -193,24 +208,36 @@ export function render({ route, chrome }) { const social = button.dataset.socialKind; const confirm = button.dataset.confirm; if (!social && !confirm) return; + if (social && effectiveSocial(flags, 'out') === social) { navigateBack(); return; } busy = true; body.classList.add('is-busy'); - status.className = 'status-line relation-manage-status'; - status.textContent = 'Сохранение...'; + body.querySelectorAll('button').forEach((item) => { item.disabled = true; }); + const label = button.textContent; + button.classList.add('is-pending'); + button.textContent = 'Сохраняем…'; try { + let done = ''; if (social) { await changeSocial(social); + done = SOCIAL_DONE[social] || 'Связь сохранена'; } else if (confirm === 'official_account') { await setKind('official_account', !flags.outOfficialAccount); + done = flags.outOfficialAccount ? 'Подтверждение убрано' : 'Вы подтвердили официальный аккаунт'; } else if (confirm === 'shine_confirmed') { await setKind('shine_confirmed', !flags.outShineConfirmed); + done = flags.outShineConfirmed ? 'Подтверждение убрано' : 'Вы подтвердили сияние'; } - await refresh({ loading: false }); + if (!screen.isConnected) return; + showToast(done); + navigateBack(); } catch (error) { - status.className = 'status-line relation-manage-status is-unavailable'; - status.textContent = `Ошибка: ${error?.message || 'Не удалось изменить связь'}`; + if (!screen.isConnected) return; + showToast(toUserMessage(error, 'Не удалось изменить связь'), { kind: 'error', timeoutMs: 4000 }); + button.textContent = label; + button.classList.remove('is-pending'); + body.querySelectorAll('button').forEach((item) => { item.disabled = false; }); } finally { busy = false; body.classList.remove('is-busy'); diff --git a/shine-UI/styles/features/profile-page.css b/shine-UI/styles/features/profile-page.css index 7d54b303..ba715e9e 100644 --- a/shine-UI/styles/features/profile-page.css +++ b/shine-UI/styles/features/profile-page.css @@ -6,57 +6,6 @@ .user-profile-screen .user-profile-status:empty { display: none; } .user-profile-screen .pf-hero { display: grid; justify-items: center; gap: var(--space-1); text-align: center; } -.user-profile-screen .pf-identity { - width: min(100%, 420px); - display: grid; - grid-template-columns: minmax(72px, 1fr) 96px minmax(72px, 1fr); - align-items: center; - gap: 10px; -} -.user-profile-screen .pf-status-card-slot { min-width: 0; display: grid; align-items: center; } -.user-profile-screen .pf-status-card-slot--left { justify-items: end; } -.user-profile-screen .pf-status-card-slot--right { justify-items: start; } -.user-profile-screen .pf-status-card { - width: min(100%, 106px); - aspect-ratio: 1; - display: grid; - grid-template-rows: auto minmax(0, 1fr) minmax(0, 1fr); - border: 1px solid var(--border-subtle); - border-radius: var(--radius-lg); - background: var(--surface); - overflow: hidden; -} -.user-profile-screen .pf-status-card--primary { border-color: color-mix(in srgb, var(--rel-family) 55%, var(--border-subtle)); } -.user-profile-screen .pf-status-card--shine { border-color: color-mix(in srgb, var(--rel-shining) 55%, var(--border-subtle)); } -.user-profile-screen .pf-status-card-title { - min-height: 27px; - padding: 7px 5px 5px; - display: grid; - place-items: center; - color: var(--text-primary); - font-size: 11px; - line-height: 1.1; - font-weight: var(--weight-bold); -} -.user-profile-screen .pf-status-card-count { - min-width: 0; - padding: 3px 2px; - display: grid; - place-items: center; - align-content: center; - gap: 0; - border: 0; - border-top: 1px solid var(--border-subtle); - background: transparent; - color: var(--text-primary); - font: inherit; - cursor: pointer; -} -.user-profile-screen .pf-status-card-count:hover, -.user-profile-screen .pf-status-card-count:active { background: var(--surface-selected); } -.user-profile-screen .pf-status-card-count:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: -2px; } -.user-profile-screen .pf-status-card-count strong { font-size: var(--text-md); line-height: 1.05; font-weight: var(--weight-bold); } -.user-profile-screen .pf-status-card-count span { color: var(--text-secondary); font-size: 9px; line-height: 1.05; } .user-profile-screen .pf-avatar { position: relative; width: 96px; height: 96px; display: grid; place-items: center; justify-self: center; } .user-profile-screen .pf-avatar .user-profile-hero-avatar.avatar, .user-profile-screen .pf-avatar .user-profile-hero-avatar.avatar-image { width: 96px; height: 96px; min-width: 96px; min-height: 96px; font-size: 36px; } @@ -64,17 +13,45 @@ .user-profile-screen .pf-avatar .user-profile-hero-avatar.avatar-framed > .avatar-photo { width: 100%; height: 100%; } .user-profile-screen .pf-avatar .user-profile-hero-avatar.avatar-framed::after, .user-profile-screen .pf-avatar .user-profile-hero-avatar.avatar-glow::before { content: none; } +/* Сияющий: тёплая золотая аура вокруг аватара, медленно «дышит» – как сияние знака на заставке. */ +.user-profile-screen .pf-avatar.is-shining { isolation: isolate; } +.user-profile-screen .pf-avatar.is-shining::before { + content: ""; + position: absolute; + inset: -30%; + z-index: -1; + border-radius: 50%; + background: radial-gradient(closest-side, color-mix(in srgb, var(--warning) 46%, transparent) 55%, color-mix(in srgb, var(--warning) 16%, transparent) 78%, transparent); + filter: blur(8px); + animation: pf-shine-breathe 5.3s ease-in-out infinite; + pointer-events: none; +} +.user-profile-screen .pf-avatar.is-shining .user-profile-hero-avatar { box-shadow: 0 0 0 2px color-mix(in srgb, var(--warning) 85%, transparent); border-radius: 50%; } +@keyframes pf-shine-breathe { + 0%, 100% { opacity: 0.7; transform: scale(0.96); } + 50% { opacity: 1; transform: scale(1.04); } +} +@media (prefers-reduced-motion: reduce) { .user-profile-screen .pf-avatar.is-shining::before { animation: none; } } + +.user-profile-screen .pf-badges { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-1); margin-top: var(--space-1); } +.user-profile-screen .pf-badge { + padding: 3px 10px; + border-radius: 999px; + font-size: var(--text-xs); + line-height: var(--leading-xs); + font-weight: var(--weight-bold); +} +.user-profile-screen .pf-badge--shine { color: var(--warning); background: color-mix(in srgb, var(--warning) 14%, transparent); } +.user-profile-screen .pf-badge--official { color: var(--accent); background: color-mix(in srgb, var(--accent) 12%, transparent); } +.user-profile-screen .pf-status-section .nav-list__title { margin-top: 0; } + .user-profile-screen .pf-name { margin: var(--space-2) 0 0; color: var(--text-primary); font-size: var(--text-xl); line-height: var(--leading-xl); font-weight: var(--weight-bold); overflow-wrap: anywhere; } .user-profile-screen .pf-login { color: var(--text-secondary); font-size: var(--text-sm); line-height: var(--leading-sm); } @media (max-width: 360px) { - .user-profile-screen .pf-identity { grid-template-columns: minmax(66px, 1fr) 88px minmax(66px, 1fr); gap: 7px; } .user-profile-screen .pf-avatar, .user-profile-screen .pf-avatar .user-profile-hero-avatar.avatar, .user-profile-screen .pf-avatar .user-profile-hero-avatar.avatar-image { width: 88px; height: 88px; min-width: 88px; min-height: 88px; } - .user-profile-screen .pf-status-card { width: min(100%, 96px); } - .user-profile-screen .pf-status-card-title { font-size: 10px; } - .user-profile-screen .pf-status-card-count span { font-size: 8px; } } .user-profile-screen .pf-stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); border: 1px solid var(--border-subtle); border-radius: var(--radius-lg); background: var(--surface); overflow: hidden; } @@ -144,7 +121,9 @@ .relation-manage-screen { gap: var(--space-3); } .relation-manage-status:empty { display: none; } .relation-manage-body { gap: var(--space-3); } -.relation-manage-body.is-busy { opacity: .72; pointer-events: none; } +.relation-manage-body.is-busy { pointer-events: none; } +.relation-manage-body.is-busy button:not(.is-pending) { opacity: .5; } +.relation-manage-body button.is-pending { border-color: var(--accent); color: var(--accent); opacity: 1; } .relation-manage-card { gap: var(--space-3); } .relation-manage-card-head { display: grid; gap: 2px; } .relation-manage-card-head > strong { color: var(--text-primary); font-size: var(--text-md); } diff --git a/shine-UI/styles/features/profile.css b/shine-UI/styles/features/profile.css index 2f912548..73ac4f78 100644 --- a/shine-UI/styles/features/profile.css +++ b/shine-UI/styles/features/profile.css @@ -760,8 +760,6 @@ .user-profile-avatar-slot { - grid-column: 2; - grid-row: 1 / 3; width: var(--user-profile-avatar-size); height: var(--user-profile-avatar-size); display: grid;