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(channel): soften composer reply bar and fade feed into composer (#22839)

Arvin Xue97306e263fe
diff --git a/src/features/Channels/ChannelConversation.tsx b/src/features/Channels/ChannelConversation.tsx
index d252f3e0132..c52c033e856 100644
--- a/src/features/Channels/ChannelConversation.tsx
+++ b/src/features/Channels/ChannelConversation.tsx
@@ -20,6 +20,7 @@ import { ArchivedNotice } from './ArchivedNotice';
import { visibleChannelDetail } from './channelAccess';
import { ChannelMessage, ThreadRootMessage } from './ChannelMessage';
import { Composer } from './Composer';
+import { hasReplyActivity } from './jobStatus';
import { JoinEventLine } from './JoinEventLine';
import { channelJoinEvents, channelTimeline } from './joinEvents';
import { isCurrentUserMember } from './memberName';
@@ -278,7 +279,9 @@ const Timeline = ({
replyTarget={reply.target}
activity={
// A direct conversation shows its Agent's state beside the name in the header.
- direct && !threadId ? null : <ReplyActivity detail={detail} threadId={threadId} />
+ (direct && !threadId) || !hasReplyActivity(detail, threadId) ? null : (
+ <ReplyActivity detail={detail} threadId={threadId} />
+ )
}
placeholder={
threadId
diff --git a/src/features/Channels/Composer.tsx b/src/features/Channels/Composer.tsx
index 6e3e5c0f8e1..fa202e19eb6 100644
--- a/src/features/Channels/Composer.tsx
+++ b/src/features/Channels/Composer.tsx
@@ -9,6 +9,7 @@ import {
} from '@lobehub/editor';
import { ChatInput, Editor, SendButton, useEditor } from '@lobehub/editor/react';
import { ActionIcon, Flexbox, Text } from '@lobehub/ui';
+import { cssVar } from '@lobehub/ui/stylex/cssVar.stylex';
import * as stylex from '@stylexjs/stylex';
import { $getSelection, $isRangeSelection, KEY_DOWN_COMMAND } from 'lexical';
import { Reply, X } from 'lucide-react';
@@ -249,9 +250,9 @@ export function Composer({
<Flexbox gap={4}>
{replyTarget && (
<Flexbox horizontal align="center" gap={8} padding={8}>
- <Reply size={14} />
+ <Reply color={cssVar.colorTextTertiary} size={14} />
<Flexbox flex={1} style={{ minWidth: 0 }}>
- <Text ellipsis fontSize={12}>
+ <Text ellipsis fontSize={12} type="secondary">
{t('reply.to', { name: replyTarget.author.name || t('deletedMember') })}
{' · '}
{replyTarget.content || t('reply.attachment')}
diff --git a/src/features/Channels/jobStatus.test.ts b/src/features/Channels/jobStatus.test.ts
index 061b2b8b505..1f5a1a435dd 100644
--- a/src/features/Channels/jobStatus.test.ts
+++ b/src/features/Channels/jobStatus.test.ts
@@ -6,6 +6,7 @@ import {
channelJobTone,
directAvatarState,
directReplyStatus,
+ hasReplyActivity,
memberCurrentJob,
memberJobStatus,
replyActivityJobs,
@@ -249,3 +250,36 @@ describe('replyAvatarState', () => {
expect(replyAvatarState([])).toBeUndefined();
});
});
+
+describe('hasReplyActivity', () => {
+ const detail = (patch: { jobs?: unknown[]; messages?: unknown[] }) =>
+ ({ jobs: [], messages: [], ...patch }) as never;
+
+ it('is false when nothing is pending, so the composer keeps no empty status strip', () => {
+ expect(hasReplyActivity(detail({}), null)).toBe(false);
+ expect(
+ hasReplyActivity(
+ detail({ jobs: [{ publicationRevoked: false, status: 'completed', threadId: null }] }),
+ null,
+ ),
+ ).toBe(false);
+ });
+
+ it('is true while a reply runs or a sent message awaits routing', () => {
+ expect(
+ hasReplyActivity(
+ detail({ jobs: [{ publicationRevoked: false, status: 'running', threadId: null }] }),
+ null,
+ ),
+ ).toBe(true);
+ expect(hasReplyActivity(detail({ messages: [{ routingStatus: 'pending' }] }), null)).toBe(true);
+ });
+
+ it('only counts replies in the given thread', () => {
+ const running = detail({
+ jobs: [{ publicationRevoked: false, status: 'running', threadId: 'thread-a' }],
+ });
+ expect(hasReplyActivity(running, 'thread-a')).toBe(true);
+ expect(hasReplyActivity(running, null)).toBe(false);
+ });
+});
diff --git a/src/features/Channels/jobStatus.ts b/src/features/Channels/jobStatus.ts
index 82e9bf96237..a7930d3c7ac 100644
--- a/src/features/Channels/jobStatus.ts
+++ b/src/features/Channels/jobStatus.ts
@@ -69,6 +69,12 @@ export const conversationReplies = (detail: ChannelDetail, threadId: string | nu
};
};
+/** Whether the conversation has a reply or routing in progress to show above the composer. */
+export const hasReplyActivity = (detail: ChannelDetail, threadId: string | null) => {
+ const { jobs, receiving } = conversationReplies(detail, threadId);
+ return jobs.length > 0 || receiving;
+};
+
/**
* What a direct conversation's header says about its one Agent: "typing" while it works, or the
* reply it is `waiting` on when blocked or stopping. Null when nothing is pending.
diff --git a/src/features/Channels/styles.ts b/src/features/Channels/styles.ts
index 5c365a11a82..5a218dbb9a5 100644
--- a/src/features/Channels/styles.ts
+++ b/src/features/Channels/styles.ts
@@ -171,10 +171,21 @@ export const styles = stylex.create({
backgroundColor: cssVar.colorInfoBg,
},
composer: {
- flexShrink: 0,
- paddingBlockEnd: 12,
+ 'position': 'relative',
+ 'flexShrink': 0,
+ 'paddingBlockEnd': 12,
+ // The feed fades out into the composer instead of being cut at its top edge.
+ '::before': {
+ pointerEvents: 'none',
+ content: '""',
+ position: 'absolute',
+ insetBlockEnd: '100%',
+ insetInline: 0,
+ height: 24,
+ backgroundImage: `linear-gradient(to top, ${cssVar.colorBgContainer}, transparent)`,
+ },
},
- /** Typing activity above the input; keeps its height when empty. */
+ /** Typing activity above the input; rendered only while someone is replying. */
composerStatus: {
display: 'flex',
alignItems: 'center',