Каналы: добавить профиль через TEXT_CHANNEL_META

This commit is contained in:
AidarKC
2026-08-01 01:57:41 +04:00
parent 24afcba20a
commit 110ff5e12e
31 changed files with 1312 additions and 191 deletions
+21 -4
View File
@@ -13,6 +13,7 @@ import {
} from '../services/channels-ux.js';
import { makeShineChannelRoute } from '../services/shine-routes.js';
import { navigateBack } from '../router.js';
import { buildArweaveDataUrl } from '../services/arweave-file-service.js';
export const pageMeta = { id: 'channels-list', title: 'Каналы' };
@@ -652,11 +653,13 @@ function mapApiChannelRow(summary, bucketKey, idx, index, notificationsState) {
const ownerLogin = summary?.channel?.ownerLogin || 'неизвестно';
const channelName = summary?.channel?.channelName || '(без названия)';
const displayTitle = String(summary?.channel?.displayName || channelName).trim();
const channelDescription = String(summary?.channel?.channelDescription || '').trim();
const channelTypeCode = Number(summary?.channel?.channelTypeCode ?? 1);
const channelTypeVersion = Number(summary?.channel?.channelTypeVersion ?? 1);
const isOwn = bucketKey === 'own';
const title = `${ownerLogin} / ${channelName}`;
const title = displayTitle || channelName;
const technicalLabel = `${ownerLogin} / ${channelName}`;
return {
id: rowId,
@@ -665,9 +668,12 @@ function mapApiChannelRow(summary, bucketKey, idx, index, notificationsState) {
ownerBlockchainName: summary?.channel?.ownerBlockchainName || '',
channelRootBlockNumber: Number(summary?.channel?.channelRoot?.blockNumber),
channelRootBlockHash: normalizeHash(summary?.channel?.channelRoot?.blockHash),
avatar: avatarLetterFromName(channelName),
avatar: avatarLetterFromName(displayTitle || channelName),
avaAr: String(summary?.channel?.avaAr || '').trim(),
title,
technicalLabel,
channelName,
displayTitle,
channelDescription,
channelTypeCode,
channelTypeVersion,
@@ -968,6 +974,10 @@ function renderChannelMain(channel) {
title.className = 'channel-row-title';
title.textContent = channel.title;
const technical = document.createElement('p');
technical.className = 'channel-row-technical';
technical.textContent = channel.technicalLabel || `${channel.ownerName || ''} / ${channel.channelName || ''}`;
if (channel.channelDescription) {
const desc = document.createElement('p');
desc.className = 'channel-row-description';
@@ -983,7 +993,7 @@ function renderChannelMain(channel) {
meta.className = 'channel-row-owner channel-counter-meta';
meta.textContent = `Сообщений: ${channel.messagesCount || 0}`;
main.prepend(title);
main.prepend(title, technical);
main.append(preview, meta);
return main;
}
@@ -1012,7 +1022,14 @@ function renderListContent({ screen, container, listState, navigate, refreshFeed
const avatar = document.createElement('div');
avatar.className = 'avatar';
avatar.textContent = channel.avatar;
if (channel.avaAr) {
const img = document.createElement('img');
img.alt = '';
img.src = buildArweaveDataUrl({ gateway: state.entrySettings.arweaveServer, txId: channel.avaAr });
avatar.append(img);
} else {
avatar.textContent = channel.avatar;
}
const main = renderChannelMain(channel);