CORE/CONTENT test5593 и адаптация UI

This commit is contained in:
AidarKC
2026-11-27 00:47:13 +03:00
parent 205b7ad971
commit 873535654e
1271 changed files with 219621 additions and 1900 deletions
+15 -12
View File
@@ -2,8 +2,7 @@ import { formatDateTime } from '../i18n/format.js';
import { t, th } from '../i18n/index.js';
import { createTopBar } from '../components/topbar.js';
import { authService } from '../state.js';
import { KeyRotationClient } from '../services/key-rotation-service.js';
import { inspectBlockchainDataItem } from '../services/blockchain-entry-inspector.js';
import { inspectCoreBlock } from '../services/blockchain-entry-inspector.js';
import { makeProfileRoute, makeShineChannelRoute, makeShineMessageRoute } from '../services/shine-routes.js';
import { actionErrorText } from '../services/ui-error-texts.js';
@@ -75,6 +74,7 @@ function shortHash(value) {
}
function formatDate(ms) {
if (ms == null) return '—';
try {
return formatDateTime(new Date(Number(ms) || 0));
} catch {
@@ -145,10 +145,10 @@ function lineTextKindLabel(subType) {
}
function describeEntry(item, inspection, channelNames) {
if (!inspection?.frame) {
if (!inspection?.frame || inspection.frame.type == null || inspection.contentStatus !== 'VALID') {
return {
title: t('screens.my_blockchain_view.text_075', { value1: item.msgType, value2: item.msgSubType }),
detailTitle: t('screens.my_blockchain_view.text_076', { value1: item.msgType, value2: item.msgSubType }),
title: 'CORE',
detailTitle: inspection?.contentStatus ? `CONTENT: ${inspection.contentStatus}` : 'CORE',
text: '',
attachmentsCount: 0,
};
@@ -436,17 +436,19 @@ function createEntryCard({ item, inspection, parseError, channelNames, blockchai
const info = document.createElement('div');
info.className = 'my-blockchain-entry__detail-grid';
const effectiveType = frame ? `${frame.type}/${frame.subType} · v${frame.version}` : `${item.msgType}/${item.msgSubType} · v${item.msgVersion}`;
const effectiveType = frame && frame.type != null && inspection?.contentStatus === 'VALID' ? `${frame.type}/${frame.subType} · v${frame.version}` : '—';
addDetailRow(info, t('screens.my_blockchain_view.text_016'), effectiveType);
addDetailRow(info, t('screens.my_blockchain_view.text_017'), `#${item.blockNumber}`);
addDetailRow(info, t('screens.my_blockchain_view.text_018'), formatDate(item.timestampMs));
addDetailRow(info, t('screens.my_blockchain_view.text_019'), item.blockHash, { code: true });
if (inspection?.dataItemId) addDetailRow(info, 'DataItem ID', inspection.dataItemId, { code: true });
if (inspection?.dataItemId) addDetailRow(info, 'CORE DataItem ID', inspection.dataItemId, { code: true });
if (inspection?.contentDataItemId) addDetailRow(info, 'CONTENT DataItem ID', inspection.contentDataItemId, { code: true });
if (inspection?.contentStatus) addDetailRow(info, 'CONTENT', inspection.contentStatus);
const body = frame?.body || {};
if (body.line) {
if (Number.isInteger(Number(body.line.lineCode))) addDetailRow(info, t('screens.my_blockchain_view.text_020'), `#${body.line.lineCode}`);
if (Number.isInteger(Number(body.line.lineSequence))) addDetailRow(info, t('screens.my_blockchain_view.text_021'), body.line.lineSequence);
if (Number.isInteger(body.line.lineSequence)) addDetailRow(info, t('screens.my_blockchain_view.text_021'), body.line.lineSequence);
}
if (body.kind === 'profile') {
addDetailRow(info, t('screens.my_blockchain_view.text_022'), body.key);
@@ -526,7 +528,6 @@ export function render({ navigate, chrome }, { historyOnly = false } = {}) {
more.hidden = true;
screen.append(more);
const client = new KeyRotationClient(authService);
const channelNames = new Map([[0, 'stories']]);
let channelsLoaded = false;
let before = null;
@@ -561,7 +562,7 @@ export function render({ navigate, chrome }, { historyOnly = false } = {}) {
before = null;
}
try {
const data = await client.getMyBlockchain({ beforeBlock: before, limit: 50, includeBlockBytes: true });
const data = await authService.getMyBlockchainPage({ beforeBlock: before, limit: 50, includeBlockBytes: true });
if (disposed || seq !== loadSeq) return;
await ensureChannelNames(String(data.login || '').trim());
if (disposed || seq !== loadSeq) return;
@@ -574,9 +575,11 @@ export function render({ navigate, chrome }, { historyOnly = false } = {}) {
}
const rows = await Promise.all((data.blocks || []).map(async (item) => {
if (!item?.blockBytesB64) return { item, inspection: null, parseError: t('screens.my_blockchain_view.text_066') };
item = { ...item, blockHash: item.coreHash };
if (!item?.coreDataItemB64) return { item, inspection: null, parseError: t('screens.my_blockchain_view.text_066') };
try {
const inspection = await inspectBlockchainDataItem(item.blockBytesB64);
const inspection = await inspectCoreBlock(item);
item = { ...item, blockHash: item.coreHash, timestampMs: inspection.frame.timestampMs, msgType: inspection.frame.type, msgSubType: inspection.frame.subType, msgVersion: inspection.frame.version };
const body = inspection?.frame?.body;
if (inspection?.frame?.type === 0 && inspection?.frame?.subType === 1) {
const root = Number(inspection.frame.blockNumber);