SHA256
Обновить кошельки и мелкие детали UI
This commit is contained in:
@@ -8,9 +8,7 @@ import { toUserMessage } from '../services/ui-error-texts.js';
|
||||
import { makeProfileLinksRoute } from '../services/shine-routes.js';
|
||||
import { navigateBack } from '../router.js';
|
||||
import { profileCardHtml, profileTileHtml } from '../components/profile-card.js';
|
||||
import { createPersonNotePreview, openPersonNoteSheet } from '../components/person-note-sheet.js';
|
||||
import { iconHtml } from '../components/ui-icon.js';
|
||||
import { PEOPLE_NOTES_EVENT, getPersonNote } from '../services/people-notes.js';
|
||||
|
||||
export const pageMeta = { id: 'user', title: 'Профиль' };
|
||||
|
||||
@@ -46,19 +44,9 @@ export function render({ navigate, route, chrome }) {
|
||||
|
||||
let card = null;
|
||||
let disposed = false;
|
||||
let noteSheet = null;
|
||||
let relation = null; // кем человек вам приходится – для плитки «Добавить связь»
|
||||
|
||||
function openNote() {
|
||||
noteSheet?.close();
|
||||
const name = [card.firstName, card.lastName].map((v) => String(v || '').trim()).filter(Boolean).join(' ') || card.login;
|
||||
noteSheet = openPersonNoteSheet({ login: card.login, name, onClose: () => { noteSheet = null; } });
|
||||
}
|
||||
|
||||
function renderProfile() {
|
||||
if (!card || disposed) return;
|
||||
const isSelf = card.login.toLowerCase() === selfLogin.toLowerCase();
|
||||
const note = isSelf ? null : getPersonNote(card.login);
|
||||
|
||||
body.innerHTML = profileCardHtml({
|
||||
card,
|
||||
@@ -71,18 +59,6 @@ export function render({ navigate, route, chrome }) {
|
||||
].join(''),
|
||||
});
|
||||
|
||||
// Личная заметка – сразу под кнопками действий; видна только владельцу аккаунта.
|
||||
let noteEl = createPersonNotePreview(note, { className: 'user-profile-note', onClick: openNote });
|
||||
if (noteEl) {
|
||||
noteEl.setAttribute('aria-label', `Ваша заметка: ${noteEl.textContent}. Изменить`);
|
||||
} else if (!isSelf) {
|
||||
noteEl = document.createElement('button');
|
||||
noteEl.type = 'button';
|
||||
noteEl.className = 'text-btn user-profile-note-add';
|
||||
noteEl.innerHTML = `${iconHtml('edit')}<span>Добавить личную заметку</span>`;
|
||||
noteEl.addEventListener('click', openNote);
|
||||
}
|
||||
if (noteEl) body.querySelector('.pf-tiles-wrap')?.after(noteEl);
|
||||
syncRelationTile();
|
||||
|
||||
const avatarSlot = body.querySelector('.user-profile-avatar-slot');
|
||||
@@ -154,13 +130,9 @@ export function render({ navigate, route, chrome }) {
|
||||
}
|
||||
});
|
||||
|
||||
const onNotesChanged = () => renderProfile();
|
||||
window.addEventListener(PEOPLE_NOTES_EVENT, onNotesChanged);
|
||||
screen.cleanup = () => {
|
||||
if (disposed) return;
|
||||
disposed = true;
|
||||
window.removeEventListener(PEOPLE_NOTES_EVENT, onNotesChanged);
|
||||
noteSheet?.close();
|
||||
};
|
||||
|
||||
async function refresh() {
|
||||
|
||||
Reference in New Issue
Block a user