SHA256
Исправил баг UI: PWA и просмотр аватаров
This commit is contained in:
@@ -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() {
|
||||
|
||||
Reference in New Issue
Block a user