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): show direct-chat typing above the composer again (#22903)

Arvin Xu9b565636173f
diff --git a/src/features/Channels/ChannelConversation.tsx b/src/features/Channels/ChannelConversation.tsx
index c3403d98155..f862a9065d4 100644
--- a/src/features/Channels/ChannelConversation.tsx
+++ b/src/features/Channels/ChannelConversation.tsx
@@ -271,10 +271,9 @@ const Timeline = ({
members={activeMembers}
replyTarget={reply.target}
activity={
- // A direct conversation shows its Agent's state beside the name in the header.
- (direct && !threadId) || !hasReplyActivity(detail, threadId) ? null : (
+ hasReplyActivity(detail, threadId) ? (
<ReplyActivity detail={detail} threadId={threadId} />
- )
+ ) : null
}
placeholder={
threadId
diff --git a/src/features/Channels/ReplyActivity.tsx b/src/features/Channels/ReplyActivity.tsx
index 26252cdb9c4..af8b4169c71 100644
--- a/src/features/Channels/ReplyActivity.tsx
+++ b/src/features/Channels/ReplyActivity.tsx
@@ -6,12 +6,7 @@ import { useTranslation } from 'react-i18next';
import AgentAvatar from '@/components/AgentAvatar';
import { activityLabel } from './activityLabel';
-import {
- channelJobStatus,
- conversationReplies,
- directReplyStatus,
- memberCurrentJob,
-} from './jobStatus';
+import { channelJobStatus, conversationReplies, memberCurrentJob } from './jobStatus';
import { replyEntries, ReplyList } from './MessageReceipts';
import { activityStyles, styles } from './styles';
import { TypingDots } from './TypingDots';
@@ -88,40 +83,3 @@ export function ReplyActivity({
</Popover>
);
}
-
-/**
- * A direct conversation has one Agent to wait on, so its state sits beside the Agent's name in
- * the header like an IM's "typing…". Anything other than plain work says what it waits on.
- */
-export function DirectReplyStatus({ detail }: { detail: ChannelDetail }) {
- const { t } = useTranslation('channel');
- const reply = directReplyStatus(detail);
- if (!reply) return null;
-
- const { jobs, waiting } = reply;
- const label = activityLabel(waiting ? t(channelJobStatus(waiting)) : t('activity.typing'));
- const status = (
- <span role="status" {...stylex.props(activityStyles.line, activityStyles.header)}>
- <span {...stylex.props(activityStyles.label)}>{label}</span>
- {!waiting && <TypingDots />}
- </span>
- );
- if (!jobs.length) return status;
-
- return (
- <Popover
- placement="bottomLeft"
- trigger="click"
- content={
- <ReplyList
- channelId={detail.channel.id}
- entries={replyEntries(detail, jobs, t('unnamedAgent'))}
- />
- }
- >
- <Button size="small" type="text" {...stylex.props(activityStyles.headerButton)}>
- {status}
- </Button>
- </Popover>
- );
-}
diff --git a/src/features/Channels/index.tsx b/src/features/Channels/index.tsx
index 3ca6dad5525..80679fe0e24 100644
--- a/src/features/Channels/index.tsx
+++ b/src/features/Channels/index.tsx
@@ -21,7 +21,6 @@ import { MEMBER_FLOAT_BREAKPOINT, MemberPanel } from './MemberPanel';
import { MemberStatus } from './MemberStatus';
import { openTopic } from './openTopic';
import { CHANNEL_ENTITY_PORTAL_SCOPE, PortalPanel } from './PortalPanel';
-import { DirectReplyStatus } from './ReplyActivity';
import { type ReplyTopic, ReplyTopicPanel } from './ReplyTopicPanel';
import { styles } from './styles';
import { ThreadPageActions, ThreadPageTitle } from './ThreadPageTitle';
@@ -82,7 +81,6 @@ function EnabledChannelPage() {
{detail?.channel.title || t('title')}
</Text>
{detail?.channel.status === 'archived' && <Tag size="small">{t('archived')}</Tag>}
- {directAgent && <DirectReplyStatus detail={detail!} />}
</Flexbox>
)
}
diff --git a/src/features/Channels/jobStatus.test.ts b/src/features/Channels/jobStatus.test.ts
index a8721f92cc0..01c88e2a0b9 100644
--- a/src/features/Channels/jobStatus.test.ts
+++ b/src/features/Channels/jobStatus.test.ts
@@ -5,7 +5,6 @@ import {
channelJobStatus,
channelJobTone,
directAvatarState,
- directReplyStatus,
hasReplyActivity,
memberCurrentJob,
memberJobStatus,
@@ -163,42 +162,6 @@ describe('Channel task tone', () => {
});
});
-describe('directReplyStatus', () => {
- const job = (patch: Partial<ChannelPublicJob> = {}) =>
- ({
- id: 'job_1',
- memberId: 'mem_cook',
- publicationRevoked: false,
- status: 'running',
- threadId: null,
- writerHeld: false,
- ...patch,
- }) as ChannelPublicJob;
- const detail = (jobs: ChannelPublicJob[], messages: unknown[] = []) =>
- ({ channel: { agentId: 'agt_cook', id: 'chn_cook' }, jobs, members: [], messages }) as never;
-
- it('is typing while the Agent replies or prepares', () => {
- expect(directReplyStatus(detail([job()]))?.waiting).toBeUndefined();
- expect(
- directReplyStatus(detail([job({ blockedCode: undefined, status: 'queued' })]))?.waiting,
- ).toBeUndefined();
- });
-
- it('is typing while a sent message is still being routed', () => {
- expect(directReplyStatus(detail([], [{ routingStatus: 'pending' }]))).toEqual({ jobs: [] });
- });
-
- it('names what a blocked reply waits on instead of typing', () => {
- const blocked = job({ blockedCode: 'device_offline', status: 'queued' });
- expect(directReplyStatus(detail([blocked]))?.waiting).toBe(blocked);
- });
-
- it('ignores thread replies and settled conversations', () => {
- expect(directReplyStatus(detail([job({ threadId: 'thr_1' })]))).toBeNull();
- expect(directReplyStatus(detail([job({ status: 'completed' })]))).toBeNull();
- });
-});
-
describe('directAvatarState', () => {
const job = (patch: Partial<ChannelPublicJob> = {}) =>
({
diff --git a/src/features/Channels/jobStatus.ts b/src/features/Channels/jobStatus.ts
index f503baccde7..02a26b7361e 100644
--- a/src/features/Channels/jobStatus.ts
+++ b/src/features/Channels/jobStatus.ts
@@ -87,17 +87,6 @@ export const hasReplyActivity = (detail: ChannelDetail, threadId: string | null)
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.
- */
-export const directReplyStatus = (detail: ChannelDetail) => {
- const { jobs, receiving } = conversationReplies(detail, null);
- const job = jobs[0] && memberCurrentJob(jobs, jobs[0].memberId);
- if (!job) return receiving ? { jobs } : null;
- return channelJobTone(job) === 'working' ? { jobs } : { jobs, waiting: job };
-};
-
/**
* How a direct conversation's Agent avatar acts out its pending replies: `working` while it
* writes, `thinking` while a message is routed or the reply is prepared, `waiting` when blocked
diff --git a/src/features/Channels/styles.ts b/src/features/Channels/styles.ts
index cce117775d8..21ac869560a 100644
--- a/src/features/Channels/styles.ts
+++ b/src/features/Channels/styles.ts
@@ -399,14 +399,6 @@ export const activityStyles = stylex.create({
paddingInline: 4,
color: cssVar.colorTextSecondary,
},
- /** Beside the Agent's name in a direct conversation's header. */
- header: {
- color: cssVar.colorTextDescription,
- },
- headerButton: {
- height: 22,
- paddingInline: 4,
- },
avatars: {
display: 'inline-flex',
flex: 'none',