Исправить мелкие баги дизайна UI

This commit is contained in:
AidarKC
2026-11-09 09:57:47 +03:00
parent 4068465ee6
commit 34f7faf0a8
7 changed files with 128 additions and 118 deletions
+14 -3
View File
@@ -40,10 +40,20 @@ function normalizeMetaText(value, max, label) {
function renderAvatarPreview(slot, avatar, title) {
if (!slot) return;
slot.innerHTML = '';
const label = String(title || 'К').trim() || 'К';
const initials = Array.from(label)[0]?.toUpperCase() || 'К';
// При вводе названия обновляем только текст fallback. Иначе асинхронно
// загруженная картинка каждый раз удаляется, и на мгновение виден кружок.
const avatarKey = `${String(avatar?.ar || '').trim()}|${String(avatar?.sha256Hex || avatar?.sha256 || '').trim().toLowerCase()}`;
const current = slot.firstElementChild;
if (current?.dataset.avatarPreviewKey === avatarKey) {
current.title = label;
const fallback = current.querySelector('.avatar-fallback');
if (fallback) fallback.textContent = initials;
return;
}
const wrap = renderAvatar({
initials: label.slice(0, 1).toUpperCase() || 'К',
initials,
avatar,
authorLogin: state.session.login,
size: 'xl',
@@ -51,8 +61,9 @@ function renderAvatarPreview(slot, avatar, title) {
title: label,
alt: 'Аватар канала',
});
wrap.dataset.avatarPreviewKey = avatarKey;
wrap.style.setProperty('--channel-avatar-size', '96px');
slot.append(wrap);
slot.replaceChildren(wrap);
}
function buildAbsoluteChannelUrl({ ownerBlockchainName = '', channelName = '' } = {}) {