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.

💄 style(messages): put typing back in a replying row's preview line (#22868)

Arvin Xu548699a6c597
diff --git a/src/features/MessageList/ConversationRow.test.tsx b/src/features/MessageList/ConversationRow.test.tsx
index e72b288479a..a13956eed85 100644
--- a/src/features/MessageList/ConversationRow.test.tsx
+++ b/src/features/MessageList/ConversationRow.test.tsx
@@ -79,9 +79,8 @@ 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', () => {
+ // The row said a green "running" with a spinner; it now reads like the header's typing line.
+ it('says typing in place of the preview while the Agent replies', () => {
render(
createElement(ConversationRow, {
avatar: null,
@@ -93,7 +92,6 @@ describe('ConversationRow', () => {
);
expect(screen.getByRole('status')).toHaveTextContent('activity.typing');
- expect(screen.getByRole('status').previousElementSibling).toHaveTextContent('Dario');
- expect(screen.getByText('last message')).toBeInTheDocument();
+ expect(screen.queryByText('last message')).toBeNull();
});
});
diff --git a/src/features/MessageList/ConversationRow.tsx b/src/features/MessageList/ConversationRow.tsx
index d1e72f1c911..591c9058c94 100644
--- a/src/features/MessageList/ConversationRow.tsx
+++ b/src/features/MessageList/ConversationRow.tsx
@@ -31,7 +31,7 @@ export interface ConversationRowProps {
/** 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. */
+ /** The Agent is replying: the preview line says "typing" like the conversation header. */
typing?: boolean;
unread?: number;
url: string;
@@ -102,21 +102,22 @@ const ConversationRow = memo<ConversationRowProps>(
{...stylex.props(styles.rowText, singleLine && styles.rowTextSingleLine)}
>
<Flexbox horizontal align={'center'} gap={8}>
- <span {...stylex.props(styles.title, typing && styles.titleBesideTyping)}>{title}</span>
- {typing && (
- <span role="status" {...stylex.props(styles.typing)}>
- {activityLabel(t('activity.typing'))}
- <TypingDots />
- </span>
- )}
+ <span {...stylex.props(styles.title)}>{title}</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 && preview && (
+ {!singleLine && (typing || preview) && (
<Flexbox horizontal align={'center'} gap={8}>
- <span {...stylex.props(styles.preview)}>{preview}</span>
+ {typing ? (
+ <span role="status" {...stylex.props(styles.preview, styles.typing)}>
+ {activityLabel(t('activity.typing'))}
+ <TypingDots />
+ </span>
+ ) : (
+ <span {...stylex.props(styles.preview)}>{preview}</span>
+ )}
</Flexbox>
)}
</Flexbox>
diff --git a/src/features/MessageList/style.ts b/src/features/MessageList/style.ts
index cf056ba82be..6092c215efe 100644
--- a/src/features/MessageList/style.ts
+++ b/src/features/MessageList/style.ts
@@ -74,28 +74,11 @@ 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.
- */
+ /** Same quiet colour as the preview it replaces, so a reply in progress does not shout. */
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',