SHA256
UI: личные чаты (поиск, медиа, «без звука», закреп) и новая карта связей
Личные сообщения: - поиск по переписке с подсветкой, переход к дате по календарю; - экран «Медиа и файлы» (/chat/<login>/media); - «без звука» и закрепление чатов (на устройстве), push от заглушённых не показывается; - новая нижняя панель ввода, круглый спиннер истории, медиа-карусель; - история загружается в ~16 раз быстрее: ключ расшифровки достаётся один раз на страницу; - исправлены прозрачные окна подтверждения в чате. Связи: - карта переписана на canvas (graph-canvas.js вместо force-graph.js): плавная анимация без дёрганья, панорама, масштаб щипком/колесом/кнопками, перетаскивание людей; - ручная раскладка и режимы «По близости»/«По группам» запоминаются на устройстве; - цвет нити – тип связи, пунктир – связь с одной стороны, аура только у сияющих; - карточка человека: раскрыть связи на месте, в центр, профиль, написать, заметка; - «Недавние» заменены раскрытием связей; фильтр «Заметки». Личные заметки о людях (текст и цветная метка, только на устройстве) – на карте и в профиле.
This commit is contained in:
@@ -6,6 +6,9 @@ import { loadUserProfileCard } from '../services/user-connections.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: 'Профиль' };
|
||||
|
||||
@@ -40,9 +43,19 @@ export function render({ navigate, route, chrome }) {
|
||||
screen.append(status, body);
|
||||
|
||||
let card = null;
|
||||
let disposed = false;
|
||||
let noteSheet = 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) return;
|
||||
if (!card || disposed) return;
|
||||
const isSelf = card.login.toLowerCase() === selfLogin.toLowerCase();
|
||||
const note = isSelf ? null : getPersonNote(card.login);
|
||||
|
||||
body.innerHTML = profileCardHtml({
|
||||
card,
|
||||
@@ -55,6 +68,19 @@ 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);
|
||||
|
||||
const avatarSlot = body.querySelector('.user-profile-avatar-slot');
|
||||
avatarSlot?.append(renderUserAvatar({
|
||||
login: card.login,
|
||||
@@ -93,12 +119,24 @@ 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() {
|
||||
card = await loadUserProfileCard(requestedLogin);
|
||||
const loaded = await loadUserProfileCard(requestedLogin);
|
||||
if (disposed) return;
|
||||
card = loaded;
|
||||
renderProfile();
|
||||
}
|
||||
|
||||
refresh().catch((error) => {
|
||||
if (disposed) return;
|
||||
status.className = 'status-line user-profile-status is-unavailable';
|
||||
status.textContent = `Ошибка: ${error?.message || 'unknown'}`;
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user