Обновить UI чатов и связей и добавить документацию ИТХ

This commit is contained in:
AidarKC
2026-07-14 13:39:01 +04:00
parent af12d7b954
commit 4cb98f7ca0
8 changed files with 535 additions and 22 deletions
+54 -1
View File
@@ -406,6 +406,31 @@ function formatMessageTime(valueMs) {
}).format(new Date(timeMs));
}
function formatCallDurationCompact(totalSeconds) {
const total = Math.max(0, Math.floor(Number(totalSeconds || 0)));
const hours = Math.floor(total / 3600);
const minutes = Math.floor((total % 3600) / 60);
const seconds = total % 60;
if (hours > 0) {
return `${hours}:${String(minutes).padStart(2, '0')}:${String(seconds).padStart(2, '0')}`;
}
return `${minutes}:${String(seconds).padStart(2, '0')}`;
}
function buildCallStatusText(callSummary) {
if (!callSummary) return '';
if (callSummary.status === 'completed') {
return `Длительность: ${formatCallDurationCompact(callSummary.durationSec)}`;
}
const reason = String(callSummary.reason || '').trim().toLowerCase();
if (reason === 'offline') return 'Не дозвонился: абонент не в сети';
if (reason === 'no_answer') return 'Не дозвонился: нет ответа';
if (reason === 'connect_failed') return 'Не дозвонился: не удалось установить соединение';
if (reason === 'busy') return 'Не дозвонился: абонент занят';
if (reason === 'declined') return 'Не дозвонился: звонок отклонён';
return 'Не дозвонился';
}
function resolveDeliveryStatus(msg) {
if (msg?.from !== 'out') return '';
if (msg?.secondTick) return '✓✓';
@@ -503,6 +528,32 @@ function renderLog(list, chatId, { onOpenActions, markAsRead = true, scrollMode
const bubbleKind = String(msg?.kind || autoKind || '').trim();
bubble.className = `bubble ${msg.from}${bubbleKind ? ` ${bubbleKind}` : ''}`;
if (parsedText.callSummary) {
const callCard = document.createElement('div');
callCard.className = 'bubble-call-card';
const callHead = document.createElement('div');
callHead.className = 'bubble-call-head';
const callIcon = document.createElement('span');
callIcon.className = 'bubble-call-icon';
callIcon.textContent = '☎';
const callTitle = document.createElement('span');
callTitle.className = 'bubble-call-title';
callTitle.textContent = msg?.from === 'out' ? 'Исходящий звонок' : 'Входящий звонок';
callHead.append(callIcon, callTitle);
const callMetaLine = document.createElement('div');
callMetaLine.className = 'bubble-call-line bubble-call-line--muted';
const callStatus = buildCallStatusText(parsedText.callSummary);
callMetaLine.textContent = callStatus;
callCard.append(callHead, callMetaLine);
bubble.append(callCard);
}
const textNode = document.createElement('div');
textNode.className = 'bubble-text';
textNode.textContent = parsedText.displayText || '';
@@ -533,7 +584,9 @@ function renderLog(list, chatId, { onOpenActions, markAsRead = true, scrollMode
bubble.append(replyBox);
}
}
bubble.append(textNode);
if (!parsedText.callSummary) {
bubble.append(textNode);
}
const metaNode = document.createElement('div');
metaNode.className = 'bubble-meta';
-11
View File
@@ -268,16 +268,6 @@ export function render({ navigate, route }) {
return makeProfileRoute(cleanLogin);
}
function helpText() {
return [
'Обозначения на экране связей:',
'• Синие линии — близкие друзья.',
'• Оранжевые линии — родственники.',
'• Стрелка на линии — односторонняя связь.',
'• Если стрелки нет, связь взаимная.',
].join('\n');
}
function persistHistory() {
persistedCenterLogin = centerLogin;
persistedCenterHistory = [...centerHistory];
@@ -523,7 +513,6 @@ export function render({ navigate, route }) {
},
rightActions: [
{ label: 'Найти', onClick: openSearchModal },
{ label: '?', onClick: () => window.alert(helpText()) },
],
});
const backBtnEl = header.querySelector('.header-left .icon-btn');
+63 -8
View File
@@ -1062,11 +1062,52 @@
.bubble.call-tech {
max-width: 90%;
justify-self: center;
border-radius: 10px;
border: 1px solid rgba(131, 162, 223, 0.32);
background: rgba(40, 55, 84, 0.55);
border-radius: 16px;
border: 1px solid rgba(132, 170, 231, 0.28);
background: rgba(24, 36, 58, 0.72);
color: #dce8ff;
font-size: 12px;
padding: 12px 14px;
}
.bubble-call-card {
display: grid;
gap: 4px;
min-width: min(280px, 72vw);
}
.bubble-call-head {
display: inline-flex;
align-items: center;
gap: 8px;
}
.bubble-call-icon {
display: inline-grid;
place-items: center;
width: 28px;
height: 28px;
border-radius: 999px;
background: rgba(80, 170, 255, 0.18);
border: 1px solid rgba(123, 191, 255, 0.28);
color: #d9ecff;
font-size: 15px;
}
.bubble-call-title {
font-size: 14px;
font-weight: 700;
color: #eef6ff;
}
.bubble-call-line {
font-size: 12px;
line-height: 1.35;
color: rgba(230, 240, 255, 0.94);
}
.bubble-call-line--muted {
color: rgba(188, 207, 238, 0.78);
}
.chat-input {
@@ -1523,17 +1564,21 @@ textarea.input {
.network-header-overlay {
position: sticky;
top: max(8px, env(safe-area-inset-top));
top: max(14px, calc(env(safe-area-inset-top) + 8px));
left: max(8px, env(safe-area-inset-left));
right: max(8px, env(safe-area-inset-right));
margin-bottom: 0;
z-index: 12;
pointer-events: none;
padding: 9px 12px 0;
}
.network-header-overlay.page-header {
display: grid;
grid-template-columns: minmax(42px, 1fr) auto minmax(58px, 1fr);
align-items: center;
margin-bottom: 0;
gap: 6px;
gap: 10px;
}
.network-header-overlay .header-left,
@@ -1542,20 +1587,30 @@ textarea.input {
gap: 6px;
}
.network-header-overlay .header-left {
justify-content: flex-start;
}
.network-header-overlay .header-actions {
justify-content: flex-end;
}
.network-header-overlay .icon-btn {
pointer-events: auto;
min-height: 30px;
padding: 5px 8px;
font-size: 11px;
min-height: 32px;
padding: 6px 10px;
font-size: 12px;
border-radius: 10px;
}
.network-header-overlay .page-title {
font-size: 16px;
line-height: 32px;
min-width: 0;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
text-align: center;
text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}