🤯 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.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
💄 style(task): open the run drawer expanded on the task detail page (#21896)
Lobehub Coder7dd912272624
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskDetailPage.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskDetailPage.tsxindex a70c4bbc866..9f96a61d6f1 100644--- a/src/features/AgentTasks/AgentTaskDetail/TaskDetailPage.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TaskDetailPage.tsx@@ -114,7 +114,8 @@ const TaskDetailPage = memo<TaskDetailPageProps>(({ taskId, showTaskAgentPanelTo{isInitialLoading ? <TaskDetailSkeleton chrome={'body'} /> : <TaskDetailSections />}</WideScreenContainer></Flexbox>- <TopicChatDrawer />+ {/* The task page has nothing else to read beside a run, so it opens wide. */}+ <TopicChatDrawer defaultExpanded /></Flexbox>);});diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsxindex 92fbf2c64a9..bc2617ab799 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.test.tsx@@ -440,6 +440,39 @@ describe('TopicChatDrawer', () => {expect(getByTitle('taskDetail.topicDrawer.collapse')).toBeInTheDocument();});+ it('opens expanded on hosts that default to the wide reading panel', () => {+ const { getByTestId, getByTitle } = render(<TopicChatDrawer defaultExpanded />);++ expect(getByTestId('topic-panel')).toHaveAttribute(+ 'data-width',+ 'min(960px, calc(100vw - 16px))',+ );+ expect(getByTestId('topic-panel')).toHaveAttribute('data-height', 'calc(100dvh - 16px)');+ expect(getByTitle('taskDetail.topicDrawer.collapse')).toBeInTheDocument();+ });++ it('restores the host default size each time the drawer reopens', () => {+ // The store mock is not reactive, so a throwaway prop forces each re-render.+ const renderAt = (revision: number) => (+ <TopicChatDrawer defaultExpanded {...({ 'data-revision': revision } as object)} />+ );+ const { getByTestId, getByTitle, queryByTestId, rerender } = render(renderAt(0));++ fireEvent.click(getByTitle('taskDetail.topicDrawer.collapse'));+ expect(getByTestId('topic-panel')).toHaveAttribute('data-width', '640');++ mocks.taskState.activeTopicDrawerTopicId = undefined as unknown as string;+ rerender(renderAt(1));+ expect(queryByTestId('topic-panel')).not.toBeInTheDocument();++ mocks.taskState.activeTopicDrawerTopicId = 'topic-1';+ rerender(renderAt(2));+ expect(getByTestId('topic-panel')).toHaveAttribute(+ 'data-width',+ 'min(960px, calc(100vw - 16px))',+ );+ });+it('opens the run in its Agent conversation', () => {const { getByText } = render(<TopicChatDrawer />);diff --git a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsxindex 98010e71e66..6484a234b76 100644--- a/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx+++ b/src/features/AgentTasks/AgentTaskDetail/TopicChatDrawer/index.tsx@@ -162,10 +162,16 @@ export const TopicChatDrawerBody = memo<TopicChatDrawerBodyProps>(TopicChatDrawerBody.displayName = 'TopicChatDrawerBody';-const TopicChatDrawer = memo(() => {+/** Configures how the floating run drawer presents itself on its host surface. */+export interface TopicChatDrawerProps {+ /** Whether each opening starts in the expanded reading size. @default false */+ defaultExpanded?: boolean;+}++const TopicChatDrawer = memo<TopicChatDrawerProps>(({ defaultExpanded = false }) => {const { t } = useTranslation(['chat', 'common']);const navigate = useWorkspaceAwareNavigate();- const [expanded, setExpanded] = useState(false);+ const [expanded, setExpanded] = useState(defaultExpanded);const topicId = useTaskStore(taskDetailSelectors.activeTopicDrawerTopicId);const activeTaskId = useTaskStore((s) => s.activeTaskId);const agentId = useTaskStore(taskDetailSelectors.topicDrawerAgentId);@@ -205,6 +211,14 @@ const TopicChatDrawer = memo(() => {const open = !!topicId && !!agentId;+ // Each opening starts from the host's default size; a toggle only lasts for+ // the run the user is looking at.+ const [wasOpen, setWasOpen] = useState(open);+ if (open !== wasOpen) {+ setWasOpen(open);+ if (open) setExpanded(defaultExpanded);+ }+const shareContext = useMemo<Partial<ConversationContext>>(() => ({ agentId: agentId ?? undefined, topicId: topicId ?? undefined }),[agentId, topicId],