Исправил баг UI: PWA и просмотр аватаров

This commit is contained in:
AidarKC
2026-11-10 14:09:54 +03:00
parent 9c30b33b39
commit 003cc942d8
14 changed files with 252 additions and 28 deletions
+8 -11
View File
@@ -1,7 +1,7 @@
import { t } from '../i18n/index.js';
import { createTopBar } from '../components/topbar.js';
import { SHINE_CONNECTIONS_LOGO_SRC } from '../components/shine-logo.js';
import { renderUserAvatar } from '../components/avatar-image.js';
import { attachProfileAvatarPreview } from '../components/profile-avatar-preview.js';
import { state } from '../state.js';
import { loadRelationsForPair, loadUserProfileCard } from '../services/user-connections.js';
import { createErrorState, createLoadingState } from '../components/feedback.js';
@@ -44,9 +44,13 @@ export function render({ navigate, route, chrome }) {
screen.append(status, body);
let card = null;
let relation = null;
let avatarPreview = null;
let disposed = false;
function renderProfile() {
if (!card || disposed) return;
avatarPreview?.cleanup();
avatarPreview = null;
const isSelf = card.login.toLowerCase() === selfLogin.toLowerCase();
body.innerHTML = profileCardHtml({
@@ -62,16 +66,7 @@ export function render({ navigate, route, chrome }) {
syncRelationTile();
const avatarSlot = body.querySelector('.user-profile-avatar-slot');
avatarSlot?.append(renderUserAvatar({
login: card.login,
firstName: card.firstName,
lastName: card.lastName,
avatar: card.avatar,
size: 'xl',
className: 'user-profile-hero-avatar',
official: card.accountRole === 'primary',
}));
avatarPreview = attachProfileAvatarPreview(body.querySelector('.user-profile-avatar-slot'), card);
status.replaceChildren();
}
@@ -134,6 +129,8 @@ export function render({ navigate, route, chrome }) {
screen.cleanup = () => {
if (disposed) return;
disposed = true;
avatarPreview?.cleanup();
avatarPreview = null;
};
async function refresh() {