Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

✨ feat: Discord-style channel timestamps, contact sorting and agent email on contact card (#22845)

Arvin Xu9830bb5ea2ff
diff --git a/.agents/ux/lobe-design-rules.md b/.agents/ux/lobe-design-rules.md
index 666a334d559..7f70150885a 100644
--- a/.agents/ux/lobe-design-rules.md
+++ b/.agents/ux/lobe-design-rules.md
@@ -140,10 +140,10 @@ Source: user correction of the proposed in-channel reply semantics (2026-10-31).
- Long-running experiment startup belongs to the experiment page. Do not trap users in a blocking modal; route navigation must not own or cancel launch orchestration. A short pre-launch cost confirmation may remain.
-## LOBE-UX-020 — Conversation day dividers follow WeChat, time included
+## LOBE-UX-020 — Conversation times follow Discord: date dividers, dated headers
-A Channel day divider stamps the first message of the day the way WeChat does: today is the time alone ("10:17"), not "今天"; earlier days are the day followed by the time ("昨天 01:36", "星期五 10:15", "11 月 7 日 10:15", "2025 年 11 月 7 日 10:15"). Days are calendar days in local time, not 24-hour spans. The full date stays in the hover title and the separator's accessible label.
+A Channel day divider is the full date alone ("2026 年 6 月 22 日"), not a day label with a time. Each message header carries its own day, so a message read away from its divider still says when it was sent: today is the time alone ("16:29"), not "今天"; yesterday is "昨天 16:29"; anything earlier is the numeric date and time ("2026/6/22 01:33"), never a weekday or a year-less date. Days are calendar days in local time, not 24-hour spans. A grouped continuation's hover stamp is the time alone, and every stamp keeps the full date and time in its hover title.
-Enforcement: `src/features/Channels/messagePresentation.test.ts` (`channelDayLabel`) covers today, the yesterday boundary, weekdays, this year and earlier years in zh-CN and en-US.
+Enforcement: `src/features/Channels/messagePresentation.test.ts` (`channelMessageTime`) covers today, the yesterday boundary, and earlier dates in this and previous years in zh-CN and en-US.
-Source: user correction on PR #22556 (2026-11-08): "今天应该显示时间", after a first version labelled today as "今天".
+Source: user correction (2026-11-12): headers showed only "16:29", so a scrolled message had no visible date — "应该得是像 discord 这样改". This replaces the WeChat-style divider from PR #22556 (2026-11-08), which kept today as the time alone ("今天应该显示时间").
diff --git a/locales/ar/common.json b/locales/ar/common.json
index 60a7f7bbe27..84c1cd25d35 100644
--- a/locales/ar/common.json
+++ b/locales/ar/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "فقط المنشئ أو مالك مساحة العمل يمكنه القيام بذلك",
"messageList.empty": "لا توجد محادثات بعد",
"messageList.newChat": "محادثة جديدة",
- "messageList.running": "قيد التشغيل…",
"messageList.search": "بحث",
"messengerBanner.dismiss": "رفض",
"messengerBanner.title": "تحدث إلى Lobe AI عبر تطبيقات المراسلة المفضلة لديك",
diff --git a/locales/bg-BG/common.json b/locales/bg-BG/common.json
index 3145223b638..dfb49841433 100644
--- a/locales/bg-BG/common.json
+++ b/locales/bg-BG/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Само създателят или собственикът на работното пространство може да направи това",
"messageList.empty": "Все още няма разговори",
"messageList.newChat": "Нов разговор",
- "messageList.running": "Изпълнява се…",
"messageList.search": "Търсене",
"messengerBanner.dismiss": "Затвори",
"messengerBanner.title": "Говорете с Lobe AI в любимите си приложения за съобщения",
diff --git a/locales/de-DE/common.json b/locales/de-DE/common.json
index 8b5de829feb..a272731921f 100644
--- a/locales/de-DE/common.json
+++ b/locales/de-DE/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Nur der Ersteller oder ein Workspace-Eigentümer kann dies tun",
"messageList.empty": "Noch keine Gespräche",
"messageList.newChat": "Neues Gespräch",
- "messageList.running": "Läuft…",
"messageList.search": "Suchen",
"messengerBanner.dismiss": "Schließen",
"messengerBanner.title": "Sprechen Sie mit Lobe AI über Ihre bevorzugten Messaging-Apps",
diff --git a/locales/en-US/common.json b/locales/en-US/common.json
index 393ee52ab6f..360721bdc19 100644
--- a/locales/en-US/common.json
+++ b/locales/en-US/common.json
@@ -187,9 +187,15 @@
"contacts.editProfile": "Edit profile",
"contacts.empty": "None yet",
"contacts.groups": "Groups",
+ "contacts.info.mail": "Email",
+ "contacts.info.sendMail": "Send email",
"contacts.noDescription": "No description yet",
"contacts.notFound": "This contact no longer exists or is not visible to you",
+ "contacts.pinned": "Pinned",
"contacts.sendMessage": "Send message",
+ "contacts.sort.title": "Name",
+ "contacts.sort.tooltip": "Sort",
+ "contacts.sort.updatedAt": "Recently updated",
"continue": "Continue",
"copy": "Copy",
"copyFail": "Copy failed",
@@ -355,7 +361,6 @@
"manageOnlyCreator": "Only the creator or a workspace owner can do this",
"messageList.empty": "No conversations yet",
"messageList.newChat": "New conversation",
- "messageList.running": "Running…",
"messageList.search": "Search",
"messengerBanner.dismiss": "Dismiss",
"messengerBanner.title": "Talk to Lobe AI on your favorite messaging apps",
diff --git a/locales/es-ES/common.json b/locales/es-ES/common.json
index 5b62bf4df85..78902a514de 100644
--- a/locales/es-ES/common.json
+++ b/locales/es-ES/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Solo el creador o un propietario del espacio de trabajo pueden hacer esto",
"messageList.empty": "Aún no hay conversaciones",
"messageList.newChat": "Nueva conversación",
- "messageList.running": "En ejecución…",
"messageList.search": "Buscar",
"messengerBanner.dismiss": "Cerrar",
"messengerBanner.title": "Habla con Lobe AI en tus aplicaciones de mensajería favoritas",
diff --git a/locales/fa-IR/common.json b/locales/fa-IR/common.json
index 92d1871b739..10a1175aab0 100644
--- a/locales/fa-IR/common.json
+++ b/locales/fa-IR/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "فقط سازنده یا مالک فضای کاری می‌تواند این کار را انجام دهد",
"messageList.empty": "هنوز مکالمه‌ای وجود ندارد",
"messageList.newChat": "مکالمه جدید",
- "messageList.running": "در حال اجرا…",
"messageList.search": "جستجو",
"messengerBanner.dismiss": "بستن",
"messengerBanner.title": "با Lobe AI در برنامه‌های پیام‌رسان محبوب خود صحبت کنید",
diff --git a/locales/fr-FR/common.json b/locales/fr-FR/common.json
index 606aff9594d..8111171cd5f 100644
--- a/locales/fr-FR/common.json
+++ b/locales/fr-FR/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Seul le créateur ou un propriétaire de l'espace de travail peut effectuer cette action",
"messageList.empty": "Aucune conversation pour l'instant",
"messageList.newChat": "Nouvelle conversation",
- "messageList.running": "En cours…",
"messageList.search": "Rechercher",
"messengerBanner.dismiss": "Fermer",
"messengerBanner.title": "Discutez avec Lobe AI sur vos applications de messagerie préférées",
diff --git a/locales/it-IT/common.json b/locales/it-IT/common.json
index 1d85541e2c0..bf22eab9aaf 100644
--- a/locales/it-IT/common.json
+++ b/locales/it-IT/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Solo il creatore o un proprietario dello spazio di lavoro può farlo",
"messageList.empty": "Ancora nessuna conversazione",
"messageList.newChat": "Nuova conversazione",
- "messageList.running": "In esecuzione…",
"messageList.search": "Cerca",
"messengerBanner.dismiss": "Chiudi",
"messengerBanner.title": "Parla con Lobe AI sulle tue app di messaggistica preferite",
diff --git a/locales/ja-JP/common.json b/locales/ja-JP/common.json
index 073f166bb88..340d21605b7 100644
--- a/locales/ja-JP/common.json
+++ b/locales/ja-JP/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "これを行えるのは、作成者またはワークスペースの所有者のみです",
"messageList.empty": "まだ会話がありません",
"messageList.newChat": "新しい会話",
- "messageList.running": "実行中…",
"messageList.search": "検索",
"messengerBanner.dismiss": "閉じる",
"messengerBanner.title": "お好きなメッセージングアプリでLobe AIと話しましょう",
diff --git a/locales/ko-KR/common.json b/locales/ko-KR/common.json
index 4a2aa78425e..9866ef03dec 100644
--- a/locales/ko-KR/common.json
+++ b/locales/ko-KR/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "이 작업은 생성자 또는 워크스페이스 소유자만 수행할 수 있습니다",
"messageList.empty": "아직 대화가 없습니다",
"messageList.newChat": "새 대화",
- "messageList.running": "실행 중…",
"messageList.search": "검색",
"messengerBanner.dismiss": "닫기",
"messengerBanner.title": "선호하는 메시징 앱에서 Lobe AI와 대화하세요",
diff --git a/locales/nl-NL/common.json b/locales/nl-NL/common.json
index ef7b22d2216..0a0eee781ae 100644
--- a/locales/nl-NL/common.json
+++ b/locales/nl-NL/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Alleen de maker of een werkruimte-eigenaar kan dit doen",
"messageList.empty": "Nog geen gesprekken",
"messageList.newChat": "Nieuw gesprek",
- "messageList.running": "Bezig…",
"messageList.search": "Zoeken",
"messengerBanner.dismiss": "Sluiten",
"messengerBanner.title": "Praat met Lobe AI via je favoriete berichtenapps",
diff --git a/locales/pl-PL/common.json b/locales/pl-PL/common.json
index 94e05dcb2b3..c0bd69b486a 100644
--- a/locales/pl-PL/common.json
+++ b/locales/pl-PL/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Tylko twórca lub właściciel przestrzeni roboczej może to zrobić",
"messageList.empty": "Brak rozmów",
"messageList.newChat": "Nowa rozmowa",
- "messageList.running": "Działa…",
"messageList.search": "Szukaj",
"messengerBanner.dismiss": "Zamknij",
"messengerBanner.title": "Porozmawiaj z Lobe AI na swoich ulubionych aplikacjach do przesyłania wiadomości",
diff --git a/locales/pt-BR/common.json b/locales/pt-BR/common.json
index f36a42174f6..bacd84618c5 100644
--- a/locales/pt-BR/common.json
+++ b/locales/pt-BR/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Somente o criador ou um proprietário do espaço de trabalho pode fazer isso",
"messageList.empty": "Nenhuma conversa ainda",
"messageList.newChat": "Nova conversa",
- "messageList.running": "Em execução…",
"messageList.search": "Pesquisar",
"messengerBanner.dismiss": "Fechar",
"messengerBanner.title": "Converse com a Lobe AI nos seus aplicativos de mensagens favoritos",
diff --git a/locales/ru-RU/common.json b/locales/ru-RU/common.json
index 7009a381aa3..8dc7bdc97c9 100644
--- a/locales/ru-RU/common.json
+++ b/locales/ru-RU/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Только создатель или владелец рабочего пространства может это сделать",
"messageList.empty": "Пока нет разговоров",
"messageList.newChat": "Новый разговор",
- "messageList.running": "Выполняется…",
"messageList.search": "Поиск",
"messengerBanner.dismiss": "Закрыть",
"messengerBanner.title": "Общайтесь с Lobe AI в ваших любимых мессенджерах",
diff --git a/locales/tr-TR/common.json b/locales/tr-TR/common.json
index 91d2fc6bf60..933af69fc27 100644
--- a/locales/tr-TR/common.json
+++ b/locales/tr-TR/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Bunu yalnızca oluşturucu veya bir çalışma alanı sahibi yapabilir",
"messageList.empty": "Henüz konuşma yok",
"messageList.newChat": "Yeni konuşma",
- "messageList.running": "Çalışıyor…",
"messageList.search": "Ara",
"messengerBanner.dismiss": "Kapat",
"messengerBanner.title": "Lobe AI ile favori mesajlaşma uygulamalarınızda konuşun",
diff --git a/locales/vi-VN/common.json b/locales/vi-VN/common.json
index 36edfa1103c..663fc2eab9a 100644
--- a/locales/vi-VN/common.json
+++ b/locales/vi-VN/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "Chỉ người tạo hoặc chủ sở hữu không gian làm việc mới có thể thực hiện điều này",
"messageList.empty": "Chưa có cuộc trò chuyện nào",
"messageList.newChat": "Cuộc trò chuyện mới",
- "messageList.running": "Đang chạy…",
"messageList.search": "Tìm kiếm",
"messengerBanner.dismiss": "Bỏ qua",
"messengerBanner.title": "Trò chuyện với Lobe AI trên các ứng dụng nhắn tin yêu thích của bạn",
diff --git a/locales/zh-CN/common.json b/locales/zh-CN/common.json
index fbc3a7cef64..1e3946d4795 100644
--- a/locales/zh-CN/common.json
+++ b/locales/zh-CN/common.json
@@ -187,9 +187,15 @@
"contacts.editProfile": "编辑档案",
"contacts.empty": "暂无",
"contacts.groups": "群组",
+ "contacts.info.mail": "邮箱",
+ "contacts.info.sendMail": "发邮件",
"contacts.noDescription": "还没有简介",
"contacts.notFound": "该联系人不存在或你无权查看",
+ "contacts.pinned": "置顶",
"contacts.sendMessage": "发消息",
+ "contacts.sort.title": "名称",
+ "contacts.sort.tooltip": "排序",
+ "contacts.sort.updatedAt": "最近更新",
"continue": "继续",
"copy": "复制",
"copyFail": "复制失败",
@@ -355,7 +361,6 @@
"manageOnlyCreator": "仅创建者或工作区 Owner 可操作",
"messageList.empty": "还没有会话",
"messageList.newChat": "新建会话",
- "messageList.running": "执行中…",
"messageList.search": "搜索",
"messengerBanner.dismiss": "关闭",
"messengerBanner.title": "在你喜爱的聊天应用中,与 Lobe AI 畅聊",
diff --git a/locales/zh-TW/common.json b/locales/zh-TW/common.json
index 8744bb218ce..6ba341fc125 100644
--- a/locales/zh-TW/common.json
+++ b/locales/zh-TW/common.json
@@ -351,7 +351,6 @@
"manageOnlyCreator": "只有創建者或工作區擁有者可以執行此操作",
"messageList.empty": "尚無對話",
"messageList.newChat": "新對話",
- "messageList.running": "執行中…",
"messageList.search": "搜尋",
"messengerBanner.dismiss": "關閉",
"messengerBanner.title": "在您喜愛的通訊應用程式上與 Lobe AI 對話",
diff --git a/packages/locales/src/default/common.ts b/packages/locales/src/default/common.ts
index c2881a0cfcb..97d6ed0e897 100644
--- a/packages/locales/src/default/common.ts
+++ b/packages/locales/src/default/common.ts
@@ -436,12 +436,17 @@ export default {
'contacts.editProfile': 'Edit profile',
'contacts.empty': 'None yet',
'contacts.groups': 'Groups',
+ 'contacts.info.mail': 'Email',
+ 'contacts.info.sendMail': 'Send email',
'contacts.noDescription': 'No description yet',
'contacts.notFound': 'This contact no longer exists or is not visible to you',
'contacts.sendMessage': 'Send message',
+ 'contacts.pinned': 'Pinned',
+ 'contacts.sort.title': 'Name',
+ 'contacts.sort.tooltip': 'Sort',
+ 'contacts.sort.updatedAt': 'Recently updated',
'messageList.empty': 'No conversations yet',
'messageList.newChat': 'New conversation',
- 'messageList.running': 'Running…',
'messageList.search': 'Search',
'taskNav.all': 'All tasks',
'taskNav.noProjects': 'No projects yet',
diff --git a/src/features/Channels/ChannelConversation.tsx b/src/features/Channels/ChannelConversation.tsx
index c52c033e856..c3403d98155 100644
--- a/src/features/Channels/ChannelConversation.tsx
+++ b/src/features/Channels/ChannelConversation.tsx
@@ -24,11 +24,7 @@ import { hasReplyActivity } from './jobStatus';
import { JoinEventLine } from './JoinEventLine';
import { channelJoinEvents, channelTimeline } from './joinEvents';
import { isCurrentUserMember } from './memberName';
-import {
- channelDayLabel,
- channelTimeFormatters,
- presentChannelTimeline,
-} from './messagePresentation';
+import { channelTimeFormatters, presentChannelTimeline } from './messagePresentation';
import { presentOutgoingMessage, timelineTail } from './outgoing';
import { OutgoingStatus } from './OutgoingStatus';
import { ReplyActivity } from './ReplyActivity';
@@ -221,10 +217,7 @@ const Timeline = ({
{...stylex.props(styles.dateDivider)}
>
<time dateTime={date.toISOString()} title={timeFormats.date.format(date)}>
- {channelDayLabel(date, {
- locale: i18n.language,
- yesterday: t('date.yesterday'),
- })}
+ {timeFormats.date.format(date)}
</time>
</div>
)}
diff --git a/src/features/Channels/ChannelMessage.tsx b/src/features/Channels/ChannelMessage.tsx
index cebf09465fe..9933f7061a7 100644
--- a/src/features/Channels/ChannelMessage.tsx
+++ b/src/features/Channels/ChannelMessage.tsx
@@ -37,7 +37,7 @@ import { userProfileSelectors } from '@/store/user/selectors';
import { authorAvatar, isCurrentUserAuthor, memberName } from './memberName';
import { CHANNEL_MENTION_TAG, remarkChannelMentions } from './mentionMarkdown';
import { MessageAttachments } from './MessageAttachments';
-import { channelTimeFormatters } from './messagePresentation';
+import { channelMessageTime, channelTimeFormatters } from './messagePresentation';
import { MessageFailureMark, MessageRoutingStatus } from './MessageReceipts';
import { showsReplyQuote } from './replyQuote';
import type { ReplyTopic } from './ReplyTopicPanel';
@@ -113,13 +113,16 @@ export const ChannelMessage = ({
!isRoot &&
message.routingStatus !== 'unassigned' &&
!detail.jobs.some((job) => job.messageId === message.id && job.status === 'failed');
+ // A continuation sits under its header, so its hover stamp only needs the clock.
const timestamp = (
<time
dateTime={date.toISOString()}
title={timeFormats.full.format(date)}
{...stylex.props(styles.messageTime)}
>
- {timeFormats.time.format(date)}
+ {compact
+ ? timeFormats.time.format(date)
+ : channelMessageTime(date, { locale: i18n.language, yesterday: t('date.yesterday') })}
</time>
);
const isOwnMessage = useUserStore((s) =>
@@ -209,6 +212,7 @@ export const ChannelMessage = ({
>
{compact && <span {...stylex.props(styles.continuationTime)}>{timestamp}</span>}
<ChatItem
+ quietHeader
showAvatar
showTitle
agentId={message.author.type === 'agent' ? message.author.id : undefined}
diff --git a/src/features/Channels/ReplyActivity.tsx b/src/features/Channels/ReplyActivity.tsx
index 71ad7cb0e41..26252cdb9c4 100644
--- a/src/features/Channels/ReplyActivity.tsx
+++ b/src/features/Channels/ReplyActivity.tsx
@@ -14,17 +14,10 @@ import {
} from './jobStatus';
import { replyEntries, ReplyList } from './MessageReceipts';
import { activityStyles, styles } from './styles';
+import { TypingDots } from './TypingDots';
const MAX_AVATARS = 3;
-export const TypingDots = () => (
- <span aria-hidden {...stylex.props(activityStyles.dots)}>
- {[0, 1, 2].map((index) => (
- <span key={index} {...stylex.props(activityStyles.typingDot, activityStyles.delay(index))} />
- ))}
- </span>
-);
-
/**
* Who is replying in this conversation, above the composer like a chat app's typing line.
* One click lists each reply with its state and a stop action.
diff --git a/src/features/Channels/TypingDots.tsx b/src/features/Channels/TypingDots.tsx
new file mode 100644
index 00000000000..0be68ec430d
--- /dev/null
+++ b/src/features/Channels/TypingDots.tsx
@@ -0,0 +1,12 @@
+import * as stylex from '@stylexjs/stylex';
+
+import { activityStyles } from './styles';
+
+/** Three blinking dots after a "typing" label, like a chat app's typing indicator. */
+export const TypingDots = () => (
+ <span aria-hidden {...stylex.props(activityStyles.dots)}>
+ {[0, 1, 2].map((index) => (
+ <span key={index} {...stylex.props(activityStyles.typingDot, activityStyles.delay(index))} />
+ ))}
+ </span>
+);
diff --git a/src/features/Channels/messagePresentation.test.ts b/src/features/Channels/messagePresentation.test.ts
index 6eb2451deac..9a03a9b811b 100644
--- a/src/features/Channels/messagePresentation.test.ts
+++ b/src/features/Channels/messagePresentation.test.ts
@@ -3,7 +3,7 @@ import { describe, expect, it } from 'vitest';
import type { TimelineItem } from './joinEvents';
import {
- channelDayLabel,
+ channelMessageTime,
channelTimeFormatters,
presentChannelTimeline,
} from './messagePresentation';
@@ -79,11 +79,11 @@ describe('channel timestamps', () => {
});
});
-describe('channelDayLabel', () => {
+describe('channelMessageTime', () => {
// Sunday 8 November 2026, a little past midnight: the day boundary is what matters.
const now = new Date(2026, 10, 8, 0, 18);
const label = (date: Date, locale = 'zh-CN') =>
- channelDayLabel(date, { locale, now, yesterday: '昨天' });
+ channelMessageTime(date, { locale, now, yesterday: '昨天' });
it('shows only the time today, and yesterday by calendar day, not by 24 hours', () => {
expect(label(new Date(2026, 10, 8, 0, 1))).toBe('00:01');
@@ -92,11 +92,9 @@ describe('channelDayLabel', () => {
expect(label(new Date(2026, 10, 6, 23, 59))).not.toMatch(/^昨天/);
});
- it('names the weekday within the past week, then the date, each with the time', () => {
- expect(label(new Date(2026, 10, 6, 10, 15))).toBe('星期五 10:15');
- expect(label(new Date(2026, 10, 2, 9, 0))).toBe('星期一 09:00');
- expect(label(new Date(2026, 10, 1, 9, 0))).toBe('11月1日 09:00');
- expect(label(new Date(2025, 10, 7, 9, 0))).toBe('2025年11月7日 09:00');
- expect(label(new Date(2026, 10, 6, 10, 15), 'en-US')).toBe('Friday 10:15 AM');
+ it('gives the full numeric date before yesterday, even within the same week or year', () => {
+ expect(label(new Date(2026, 10, 6, 10, 15))).toBe('2026/11/6 10:15');
+ expect(label(new Date(2025, 5, 22, 1, 33))).toBe('2025/6/22 01:33');
+ expect(label(new Date(2026, 10, 6, 10, 15), 'en-US')).toBe('11/6/2026 10:15 AM');
});
});
diff --git a/src/features/Channels/messagePresentation.ts b/src/features/Channels/messagePresentation.ts
index aded7a73044..b7e2738d6bd 100644
--- a/src/features/Channels/messagePresentation.ts
+++ b/src/features/Channels/messagePresentation.ts
@@ -49,11 +49,11 @@ const calendarDaysAgo = (date: Date, now: Date) =>
);
/**
- * A day divider's label, the way WeChat stamps a conversation: the time alone today, then
- * "Yesterday", the weekday within the past week, the month and day within this year, or the full
- * date before that, each followed by the time of the day's first message.
+ * A message's header time, the way Discord stamps it: the time alone today (the day divider above
+ * names the date), "Yesterday" with the time, and the numeric date with the time before that, so a
+ * message read away from its divider still says which day it was sent.
*/
-export const channelDayLabel = (
+export const channelMessageTime = (
date: Date,
{
locale,
@@ -71,10 +71,10 @@ export const channelDayLabel = (
const day =
days === 1
? yesterday
- : days > 1 && days < 7
- ? new Intl.DateTimeFormat(locale, { weekday: 'long' }).format(date)
- : date.getFullYear() === now.getFullYear()
- ? new Intl.DateTimeFormat(locale, { day: 'numeric', month: 'long' }).format(date)
- : new Intl.DateTimeFormat(locale, { dateStyle: 'long' }).format(date);
+ : new Intl.DateTimeFormat(locale, {
+ day: 'numeric',
+ month: 'numeric',
+ year: 'numeric',
+ }).format(date);
return `${day} ${time}`;
};
diff --git a/src/features/Channels/styles.ts b/src/features/Channels/styles.ts
index 19e04c67a89..05a3cc4f2b4 100644
--- a/src/features/Channels/styles.ts
+++ b/src/features/Channels/styles.ts
@@ -101,7 +101,8 @@ export const styles = stylex.create({
flexShrink: 0,
fontSize: cssVar.fontSizeSM,
fontVariantNumeric: 'tabular-nums',
- color: cssVar.colorTextSecondary,
+ // One step below the author name, which is one step below the message.
+ color: cssVar.colorTextTertiary,
whiteSpace: 'nowrap',
opacity: 1,
},
@@ -235,9 +236,10 @@ export const styles = stylex.create({
flex: '1',
minWidth: 0,
maxHeight: 240,
- // Buttons sit on the last line; glyphs ride high in the line box, so drop the
- // text 1px to center it on the 28px icons beside it.
- marginBlockEnd: -1,
+ // Buttons sit on the last line; the glyphs ride about 1.5px high in the line box,
+ // so drop the text that much to center it on the 28px icons beside it. Layout snaps
+ // text to whole pixels, so only a transform can move it the half pixel.
+ transform: 'translateY(1.5px)',
},
/** Takes the composer's place while the channel or thread is archived. */
archivedNotice: {
diff --git a/src/features/ContactList/ContactDetail.tsx b/src/features/ContactList/ContactDetail.tsx
index 0cdc11febe3..8c904a1c843 100644
--- a/src/features/ContactList/ContactDetail.tsx
+++ b/src/features/ContactList/ContactDetail.tsx
@@ -17,6 +17,7 @@ import { useAgentCoverColor } from '@/features/AgentViewAll/useAgentCoverColor';
import NavHeader from '@/features/NavHeader';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
+import { ContactInfo } from './ContactInfo';
import { type ContactCardState, useContactCard } from './useContactCard';
const AVATAR_SIZE = 88;
@@ -135,6 +136,8 @@ const ContactCard = memo<Extract<ContactCardState, { status: 'ready' }>>(
</Button>
)}
</Flexbox>
+ {/* Groups own no addresses; only agents carry contact info. */}
+ {item.type !== 'group' && <ContactInfo agentId={item.id} />}
</Flexbox>
</>
);
diff --git a/src/features/ContactList/ContactInfo.tsx b/src/features/ContactList/ContactInfo.tsx
new file mode 100644
index 00000000000..e268e71ffda
--- /dev/null
+++ b/src/features/ContactList/ContactInfo.tsx
@@ -0,0 +1,83 @@
+'use client';
+
+import { ActionIcon, CopyButton, Flexbox } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
+import * as stylex from '@stylexjs/stylex';
+import { MailIcon } from 'lucide-react';
+import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
+
+import { useAgentAccounts } from '@/features/AgentMail/useAgentIdentity';
+
+const styles = stylex.create({
+ list: {
+ overflow: 'hidden',
+ marginBlockStart: '24px',
+ borderRadius: '12px',
+ width: '100%',
+ textAlign: 'start',
+ backgroundColor: cssVar.colorFillQuaternary,
+ },
+ row: {
+ paddingBlock: '10px',
+ paddingInline: '16px',
+ },
+ divided: {
+ borderBlockStartWidth: '1px',
+ borderBlockStartStyle: 'solid',
+ borderBlockStartColor: cssVar.colorBorderSecondary,
+ },
+ label: {
+ fontSize: '12px',
+ color: cssVar.colorTextTertiary,
+ },
+ value: {
+ overflow: 'hidden',
+ fontSize: '14px',
+ color: cssVar.colorText,
+ textOverflow: 'ellipsis',
+ whiteSpace: 'nowrap',
+ },
+});
+
+/**
+ * How to reach an agent outside LobeHub, like the numbers and addresses on a
+ * phone contact: today the mail addresses it owns. Absent while loading, on a
+ * failed read, and for agents without one, so the card never shows an empty box.
+ */
+export const ContactInfo = memo<{ agentId: string }>(({ agentId }) => {
+ const { t } = useTranslation('common');
+ const { data } = useAgentAccounts(agentId);
+ const mails = (data ?? []).filter(
+ (account) => account.kind === 'mail' && account.status !== 'revoked',
+ );
+
+ if (mails.length === 0) return null;
+
+ return (
+ <div {...stylex.props(styles.list)}>
+ {mails.map((account, index) => (
+ <Flexbox
+ horizontal
+ align={'center'}
+ gap={8}
+ key={account.id}
+ {...stylex.props(styles.row, index > 0 && styles.divided)}
+ >
+ <Flexbox flex={1} gap={2} style={{ minWidth: 0 }}>
+ <span {...stylex.props(styles.label)}>{t('contacts.info.mail')}</span>
+ <span title={account.identifier} {...stylex.props(styles.value)}>
+ {account.identifier}
+ </span>
+ </Flexbox>
+ <CopyButton content={account.identifier} size={'small'} />
+ <a aria-label={t('contacts.info.sendMail')} href={`mailto:${account.identifier}`}>
+ <ActionIcon icon={MailIcon} size={'small'} title={t('contacts.info.sendMail')} />
+ </a>
+ </Flexbox>
+ ))}
+ </div>
+ );
+});
+
+ContactInfo.displayName = 'ContactInfo';
diff --git a/src/features/ContactList/index.tsx b/src/features/ContactList/index.tsx
index 18ca85be3f7..1bd3e7caf29 100644
--- a/src/features/ContactList/index.tsx
+++ b/src/features/ContactList/index.tsx
@@ -6,15 +6,18 @@ import {
AccordionItem,
AccordionPanel,
AccordionRoot,
+ accordionStyles,
AccordionTrigger,
ActionIcon,
+ cx,
DropdownMenu,
Flexbox,
+ Icon,
Text,
} from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import isEqual from 'fast-deep-equal';
-import { UserRoundPlusIcon } from 'lucide-react';
+import { ArrowDownUpIcon, Pin, PinOff, UserRoundPlusIcon } from 'lucide-react';
import { memo, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -30,16 +33,16 @@ import { NAV_PANEL_CONTACTS_KEY } from '@/features/NavPanel/railRouteKey';
import SideBarLayout from '@/features/NavPanel/SideBarLayout';
import { useActiveLocation } from '@/hooks/useActiveLocation';
import { useFetchAgentList } from '@/hooks/useFetchAgentList';
+import { useGlobalStore } from '@/store/global';
+import { systemStatusSelectors } from '@/store/global/selectors';
import { useHomeStore } from '@/store/home';
import { homeAgentListSelectors } from '@/store/home/selectors';
import { CONTACT_URL } from './const';
import ContactAvatar from './ContactAvatar';
+import { CONTACT_SORT_BYS, groupContacts } from './sortContacts';
import { styles } from './style';
-const byTitle = (fallback: string) => (a: SidebarAgentItem, b: SidebarAgentItem) =>
- agentDisplayName(a, fallback).localeCompare(agentDisplayName(b, fallback), 'zh-Hans-CN');
-
const useActiveRouteId = () => {
const { pathname } = useActiveLocation();
const slug = useActiveWorkspaceSlug();
@@ -51,6 +54,9 @@ const useActiveRouteId = () => {
const Contact = memo<{ active: boolean; item: SidebarAgentItem }>(({ active, item }) => {
const { t } = useTranslation('chat');
+ const { t: tCommon } = useTranslation('common');
+ const [pinAgent, pinAgentGroup] = useHomeStore((s) => [s.pinAgent, s.pinAgentGroup]);
+ const pinned = !!item.pinned;
const title =
item.type === 'group'
? item.title || t('untitledAgent')
@@ -63,6 +69,15 @@ const Contact = memo<{ active: boolean; item: SidebarAgentItem }>(({ active, ite
avatar={<ContactAvatar item={item} name={title} size={AVATAR_SIZE} />}
title={title}
url={CONTACT_URL(item.id)}
+ contextMenuItems={() => [
+ {
+ icon: <Icon icon={pinned ? PinOff : Pin} />,
+ key: 'pin',
+ label: tCommon(pinned ? 'pinOff' : 'pin'),
+ onClick: () =>
+ item.type === 'group' ? pinAgentGroup(item.id, !pinned) : pinAgent(item.id, !pinned),
+ },
+ ]}
/>
);
});
@@ -76,15 +91,26 @@ const Body = memo(() => {
const isInit = useHomeStore(homeAgentListSelectors.isAgentListInit);
const items = useHomeStore(homeAgentListSelectors.allAgents, isEqual);
const activeRouteId = useActiveRouteId();
+ const sortBy = useGlobalStore(systemStatusSelectors.contactListSortBy);
+ const updateSystemStatus = useGlobalStore((s) => s.updateSystemStatus);
+
+ const { agents, groups, pinned } = useMemo(
+ () =>
+ groupContacts(
+ [...new Map(items.map((item) => [item.id, item])).values()],
+ sortBy,
+ tChat('untitledAgent'),
+ ),
+ [items, sortBy, tChat],
+ );
- const { agents, groups } = useMemo(() => {
- const unique = [...new Map(items.map((item) => [item.id, item])).values()];
- const sort = byTitle(tChat('untitledAgent'));
- return {
- agents: unique.filter((item) => item.type !== 'group').sort(sort),
- groups: unique.filter((item) => item.type === 'group').sort(sort),
- };
- }, [items, tChat]);
+ const sortMenuItems = CONTACT_SORT_BYS.map((by) => ({
+ checked: sortBy === by,
+ key: by,
+ label: t(`contacts.sort.${by}`),
+ onCheckedChange: () => updateSystemStatus({ contactListSortBy: by }),
+ type: 'checkbox' as const,
+ }));
if (!isInit && items.length === 0)
return error ? (
@@ -94,7 +120,9 @@ const Body = memo(() => {
);
const sections = [
- // Groups first: there are few, and they would sink below every agent.
+ // Pinned contacts lead, like the Messages list; the section is left out until one is pinned.
+ ...(pinned.length > 0 ? [{ items: pinned, key: 'pinned', title: t('contacts.pinned') }] : []),
+ // Groups next: there are few, and they would sink below every agent.
{ items: groups, key: 'groups', title: t('contacts.groups') },
{ items: agents, key: 'agents', title: t('navPanel.agent') },
];
@@ -104,7 +132,8 @@ const Body = memo(() => {
return (
<Flexbox paddingBlock={'4px 12px'} paddingInline={4}>
<AccordionRoot
- defaultValue={sections.map((section) => section.key)}
+ // Listed up front so a section that appears later, like the first pin, opens expanded.
+ defaultValue={['pinned', 'groups', 'agents']}
indicatorPlacement={'inline'}
style={{ gap: 8 }}
>
@@ -121,6 +150,24 @@ const Body = memo(() => {
</Text>
</Flexbox>
</AccordionTrigger>
+ {/* One order for both sections; the hover action sits where the home sidebar keeps its section actions. */}
+ <Flexbox
+ horizontal
+ align={'center'}
+ className={cx(
+ 'accordion-action',
+ accordionStyles.action,
+ accordionStyles.actionBorderless,
+ )}
+ >
+ <DropdownMenu items={sortMenuItems} placement={'bottomRight'}>
+ <ActionIcon
+ icon={ArrowDownUpIcon}
+ size={'small'}
+ title={t('contacts.sort.tooltip')}
+ />
+ </DropdownMenu>
+ </Flexbox>
</AccordionHeader>
<AccordionPanel>
<Flexbox gap={1} paddingBlock={1} paddingInline={2}>
@@ -169,7 +216,7 @@ const Header = memo(() => {
Header.displayName = 'ContactListHeader';
/**
- * Contacts tab list column: every agent and group, alphabetically. A row opens
+ * Contacts tab list column: every agent and group, by name or most recently updated. A row opens
* the contact card (`/agents/:id`) and keeps the list in place; the card is
* where the user starts a chat or goes on to edit the profile.
*/
diff --git a/src/features/ContactList/sortContacts.test.ts b/src/features/ContactList/sortContacts.test.ts
new file mode 100644
index 00000000000..c3abf0ee54b
--- /dev/null
+++ b/src/features/ContactList/sortContacts.test.ts
@@ -0,0 +1,55 @@
+import type { SidebarAgentItem } from '@lobechat/types';
+import { describe, expect, it } from 'vitest';
+
+import { groupContacts, sortContacts } from './sortContacts';
+
+const item = (id: string, title: string, updatedAt: string): SidebarAgentItem =>
+ ({ id, pinned: false, title, type: 'agent', updatedAt: new Date(updatedAt) }) as SidebarAgentItem;
+
+const items = [
+ item('b', 'Beta', '2026-11-10T00:00:00Z'),
+ item('a', 'Alpha', '2026-11-01T00:00:00Z'),
+ item('c', 'Gamma', '2026-11-12T00:00:00Z'),
+ item('d', 'Delta', '2026-11-10T00:00:00Z'),
+];
+
+describe('sortContacts', () => {
+ it('orders by name', () => {
+ expect(sortContacts(items, 'title', 'Untitled').map((i) => i.id)).toEqual(['a', 'b', 'd', 'c']);
+ });
+
+ it('orders the most recently updated first, ties by name', () => {
+ expect(sortContacts(items, 'updatedAt', 'Untitled').map((i) => i.id)).toEqual([
+ 'c',
+ 'b',
+ 'd',
+ 'a',
+ ]);
+ });
+
+ it('does not mutate the input', () => {
+ sortContacts(items, 'updatedAt', 'Untitled');
+ expect(items.map((i) => i.id)).toEqual(['b', 'a', 'c', 'd']);
+ });
+});
+
+describe('groupContacts', () => {
+ it('leads with pinned contacts of either kind and leaves them out of their own section', () => {
+ const group = (id: string, title: string, pinned: boolean) =>
+ ({ ...item(id, title, '2026-11-01T00:00:00Z'), pinned, type: 'group' }) as SidebarAgentItem;
+ const sections = groupContacts(
+ [
+ { ...items[0], pinned: true },
+ items[1],
+ group('g', 'Omega', true),
+ group('h', 'Delta group', false),
+ ],
+ 'title',
+ 'Untitled',
+ );
+
+ expect(sections.pinned.map((i) => i.id)).toEqual(['b', 'g']);
+ expect(sections.groups.map((i) => i.id)).toEqual(['h']);
+ expect(sections.agents.map((i) => i.id)).toEqual(['a']);
+ });
+});
diff --git a/src/features/ContactList/sortContacts.ts b/src/features/ContactList/sortContacts.ts
new file mode 100644
index 00000000000..d9144afc78c
--- /dev/null
+++ b/src/features/ContactList/sortContacts.ts
@@ -0,0 +1,39 @@
+import { agentDisplayName, type SidebarAgentItem } from '@lobechat/types';
+
+import type { ContactListSortBy } from '@/store/global/initialState';
+
+export const CONTACT_SORT_BYS: ContactListSortBy[] = ['title', 'updatedAt'];
+
+const byTitle = (fallback: string) => (a: SidebarAgentItem, b: SidebarAgentItem) =>
+ agentDisplayName(a, fallback).localeCompare(agentDisplayName(b, fallback), 'zh-Hans-CN');
+
+/** Newest first; equal times fall back to the name so the order stays stable. */
+const byUpdatedAt = (fallback: string) => {
+ const title = byTitle(fallback);
+ return (a: SidebarAgentItem, b: SidebarAgentItem) =>
+ new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime() || title(a, b);
+};
+
+export const sortContacts = (
+ items: SidebarAgentItem[],
+ sortBy: ContactListSortBy,
+ fallback: string,
+) => [...items].sort(sortBy === 'updatedAt' ? byUpdatedAt(fallback) : byTitle(fallback));
+
+/**
+ * The contact list's sections, each in the chosen order: pinned contacts of either kind lead in
+ * their own section and are left out of the groups and agents below.
+ */
+export const groupContacts = (
+ items: SidebarAgentItem[],
+ sortBy: ContactListSortBy,
+ fallback: string,
+) => {
+ const sorted = sortContacts(items, sortBy, fallback);
+ const rest = sorted.filter((item) => !item.pinned);
+ return {
+ agents: rest.filter((item) => item.type !== 'group'),
+ groups: rest.filter((item) => item.type === 'group'),
+ pinned: sorted.filter((item) => item.pinned),
+ };
+};
diff --git a/src/features/Conversation/ChatItem/ChatItem.tsx b/src/features/Conversation/ChatItem/ChatItem.tsx
index 2dac677bba7..67eacfb287e 100644
--- a/src/features/Conversation/ChatItem/ChatItem.tsx
+++ b/src/features/Conversation/ChatItem/ChatItem.tsx
@@ -43,6 +43,7 @@ const ChatItem = memo<ChatItemProps>(
showAvatar = true,
showHeader = true,
titleAddon,
+ quietHeader,
disabled = false,
id,
style,
@@ -83,7 +84,7 @@ const ChatItem = memo<ChatItemProps>(
>
{showHeader && (
<Flexbox
- align={'center'}
+ align={quietHeader ? 'baseline' : 'center'}
className={'message-header'}
direction={isUser ? 'horizontal-reverse' : 'horizontal'}
gap={8}
@@ -97,7 +98,13 @@ const ChatItem = memo<ChatItemProps>(
{showAvatar &&
(customAvatarRender ? customAvatarRender(avatar, avatarContent) : avatarContent)}
{headerAddon}
- <Title avatar={avatar} showTitle={showTitle} time={time} titleAddon={titleAddon} />
+ <Title
+ avatar={avatar}
+ quiet={quietHeader}
+ showTitle={showTitle}
+ time={time}
+ titleAddon={titleAddon}
+ />
</Flexbox>
)}
<Flexbox
diff --git a/src/features/Conversation/ChatItem/components/Title.tsx b/src/features/Conversation/ChatItem/components/Title.tsx
index a630579845c..9f7c05a4d06 100644
--- a/src/features/Conversation/ChatItem/components/Title.tsx
+++ b/src/features/Conversation/ChatItem/components/Title.tsx
@@ -1,5 +1,6 @@
import { agentDisplayName } from '@lobechat/types';
import { Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
@@ -9,12 +10,13 @@ import { type ChatItemProps } from '../type';
export interface TitleProps {
avatar: ChatItemProps['avatar'];
+ quiet?: boolean;
showTitle?: ChatItemProps['showTitle'];
time?: ChatItemProps['time'];
titleAddon?: ChatItemProps['titleAddon'];
}
-const Title = memo<TitleProps>(({ showTitle, time, avatar, titleAddon }) => {
+const Title = memo<TitleProps>(({ showTitle, time, avatar, quiet, titleAddon }) => {
const { t } = useTranslation('chat');
const title = agentDisplayName(avatar, t('untitledAgent'));
const { text: timeText, title: timeTitle } = useActivityTime(time);
@@ -22,7 +24,14 @@ const Title = memo<TitleProps>(({ showTitle, time, avatar, titleAddon }) => {
return (
<>
{showTitle && (
- <Text fontSize={14} style={{ whiteSpace: 'nowrap' }} weight={500}>
+ <Text
+ // `type="secondary"` is the description colour, the time's own step; a quiet name sits
+ // one step above it.
+ color={quiet ? cssVar.colorTextSecondary : undefined}
+ fontSize={14}
+ style={{ whiteSpace: 'nowrap' }}
+ weight={500}
+ >
{title}
</Text>
)}
diff --git a/src/features/Conversation/ChatItem/type.ts b/src/features/Conversation/ChatItem/type.ts
index 29038a17c93..690285c4e93 100644
--- a/src/features/Conversation/ChatItem/type.ts
+++ b/src/features/Conversation/ChatItem/type.ts
@@ -66,6 +66,11 @@ export interface ChatItemProps extends Omit<FlexboxProps, 'children' | 'onChange
* @default 'left'
*/
placement?: 'left' | 'right';
+ /**
+ * Quiet header: name and time sit on one baseline, one colour step lighter than the message,
+ * like an IM author line. Off for the main chat, whose header stays as is.
+ */
+ quietHeader?: boolean;
/**
* @description Whether to hide the avatar
* @default false
diff --git a/src/features/MessageList/AgentConversation.test.tsx b/src/features/MessageList/AgentConversation.test.tsx
index 5771767afaf..34cf2a75272 100644
--- a/src/features/MessageList/AgentConversation.test.tsx
+++ b/src/features/MessageList/AgentConversation.test.tsx
@@ -57,10 +57,10 @@ vi.mock('./useAgentConversationLink', () => ({
useAgentConversationLink: (_: string, url: string) => ({ url }),
}));
vi.mock('./ConversationRow', () => ({
- default: ({ avatar, contextMenuItems, running, title }: any) =>
+ default: ({ avatar, contextMenuItems, title, typing }: any) =>
createElement(
'div',
- { 'data-running': String(!!running), 'data-testid': 'row' },
+ { 'data-testid': 'row', 'data-typing': String(!!typing) },
title,
avatar as never,
createElement(
@@ -142,7 +142,7 @@ describe('AgentConversation reply activity', () => {
// The header said "typing" while the row and its avatar stayed idle: the row only read chat
// operations, and a direct Channel replies through Channel jobs.
- it('animates the avatar while the direct Channel replies, keeping the row preview', () => {
+ it('animates the avatar and says typing while the direct Channel replies', () => {
showReply({ status: 'running' });
render(
createElement(AgentConversation, { active: true, conversation: conversation(undefined, {}) }),
@@ -150,7 +150,7 @@ describe('AgentConversation reply activity', () => {
expect(screen.getByTestId('agent-avatar')).toHaveAttribute('data-state', 'working');
expect(screen.getByTestId('agent-avatar')).toHaveAttribute('data-animated', 'true');
- expect(screen.getByTestId('row')).toHaveAttribute('data-running', 'false');
+ expect(screen.getByTestId('row')).toHaveAttribute('data-typing', 'true');
});
it('shows a blocked reply as waiting', () => {
@@ -160,7 +160,7 @@ describe('AgentConversation reply activity', () => {
);
expect(screen.getByTestId('agent-avatar')).toHaveAttribute('data-state', 'waiting');
- expect(screen.getByTestId('row')).toHaveAttribute('data-running', 'false');
+ expect(screen.getByTestId('row')).toHaveAttribute('data-typing', 'false');
});
it('stays idle once the reply settles', () => {
@@ -171,6 +171,7 @@ describe('AgentConversation reply activity', () => {
expect(screen.getByTestId('agent-avatar')).not.toHaveAttribute('data-state');
expect(screen.getByTestId('agent-avatar')).toHaveAttribute('data-animated', 'false');
+ expect(screen.getByTestId('row')).toHaveAttribute('data-typing', 'false');
});
// A row whose conversation is not open used to stay idle; it now reads the list's jobs.
@@ -196,6 +197,6 @@ describe('AgentConversation reply activity', () => {
);
expect(screen.getByTestId('agent-avatar')).toHaveAttribute('data-state', 'working');
- expect(screen.getByTestId('row')).toHaveAttribute('data-running', 'false');
+ expect(screen.getByTestId('row')).toHaveAttribute('data-typing', 'true');
});
});
diff --git a/src/features/MessageList/AgentConversation.tsx b/src/features/MessageList/AgentConversation.tsx
index 907d183f7f0..351e3cf04b8 100644
--- a/src/features/MessageList/AgentConversation.tsx
+++ b/src/features/MessageList/AgentConversation.tsx
@@ -34,6 +34,8 @@ const AgentConversation = memo<AgentConversationProps>(({ active, conversation }
const { onClick, url } = useAgentConversationLink(id, agentUrl);
const { channelActions, replyState } = useDirectChannelRow(conversation.channel, active);
const avatarState = replyState ?? (chatRunning ? 'working' : undefined);
+ // A blocked reply keeps the preview; its avatar already shows it waiting.
+ const typing = !!avatarState && avatarState !== 'waiting';
const title = agentDisplayName(item, t('untitledAgent'));
const avatarSrc = typeof avatar === 'string' ? avatar : undefined;
@@ -75,8 +77,8 @@ const AgentConversation = memo<AgentConversationProps>(({ active, conversation }
activeAt={activeAt}
contextMenuItems={menuItems}
preview={preview}
- running={chatRunning}
title={title}
+ typing={typing}
unread={conversation.unread ?? item.unreadCount}
url={url}
avatar={
diff --git a/src/features/MessageList/Body.tsx b/src/features/MessageList/Body.tsx
index f45d106aea5..865f5ee2188 100644
--- a/src/features/MessageList/Body.tsx
+++ b/src/features/MessageList/Body.tsx
@@ -190,6 +190,7 @@ const Body = memo(() => {
activeRouteId={activeRouteId}
channel={entry.channel}
key={'inbox'}
+ topic={inboxTopic}
/>
) : entry.type === 'channel' ? (
<ChannelConversation
diff --git a/src/features/MessageList/ChannelConversation.tsx b/src/features/MessageList/ChannelConversation.tsx
index 6a327293ada..b0afcf5dc15 100644
--- a/src/features/MessageList/ChannelConversation.tsx
+++ b/src/features/MessageList/ChannelConversation.tsx
@@ -8,6 +8,8 @@ import { HashIcon } from 'lucide-react';
import { memo } from 'react';
import { useChannelMenu } from '@/features/Channels/useChannelMenu';
+import ProjectAvatar from '@/features/Projects/ProjectAvatar';
+import { projectListItemSelector, useProjectStore } from '@/store/project';
import ConversationRow from './ConversationRow';
import { channelPreview } from './conversations';
@@ -22,6 +24,8 @@ interface ChannelConversationProps {
/** A group Channel as one more conversation, ordered with the Agents by its latest message. */
const ChannelConversation = memo<ChannelConversationProps>(({ active, activeAt, channel }) => {
const menuItems = useChannelMenu();
+ // A Channel grouped under a project wears that project's logo; a standalone one keeps "#".
+ const project = useProjectStore(projectListItemSelector(channel.projectId));
return (
<ConversationRow
@@ -34,12 +38,16 @@ const ChannelConversation = memo<ChannelConversationProps>(({ active, activeAt,
unread={channel.unreadCount}
url={CHANNEL_URL(channel.id)}
avatar={
- <Avatar
- avatar={<Icon color={cssVar.colorTextSecondary} icon={HashIcon} size={16} />}
- background={cssVar.colorFillSecondary}
- shape={'square'}
- size={AVATAR_SIZE}
- />
+ project ? (
+ <ProjectAvatar avatar={project.avatar} name={project.name} size={AVATAR_SIZE} />
+ ) : (
+ <Avatar
+ avatar={<Icon color={cssVar.colorTextSecondary} icon={HashIcon} size={16} />}
+ background={cssVar.colorFillSecondary}
+ shape={'square'}
+ size={AVATAR_SIZE}
+ />
+ )
}
/>
);
diff --git a/src/features/MessageList/ConversationRow.test.tsx b/src/features/MessageList/ConversationRow.test.tsx
index 14277506cc1..e72b288479a 100644
--- a/src/features/MessageList/ConversationRow.test.tsx
+++ b/src/features/MessageList/ConversationRow.test.tsx
@@ -78,4 +78,22 @@ describe('ConversationRow', () => {
expect(row.textContent).toBe('Dario');
});
+
+ // The row said a green "running" with a spinner; it now reads like the header's typing line,
+ // beside the name, and keeps the preview below it.
+ it('says typing beside the name while the Agent replies, keeping the preview', () => {
+ render(
+ createElement(ConversationRow, {
+ avatar: null,
+ preview: 'last message',
+ title: 'Dario',
+ typing: true,
+ url: '/channels/chn_dario',
+ }),
+ );
+
+ expect(screen.getByRole('status')).toHaveTextContent('activity.typing');
+ expect(screen.getByRole('status').previousElementSibling).toHaveTextContent('Dario');
+ expect(screen.getByText('last message')).toBeInTheDocument();
+ });
});
diff --git a/src/features/MessageList/ConversationRow.tsx b/src/features/MessageList/ConversationRow.tsx
index 3b60569f051..d1e72f1c911 100644
--- a/src/features/MessageList/ConversationRow.tsx
+++ b/src/features/MessageList/ConversationRow.tsx
@@ -1,10 +1,12 @@
'use client';
-import { ContextMenuTrigger, Flexbox, Spin } from '@lobehub/ui';
+import { ContextMenuTrigger, Flexbox } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import { type ComponentProps, memo, type MouseEvent, type ReactNode, type Ref } from 'react';
import { useTranslation } from 'react-i18next';
+import { activityLabel } from '@/features/Channels/activityLabel';
+import { TypingDots } from '@/features/Channels/TypingDots';
import { useWorkspaceAwareNavigate } from '@/features/Workspace/useWorkspaceAwareNavigate';
import WorkspaceLink, { type WorkspaceLinkProps } from '@/features/Workspace/WorkspaceLink';
@@ -26,10 +28,11 @@ export interface ConversationRowProps {
preview?: string;
/** The row element, e.g. the anchor for an inline rename popover. */
ref?: Ref<HTMLElement>;
- running?: boolean;
/** Title only, no preview line — for directory lists like the contacts tab. */
singleLine?: boolean;
title: string;
+ /** The Agent is replying: "typing" follows the name, like the conversation header. */
+ typing?: boolean;
unread?: number;
url: string;
}
@@ -67,13 +70,13 @@ const ConversationRow = memo<ConversationRowProps>(
onMouseEnter,
preview,
ref,
- running,
singleLine,
title,
+ typing,
unread,
url,
}) => {
- const { t } = useTranslation('common');
+ const { t } = useTranslation('channel');
const link: WorkspaceLinkProps = {
'aria-current': active ? 'page' : undefined,
'aria-label': title,
@@ -99,27 +102,21 @@ const ConversationRow = memo<ConversationRowProps>(
{...stylex.props(styles.rowText, singleLine && styles.rowTextSingleLine)}
>
<Flexbox horizontal align={'center'} gap={8}>
- <span {...stylex.props(styles.title)}>{title}</span>
+ <span {...stylex.props(styles.title, typing && styles.titleBesideTyping)}>{title}</span>
+ {typing && (
+ <span role="status" {...stylex.props(styles.typing)}>
+ {activityLabel(t('activity.typing'))}
+ <TypingDots />
+ </span>
+ )}
{activeAt && (
<span {...stylex.props(styles.time)}>{formatConversationTime(activeAt)}</span>
)}
</Flexbox>
{/* No preview: the title sits centered at the full row height, not over a blank line. */}
- {!singleLine && (running || preview) && (
+ {!singleLine && preview && (
<Flexbox horizontal align={'center'} gap={8}>
- {running ? (
- <Flexbox
- horizontal
- align={'center'}
- {...stylex.props(styles.preview, styles.running)}
- gap={4}
- >
- <Spin size={10} style={{ color: 'inherit' }} />
- {t('messageList.running')}
- </Flexbox>
- ) : (
- <span {...stylex.props(styles.preview)}>{preview}</span>
- )}
+ <span {...stylex.props(styles.preview)}>{preview}</span>
</Flexbox>
)}
</Flexbox>
diff --git a/src/features/MessageList/InboxConversation.tsx b/src/features/MessageList/InboxConversation.tsx
index 01003122894..db1198c4d88 100644
--- a/src/features/MessageList/InboxConversation.tsx
+++ b/src/features/MessageList/InboxConversation.tsx
@@ -1,9 +1,10 @@
'use client';
import { DEFAULT_INBOX_AVATAR, DEFAULT_INBOX_TITLE } from '@lobechat/const';
-import type { ChannelListItem } from '@lobechat/types';
+import type { ChannelListItem, RecentItem } from '@lobechat/types';
import { agentDisplayName } from '@lobechat/types';
import { memo } from 'react';
+import { useTranslation } from 'react-i18next';
import AgentAvatar from '@/components/AgentAvatar';
import { resolveInboxAgentRouteId } from '@/features/AgentRoute/useResolvedAgentRouteId';
@@ -14,7 +15,7 @@ import { useChatStore } from '@/store/chat';
import { operationSelectors } from '@/store/chat/selectors';
import ConversationRow from './ConversationRow';
-import { channelPreview } from './conversations';
+import { conversationPreview } from './conversations';
import { AVATAR_SIZE } from './style';
import { useInboxConversationLink } from './useAgentConversationLink';
import { useDirectChannelRow } from './useDirectChannelRow';
@@ -25,7 +26,10 @@ const InboxConversation = memo<{
activeRouteId?: string;
/** The inbox Agent's direct Channel, when the row opens it. */
channel?: ChannelListItem;
-}>(({ activeAt, activeRouteId, channel }) => {
+ /** Its latest topic, previewed like any other Agent row's while it has no direct Channel. */
+ topic?: RecentItem;
+}>(({ activeAt, activeRouteId, channel, topic }) => {
+ const { t } = useTranslation('chat');
const inboxAgentId = useAgentStore(builtinAgentSelectors.inboxAgentId);
const routeId = resolveInboxAgentRouteId(inboxAgentId);
const meta = useAgentStore(agentSelectors.getAgentMetaById(routeId));
@@ -38,17 +42,20 @@ const InboxConversation = memo<{
const active = !!activeRouteId && (activeRouteId === routeId || activeRouteId === inboxAgentId);
const { channelActions, replyState } = useDirectChannelRow(channel, active);
const avatarState = replyState ?? (running ? 'working' : undefined);
+ // A blocked reply keeps the preview; its avatar already shows it waiting.
+ const typing = !!avatarState && avatarState !== 'waiting';
return (
<ConversationRow
closeOnReselect
active={active}
- activeAt={channel ? activeAt : undefined}
+ activeAt={activeAt}
// An archived direct Channel is the only thing this row can act on.
contextMenuItems={channel?.status === 'archived' ? channelActions : undefined}
- preview={(channel && channelPreview(channel)) || meta.description || undefined}
- running={running}
+ // Same preview and time as every other Agent row; its tagline when it has nothing yet.
+ preview={conversationPreview(meta.description, topic, channel) ?? t('inbox.desc')}
title={title}
+ typing={typing}
unread={channel?.unreadCount ?? undefined}
url={url}
avatar={
diff --git a/src/features/MessageList/conversations.ts b/src/features/MessageList/conversations.ts
index 0892a1ecb97..d53a9e962b4 100644
--- a/src/features/MessageList/conversations.ts
+++ b/src/features/MessageList/conversations.ts
@@ -43,6 +43,19 @@ const oneLine = (text: string | null | undefined) =>
export const channelPreview = (channel: Pick<ChannelListItem, 'lastMessage'>) =>
channel.lastMessage ? oneLine(markdownToTxt(channel.lastMessage.content)) : undefined;
+/**
+ * A row's preview line: its direct Channel's latest message once it has one, else its latest
+ * topic (assistant reply, else title), else its description.
+ */
+export const conversationPreview = (
+ description: string | null | undefined,
+ topic: RecentItem | undefined,
+ direct?: Pick<ChannelListItem, 'lastMessage'>,
+) =>
+ direct
+ ? (channelPreview(direct) ?? oneLine(description))
+ : oneLine(topic?.lastAssistantMessage || topic?.title || description);
+
/** When a Channel last had a message, else when it was opened. */
export const channelActivity = (channel: ChannelListItem): Date =>
new Date(channel.lastMessage?.createdAt ?? channel.updatedAt ?? channel.createdAt);
@@ -116,7 +129,7 @@ export const buildConversationSections = (
activeAt: new Date(Math.max(itemTime, channelActivity(direct).getTime())),
channel: direct,
item,
- preview: channelPreview(direct) ?? oneLine(item.description),
+ preview: conversationPreview(item.description, undefined, direct),
unread: direct.unreadCount ?? 0,
});
continue;
@@ -128,10 +141,7 @@ export const buildConversationSections = (
conversations.push({
activeAt: new Date(Math.max(itemTime, latestTime)),
item,
- preview:
- (latest?.lastAssistantMessage || latest?.title || item.description || '')
- .replaceAll(/\s+/g, ' ')
- .trim() || undefined,
+ preview: conversationPreview(item.description, latest),
});
}
diff --git a/src/features/MessageList/style.ts b/src/features/MessageList/style.ts
index f4620b37740..cf056ba82be 100644
--- a/src/features/MessageList/style.ts
+++ b/src/features/MessageList/style.ts
@@ -58,9 +58,6 @@ export const styles = stylex.create({
rowTextSingleLine: {
minHeight: 0,
},
- running: {
- color: cssVar.colorSuccess,
- },
time: {
flex: 'none',
fontSize: '11px',
@@ -77,6 +74,29 @@ export const styles = stylex.create({
fontWeight: 500,
lineHeight: '18px',
},
+ /** The name gives up the spare width to the typing label beside it. */
+ titleBesideTyping: {
+ flexGrow: '0',
+ flexShrink: '1',
+ flexBasis: 'auto',
+ },
+ /**
+ * Beside the name like the conversation header's typing line, in the quiet preview colour. It
+ * keeps its own width and takes the spare room up to the time; a long name ellipsizes instead,
+ * so the dots never run into the time.
+ */
+ typing: {
+ display: 'flex',
+ flexGrow: '1',
+ flexShrink: '0',
+ flexBasis: 'auto',
+ gap: '6px',
+ alignItems: 'center',
+ fontSize: '12px',
+ lineHeight: '18px',
+ color: cssVar.colorTextTertiary,
+ whiteSpace: 'nowrap',
+ },
unread: {
pointerEvents: 'none',
position: 'absolute',
diff --git a/src/store/global/initialState.ts b/src/store/global/initialState.ts
index 0fa84913668..c718d88aa6c 100644
--- a/src/store/global/initialState.ts
+++ b/src/store/global/initialState.ts
@@ -184,6 +184,9 @@ export const DEFAULT_DOCS_PAGE_SECTION_VIEW: DocsPageSectionView = {
type: 'all',
};
+/** How the Contacts list is ordered: by name, or most recently updated first. */
+export type ContactListSortBy = 'title' | 'updatedAt';
+
/** How the sidebar project list is ordered; `manual` follows the shared drag order. */
export type ProjectListSortBy = 'manual' | 'createdAt' | 'updatedAt';
@@ -239,6 +242,8 @@ export interface SystemStatus {
* match and every group would render collapsed.
*/
collapsedTopicGroupKeysByMode?: Partial<Record<TopicGroupMode, string[]>>;
+ /** Order of the Contacts list; absent means by name. Device-local view setting. */
+ contactListSortBy?: ContactListSortBy;
disabledModelProvidersSortType?: string;
disabledModelsSortType?: string;
/**
diff --git a/src/store/global/selectors/systemStatus.ts b/src/store/global/selectors/systemStatus.ts
index 49526bb86b1..562d0a74891 100644
--- a/src/store/global/selectors/systemStatus.ts
+++ b/src/store/global/selectors/systemStatus.ts
@@ -2,6 +2,7 @@ import { type TopicGroupMode } from '@/types/topic';
import type {
AgentDocumentSort,
+ ContactListSortBy,
DocsPageSectionKey,
DocsPageSectionView,
GlobalState,
@@ -505,6 +506,8 @@ const DEFAULT_AGENT_DOCUMENT_SORT: AgentDocumentSort = {
foldersFirst: true,
order: 'asc',
};
+const contactListSortBy = (s: GlobalState): ContactListSortBy =>
+ s.status.contactListSortBy ?? 'title';
const projectListSortBy = (s: GlobalState): ProjectListSortBy =>
s.status.projectListSortBy ?? 'manual';
const agentDocumentSort = (s: GlobalState): AgentDocumentSort =>
@@ -558,6 +561,7 @@ const homeSelectedAgentId = (s: GlobalState) => s.status.homeSelectedAgentId;
export const systemStatusSelectors = {
agentBuilderPanelWidth,
agentDocumentSort,
+ contactListSortBy,
projectListSortBy,
agentListExpandedGroupKeys,
agentListSidebarSectionCollapsed,