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(channel): render entity links and open acceptance reports beside the feed (#22584)

Arvin Xu3090c7a6c40b
diff --git a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
index 4a6947e9265..c81cbecfcbf 100644
--- a/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
+++ b/src/features/Acceptance/Viewer/AcceptanceOverview.tsx
@@ -103,8 +103,15 @@ export const AcceptanceOverview = ({
<Flexbox className={styles.column} gap={12}>
{/* Sharing sits beside the identity, as on the workbench page. The
control gates itself on the server's review capability, so a
- reader without it sees nothing here. */}
- <Flexbox horizontal align={'flex-start'} gap={16} justify={'space-between'}>
+ reader without it sees nothing here. The inline padding clears the
+ ledger's collapsed chip, which floats over this corner. */}
+ <Flexbox
+ horizontal
+ align={'flex-start'}
+ gap={16}
+ justify={'space-between'}
+ style={{ paddingInlineEnd: 24 }}
+ >
<Flexbox flex={1} style={{ minWidth: 0 }}>
<AcceptanceIdentity
focusSlot={<AcceptanceEnterFocus />}
diff --git a/src/features/Channels/AcceptancePanel.tsx b/src/features/Channels/AcceptancePanel.tsx
new file mode 100644
index 00000000000..7a370636e9d
--- /dev/null
+++ b/src/features/Channels/AcceptancePanel.tsx
@@ -0,0 +1,59 @@
+import { Flexbox } from '@lobehub/ui';
+import * as stylex from '@stylexjs/stylex';
+import type { ReactNode } from 'react';
+import { useState } from 'react';
+
+import type { InternalLinkReference } from '@/features/EntityLink';
+import { PortalContent } from '@/features/Portal/router';
+import RightPanel from '@/features/RightPanel';
+
+import { styles } from './styles';
+import { THREAD_FLOAT_BREAKPOINT } from './ThreadPanel';
+import { useAcceptancePanel } from './useAcceptancePanel';
+
+/** Entity details a Channel can show beside its feed; anything else follows its own route. */
+export const CHANNEL_ENTITY_PORTAL_SCOPE = [
+ 'acceptance',
+] as const satisfies readonly InternalLinkReference['type'][];
+
+/** The acceptance report behind a link in the feed, beside the Channel like a thread. */
+export function AcceptancePanel({
+ availableWidth = 1000,
+ channelId,
+}: {
+ availableWidth?: number;
+ channelId: string;
+}): ReactNode {
+ const { close, open } = useAcceptancePanel(channelId);
+ const [preferredWidth, setPreferredWidth] = useState(720);
+ const narrow = availableWidth < THREAD_FLOAT_BREAKPOINT;
+ const maxWidth = narrow ? availableWidth : availableWidth - 360;
+ const width = Math.min(preferredWidth, maxWidth);
+
+ return (
+ <RightPanel
+ className={stylex.props(styles.threadPanel).className}
+ classNames={{ content: stylex.props(styles.threadContent).className }}
+ expand={open}
+ maxWidth={maxWidth}
+ minWidth={Math.min(360, maxWidth)}
+ mode={narrow ? 'float' : 'fixed'}
+ showHandleWhenCollapsed={false}
+ showHandleWideArea={false}
+ width={narrow ? availableWidth : width}
+ onExpandChange={(expand) => {
+ if (!expand) close();
+ }}
+ onSizeChange={(size) => {
+ const next = Number.parseFloat(String(size?.width));
+ if (Number.isFinite(next)) setPreferredWidth(next);
+ }}
+ >
+ {open && (
+ <Flexbox {...stylex.props(styles.body)}>
+ <PortalContent onClose={close} />
+ </Flexbox>
+ )}
+ </RightPanel>
+ );
+}
diff --git a/src/features/Channels/ChannelList.tsx b/src/features/Channels/ChannelList.tsx
index 77de170bdec..cc69c556b76 100644
--- a/src/features/Channels/ChannelList.tsx
+++ b/src/features/Channels/ChannelList.tsx
@@ -38,7 +38,7 @@ import { useChannelMenu } from './useChannelMenu';
import { useChannelsEnabled } from './useChannelsEnabled';
import { useThreadMenu } from './useThreadMenu';
-// The connector runs down from the centre of the Channel's 18px icon (4px row padding + half
+// The connector runs down from the centre of the Channel's icon (4px row padding + half
// its 28px slot) and bends into each thread row, the way Discord nests threads. A 2px line
// centres on that axis; Chromium floors fractional border widths, so 1.5px drew as 1px.
const SPINE_X = 17;
@@ -188,6 +188,8 @@ const EnabledChannelSection = ({ itemKey = 'channels', projectId }: ChannelSecti
data-channel-id={channel.id}
href={buildWorkspaceAwarePath(path, slug)}
icon={Hash}
+ // The glyph fills its whole box, so it reads larger than other nav icons at 18px.
+ iconSize={14}
title={channel.title}
actions={() => (
<DropdownMenu items={menuItems(channel)}>
diff --git a/src/features/Channels/ChannelMessage.test.tsx b/src/features/Channels/ChannelMessage.test.tsx
index 6e1b1028367..2362a00e5a7 100644
--- a/src/features/Channels/ChannelMessage.test.tsx
+++ b/src/features/Channels/ChannelMessage.test.tsx
@@ -6,18 +6,29 @@ import { render, screen } from '@testing-library/react';
import { createElement, type ReactNode } from 'react';
import { describe, expect, it, vi } from 'vitest';
+import EntityLinkElement from '@/features/EntityLink/element';
+
import { ChannelMessage } from './ChannelMessage';
+import { CHANNEL_MENTION_TAG } from './mentionMarkdown';
vi.mock('react-i18next', () => ({
useTranslation: () => ({ i18n: { language: 'en-US' }, t: (key: string) => key }),
}));
vi.mock('@/features/Conversation/ChatItem', () => ({
- // Renders only the avatar slot, the way ChatItem hands it to customAvatarRender.
+ // Renders only the avatar and message slots, the way ChatItem hands them over.
ChatItem: ({
customAvatarRender,
+ message,
}: {
customAvatarRender: (a: unknown, n: ReactNode) => ReactNode;
- }) => createElement('div', {}, customAvatarRender({}, createElement('img', { alt: 'avatar' }))),
+ message: ReactNode;
+ }) =>
+ createElement(
+ 'div',
+ {},
+ customAvatarRender({}, createElement('img', { alt: 'avatar' })),
+ message,
+ ),
}));
vi.mock('@/features/AgentProfileCard/AgentProfilePopup', () => ({
default: ({
@@ -42,7 +53,13 @@ vi.mock('@/features/AgentProfileCard/AgentProfilePopup', () => ({
children,
),
}));
-vi.mock('@/features/Conversation/Markdown', () => ({ default: () => null }));
+const markdownProps = vi.hoisted(() => ({ current: undefined as any }));
+vi.mock('@/features/Conversation/Markdown', () => ({
+ default: (props: unknown) => {
+ markdownProps.current = props;
+ return null;
+ },
+}));
vi.mock('@/features/User/UserAvatar', () => ({ default: () => createElement('i', {}, 'me') }));
vi.mock('@/store/user', () => ({
useUserStore: (selector: (s: unknown) => unknown) => selector({}),
@@ -102,3 +119,23 @@ describe('ChannelMessage avatar', () => {
expect(screen.getByAltText('avatar')).toBeTruthy();
});
});
+
+describe('ChannelMessage links', () => {
+ it('renders links through the entity-link element, alongside mention chips', () => {
+ render(
+ <ChannelMessage
+ detail={detail}
+ message={{
+ ...message({ avatar: null, id: 'agt_1', name: 'Sanjo', type: 'agent' }),
+ content: 'https://github.com/lobehub/lobehub/pull/22581',
+ }}
+ />,
+ );
+
+ expect(markdownProps.current.components[EntityLinkElement.tag]).toBe(
+ EntityLinkElement.Component,
+ );
+ expect(markdownProps.current.components[CHANNEL_MENTION_TAG]).toBeDefined();
+ expect(markdownProps.current.rehypePlugins).toContain(EntityLinkElement.rehypePlugin);
+ });
+});
diff --git a/src/features/Channels/ChannelMessage.tsx b/src/features/Channels/ChannelMessage.tsx
index 69713b00d8a..71f8c23fc74 100644
--- a/src/features/Channels/ChannelMessage.tsx
+++ b/src/features/Channels/ChannelMessage.tsx
@@ -20,6 +20,7 @@ import CollapsibleContent from '@/components/CollapsibleContent';
import AgentProfilePopup from '@/features/AgentProfileCard/AgentProfilePopup';
import { ChatItem } from '@/features/Conversation/ChatItem';
import Markdown from '@/features/Conversation/Markdown';
+import EntityLinkElement from '@/features/EntityLink/element';
import UserAvatar from '@/features/User/UserAvatar';
import { useUserStore } from '@/store/user';
import { userProfileSelectors } from '@/store/user/selectors';
@@ -38,7 +39,12 @@ import type { ChannelReplyTarget } from './useReplyTarget';
const MentionChip = ({ children }: { children?: ReactNode }) => (
<span {...stylex.props(styles.mention)}>{children}</span>
);
-const mentionComponents = { [CHANNEL_MENTION_TAG]: MentionChip };
+// GitHub and LobeHub links render as the same chips the conversation shows.
+const messageComponents = {
+ [CHANNEL_MENTION_TAG]: MentionChip,
+ [EntityLinkElement.tag]: EntityLinkElement.Component,
+};
+const rehypePlugins = [EntityLinkElement.rehypePlugin];
/** Message text with the members it mentioned shown as chips. */
const MessageText = ({ content, names }: { content: string; names: string[] }) => {
@@ -47,7 +53,11 @@ const MessageText = ({ content, names }: { content: string; names: string[] }) =
// memoized Markdown parse each message again on every refresh.
const remarkPlugins = useMemo(() => [remarkChannelMentions(key ? key.split('\n') : [])], [key]);
return (
- <Markdown components={mentionComponents} remarkPlugins={remarkPlugins}>
+ <Markdown
+ components={messageComponents}
+ rehypePlugins={rehypePlugins}
+ remarkPlugins={remarkPlugins}
+ >
{content}
</Markdown>
);
@@ -179,7 +189,7 @@ export const ChannelMessage = ({
showAvatar
showTitle
agentId={message.author.type === 'agent' ? message.author.id : undefined}
- avatarProps={{ size: 36 }}
+ avatarProps={{ shape: 'circle', size: 36 }}
gap={4}
id={message.id}
paddingBlock={compact ? 2 : 8}
@@ -208,7 +218,7 @@ export const ChannelMessage = ({
customAvatarRender={(_, avatar) => (
<Flexbox {...stylex.props(styles.messageAvatar)}>
{isOwnMessage ? (
- <UserAvatar size={36} />
+ <UserAvatar shape={'circle'} size={36} />
) : agentAuthorId ? (
// Same profile card an Agent shows on hover in goals and tasks.
<AgentProfilePopup
diff --git a/src/features/Channels/CreateChannel/PeopleOptions.tsx b/src/features/Channels/CreateChannel/PeopleOptions.tsx
index 9f36018b07f..f60f9e581cc 100644
--- a/src/features/Channels/CreateChannel/PeopleOptions.tsx
+++ b/src/features/Channels/CreateChannel/PeopleOptions.tsx
@@ -29,7 +29,7 @@ export const usePersonName = () => {
};
const PersonAvatar = ({ name, person }: { name: string; person: ChannelPersonOption }) => (
- <Avatar avatar={person.avatar || DEFAULT_USER_AVATAR} size={28} title={name} />
+ <Avatar avatar={person.avatar || DEFAULT_USER_AVATAR} shape={'circle'} size={28} title={name} />
);
/** Workspace members who are not in the Channel yet, searched on the server. */
diff --git a/src/features/Channels/MemberAvatar.tsx b/src/features/Channels/MemberAvatar.tsx
index 04779900fb4..fe3edd82efb 100644
--- a/src/features/Channels/MemberAvatar.tsx
+++ b/src/features/Channels/MemberAvatar.tsx
@@ -13,7 +13,7 @@ export function MemberAvatar({ member, size }: { member: ChannelPublicMember; si
const { t } = useTranslation('channel');
const isSelf = useUserStore((s) => isCurrentUserMember(member, userProfileSelectors.userId(s)));
const name = memberName(member, t('deletedMember'));
- if (isSelf) return <UserAvatar size={size} />;
+ if (isSelf) return <UserAvatar shape={'circle'} size={size} />;
if (member.actorType === 'agent')
return (
<AgentAvatar
@@ -25,5 +25,5 @@ export function MemberAvatar({ member, size }: { member: ChannelPublicMember; si
title={name}
/>
);
- return <Avatar avatar={memberAvatar(member)} size={size} title={name} />;
+ return <Avatar avatar={memberAvatar(member)} shape={'circle'} size={size} title={name} />;
}
diff --git a/src/features/Channels/index.tsx b/src/features/Channels/index.tsx
index ef4ccca2a2f..872b961cb4f 100644
--- a/src/features/Channels/index.tsx
+++ b/src/features/Channels/index.tsx
@@ -1,4 +1,4 @@
-import { Flexbox, Tag, Text } from '@lobehub/ui';
+import { cssVar, Flexbox, Tag, Text } from '@lobehub/ui';
import * as stylex from '@stylexjs/stylex';
import { useSize } from 'ahooks';
import { Hash } from 'lucide-react';
@@ -8,10 +8,13 @@ import { useParams } from 'react-router';
import NotFound from '@/components/404';
import { RouteLoading } from '@/components/Skeleton/RouteSegment';
+import { EntityLinkHostProvider } from '@/features/EntityLink/host';
import NavHeader from '@/features/NavHeader';
import { channelActions, channelSelectors, useChannelStore } from '@/store/channel';
+import { useChatStore } from '@/store/chat';
import { serverConfigSelectors, useServerConfigStore } from '@/store/serverConfig';
+import { AcceptancePanel, CHANNEL_ENTITY_PORTAL_SCOPE } from './AcceptancePanel';
import { visibleChannelDetail } from './channelAccess';
import { ChannelConversation } from './ChannelConversation';
import { MEMBER_FLOAT_BREAKPOINT, MemberPanel } from './MemberPanel';
@@ -20,6 +23,7 @@ import { DirectReplyStatus } from './ReplyActivity';
import { type ReplyTopic, ReplyTopicPanel } from './ReplyTopicPanel';
import { styles } from './styles';
import { THREAD_FLOAT_BREAKPOINT, ThreadPanel } from './ThreadPanel';
+import { useAcceptancePanelOpen } from './useAcceptancePanel';
import { useThreadPanel } from './useThreadPanel';
/** One Channel: the main conversation, with a thread beside it. */
@@ -39,14 +43,21 @@ function EnabledChannelPage() {
? detail.members.find((member) => member.agentId === detail.channel.agentId)
: undefined;
const [topic, setTopic] = useState<(ReplyTopic & { channelId: string }) | null>(null);
+ const acceptanceOpen = useAcceptancePanelOpen();
+ const clearPortalStack = useChatStore((s) => s.clearPortalStack);
+ // One side panel at a time. A report covers whatever was open and uncovers it when closed;
+ // explicitly opening another panel closes the report.
+ const threadId = acceptanceOpen ? null : panel.threadId;
+ const threadDraft = acceptanceOpen ? null : panel.draft;
const membersOpen =
!!detail?.channel.workspaceId &&
membersChannelId === channelId &&
- !panel.threadId &&
- !panel.draft;
- // One side panel at a time: a thread or the member list replaces the topic.
+ !threadId &&
+ !threadDraft &&
+ !acceptanceOpen;
+ // A thread or the member list replaces the topic.
const openTopic =
- topic?.channelId === channelId && !panel.threadId && !panel.draft && !membersOpen
+ topic?.channelId === channelId && !threadId && !threadDraft && !membersOpen && !acceptanceOpen
? topic
: null;
if (!channelId) return null;
@@ -59,7 +70,7 @@ function EnabledChannelPage() {
left={
<Flexbox horizontal align="center" gap={8}>
{/* A direct conversation is titled by its Agent's name alone, like an IM chat. */}
- {!directAgent && <Hash size={18} />}
+ {!directAgent && <Hash color={cssVar.colorTextDescription} size={16} />}
<Text ellipsis weight={500}>
{detail?.channel.title || t('title')}
</Text>
@@ -80,6 +91,7 @@ function EnabledChannelPage() {
if (!membersOpen) {
panel.close();
setTopic(null);
+ clearPortalStack();
}
setMembersChannelId(membersOpen ? null : channelId);
},
@@ -90,55 +102,63 @@ function EnabledChannelPage() {
)
}
/>
- <Flexbox horizontal ref={conversationRef} {...stylex.props(styles.conversations)}>
- <ChannelConversation
- channelId={channelId}
- key={channelId}
- inert={
- (!!(panel.threadId || panel.draft) &&
- (conversationWidth ?? 1000) < THREAD_FLOAT_BREAKPOINT) ||
- (membersOpen && (conversationWidth ?? 1000) < MEMBER_FLOAT_BREAKPOINT) ||
- (!!openTopic && (conversationWidth ?? 1000) < THREAD_FLOAT_BREAKPOINT)
- }
- onOpenThread={(threadId, toggle) => {
- setTopic(null);
- panel.openThread(threadId, toggle);
- }}
- onOpenTopic={(next) => {
- panel.close();
- setMembersChannelId(null);
- setTopic({ ...next, channelId });
- }}
- onStartThread={(draft) => {
- setTopic(null);
- panel.openDraft(draft);
- }}
- />
- {detail && membersOpen && (
- <MemberPanel
- availableWidth={conversationWidth}
- detail={detail}
- id={memberPanelId}
- onClose={() => setMembersChannelId(null)}
+ <EntityLinkHostProvider portal={CHANNEL_ENTITY_PORTAL_SCOPE}>
+ <Flexbox horizontal ref={conversationRef} {...stylex.props(styles.conversations)}>
+ <ChannelConversation
+ channelId={channelId}
+ key={channelId}
+ inert={
+ (!!(threadId || threadDraft || acceptanceOpen) &&
+ (conversationWidth ?? 1000) < THREAD_FLOAT_BREAKPOINT) ||
+ (membersOpen && (conversationWidth ?? 1000) < MEMBER_FLOAT_BREAKPOINT) ||
+ (!!openTopic && (conversationWidth ?? 1000) < THREAD_FLOAT_BREAKPOINT)
+ }
+ onOpenThread={(nextThreadId, toggle) => {
+ setTopic(null);
+ // A send that finishes behind an open report (toggle: false) must not close it.
+ if (toggle !== false) clearPortalStack();
+ // Under a report the thread only looks closed, so bring it back, don't toggle it off.
+ panel.openThread(nextThreadId, acceptanceOpen ? false : toggle);
+ }}
+ onOpenTopic={(next) => {
+ panel.close();
+ setMembersChannelId(null);
+ clearPortalStack();
+ setTopic({ ...next, channelId });
+ }}
+ onStartThread={(draft) => {
+ setTopic(null);
+ clearPortalStack();
+ panel.openDraft(draft);
+ }}
/>
- )}
- <ReplyTopicPanel
- availableWidth={conversationWidth}
- topic={openTopic}
- onClose={() => setTopic(null)}
- />
- {detail && (
- <ThreadPanel
+ {detail && membersOpen && (
+ <MemberPanel
+ availableWidth={conversationWidth}
+ detail={detail}
+ id={memberPanelId}
+ onClose={() => setMembersChannelId(null)}
+ />
+ )}
+ <ReplyTopicPanel
availableWidth={conversationWidth}
- detail={detail}
- draft={panel.draft}
- key={`thread:${channelId}`}
- threadId={panel.threadId}
- onClose={panel.close}
- onSendDraft={panel.send}
+ topic={openTopic}
+ onClose={() => setTopic(null)}
/>
- )}
- </Flexbox>
+ {detail && (
+ <ThreadPanel
+ availableWidth={conversationWidth}
+ detail={detail}
+ draft={threadDraft}
+ key={`thread:${channelId}`}
+ threadId={threadId}
+ onClose={panel.close}
+ onSendDraft={panel.send}
+ />
+ )}
+ <AcceptancePanel availableWidth={conversationWidth} channelId={channelId} />
+ </Flexbox>
+ </EntityLinkHostProvider>
</Flexbox>
);
}
diff --git a/src/features/Channels/useAcceptancePanel.test.ts b/src/features/Channels/useAcceptancePanel.test.ts
new file mode 100644
index 00000000000..4f82fd97c34
--- /dev/null
+++ b/src/features/Channels/useAcceptancePanel.test.ts
@@ -0,0 +1,55 @@
+/**
+ * @vitest-environment happy-dom
+ */
+import { act, renderHook } from '@testing-library/react';
+import { beforeEach, describe, expect, it } from 'vitest';
+
+import { useChatStore } from '@/store/chat';
+import { PortalViewType } from '@/store/chat/slices/portal/initialState';
+
+import { useAcceptancePanel } from './useAcceptancePanel';
+
+const acceptanceView = { acceptanceId: 'acc_1', type: PortalViewType.Acceptance } as const;
+
+describe('useAcceptancePanel', () => {
+ beforeEach(() => {
+ act(() => useChatStore.setState({ portalStack: [], showPortal: false }));
+ });
+
+ it('opens when a link pushes an acceptance onto the portal stack', () => {
+ const { result } = renderHook(() => useAcceptancePanel('chn_1'));
+ expect(result.current.open).toBe(false);
+
+ act(() => useChatStore.getState().openAcceptance('acc_1'));
+
+ expect(result.current.open).toBe(true);
+ });
+
+ it('does not reopen a report left on the portal stack by another page', () => {
+ act(() => useChatStore.setState({ portalStack: [acceptanceView], showPortal: true }));
+
+ const { result } = renderHook(() => useAcceptancePanel('chn_1'));
+
+ expect(result.current.open).toBe(false);
+ });
+
+ it('closes the report when moving to another Channel', () => {
+ const { result, rerender } = renderHook(({ id }) => useAcceptancePanel(id), {
+ initialProps: { id: 'chn_1' },
+ });
+ act(() => useChatStore.getState().openAcceptance('acc_1'));
+
+ rerender({ id: 'chn_2' });
+
+ expect(result.current.open).toBe(false);
+ });
+
+ it('leaves no report behind after leaving the Channel page', () => {
+ const { unmount } = renderHook(() => useAcceptancePanel('chn_1'));
+ act(() => useChatStore.getState().openAcceptance('acc_1'));
+
+ unmount();
+
+ expect(useChatStore.getState().portalStack).toEqual([]);
+ });
+});
diff --git a/src/features/Channels/useAcceptancePanel.ts b/src/features/Channels/useAcceptancePanel.ts
new file mode 100644
index 00000000000..d321747931b
--- /dev/null
+++ b/src/features/Channels/useAcceptancePanel.ts
@@ -0,0 +1,21 @@
+import { useLayoutEffect } from 'react';
+
+import { isAcceptancePortalView } from '@/features/Home/acceptancePortalView';
+import { useChatStore } from '@/store/chat';
+import { chatPortalSelectors } from '@/store/chat/selectors';
+
+export const useAcceptancePanelOpen = () =>
+ useChatStore((s) => isAcceptancePortalView(chatPortalSelectors.currentViewType(s)));
+
+/** Whether a report is open beside this Channel, and how to close it. */
+export const useAcceptancePanel = (channelId: string) => {
+ const open = useAcceptancePanelOpen();
+ const close = useChatStore((s) => s.clearPortalStack);
+ // The portal stack is global: a view left open on another page, or by the previous
+ // Channel, must not appear here.
+ useLayoutEffect(() => {
+ close();
+ return close;
+ }, [channelId, close]);
+ return { close, open };
+};
diff --git a/src/features/Channels/useMentionInvites.tsx b/src/features/Channels/useMentionInvites.tsx
index f3b82dfed5b..b7adb6e4cd7 100644
--- a/src/features/Channels/useMentionInvites.tsx
+++ b/src/features/Channels/useMentionInvites.tsx
@@ -193,7 +193,14 @@ export const useMentionInvites = (
...persons.map((person) => {
const name = person.fullName || person.username || t('person');
return {
- icon: <Avatar avatar={person.avatar || DEFAULT_USER_AVATAR} size={24} title={name} />,
+ icon: (
+ <Avatar
+ avatar={person.avatar || DEFAULT_USER_AVATAR}
+ shape={'circle'}
+ size={24}
+ title={name}
+ />
+ ),
key: `invite:${inviteKey({ actorType: 'user', id: person.userId })}`,
label: name,
metadata: {
diff --git a/src/features/Conversation/ChatItem/components/Avatar.tsx b/src/features/Conversation/ChatItem/components/Avatar.tsx
index 82d65396e01..e68588b4077 100644
--- a/src/features/Conversation/ChatItem/components/Avatar.tsx
+++ b/src/features/Conversation/ChatItem/components/Avatar.tsx
@@ -15,13 +15,14 @@ export interface AvatarProps {
avatar: ChatItemProps['avatar'];
loading?: boolean;
onClick?: ChatItemProps['onAvatarClick'] | MouseEventHandler<HTMLDivElement>;
+ shape?: 'circle' | 'square';
size?: number;
style?: CSSProperties;
unoptimized?: boolean;
}
const Avatar = memo<AvatarProps>(
- ({ agentId, loading, avatar, unoptimized, onClick, size = 28, style, alt }) => {
+ ({ agentId, loading, avatar, unoptimized, onClick, shape = 'square', size = 28, style, alt }) => {
const displayName = agentDisplayName(avatar);
const contextAgentId = useConversationStore(contextSelectors.agentId);
@@ -40,6 +41,7 @@ const Avatar = memo<AvatarProps>(
avatar={agentAvatar}
background={avatar.backgroundColor}
name={displayName}
+ shape={shape}
size={size}
style={style}
title={displayName}
@@ -55,7 +57,7 @@ const Avatar = memo<AvatarProps>(
avatar={avatar.avatar}
background={avatar.backgroundColor}
name={displayName}
- shape={'square'}
+ shape={shape}
size={size}
style={style}
title={displayName}