Доработать UI до MVP

This commit is contained in:
AidarKC
2026-10-10 13:23:26 +03:00
parent e14e3dfa21
commit d138bd9464
8 changed files with 114 additions and 4 deletions
+19 -1
View File
@@ -1,3 +1,4 @@
import { mountPublicChannelSidebar } from '../services/public-channel-sidebar.js';
import { confirmDialog } from '../components/confirm-dialog.js';
import { iconHtml } from '../components/ui-icon.js';
import { rememberChannelPosition, readChannelPosition, restoreChannelPosition } from '../services/channel-view-state.js';
@@ -1617,7 +1618,7 @@ export function render({ navigate, route, chrome }) {
try {
let resolvedMessage = selector.message;
if (selector.short?.ownerBlockchainName && selector.short?.channelName) {
const ownFeed = await authService.listSubscriptionsFeed(state.session.login, 1000);
const ownFeed = state.session.isAuthorized ? await authService.listSubscriptionsFeed(state.session.login, 1000) : {};
if (disposed || seq !== refreshSeq) return;
const allRows = [
...(Array.isArray(ownFeed?.ownedChannels) ? ownFeed.ownedChannels : []),
@@ -1666,6 +1667,17 @@ export function render({ navigate, route, chrome }) {
// ignore owner feed lookup errors
}
}
if (!channel && ownerLoginFromBch) {
try {
const publicChannels = await authService.listUserProfileChannels(ownerLoginFromBch, 'owned', 500, 0, true);
const row = (Array.isArray(publicChannels?.channels) ? publicChannels.channels : []).find((item) =>
String(item?.slug || '').trim().toLowerCase() === channelNameNormalized);
if (row) channel = { channel: {
ownerBlockchainName: row.ownerBlockchainName,
channelRoot: { blockNumber: Number(row.rootBlockNumber), blockHash: normalizeRouteHash(row.rootBlockHashHex) },
} };
} catch { /* Public profile may be unavailable. */ }
}
const ownerBch = String(channel?.channel?.ownerBlockchainName || '').trim();
const rootNo = Number(channel?.channel?.channelRoot?.blockNumber);
const rootHash = normalizeRouteHash(channel?.channel?.channelRoot?.blockHash);
@@ -1732,6 +1744,12 @@ export function render({ navigate, route, chrome }) {
clearContent();
const channelOwner = extractLoginFromBlockchainName(selector?.channel?.ownerBlockchainName || focus?.channelInfo?.ownerBlockchainName || '');
if (!state.session.isAuthorized) mountPublicChannelSidebar(screen, {
owner: channelOwner,
channel: resolvedChannelTitle,
subscribers: payload?.channel?.subscribersCount ?? payload?.focus?.channelInfo?.subscribersCount ?? null,
navigate,
});
const openPost = () => {
const routeToChannel = buildChannelRouteFromThread(selector, resolvedChannelLabel);
if (routeToChannel) navigate(routeToChannel);