Ускорить публикацию блоков в Arweave

This commit is contained in:
AidarKC
2026-10-03 16:39:35 +03:00
parent aca1e3054e
commit daa221a158
13 changed files with 629 additions and 240 deletions
+43 -14
View File
@@ -12,13 +12,27 @@ export function escapeProfileHtml(text) {
const esc = escapeProfileHtml;
function statusChip({ kind, label, value, active }) {
const n = Number(value || 0);
function statusCardHtml({ kind, title, received, given }) {
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 `
<button type="button" class="pf-status${active ? ' is-active' : ''}" data-profile-list="${esc(kind)}"
aria-label="${esc(label)}: подтверждений ${n}" title="Статус «${esc(label)}». Число – сколько людей его подтвердили. Нажмите, чтобы увидеть кто.">
<span class="pf-status-dot" aria-hidden="true"></span>${esc(label)}${n > 0 ? `<b>${n}</b>` : ''}
</button>`;
<section class="pf-status-card pf-status-card--${esc(kind)}" aria-label="${esc(title)}">
<div class="pf-status-card-title">${esc(title)}</div>
<button type="button" class="pf-status-card-count" data-profile-list="${receivedKind}"
aria-label="${esc(receivedTitle)}: ${receivedCount}" title="${esc(receivedTitle)}">
<strong>${receivedCount}</strong><span>подтвердили</span>
</button>
<button type="button" class="pf-status-card-count" data-profile-list="${givenKind}"
aria-label="${esc(givenTitle)}: ${givenCount}" title="${esc(givenTitle)}">
<strong>${givenCount}</strong><span>подтвердил</span>
</button>
</section>`;
}
function statHtml({ kind, label, valueHtml, ariaLabel }) {
@@ -75,19 +89,34 @@ export function profileCardHtml({ card, login = '', tilesHtml = '', tilesWrapCla
const listInner = aboutRow + contacts + pathRow;
const listHtml = listInner.trim() ? `<div class="pf-list">${listInner}</div>` : '';
const friends = Number(stats.friendsCount || 0);
const statusChips = [
(official || Number(stats.primaryReceivedCount || 0) > 0) && statusChip({ kind: 'primary_received', label: 'Официальный', value: stats.primaryReceivedCount, active: official }),
(shining || Number(stats.shineReceivedCount || 0) > 0) && statusChip({ kind: 'shine_received', label: 'Сияющий', value: stats.shineReceivedCount, active: shining }),
].filter(Boolean);
const statusesHtml = statusChips.length ? `<div class="pf-statuses">${statusChips.join('')}</div>` : '';
const closeFriends = Number(stats.closeFriendsCount || 0);
const officialCard = official
? statusCardHtml({
kind: 'primary',
title: 'Официальный',
received: stats.primaryReceivedCount,
given: stats.primaryGivenCount,
})
: '';
const shiningCard = shining
? statusCardHtml({
kind: 'shine',
title: 'Сияющий',
received: stats.shineReceivedCount,
given: stats.shineGivenCount,
})
: '';
return `
<div class="pf-hero${shining ? ' is-shining' : ''}" aria-label="Профиль ${esc(cardLogin)}">
<div class="pf-avatar user-profile-avatar-slot"></div>
<div class="pf-hero" aria-label="Профиль ${esc(cardLogin)}">
<div class="pf-identity">
<div class="pf-status-card-slot pf-status-card-slot--left">${officialCard}</div>
<div class="pf-avatar user-profile-avatar-slot"></div>
<div class="pf-status-card-slot pf-status-card-slot--right">${shiningCard}</div>
</div>
<h2 class="pf-name">${esc(displayName)}</h2>
<div class="pf-login">@${esc(cardLogin)}</div>
${statusesHtml}
</div>
<div class="pf-stats">
-6
View File
@@ -30,8 +30,6 @@ export function render({ navigate, chrome }) {
function renderProfile() {
if (!card) return;
const official = card.accountRole === 'primary';
const shining = card.shineStatus === 'shining';
body.innerHTML = profileCardHtml({
card,
login,
@@ -42,8 +40,6 @@ export function render({ navigate, chrome }) {
].join(''),
}) + `
<div class="nav-list profile-more-list">
<button class="nav-row" type="button" data-profile-list="primary_given"><span class="nav-row__label">Подтверждённые мной аккаунты</span><span class="nav-row__hint">Аккаунты, за которые вы поручились</span></button>
<button class="nav-row" type="button" data-profile-list="shine_given"><span class="nav-row__label">Отмеченные мной как сияющие</span></button>
<button class="nav-row" type="button" data-self-profile-action="profiles"><span class="nav-row__label">Сменить профиль</span><span class="nav-row__hint">Другие аккаунты на этом устройстве</span></button>
</div>`;
@@ -55,8 +51,6 @@ export function render({ navigate, chrome }) {
avatar: card.avatar,
size: 'xl',
className: 'user-profile-hero-avatar',
glow: shining,
official,
}));
status.textContent = '';
+4 -138
View File
@@ -1,8 +1,8 @@
import { createTopBar } from '../components/topbar.js';
import { SHINE_CONNECTIONS_LOGO_SRC } from '../components/shine-logo.js';
import { renderUserAvatar } from '../components/avatar-image.js';
import { authService, state } from '../state.js';
import { loadRelationsForPair, loadUserProfileCard } from '../services/user-connections.js';
import { state } from '../state.js';
import { loadUserProfileCard } from '../services/user-connections.js';
import { makeProfileLinksRoute } from '../services/shine-routes.js';
import { navigateBack } from '../router.js';
import { profileCardHtml, profileTileHtml } from '../components/profile-card.js';
@@ -18,27 +18,6 @@ function escapeHtml(text) {
.replaceAll("'", '&#39;');
}
function effectiveSocial(flags = {}) {
if (flags.outCloseFriend) return 'close_friend';
if (flags.outFriend) return 'friend';
if (flags.outContact) return 'contact';
return 'none';
}
function relationMenuHtml(flags = {}) {
const current = effectiveSocial(flags);
const rows = [
['friend', 'Друг'],
['close_friend', 'Близкий друг'],
['contact', 'Контакт'],
];
return rows.map(([kind, label]) => `
<button type="button" class="user-profile-add-option${current === kind ? ' is-current' : ''}" data-relation-kind="${kind}">
<span>${escapeHtml(label)}</span>
<span class="user-profile-add-option-check" aria-hidden="true">${current === kind ? '✓' : ''}</span>
</button>`).join('');
}
export function render({ navigate, route, chrome }) {
const requestedLogin = String(route?.params?.login || '').trim();
const selfLogin = String(state.session.login || '').trim();
@@ -61,80 +40,16 @@ export function render({ navigate, route, chrome }) {
screen.append(status, body);
let card = null;
let relationFlags = null;
let relationLoadPromise = null;
let addMenu = null;
let addActionButton = null;
function updateRelationUi() {
if (!addMenu) return;
addMenu.innerHTML = relationMenuHtml(relationFlags || {});
const social = effectiveSocial(relationFlags || {});
addActionButton?.classList.toggle('is-active', social !== 'none');
addActionButton?.setAttribute('aria-label', social === 'none' ? 'Добавить' : 'Изменить связь');
}
async function ensureRelationFlags() {
if (relationFlags) return relationFlags;
if (relationLoadPromise) return relationLoadPromise;
if (!selfLogin || !card?.login) return {};
relationLoadPromise = loadRelationsForPair({ currentLogin: selfLogin, targetLogin: card.login })
.then((flags) => {
relationFlags = flags || {};
updateRelationUi();
return relationFlags;
})
.finally(() => {
relationLoadPromise = null;
});
return relationLoadPromise;
}
async function setRelationKind(kind, enabled) {
await authService.setUserRelation({
login: selfLogin,
toLogin: card.login,
kind,
enabled,
storagePwd: state.session.storagePwdInMemory,
});
}
async function changeSocial(next) {
const flags = await ensureRelationFlags();
const current = effectiveSocial(flags);
if (current === next) return;
if (next === 'contact') {
if (flags.outCloseFriend) await setRelationKind('close_friend', false);
if (flags.outFriend) await setRelationKind('friend', false);
if (!flags.outContact) await setRelationKind('contact', true);
}
if (next === 'friend') {
if (flags.outCloseFriend) await setRelationKind('close_friend', false);
if (!flags.outFriend) await setRelationKind('friend', true);
}
if (next === 'close_friend' && !flags.outCloseFriend) {
await setRelationKind('close_friend', true);
}
relationFlags = await loadRelationsForPair({ currentLogin: selfLogin, targetLogin: card.login });
updateRelationUi();
}
function renderProfile() {
if (!card) return;
const isSelf = card.login.toLowerCase() === selfLogin.toLowerCase();
const official = card.accountRole === 'primary';
const shining = card.shineStatus === 'shining';
body.innerHTML = profileCardHtml({
card,
login: requestedLogin,
isSelf,
beforeTilesHtml: '<div class="user-profile-add-menu" hidden></div>',
tilesHtml: isSelf ? '' : [
profileTileHtml({ icon: 'user-plus', label: 'Добавить', attrs: 'data-profile-action="add" aria-haspopup="menu" aria-expanded="false"' }),
profileTileHtml({ icon: 'user-plus', label: 'Добавить связь', attrs: 'data-profile-action="add"' }),
profileTileHtml({ label: 'Связи', attrs: 'data-profile-action="links"', iconMarkup: `<img class="pf-tile-mandala" src="${SHINE_CONNECTIONS_LOGO_SRC}" alt="" aria-hidden="true">` }),
profileTileHtml({ icon: 'message', label: 'Написать', attrs: 'data-profile-action="chat"' }),
].join(''),
@@ -148,21 +63,12 @@ export function render({ navigate, route, chrome }) {
avatar: card.avatar,
size: 'xl',
className: 'user-profile-hero-avatar',
glow: shining,
official,
}));
addMenu = body.querySelector('.user-profile-add-menu');
addActionButton = body.querySelector('[data-profile-action="add"]');
updateRelationUi();
status.textContent = '';
if (!isSelf && selfLogin) {
void ensureRelationFlags().catch(() => {});
}
}
body.addEventListener('click', async (event) => {
body.addEventListener('click', (event) => {
if (!card) return;
const listButton = event.target.closest('[data-profile-list]');
if (listButton) {
@@ -171,34 +77,9 @@ export function render({ navigate, route, chrome }) {
return;
}
const relationButton = event.target.closest('[data-relation-kind]');
if (relationButton) {
if (!selfLogin) {
status.className = 'status-line user-profile-status is-unavailable';
status.textContent = 'Для добавления пользователя необходимо войти.';
return;
}
const next = relationButton.dataset.relationKind;
try {
addMenu?.classList.add('is-busy');
await changeSocial(next);
if (addMenu) addMenu.hidden = true;
addActionButton?.setAttribute('aria-expanded', 'false');
status.className = 'status-line user-profile-status';
status.textContent = '';
} catch (error) {
status.className = 'status-line user-profile-status is-unavailable';
status.textContent = `Ошибка: ${error?.message || 'Не удалось изменить связь'}`;
} finally {
addMenu?.classList.remove('is-busy');
}
return;
}
const actionButton = event.target.closest('[data-profile-action]');
const action = actionButton?.dataset.profileAction;
if (action === 'add') {
if (!addMenu) return;
navigate(`SHiNE/${encodeURIComponent(card.login)}/manage`);
return;
}
@@ -211,17 +92,6 @@ export function render({ navigate, route, chrome }) {
}
});
const handleOutsidePointer = (event) => {
if (!addMenu || addMenu.hidden) return;
if (event.target instanceof Node && body.contains(event.target)) {
const insideActions = event.target.closest?.('.user-profile-actions-wrap');
if (insideActions) return;
}
addMenu.hidden = true;
addActionButton?.setAttribute('aria-expanded', 'false');
};
document.addEventListener('pointerdown', handleOutsidePointer);
async function refresh() {
card = await loadUserProfileCard(requestedLogin);
renderProfile();
@@ -232,9 +102,5 @@ export function render({ navigate, route, chrome }) {
status.textContent = `Ошибка: ${error?.message || 'unknown'}`;
});
screen.cleanup = () => {
document.removeEventListener('pointerdown', handleOutsidePointer);
};
return screen;
}
+214 -37
View File
@@ -2,54 +2,231 @@ import { createTopBar } from '../components/topbar.js';
import { authService, state } from '../state.js';
import { loadRelationsForPair, loadUserProfileCard } from '../services/user-connections.js';
import { navigateBack } from '../router.js';
import { escapeProfileHtml } from '../components/profile-card.js';
export const pageMeta = { id: 'user-relation-manage-view', title: 'Добавить' };
export const pageMeta = { id: 'user-relation-manage-view', title: 'Добавить связь' };
function effectiveSocial(f) { if (f.outCloseFriend) return 'close_friend'; if (f.outFriend) return 'friend'; if (f.outContact) return 'contact'; return 'none'; }
const SOCIAL_LABELS = {
none: 'Нет связи',
contact: 'Контакт',
friend: 'Друг',
close_friend: 'Близкий друг',
};
export function render({route, chrome}) {
const targetLogin = String(route?.params?.login || '').trim(); const selfLogin = String(state.session.login || '').trim();
const screen = document.createElement('section'); screen.className = 'stack';
const body = document.createElement('div'); body.className = 'stack'; const status = document.createElement('div'); status.className = 'status-line';
chrome?.setTopbar(createTopBar({ title: 'Добавить', back: { label: '←', onClick: () => navigateBack() } }));
screen.append(
status,
body,
);
let flags, selfCard, targetCard;
const MUTUAL_LABELS = {
contact: 'контакты',
friend: 'друзья',
close_friend: 'близкие друзья',
};
async function setKind(kind, enabled) { await authService.setUserRelation({ login: selfLogin, toLogin: targetLogin, kind, enabled, storagePwd: state.session.storagePwdInMemory }); }
async function changeSocial(next) {
const current = effectiveSocial(flags); if (current === next) return;
if (next === 'none') { if (flags.outCloseFriend) await setKind('close_friend', false); if (flags.outFriend) await setKind('friend', false); if (flags.outContact) await setKind('contact', false); }
if (next === 'contact') { if (flags.outCloseFriend) await setKind('close_friend', false); if (flags.outFriend) await setKind('friend', false); if (!flags.outContact) await setKind('contact', true); }
if (next === 'friend') { if (flags.outCloseFriend) await setKind('close_friend', false); if (!flags.outFriend) await setKind('friend', true); }
if (next === 'close_friend' && !flags.outCloseFriend) await setKind('close_friend', true);
await refresh();
function effectiveSocial(flags = {}, direction = 'out') {
const prefix = direction === 'in' ? 'in' : 'out';
if (flags[`${prefix}CloseFriend`]) return 'close_friend';
if (flags[`${prefix}Friend`]) return 'friend';
if (flags[`${prefix}Contact`]) return 'contact';
return 'none';
}
function relationSummaryHtml(flags = {}) {
const outgoing = effectiveSocial(flags, 'out');
const incoming = effectiveSocial(flags, 'in');
if (outgoing !== 'none' && outgoing === incoming) {
return `
<div class="relation-manage-mutual">
<span class="relation-manage-mutual-label">Взаимно:</span>
<strong>${escapeProfileHtml(MUTUAL_LABELS[outgoing])}</strong>
</div>`;
}
async function refresh() {
status.textContent = 'Загрузка...'; body.innerHTML = '';
[selfCard, targetCard, flags] = await Promise.all([loadUserProfileCard(selfLogin), loadUserProfileCard(targetLogin), loadRelationsForPair({ currentLogin: selfLogin, targetLogin })]);
const social = effectiveSocial(flags);
const canPrimary = selfCard.accountRole === 'primary' && targetCard.accountRole !== 'non_voting';
const canShine = selfCard.accountRole === 'primary' && selfCard.shineStatus === 'shining' && targetCard.shineStatus !== 'not_interested';
body.innerHTML = `
<div class="card stack"><b>Связь с ${targetLogin}</b>
<div class="row wrap-row" data-social>${['none','contact','friend','close_friend'].map(v => `<button class="secondary-btn ${social===v?'is-active':''}" data-social-kind="${v}">${({none:'Нет',contact:'Контакт',friend:'Друг',close_friend:'Близкий друг'})[v]}</button>`).join('')}</div>
return `
<div class="relation-manage-current">
<div class="relation-manage-current-row">
<span>Вы к пользователю</span>
<strong>${escapeProfileHtml(SOCIAL_LABELS[outgoing])}</strong>
</div>
${canPrimary ? `<div class="card row"><span>Основной аккаунт</span><button class="secondary-btn" data-confirm="official_account">${flags.outOfficialAccount ? 'Убрать подтверждение' : 'Подтвердить'}</button></div>` : ''}
${canShine ? `<div class="card row"><span>Сияющий</span><button class="secondary-btn" data-confirm="shine_confirmed">${flags.outShineConfirmed ? 'Убрать подтверждение' : 'Подтвердить'}</button></div>` : ''}
${incoming !== 'none' ? `
<div class="relation-manage-current-row">
<span>Пользователь к вам</span>
<strong>${escapeProfileHtml(SOCIAL_LABELS[incoming])}</strong>
</div>` : ''}
</div>`;
}
function socialButtonsHtml(flags = {}) {
const current = effectiveSocial(flags, 'out');
const kinds = ['none', 'contact', 'friend', 'close_friend'];
return kinds.map((kind) => `
<button type="button" class="secondary-btn relation-manage-choice${current === kind ? ' is-active' : ''}" data-social-kind="${kind}">
${escapeProfileHtml(SOCIAL_LABELS[kind])}
</button>`).join('');
}
function officialBlockHtml(flags = {}) {
return `
<section class="card stack relation-manage-card relation-manage-card--official">
<div class="relation-manage-card-head">
<strong>Основной аккаунт</strong>
<span>Этот аккаунт — основной</span>
</div>
<div class="relation-manage-confirmations">
${flags.outOfficialAccount ? '<div class="relation-manage-confirmation">✓ Вы подтвердили его основной аккаунт</div>' : ''}
${flags.inOfficialAccount ? '<div class="relation-manage-confirmation">✓ Этот пользователь подтвердил ваш основной аккаунт</div>' : ''}
</div>
<button type="button" class="secondary-btn relation-manage-confirm-btn" data-confirm="official_account">
${flags.outOfficialAccount ? 'Убрать подтверждение' : 'Подтвердить основной аккаунт'}
</button>
</section>`;
}
function shineBlockHtml(flags = {}) {
return `
<section class="card stack relation-manage-card relation-manage-card--shine">
<div class="relation-manage-card-head">
<strong>Сияющий</strong>
<span>Этот аккаунт — сияющий</span>
</div>
<div class="relation-manage-confirmations">
${flags.outShineConfirmed ? '<div class="relation-manage-confirmation">✓ Вы подтверждаете его сияющим</div>' : ''}
${flags.inShineConfirmed ? '<div class="relation-manage-confirmation">✓ Этот пользователь подтверждает вас сияющим</div>' : ''}
</div>
<button type="button" class="secondary-btn relation-manage-confirm-btn" data-confirm="shine_confirmed">
${flags.outShineConfirmed ? 'Убрать подтверждение' : 'Подтвердить как сияющего'}
</button>
</section>`;
}
export function render({ route, chrome }) {
const targetLogin = String(route?.params?.login || '').trim();
const selfLogin = String(state.session.login || '').trim();
const screen = document.createElement('section');
screen.className = 'stack relation-manage-screen';
const body = document.createElement('div');
body.className = 'stack relation-manage-body';
const status = document.createElement('div');
status.className = 'status-line relation-manage-status';
chrome?.setTopbar(createTopBar({
title: 'Добавить связь',
back: { label: '←', onClick: () => navigateBack() },
}));
screen.append(status, body);
let flags = {};
let selfCard = null;
let targetCard = null;
let busy = false;
async function setKind(kind, enabled) {
await authService.setUserRelation({
login: selfLogin,
toLogin: targetLogin,
kind,
enabled,
storagePwd: state.session.storagePwdInMemory,
});
}
async function changeSocial(next) {
const current = effectiveSocial(flags, 'out');
if (current === next) return;
if (next === 'none') {
if (flags.outCloseFriend) await setKind('close_friend', false);
if (flags.outFriend) await setKind('friend', false);
if (flags.outContact) await setKind('contact', false);
}
if (next === 'contact') {
if (flags.outCloseFriend) await setKind('close_friend', false);
if (flags.outFriend) await setKind('friend', false);
if (!flags.outContact) await setKind('contact', true);
}
if (next === 'friend') {
if (flags.outCloseFriend) await setKind('close_friend', false);
if (!flags.outFriend) await setKind('friend', true);
}
if (next === 'close_friend' && !flags.outCloseFriend) {
await setKind('close_friend', true);
}
}
function renderBody() {
const canPrimary = selfCard?.accountRole === 'primary' && targetCard?.accountRole === 'primary';
const canShine = selfCard?.shineStatus === 'shining' && targetCard?.shineStatus === 'shining';
body.innerHTML = `
<section class="card stack relation-manage-card relation-manage-card--social">
<div class="relation-manage-card-head">
<strong>Связь</strong>
<span>@${escapeProfileHtml(targetCard?.login || targetLogin)}</span>
</div>
${relationSummaryHtml(flags)}
<div class="relation-manage-choices" aria-label="Изменить ваше отношение к пользователю">
${socialButtonsHtml(flags)}
</div>
</section>
${canPrimary ? officialBlockHtml(flags) : ''}
${canShine ? shineBlockHtml(flags) : ''}
`;
}
async function refresh({ loading = true } = {}) {
if (loading) {
status.className = 'status-line relation-manage-status';
status.textContent = 'Загрузка...';
}
[selfCard, targetCard, flags] = await Promise.all([
loadUserProfileCard(selfLogin),
loadUserProfileCard(targetLogin),
loadRelationsForPair({ currentLogin: selfLogin, targetLogin }),
]);
renderBody();
status.className = 'status-line relation-manage-status';
status.textContent = '';
}
body.addEventListener('click', async (e) => {
const btn = e.target.closest('button'); if (!btn) return;
const social = btn.dataset.socialKind; const confirm = btn.dataset.confirm;
try { status.textContent = 'Сохранение...'; if (social) await changeSocial(social); else if (confirm) { const enabled = confirm === 'official_account' ? !flags.outOfficialAccount : !flags.outShineConfirmed; await setKind(confirm, enabled); await refresh(); } }
catch (err) { status.className='status-line is-unavailable'; status.textContent=`Ошибка: ${err.message || 'unknown'}`; }
body.addEventListener('click', async (event) => {
const button = event.target.closest('button');
if (!button || busy) return;
const social = button.dataset.socialKind;
const confirm = button.dataset.confirm;
if (!social && !confirm) return;
busy = true;
body.classList.add('is-busy');
status.className = 'status-line relation-manage-status';
status.textContent = 'Сохранение...';
try {
if (social) {
await changeSocial(social);
} else if (confirm === 'official_account') {
await setKind('official_account', !flags.outOfficialAccount);
} else if (confirm === 'shine_confirmed') {
await setKind('shine_confirmed', !flags.outShineConfirmed);
}
await refresh({ loading: false });
} catch (error) {
status.className = 'status-line relation-manage-status is-unavailable';
status.textContent = `Ошибка: ${error?.message || 'Не удалось изменить связь'}`;
} finally {
busy = false;
body.classList.remove('is-busy');
}
});
refresh().catch(e => { status.className='status-line is-unavailable'; status.textContent=`Ошибка: ${e.message || 'unknown'}`; });
if (!selfLogin || !targetLogin) {
status.className = 'status-line relation-manage-status is-unavailable';
status.textContent = 'Не удалось определить пользователя.';
return screen;
}
refresh().catch((error) => {
status.className = 'status-line relation-manage-status is-unavailable';
status.textContent = `Ошибка: ${error?.message || 'Не удалось загрузить связи'}`;
});
return screen;
}
+94 -32
View File
@@ -1,51 +1,81 @@
/* Карточка профиля (js/components/profile-card.js): свой и чужой профиль в одной системе с «О канале».
* Селекторы привязаны к .user-profile-screen, чтобы перекрыть старую геометрию profile.css. */
.user-profile-screen { gap: 0; min-height: 0; overflow-x: clip; } /* clip, а не hidden: hidden обрезал бы и свечение аватарки сверху */
.user-profile-screen { gap: 0; min-height: 0; overflow-x: clip; }
.user-profile-screen::before { content: none; }
.user-profile-screen .user-profile-body { display: grid; gap: var(--space-4); padding: var(--space-2) 0 var(--space-5); }
.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-avatar { position: relative; grid-column: auto; grid-row: auto; width: 96px; height: 96px; margin-bottom: var(--space-2); display: grid; place-items: center; justify-self: 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; }
.user-profile-screen .pf-avatar .user-profile-hero-avatar.avatar-framed > .avatar-fallback,
.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-hero.is-shining .pf-avatar::after {
content: '';
position: absolute;
inset: -5px;
border-radius: 50%;
border: 2px solid var(--rel-shining);
box-shadow: 0 0 14px var(--rel-shining-glow);
pointer-events: none;
}
.user-profile-screen .pf-name { margin: 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-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); }
.user-profile-screen .pf-statuses { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-2); margin-top: var(--space-2); }
.user-profile-screen .pf-status {
min-height: 32px;
padding: 0 12px;
display: inline-flex;
align-items: center;
gap: 6px;
border: 1px solid var(--border-subtle);
border-radius: var(--radius-pill);
color: var(--text-secondary);
background: var(--surface);
font: inherit;
font-size: var(--text-xs);
cursor: pointer;
@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-status b { color: var(--text-primary); font-weight: var(--weight-bold); }
.user-profile-screen .pf-status-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--border-control); }
.user-profile-screen .pf-status.is-active { color: var(--text-primary); border-color: var(--border-control); }
.user-profile-screen .pf-status.is-active .pf-status-dot { background: var(--rel-shining); box-shadow: 0 0 6px var(--rel-shining-glow); }
.user-profile-screen .pf-status[data-profile-list='primary_received'].is-active .pf-status-dot { background: var(--rel-family); box-shadow: 0 0 6px var(--rel-family-glow); }
.user-profile-screen .pf-status:focus-visible { outline: 2px solid var(--focus-ring); outline-offset: 2px; }
.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; }
.user-profile-screen .pf-stat { min-height: 64px; padding: var(--space-2) var(--space-1); display: grid; align-content: center; justify-items: center; gap: 2px; border: 0; border-left: 1px solid var(--border-subtle); background: transparent; color: var(--text-primary); font: inherit; cursor: pointer; }
@@ -109,3 +139,35 @@
.profiles-active-badge { padding: 2px 8px; border-radius: var(--radius-pill); color: var(--accent); background: var(--accent-soft); font-size: .6875rem; font-weight: var(--weight-bold); }
.screen-content .profiles-row .profiles-close { width: 44px; height: 44px; display: grid; place-items: center; border: 0; border-radius: var(--radius-md); color: var(--text-secondary); background: transparent; font-size: 22px; cursor: pointer; }
.screen-content .profiles-row .profiles-close:hover { background: var(--surface-selected); color: var(--danger); }
/* Экран управления отношениями с другим пользователем. */
.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-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); }
.relation-manage-card-head > span { color: var(--text-secondary); font-size: var(--text-xs); }
.relation-manage-current { display: grid; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); overflow: hidden; }
.relation-manage-current-row { min-height: 48px; padding: 8px 12px; display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); border-top: 1px solid var(--border-subtle); }
.relation-manage-current-row:first-child { border-top: 0; }
.relation-manage-current-row > span { color: var(--text-secondary); font-size: var(--text-sm); }
.relation-manage-current-row > strong { color: var(--text-primary); font-size: var(--text-sm); text-align: right; }
.relation-manage-mutual { min-height: 52px; padding: 10px 12px; display: flex; align-items: center; justify-content: center; gap: 5px; border: 1px solid var(--border-subtle); border-radius: var(--radius-md); background: var(--surface-selected); }
.relation-manage-mutual-label { color: var(--text-secondary); }
.relation-manage-mutual > strong { color: var(--text-primary); }
.relation-manage-choices { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-2); }
.relation-manage-choice { width: 100%; min-width: 0; }
.relation-manage-choice.is-active { background: var(--surface-selected); border-color: var(--accent); color: var(--accent); }
.relation-manage-confirmations { display: grid; gap: 6px; }
.relation-manage-confirmations:empty { display: none; }
.relation-manage-confirmation { padding: 9px 11px; border-radius: var(--radius-md); background: var(--surface-selected); color: var(--text-primary); font-size: var(--text-sm); line-height: var(--leading-sm); }
.relation-manage-confirm-btn { width: 100%; }
.relation-manage-card--official { border-color: color-mix(in srgb, var(--rel-family) 45%, var(--border-subtle)); }
.relation-manage-card--shine { border-color: color-mix(in srgb, var(--rel-shining) 45%, var(--border-subtle)); }
@media (max-width: 420px) {
.relation-manage-choices { grid-template-columns: 1fr; }
.relation-manage-current-row { align-items: flex-start; }
}