Skip to content

Commit c0d3d53

Browse files
fix(web): retain main loading and syncing status display
1 parent fe1774e commit c0d3d53

4 files changed

Lines changed: 49 additions & 112 deletions

File tree

‎apps/web/src/components/chat/ChatComposer.tsx‎

Lines changed: 22 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ import {
7979
type ComposerTaskStep,
8080
type ComposerTasksProgress,
8181
} from "./ComposerTasksBadge";
82-
import { ComposerActivityRow, type ComposerActivityStatus } from "./ComposerActivityStatus";
82+
import { ThreadSyncStatusPill } from "./ThreadSyncStatusPill";
8383
import type { ThreadSyncPhase } from "../../threadSync";
8484
import { ComposerBanner } from "./ComposerBanner";
8585
import { ComposerSurface } from "./ComposerSurface";
@@ -768,6 +768,8 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
768768
respondingRequestIds,
769769
showPlanFollowUpPrompt,
770770
activeProposedPlan,
771+
activeTasksProgress,
772+
activeTaskSteps,
771773
runtimeMode,
772774
interactionMode,
773775
lockedProvider,
@@ -808,8 +810,6 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
808810
onFileOpen,
809811
openingVideoAttachmentId,
810812
} = props;
811-
const activeTasksProgress = props.threadSyncPhase === null ? props.activeTasksProgress : null;
812-
const activeTaskSteps = props.threadSyncPhase === null ? props.activeTaskSteps : null;
813813
// ------------------------------------------------------------------
814814
// Store subscriptions (prompt / images / terminal contexts)
815815
// ------------------------------------------------------------------
@@ -2855,17 +2855,14 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
28552855
const toggleTasksDrawer = useCallback(() => {
28562856
setIsTasksDrawerOpen((open) => !open);
28572857
}, []);
2858-
const activityStatus = useMemo<ComposerActivityStatus | undefined>(
2859-
() => (props.threadSyncPhase ? { kind: "sync", phase: props.threadSyncPhase } : undefined),
2860-
[props.threadSyncPhase],
2861-
);
28622858
const hasBannerItems = props.bannerItems.length > 0;
2859+
const hasAttachedNotice = hasBannerItems || props.threadSyncPhase !== null;
28632860
const hasBlockingComposerTopDrawer =
28642861
activePendingApproval !== null || pendingUserInputs.length > 0;
28652862
const showInlineStashBadge =
28662863
stashQueue.length > 0 &&
28672864
!isComposerApprovalState &&
2868-
(hasBannerItems || showComposerTopDrawer || isTasksDrawerOpen || isMobileViewport);
2865+
(hasAttachedNotice || showComposerTopDrawer || isTasksDrawerOpen || isMobileViewport);
28692866
const inlineStashBadge = showInlineStashBadge ? (
28702867
<ComposerStashBadge
28712868
count={stashQueue.length}
@@ -2881,56 +2878,46 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
28812878
activeTaskSteps !== null &&
28822879
!isTasksDrawerOpen &&
28832880
!hasBlockingComposerTopDrawer &&
2884-
(hasBannerItems || showComposerTopDrawer || isComposerCollapsedMobile);
2881+
(hasAttachedNotice || showComposerTopDrawer || isComposerCollapsedMobile);
28852882
const inlineTasksBadge = showInlineTasksBadge ? (
28862883
<ComposerTasksBadge
28872884
expanded={false}
28882885
onToggle={toggleTasksDrawer}
28892886
placement="inline"
28902887
progress={activeTasksProgress}
28912888
steps={activeTaskSteps}
2892-
activityStatus={activityStatus}
28932889
/>
28942890
) : null;
28952891
const showShoulderTabs =
2896-
!hasBannerItems && !showComposerTopDrawer && !isTasksDrawerOpen && !isComposerCollapsedMobile;
2892+
!hasAttachedNotice &&
2893+
!showComposerTopDrawer &&
2894+
!isTasksDrawerOpen &&
2895+
!isComposerCollapsedMobile;
28972896
const hasShoulderTab =
28982897
showShoulderTabs &&
2899-
(activityStatus !== undefined ||
2900-
(stashQueue.length > 0 && !showInlineStashBadge) ||
2898+
((stashQueue.length > 0 && !showInlineStashBadge) ||
29012899
(activeTasksProgress !== null &&
29022900
activeTaskSteps !== null &&
29032901
activeTasksProgress.totalSteps > 0));
2904-
const tasksHostActivityStatus =
2905-
activeTasksProgress !== null &&
2906-
activeTasksProgress.totalSteps > 0 &&
2907-
activeTaskSteps !== null &&
2908-
!hasBlockingComposerTopDrawer &&
2909-
(showShoulderTabs || showInlineTasksBadge || isTasksDrawerOpen);
2910-
const standaloneActivityStatus = !tasksHostActivityStatus ? activityStatus : undefined;
2911-
const activityStackContent = hasBannerItems ? (
2912-
!hasBlockingComposerTopDrawer && activeTasksProgress && activeTaskSteps ? (
2902+
const tasksStackContent =
2903+
hasBannerItems && !hasBlockingComposerTopDrawer && activeTasksProgress && activeTaskSteps ? (
29132904
<ComposerTasksContent
29142905
expanded={isTasksDrawerOpen}
29152906
onToggle={toggleTasksDrawer}
29162907
progress={activeTasksProgress}
29172908
steps={activeTaskSteps}
2918-
activityStatus={activityStatus}
29192909
/>
2920-
) : activityStatus ? (
2921-
<ComposerActivityRow status={activityStatus} />
2922-
) : null
2923-
) : null;
2924-
const activityStackItem: ComposerBannerStackContent | null = activityStackContent
2910+
) : null;
2911+
const tasksStackItem: ComposerBannerStackContent | null = tasksStackContent
29252912
? {
29262913
id: "composer-activity",
29272914
variant: "default",
29282915
priority: "activity",
2929-
content: activityStackContent,
2916+
content: tasksStackContent,
29302917
}
29312918
: null;
2932-
const bannerStackItems = activityStackItem
2933-
? [...props.bannerItems, activityStackItem]
2919+
const bannerStackItems = tasksStackItem
2920+
? [...props.bannerItems, tasksStackItem]
29342921
: props.bannerItems;
29352922
useEffect(() => {
29362923
if (activeTasksProgress === null || activeTaskSteps === null) {
@@ -3463,14 +3450,11 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
34633450
data-chat-composer-form="true"
34643451
>
34653452
<ComposerBannerStack key={activeThreadId} className="relative z-0" items={bannerStackItems} />
3466-
{!activityStackItem &&
3467-
(inlineTasksBadge || (standaloneActivityStatus && !showShoulderTabs)) ? (
3453+
{props.threadSyncPhase ? <ThreadSyncStatusPill phase={props.threadSyncPhase} /> : null}
3454+
{!tasksStackItem && inlineTasksBadge ? (
34683455
<ComposerBanner.Attachment>
34693456
<ComposerBanner.Root data-chat-composer-activity-strip="true">
3470-
{inlineTasksBadge ??
3471-
(standaloneActivityStatus ? (
3472-
<ComposerActivityRow status={standaloneActivityStatus} />
3473-
) : null)}
3457+
{inlineTasksBadge}
34743458
</ComposerBanner.Root>
34753459
</ComposerBanner.Attachment>
34763460
) : null}
@@ -3579,7 +3563,7 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
35793563
</ComposerBanner.Root>
35803564
</ComposerBanner.Attachment>
35813565
) : null}
3582-
{!activityStackItem &&
3566+
{!tasksStackItem &&
35833567
isTasksDrawerOpen &&
35843568
!hasBlockingComposerTopDrawer &&
35853569
activeTasksProgress &&
@@ -3588,23 +3572,16 @@ export const ChatComposer = memo(function ChatComposer(props: ChatComposerProps)
35883572
onCollapse={toggleTasksDrawer}
35893573
progress={activeTasksProgress}
35903574
steps={activeTaskSteps}
3591-
activityStatus={activityStatus}
35923575
/>
35933576
) : null}
35943577
{hasShoulderTab ? (
35953578
<ComposerBanner.Dock>
3596-
{standaloneActivityStatus ? (
3597-
<ComposerBanner.Root width="content" data-composer-shoulder-tab>
3598-
<ComposerActivityRow status={standaloneActivityStatus} />
3599-
</ComposerBanner.Root>
3600-
) : null}
36013579
{activeTasksProgress && activeTaskSteps ? (
36023580
<ComposerTasksBadge
36033581
expanded={false}
36043582
onToggle={toggleTasksDrawer}
36053583
progress={activeTasksProgress}
36063584
steps={activeTaskSteps}
3607-
activityStatus={activityStatus}
36083585
/>
36093586
) : null}
36103587
{!showInlineStashBadge ? (

‎apps/web/src/components/chat/ComposerActivityStatus.tsx‎

Lines changed: 0 additions & 36 deletions
This file was deleted.

‎apps/web/src/components/chat/ComposerTasksBadge.tsx‎

Lines changed: 5 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,6 @@ import { memo, type ComponentProps } from "react";
44
import { formatDuration } from "../../session-logic";
55
import { cn } from "~/lib/utils";
66
import { ComposerBanner } from "./ComposerBanner";
7-
import {
8-
ComposerActivityIcon,
9-
ComposerActivityLabel,
10-
type ComposerActivityStatus,
11-
} from "./ComposerActivityStatus";
127

138
export interface ComposerTasksProgress {
149
readonly step: string;
@@ -65,29 +60,18 @@ function TaskSummary({
6560
expanded,
6661
progress,
6762
steps,
68-
activityStatus,
6963
}: {
7064
readonly expanded: boolean;
7165
readonly progress: ComposerTasksProgress;
7266
readonly steps: readonly ComposerTaskStep[];
73-
readonly activityStatus: ComposerActivityStatus | undefined;
7467
}) {
7568
return (
7669
<>
77-
{activityStatus !== undefined ? (
78-
<ComposerActivityIcon />
79-
) : (
80-
<ComposerBanner.Icon>
81-
<ListTodoIcon />
82-
</ComposerBanner.Icon>
83-
)}
70+
<ComposerBanner.Icon>
71+
<ListTodoIcon />
72+
</ComposerBanner.Icon>
8473
<ComposerBanner.Content>
85-
{activityStatus !== undefined ? (
86-
<ComposerActivityLabel status={activityStatus} />
87-
) : (
88-
<span className="shrink-0 text-muted-foreground">Tasks</span>
89-
)}
90-
{activityStatus !== undefined ? <ComposerBanner.Separator /> : null}
74+
<span className="shrink-0 text-muted-foreground">Tasks</span>
9175
<span
9276
className="min-w-0 flex-1 truncate text-left font-medium text-foreground/80"
9377
data-composer-task-current="true"
@@ -115,14 +99,12 @@ export const ComposerTasksBadge = memo(function ComposerTasksBadge({
11599
placement = "tab",
116100
progress,
117101
steps,
118-
activityStatus,
119102
}: {
120103
readonly expanded: boolean;
121104
readonly onToggle: () => void;
122105
readonly placement?: "inline" | "tab";
123106
readonly progress: ComposerTasksProgress;
124107
readonly steps: readonly ComposerTaskStep[];
125-
readonly activityStatus?: ComposerActivityStatus | undefined;
126108
}) {
127109
if (progress.totalSteps <= 0) return null;
128110

@@ -135,12 +117,7 @@ export const ComposerTasksBadge = memo(function ComposerTasksBadge({
135117
onClick={onToggle}
136118
onPointerDown={(event) => event.preventDefault()}
137119
>
138-
<TaskSummary
139-
expanded={expanded}
140-
progress={progress}
141-
steps={steps}
142-
activityStatus={activityStatus}
143-
/>
120+
<TaskSummary expanded={expanded} progress={progress} steps={steps} />
144121
</ComposerBanner.Row>
145122
);
146123
return placement === "inline" ? (
@@ -155,13 +132,11 @@ export const ComposerTasksContent = memo(function ComposerTasksContent({
155132
onToggle,
156133
progress,
157134
steps,
158-
activityStatus,
159135
}: {
160136
readonly expanded: boolean;
161137
readonly onToggle: () => void;
162138
readonly progress: ComposerTasksProgress;
163139
readonly steps: readonly ComposerTaskStep[];
164-
readonly activityStatus?: ComposerActivityStatus | undefined;
165140
}) {
166141
return (
167142
<div
@@ -174,7 +149,6 @@ export const ComposerTasksContent = memo(function ComposerTasksContent({
174149
placement="inline"
175150
progress={progress}
176151
steps={steps}
177-
activityStatus={activityStatus}
178152
/>
179153
{expanded ? (
180154
<ComposerBanner.Scroll data-composer-tasks-scroll="true">
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import { LoaderCircleIcon } from "lucide-react";
2+
3+
import { threadSyncLabel, type ThreadSyncPhase } from "../../threadSync";
4+
import { ComposerBanner } from "./ComposerBanner";
5+
6+
export function ThreadSyncStatusPill({ phase }: { readonly phase: ThreadSyncPhase }) {
7+
const label = threadSyncLabel(phase);
8+
9+
return (
10+
<ComposerBanner.Attachment>
11+
<ComposerBanner.Surface
12+
aria-label={label}
13+
className="pointer-events-none flex items-center gap-2 px-3 pt-2 pb-[calc(var(--chat-composer-attachment-overlap)+0.375rem)] text-xs font-medium text-foreground sm:px-4"
14+
data-thread-sync-drawer="true"
15+
role="status"
16+
>
17+
<LoaderCircleIcon aria-hidden className="size-3.5 shrink-0 text-muted-foreground" />
18+
<span className="truncate">{label}</span>
19+
</ComposerBanner.Surface>
20+
</ComposerBanner.Attachment>
21+
);
22+
}

0 commit comments

Comments
 (0)