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(profile-card): show member and Agent hover cards beyond Tasks (#23054)

Rdmclin235ecc01d5651
diff --git a/src/features/AgentProfileCard/AgentProfilePopup.tsx b/src/features/AgentProfileCard/AgentProfilePopup.tsx
index 9e7f4d590ad..5e13e942a64 100644
--- a/src/features/AgentProfileCard/AgentProfilePopup.tsx
+++ b/src/features/AgentProfileCard/AgentProfilePopup.tsx
@@ -70,11 +70,13 @@ interface AgentProfilePopupProps extends PropsWithChildren {
agentId: string;
/** When set, enables group-specific actions (settings nav + model change). */
groupId?: string;
+ /** Where the card opens; defaults to above a hover trigger and beside a click one. */
+ placement?: 'top' | 'right' | 'bottom' | 'left';
trigger?: 'click' | 'hover';
}
const AgentProfilePopup = memo<AgentProfilePopupProps>(
- ({ agent, agentId, groupId, children, trigger = 'click' }) => {
+ ({ agent, agentId, groupId, children, placement, trigger = 'click' }) => {
const { t } = useTranslation('chat');
const navigate = useWorkspaceAwareNavigate();
const [open, setOpen] = useState(false);
@@ -267,7 +269,7 @@ const AgentProfilePopup = memo<AgentProfilePopupProps>(
classNames={trigger === 'click' ? { trigger: styles.trigger } : undefined}
nativeButton={false}
open={open}
- placement={trigger === 'hover' ? 'top' : 'right'}
+ placement={placement ?? (trigger === 'hover' ? 'top' : 'right')}
trigger={trigger}
content={
<div role="presentation" onClick={stopCardClick}>
diff --git a/src/features/Conversation/Markdown/plugins/Mention/Render.tsx b/src/features/Conversation/Markdown/plugins/Mention/Render.tsx
index dda14cc8d7f..f63c42fac50 100644
--- a/src/features/Conversation/Markdown/plugins/Mention/Render.tsx
+++ b/src/features/Conversation/Markdown/plugins/Mention/Render.tsx
@@ -1,11 +1,11 @@
'use client';
-import { createStaticStyles, Flexbox, Popover, Text } from '@lobehub/ui';
+import { createStaticStyles } from '@lobehub/ui';
import isEqual from 'fast-deep-equal';
import { memo } from 'react';
import { useTranslation } from 'react-i18next';
-import AgentAvatar from '@/components/AgentAvatar';
+import MentionProfileTrigger from '@/features/MemberProfileCard/MentionProfileTrigger';
import { useSessionStore } from '@/store/session';
import { sessionSelectors } from '@/store/session/selectors';
@@ -58,47 +58,31 @@ const Render = memo<MarkdownElementProps<MentionProps>>(({ children, node }) =>
);
}
- // Find the specific member
+ // A group member resolves to its Agent at once; any other id (a workspace
+ // member, an Agent outside this group) is looked up by the profile card.
const member = currentGroupMembers?.find((m) => m.id === mentionId);
-
- if (!member) {
- // Fallback for unknown member
- return (
- <span className={styles.mention}>
- {'@'}
- {name || children || 'unknown'}
- </span>
- );
- }
+ const label = member?.title || name || children || 'unknown';
return (
- <Popover
- trigger="click"
- content={
- <Flexbox gap={12} style={{ overflow: 'hidden' }} width={320}>
- <Flexbox horizontal align="center" gap={8}>
- <AgentAvatar
- agentId={member.id}
- avatar={member.avatar}
- background={member.backgroundColor ?? undefined}
- name={member.title || name}
- size={40}
- style={{ flex: 'none' }}
- />
- <Flexbox style={{ overflow: 'hidden' }}>
- <Text ellipsis type={'secondary'}>
- {member.description}
- </Text>
- </Flexbox>
- </Flexbox>
- </Flexbox>
+ <MentionProfileTrigger
+ id={mentionId}
+ type={member ? 'agent' : undefined}
+ agent={
+ member
+ ? {
+ avatar: member.avatar,
+ backgroundColor: member.backgroundColor,
+ description: member.description,
+ title: member.title || name,
+ }
+ : { title: name }
}
>
<span className={styles.mention}>
{'@'}
- {member.title || name || children}
+ {label}
</span>
- </Popover>
+ </MentionProfileTrigger>
);
});
diff --git a/src/features/Conversation/Messages/User/components/RichTextMessage.test.tsx b/src/features/Conversation/Messages/User/components/RichTextMessage.test.tsx
index 1ef573e5c8c..92bff6cc5fb 100644
--- a/src/features/Conversation/Messages/User/components/RichTextMessage.test.tsx
+++ b/src/features/Conversation/Messages/User/components/RichTextMessage.test.tsx
@@ -3,10 +3,18 @@
*/
import { moment } from '@lobehub/editor';
import { act, cleanup, fireEvent, render, screen } from '@testing-library/react';
-import { afterEach, describe, expect, it } from 'vitest';
+import { afterEach, describe, expect, it, vi } from 'vitest';
import RichTextMessage from './RichTextMessage';
+vi.mock('@/features/MemberProfileCard/MentionProfileTrigger', () => ({
+ default: ({ children, id, type }: { children: React.ReactNode; id?: string; type?: string }) => (
+ <span data-mention-profile={id} data-mention-type={type}>
+ {children}
+ </span>
+ ),
+}));
+
const mentionEditorState = {
root: {
children: [
@@ -112,6 +120,19 @@ describe('RichTextMessage', () => {
expect(container.querySelector('.editor_mention')?.textContent).toBe('@Agent A');
});
+ it('should open the profile card of the mentioned Agent on hover', async () => {
+ const { container } = render(<RichTextMessage editorState={mentionEditorState} />);
+
+ await act(async () => {
+ await moment();
+ });
+
+ const trigger = container.querySelector('[data-mention-profile]');
+ expect(trigger?.getAttribute('data-mention-profile')).toBe('agent-a');
+ expect(trigger?.getAttribute('data-mention-type')).toBe('agent');
+ expect(trigger?.querySelector('.editor_mention')?.textContent).toBe('@Agent A');
+ });
+
// Regression: a local file dragged from the working sidebar serializes to a
// `local-file-tag` node. If that node isn't registered on the renderer,
// LexicalRenderer throws while parsing the state and the whole message crashes.
diff --git a/src/features/Conversation/Messages/User/components/RichTextMessage.tsx b/src/features/Conversation/Messages/User/components/RichTextMessage.tsx
index cde6c46d780..e291f33e2e2 100644
--- a/src/features/Conversation/Messages/User/components/RichTextMessage.tsx
+++ b/src/features/Conversation/Messages/User/components/RichTextMessage.tsx
@@ -12,6 +12,7 @@ import { ReferTopicNode } from '@/features/ChatInput/InputEditor/ReferTopic/Refe
import { downloadPreviewImage } from '../../components/downloadPreviewImage';
import { richTextImageRenderers } from './richTextImageRenderers';
+import { richTextMentionRenderers } from './richTextMentionRenderers';
interface RichTextMessageProps {
editorState: unknown;
@@ -22,6 +23,7 @@ const LINE_HEIGHT = 1.6;
const style: CSSProperties = { '--common-line-height': LINE_HEIGHT } as CSSProperties;
const EXTRA_NODES = [ActionTagNode, ReferTopicNode, ReferDocumentNode, LocalFileTagNode];
const PREVIEW_OPTIONS = { onDownload: downloadPreviewImage };
+const RENDERERS = { ...richTextImageRenderers, ...richTextMentionRenderers };
const RichTextMessage = memo<RichTextMessageProps>(({ editorState, variant = 'chat' }) => {
const value = useMemo(() => {
@@ -37,7 +39,7 @@ const RichTextMessage = memo<RichTextMessageProps>(({ editorState, variant = 'ch
<LexicalRenderer
className={mentionPlainClassName}
extraNodes={EXTRA_NODES}
- overrides={richTextImageRenderers}
+ overrides={RENDERERS}
style={style}
value={value}
variant={variant}
diff --git a/src/features/Conversation/Messages/User/components/richTextMentionRenderers.tsx b/src/features/Conversation/Messages/User/components/richTextMentionRenderers.tsx
new file mode 100644
index 00000000000..cbf0df368b4
--- /dev/null
+++ b/src/features/Conversation/Messages/User/components/richTextMentionRenderers.tsx
@@ -0,0 +1,31 @@
+import { createDefaultRenderers, type NodeRenderer } from '@lobehub/editor/renderer';
+
+import MentionProfileTrigger from '@/features/MemberProfileCard/MentionProfileTrigger';
+
+const stockMention = createDefaultRenderers().get('mention');
+
+/**
+ * `LexicalRenderer` override for `mention` nodes: the stock chip, wrapped so
+ * hovering an @Agent or @member shows their profile card. Mentions without an
+ * id render exactly as before.
+ */
+export const renderProfileMention: NodeRenderer = (node, key, children) => {
+ const chip = stockMention?.(node, key, children) ?? `@${node.label ?? ''}`;
+ const id = typeof node.metadata?.id === 'string' ? node.metadata.id : undefined;
+ if (!id) return chip;
+
+ return (
+ <MentionProfileTrigger
+ agent={{ title: node.label || undefined }}
+ id={id}
+ key={key}
+ type={typeof node.metadata?.type === 'string' ? node.metadata.type : undefined}
+ >
+ {chip}
+ </MentionProfileTrigger>
+ );
+};
+
+export const richTextMentionRenderers: Record<string, NodeRenderer> = {
+ mention: renderProfileMention,
+};
diff --git a/src/features/HomeSidebar/Body/Agent/List/AgentItem/index.tsx b/src/features/HomeSidebar/Body/Agent/List/AgentItem/index.tsx
index 735c7e1f652..51a34156882 100644
--- a/src/features/HomeSidebar/Body/Agent/List/AgentItem/index.tsx
+++ b/src/features/HomeSidebar/Body/Agent/List/AgentItem/index.tsx
@@ -9,6 +9,7 @@ import { memo, useCallback, useMemo } from 'react';
import { useTranslation } from 'react-i18next';
import AgentAvatar from '@/components/AgentAvatar';
+import AgentProfilePopup from '@/features/AgentProfileCard/AgentProfilePopup';
import NavItem from '@/features/NavPanel/components/NavItem';
import WorkspaceLink from '@/features/Workspace/WorkspaceLink';
import { usePrefetchAgent } from '@/hooks/usePrefetchAgent';
@@ -43,7 +44,7 @@ const styles = stylex.create({
fontSize: '9px',
fontWeight: 600,
lineHeight: 1,
- color: '#fff',
+ color: cssVar.colorTextLightSolid,
backgroundColor: cssVar.colorError,
backgroundImage: 'none',
},
@@ -77,7 +78,19 @@ interface AgentItemProps {
}
const AgentItem = memo<AgentItemProps>(({ item, style, className, onNavigate, secondaryLabel }) => {
- const { id, avatar, backgroundColor, pinned, slug, userId, visibility } = item;
+ const {
+ id,
+ avatar,
+ backgroundColor,
+ description,
+ name,
+ pinned,
+ slug,
+ title,
+ userId,
+ visibility,
+ } = item;
+ const avatarUrl = typeof avatar === 'string' ? avatar : undefined;
// Unread count is server-computed (topics.status === 'unread') and carried on
// the sidebar list item, so it stays accurate across agents whose topics
// aren't loaded into the chat store on this client.
@@ -159,42 +172,53 @@ const AgentItem = memo<AgentItemProps>(({ item, style, className, onNavigate, se
const avatarNode = (
<AgentAvatar
agentId={id}
- avatar={typeof avatar === 'string' ? avatar : undefined}
+ avatar={avatarUrl}
background={backgroundColor || undefined}
name={displayTitle}
size={22}
/>
);
- if (isLoading) {
- return (
- <span {...stylex.props(styles.wrapper)}>
- {avatarNode}
- <span {...stylex.props(styles.runningBadge)}>
- <Spin size={9} style={{ color: 'inherit' }} />
- </span>
- </span>
- );
- }
-
- if (unreadCount > 0) {
- return (
+ // Hovering the avatar (not the whole row, which the pointer crosses all
+ // the time) shows the same profile card the Task assignees use.
+ return (
+ <AgentProfilePopup
+ agent={{ avatar: avatarUrl, backgroundColor, description, name, title }}
+ agentId={id}
+ placement={'right'}
+ trigger={'hover'}
+ >
<span {...stylex.props(styles.wrapper)}>
{avatarNode}
- <span {...stylex.props(styles.badge)}>{unreadCount > 99 ? '99+' : unreadCount}</span>
+ {isLoading ? (
+ <span {...stylex.props(styles.runningBadge)}>
+ <Spin size={9} style={{ color: 'inherit' }} />
+ </span>
+ ) : unreadCount > 0 ? (
+ <span {...stylex.props(styles.badge)}>{unreadCount > 99 ? '99+' : unreadCount}</span>
+ ) : null}
</span>
- );
- }
-
- return avatarNode;
- }, [isUpdating, isLoading, id, avatar, backgroundColor, displayTitle, unreadCount]);
+ </AgentProfilePopup>
+ );
+ }, [
+ isUpdating,
+ isLoading,
+ id,
+ avatarUrl,
+ backgroundColor,
+ description,
+ displayTitle,
+ name,
+ title,
+ unreadCount,
+ ]);
const dropdownMenu = useAgentDropdownMenu({
- avatar: typeof avatar === 'string' ? avatar : undefined,
+ avatar: avatarUrl,
backgroundColor: backgroundColor || undefined,
group: undefined, // TODO: pass group from parent if needed
id,
- name: item.name,
+ name,
openCreateGroupModal: handleOpenCreateGroupModal,
pinned: pinned ?? false,
slug,
diff --git a/src/features/MemberProfileCard/MemberProfilePopup.tsx b/src/features/MemberProfileCard/MemberProfilePopup.tsx
index 4809b3f7ce8..f122d62576f 100644
--- a/src/features/MemberProfileCard/MemberProfilePopup.tsx
+++ b/src/features/MemberProfileCard/MemberProfilePopup.tsx
@@ -13,6 +13,8 @@ interface MemberProfilePopupProps extends PropsWithChildren {
/** Rendered instead of the children when there is no member card to show. */
fallback?: ReactNode;
placement?: 'top' | 'right' | 'bottom' | 'left';
+ /** `click` for touch surfaces, where nothing hovers. */
+ trigger?: 'click' | 'hover';
userId?: string | null;
}
@@ -24,7 +26,7 @@ interface MemberProfilePopupProps extends PropsWithChildren {
* long list of avatars does not refetch it per row.
*/
const MemberProfilePopup = memo<MemberProfilePopupProps>(
- ({ children, fallback, placement = 'top', userId }) => {
+ ({ children, fallback, placement = 'top', trigger = 'hover', userId }) => {
const member = useWorkspaceMemberProfile(userId);
if (!member) return fallback ?? children;
@@ -34,7 +36,7 @@ const MemberProfilePopup = memo<MemberProfilePopupProps>(
nativeButton={false}
placement={placement}
styles={POPOVER_STYLES}
- trigger={'hover'}
+ trigger={trigger}
content={
<div role="presentation" onClick={stopCardClick}>
<MemberProfileCard member={member} />
diff --git a/src/features/MemberProfileCard/MentionProfileTrigger.tsx b/src/features/MemberProfileCard/MentionProfileTrigger.tsx
new file mode 100644
index 00000000000..5ca2619029e
--- /dev/null
+++ b/src/features/MemberProfileCard/MentionProfileTrigger.tsx
@@ -0,0 +1,55 @@
+'use client';
+
+import { memo, type ReactNode } from 'react';
+
+import { useFetchWorkspaceMembers } from '@/business/client/hooks/useFetchWorkspaceMembers';
+import AgentProfilePopup from '@/features/AgentProfileCard/AgentProfilePopup';
+import type { AgentProfilePreview } from '@/features/AgentProfileCard/useAgentProfileDetail';
+import { useIsMobile } from '@/hooks/useIsMobile';
+
+import MemberProfilePopup from './MemberProfilePopup';
+import { isAgentMention } from './mentionTarget';
+
+interface MentionProfileTriggerProps {
+ /** Prefilled Agent data so the card paints before the Agent loads. */
+ agent?: Partial<AgentProfilePreview>;
+ children: ReactNode;
+ /** The mentioned Agent id or workspace member's user id. */
+ id?: string | null;
+ /** Mention kind from the editor metadata (`agent`, `member`, …), when known. */
+ type?: string | null;
+}
+
+/**
+ * Hovering an @mention shows who it is: the Agent's profile card or the
+ * workspace member's card, the same ones Task assignees use. A mention that
+ * resolves to neither (a removed member, personal mode) stays plain text.
+ */
+const MentionProfileTrigger = memo<MentionProfileTriggerProps>(({ agent, children, id, type }) => {
+ const isAgent = isAgentMention(id, type);
+ // Touch screens have no hover: a tap opens the card there instead.
+ const isMobile = useIsMobile();
+ const trigger = isMobile ? 'click' : 'hover';
+ // The member card reads the shared directory; the request is deduplicated
+ // across every mention on the page.
+ useFetchWorkspaceMembers({ enabled: !!id && !isAgent });
+
+ if (!id) return children;
+
+ if (isAgent)
+ return (
+ <AgentProfilePopup agent={agent} agentId={id} placement={'top'} trigger={trigger}>
+ <span style={{ display: 'inline' }}>{children}</span>
+ </AgentProfilePopup>
+ );
+
+ return (
+ <MemberProfilePopup trigger={trigger} userId={id}>
+ {children}
+ </MemberProfilePopup>
+ );
+});
+
+MentionProfileTrigger.displayName = 'MentionProfileTrigger';
+
+export default MentionProfileTrigger;
diff --git a/src/features/MemberProfileCard/mentionTarget.test.ts b/src/features/MemberProfileCard/mentionTarget.test.ts
new file mode 100644
index 00000000000..3fdc4071814
--- /dev/null
+++ b/src/features/MemberProfileCard/mentionTarget.test.ts
@@ -0,0 +1,19 @@
+import { describe, expect, it } from 'vitest';
+
+import { isAgentMention } from './mentionTarget';
+
+describe('isAgentMention', () => {
+ it('trusts an explicit agent type', () => {
+ expect(isAgentMention('anything', 'agent')).toBe(true);
+ });
+
+ it('recognises Agent ids when the type is missing or generic', () => {
+ expect(isAgentMention('agt_123', undefined)).toBe(true);
+ expect(isAgentMention('agt_123', 'member')).toBe(true);
+ });
+
+ it('treats other ids as people', () => {
+ expect(isAgentMention('user_123', 'member')).toBe(false);
+ expect(isAgentMention(undefined, undefined)).toBe(false);
+ });
+});
diff --git a/src/features/MemberProfileCard/mentionTarget.ts b/src/features/MemberProfileCard/mentionTarget.ts
new file mode 100644
index 00000000000..1edfb103fde
--- /dev/null
+++ b/src/features/MemberProfileCard/mentionTarget.ts
@@ -0,0 +1,9 @@
+const AGENT_ID_PREFIX = 'agt_';
+
+/**
+ * Whether a mention points at an Agent. The chat composer stamps `type: 'agent'`;
+ * group-chat members and older messages only carry the id, and Agent ids are
+ * the ones with the `agt_` prefix.
+ */
+export const isAgentMention = (id?: string | null, type?: string | null) =>
+ type === 'agent' || !!id?.startsWith(AGENT_ID_PREFIX);
diff --git a/src/features/PageEditor/DocumentComments/CommentCard.tsx b/src/features/PageEditor/DocumentComments/CommentCard.tsx
index 32623bd0204..8399563ce77 100644
--- a/src/features/PageEditor/DocumentComments/CommentCard.tsx
+++ b/src/features/PageEditor/DocumentComments/CommentCard.tsx
@@ -15,6 +15,7 @@ import { ChevronRight, MessageCircle, Pencil, Trash } from 'lucide-react';
import { memo, useCallback, useEffect, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { useFetchWorkspaceMembers } from '@/business/client/hooks/useFetchWorkspaceMembers';
import { AttachmentMenu } from '@/features/AttachmentInput';
import RichTextMessage from '@/features/Conversation/Messages/User/components/RichTextMessage';
import { TypoBar } from '@/features/EditorCanvas';
@@ -23,6 +24,7 @@ import {
insertExistingAttachmentsIntoEditor,
insertFilesIntoEditor,
} from '@/features/EditorCanvas/editorAttachments';
+import MemberProfilePopup from '@/features/MemberProfileCard/MemberProfilePopup';
import { useActivityTime } from '@/hooks/useActivityTime';
import { useEnterToSend } from '@/hooks/useEnterToSend';
import { useLocalStorageState } from '@/hooks/useLocalStorageState';
@@ -97,6 +99,9 @@ const CommentCard = memo<CommentCardProps>(
variant = 'root',
}) => {
const { t } = useTranslation('file');
+ // Hovering the author shows their member card; the directory request is
+ // shared by every card in the thread.
+ useFetchWorkspaceMembers({ enabled: !!comment.authorUserId });
const cardRef = useRef<HTMLDivElement>(null);
const { text: time, title: timeTitle } = useActivityTime(comment.createdAt);
const shouldSendOnEnter = useEnterToSend();
@@ -239,17 +244,21 @@ const CommentCard = memo<CommentCardProps>(
className={cx(styles.header, compact && styles.headerCompact)}
gap={compact ? 8 : 8}
>
- <Avatar
- avatar={comment.author.avatar || authorName}
- size={compact ? 28 : variant === 'reply' ? 28 : 32}
- />
+ <MemberProfilePopup userId={comment.authorUserId}>
+ <Avatar
+ avatar={comment.author.avatar || authorName}
+ size={compact ? 28 : variant === 'reply' ? 28 : 32}
+ />
+ </MemberProfilePopup>
{compact ? (
// Name over time, the way a card in a narrow column reads best.
<Flexbox gap={2} style={{ minWidth: 0 }}>
<Flexbox horizontal align={'center'} gap={6} style={{ minWidth: 0 }}>
- <Text ellipsis fontSize={13} weight={600}>
- {authorName}
- </Text>
+ <MemberProfilePopup userId={comment.authorUserId}>
+ <Text ellipsis fontSize={13} weight={600}>
+ {authorName}
+ </Text>
+ </MemberProfilePopup>
{replyToName && (
<>
<ChevronRight aria-hidden className={styles.replyTargetIcon} size={12} />
@@ -270,9 +279,11 @@ const CommentCard = memo<CommentCardProps>(
)}
</Flexbox>
) : (
- <Text fontSize={14} weight={600}>
- {authorName}
- </Text>
+ <MemberProfilePopup userId={comment.authorUserId}>
+ <Text fontSize={14} weight={600}>
+ {authorName}
+ </Text>
+ </MemberProfilePopup>
)}
{!compact && replyToName && (
<>
diff --git a/src/features/PageEditor/History/HistoryListItem.tsx b/src/features/PageEditor/History/HistoryListItem.tsx
index 8bf3088c9d9..f8cd24b6b34 100644
--- a/src/features/PageEditor/History/HistoryListItem.tsx
+++ b/src/features/PageEditor/History/HistoryListItem.tsx
@@ -8,6 +8,8 @@ import { memo } from 'react';
import { useTranslation } from 'react-i18next';
import { useAuthorInfo } from '@/business/client/hooks/useAuthorInfo';
+import { useFetchWorkspaceMembers } from '@/business/client/hooks/useFetchWorkspaceMembers';
+import MemberProfilePopup from '@/features/MemberProfileCard/MemberProfilePopup';
import { useEventCallback } from '@/hooks/useEventCallback';
import type { DocumentHistorySaveSource } from '@/server/routers/lambda/_schema/documentHistory';
@@ -140,6 +142,7 @@ export const HistoryListItem = memo<HistoryListItemProps>(({ historyId, onCompar
const item = useHistoryItemsStore(historyItemSelectors.itemById(historyId));
const isRestoring = useHistoryItemsStore(historyItemSelectors.isRestoring(historyId));
const authorInfo = useAuthorInfo(item?.userId);
+ useFetchWorkspaceMembers({ enabled: !!item?.userId });
const handleCompare = useEventCallback(() => {
onCompare(historyId);
@@ -170,7 +173,14 @@ export const HistoryListItem = memo<HistoryListItemProps>(({ historyId, onCompar
</span>
</Tooltip>
<span className={styles.description}>
- {authorInfo?.fullName ? `${authorInfo.fullName} · ` : ''}
+ {authorInfo?.fullName && (
+ <>
+ <MemberProfilePopup placement={'left'} userId={item.userId}>
+ {authorInfo.fullName}
+ </MemberProfilePopup>
+ {' · '}
+ </>
+ )}
{dayjs(item.savedAt).fromNow()}
</span>
</Flexbox>
diff --git a/src/features/Portal/TopicComments/CommentCard.tsx b/src/features/Portal/TopicComments/CommentCard.tsx
index 215109617df..8616179ddfa 100644
--- a/src/features/Portal/TopicComments/CommentCard.tsx
+++ b/src/features/Portal/TopicComments/CommentCard.tsx
@@ -16,7 +16,9 @@ import { MessageCircle, MoreHorizontal, Pencil, Trash } from 'lucide-react';
import { memo, useCallback, useMemo, useRef, useState } from 'react';
import { useTranslation } from 'react-i18next';
+import { useFetchWorkspaceMembers } from '@/business/client/hooks/useFetchWorkspaceMembers';
import RichTextMessage from '@/features/Conversation/Messages/User/components/RichTextMessage';
+import MemberProfilePopup from '@/features/MemberProfileCard/MemberProfilePopup';
import { useTopicCommentMutations } from '@/features/TopicComment/hooks';
import { useActivityTime } from '@/hooks/useActivityTime';
@@ -77,6 +79,8 @@ const CommentCard = memo<CommentCardProps>(
const moderated = Boolean(comment.moderatedAt);
const authorName =
comment.author.fullName || comment.author.username || t('topicComment.author.deactivated');
+ // The author's member card reads the shared workspace directory.
+ useFetchWorkspaceMembers({ enabled: !!comment.authorUserId });
const edited = new Date(comment.updatedAt).getTime() > new Date(comment.createdAt).getTime();
const handleUpdate = useCallback(async () => {
@@ -159,10 +163,14 @@ const CommentCard = memo<CommentCardProps>(
gap={8}
>
<Flexbox horizontal align={'center'} gap={8}>
- <Avatar avatar={comment.author.avatar || authorName} size={24} />
- <Text fontSize={13} weight={500}>
- {authorName}
- </Text>
+ <MemberProfilePopup userId={comment.authorUserId}>
+ <Avatar avatar={comment.author.avatar || authorName} size={24} />
+ </MemberProfilePopup>
+ <MemberProfilePopup userId={comment.authorUserId}>
+ <Text fontSize={13} weight={500}>
+ {authorName}
+ </Text>
+ </MemberProfilePopup>
{comment.author.status === 'former' && (
<Text fontSize={12} type={'secondary'}>
{t('topicComment.author.former')}