Editing correction (in progress)

This commit is contained in:
2026-09-30 13:01:42 +03:30
parent 3c0ed3369e
commit c7a60c524d
4 changed files with 135 additions and 23 deletions
+31 -1
View File
@@ -341,7 +341,31 @@ function deliveryLabel(delivery?: ChatDelivery) {
return '…';
}
function roomTypingPreview(roomId: string): string {
void typingTick.value;
const list = (typingMap.value?.[roomId] || []).filter(
(t) => Date.now() - t.at < 4000,
);
if (!list.length) return '';
const names = list
.map((t) => {
if (t.name) return t.name;
if (t.userId === '__someone__') return '';
return (
peers.value.find((p) => p.chatUserId === t.userId)?.fullName ||
peers.value.find((p) => p.id === t.userId)?.fullName ||
''
);
})
.filter(Boolean);
if (!names.length) return 'در حال نوشتن…';
if (names.length === 1) return `${names[0]} در حال نوشتن…`;
return `${toFaDigits(names.length)} نفر در حال نوشتن…`;
}
function roomPreviewText(room: ConversationRoomDto) {
const typing = roomTypingPreview(room.externalRoomId);
if (typing) return typing;
const raw = (room.lastMessagePreview || '').trim();
if (!raw) return 'بدون پیام';
if (raw === 'وویس') return 'پیام صوتی';
@@ -1648,7 +1672,9 @@ onUnmounted(() => {
<UiIcon v-if="room.pinned" name="pin" :size="12" class="room-pin-ic" />
{{ roomTitle(room) }}
</strong>
<small>{{ roomPreviewText(room) }}</small>
<small :class="{ 'room-typing': Boolean(roomTypingPreview(room.externalRoomId)) }">{{
roomPreviewText(room)
}}</small>
</span>
<span v-if="room.unreadCount" class="unread">{{ toFaDigits(room.unreadCount) }}</span>
<time>{{ formatListTime(room.lastMessageAt) }}</time>
@@ -2694,6 +2720,10 @@ onUnmounted(() => {
max-width: 100%;
display: block;
}
.room-meta small.room-typing {
color: #0f766e;
font-weight: 600;
}
.unread {
grid-column: 3;
grid-row: 1;