SHA256
Обновить UI чатов и связей и добавить документацию ИТХ
This commit is contained in:
@@ -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';
|
||||
|
||||
Reference in New Issue
Block a user