fix(chat-ui): move source visibility controls to contact row

This commit is contained in:
Ruslan Bakiev
2026-02-23 10:59:04 +07:00
parent 70369255a2
commit 6e40c96abd

View File

@@ -3558,25 +3558,26 @@ const selectedCommPins = computed(() => {
return commPins.value.filter((item) => item.contact === selectedCommThread.value?.contact);
});
const selectedThreadInboxes = computed(() => {
if (!selectedCommThread.value) return [];
const all = contactInboxes.value.filter((inbox) => inbox.contactId === selectedCommThread.value?.id);
return all.sort((a, b) => {
const aTime = a.lastMessageAt || a.updatedAt;
const bTime = b.lastMessageAt || b.updatedAt;
return bTime.localeCompare(aTime);
});
});
const hiddenContactInboxes = computed(() =>
contactInboxes.value
.filter((inbox) => inbox.isHidden)
function threadInboxes(thread: { id: string }) {
return contactInboxes.value
.filter((inbox) => inbox.contactId === thread.id)
.sort((a, b) => {
const aTime = a.lastMessageAt || a.updatedAt;
const bTime = b.lastMessageAt || b.updatedAt;
return bTime.localeCompare(aTime);
}),
);
});
}
function threadChannelLabel(thread: { id: string; channels: CommItem["channel"][] }) {
const visibleChannels = [...new Set(threadInboxes(thread).filter((inbox) => !inbox.isHidden).map((inbox) => inbox.channel))];
if (visibleChannels.length === 1) return visibleChannels[0];
if (visibleChannels.length > 1) return `${visibleChannels[0]} +${visibleChannels.length - 1}`;
const fallback = [...new Set(thread.channels.filter((channel) => channel !== "Phone"))];
if (fallback.length === 1) return fallback[0];
if (fallback.length > 1) return `${fallback[0]} +${fallback.length - 1}`;
return "No channel";
}
const selectedCommLifecycleEvents = computed(() => {
const nowMs = lifecycleNowMs.value;
@@ -4277,26 +4278,6 @@ function isCallTranscriptOpen(itemId: string) {
return Boolean(callTranscriptOpen.value[itemId]);
}
function threadTone(thread: { contact: string; items: CommItem[] }) {
const now = Date.now();
const oneDay = 24 * 60 * 60 * 1000;
const hasEvent = sortedEvents.value.some((event) => {
if (event.contact !== thread.contact) return false;
const start = new Date(event.start).getTime();
const end = new Date(event.end).getTime();
return end <= now || start - now <= oneDay;
});
if (hasEvent) return "event";
const hasRecommendation = feedCards.value.some((card) => card.contact === thread.contact && card.decision === "pending");
if (hasRecommendation) return "recommendation";
const last = thread.items[thread.items.length - 1];
if (!last) return "neutral";
if (last.direction === "in") return "message";
return "neutral";
}
function channelIcon(channel: "All" | CommItem["channel"]) {
if (channel === "All") return "all";
if (channel === "Telegram") return "telegram";