SHA256
Исправить мелкие баги дизайна UI
This commit is contained in:
@@ -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 = '' } = {}) {
|
||||
|
||||
Reference in New Issue
Block a user