fix(mobile): port main's composer stabilization into the v2 thread screens
Round-4 reconciliation of #5986/#5988 with the v2 cutover files: - PendingUserInputCard adopts main's collapsible overlay redesign with the v2 RuntimeRequestId/responseCapability plumbing (dead provider processes still read-only the card) - ThreadFeed adopts the thread-feed-live-follow transition model, the user-scroll settle window, momentum handoff, and env-scoped feed keys while keeping the v2 nearListEnd layout gating - ThreadDetailScreen hides (not unmounts) the composer while a user-input request owns the slot; multi-select answers flow as arrays end to end (threadActivity toggle/build helpers + tests, ThreadUserInputQuestion) - ThreadComposer keeps the v2 canStopThread stop gate under main's onEditorFocusChange rename; standalone stop reuses the shared renderer - Restored the branch's steer stop/send tests alongside main's composer test suite Co-Authored-By: Claude Fable 5 <[email protected]>
This commit is contained in:
1 parent
5f3ccad35c
commit
d0b6cbdec8
12 files changed
+1082
-208
No files matched your search
@@ -278,8 +278,6 @@ import {
|
||||
import { resolveThreadPr } from "./ThreadStatusIndicators";
|
||||
import { ComposerBannerStack, type ComposerBannerStackItem } from "./chat/ComposerBannerStack";
|
||||
import { QueuedRunsControl } from "./chat/QueuedRunsControl";
|
||||
import { resolveThreadPr } from "./ThreadStatusIndicators";
|
||||
import { ComposerBannerStack, type ComposerBannerStackItem } from "./chat/ComposerBannerStack";
|
||||
import {
|
||||
DRAFT_HERO_TRANSITION_ANIMATION_ID,
|
||||
DRAFT_HERO_TRANSITION_DURATION_MS,
|
||||
|
||||
@@ -32,7 +32,6 @@ function renderPendingActions(isRunning: boolean) {
|
||||
showPlanFollowUpPrompt: false,
|
||||
promptHasText: false,
|
||||
isSendBusy: false,
|
||||
sendDisabledReason: null,
|
||||
isConnecting: false,
|
||||
isEnvironmentUnavailable: false,
|
||||
isPreparingWorktree: false,
|
||||
@@ -53,7 +52,6 @@ function renderStandaloneStop() {
|
||||
showPlanFollowUpPrompt: false,
|
||||
promptHasText: false,
|
||||
isSendBusy: false,
|
||||
sendDisabledReason: null,
|
||||
isConnecting: false,
|
||||
isEnvironmentUnavailable: false,
|
||||
isPreparingWorktree: false,
|
||||
@@ -74,7 +72,6 @@ function renderSendButton() {
|
||||
showPlanFollowUpPrompt: false,
|
||||
promptHasText: true,
|
||||
isSendBusy: false,
|
||||
sendDisabledReason: null,
|
||||
isConnecting: false,
|
||||
isEnvironmentUnavailable: false,
|
||||
isPreparingWorktree: false,
|
||||
@@ -216,3 +213,46 @@ describe("ComposerPrimaryActions", () => {
|
||||
expect(markup).toContain("bg-message-action text-message-action-foreground");
|
||||
});
|
||||
});
|
||||
|
||||
const activeTurnProps = {
|
||||
compact: false,
|
||||
pendingAction: null,
|
||||
showPlanFollowUpPrompt: false,
|
||||
promptHasText: false,
|
||||
isSendBusy: false,
|
||||
isConnecting: false,
|
||||
isEnvironmentUnavailable: false,
|
||||
isPreparingWorktree: false,
|
||||
preserveComposerFocusOnPointerDown: false,
|
||||
onPreviousPendingQuestion: () => {},
|
||||
onInterrupt: () => {},
|
||||
onImplementPlanInNewThread: () => {},
|
||||
} as const;
|
||||
|
||||
describe("active-turn primary action", () => {
|
||||
it("shows stop while the active composer is empty", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
createElement(ComposerPrimaryActions, {
|
||||
...activeTurnProps,
|
||||
isRunning: true,
|
||||
hasSendableContent: false,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(markup).toContain('aria-label="Stop generation"');
|
||||
expect(markup).not.toContain("steer active turn");
|
||||
});
|
||||
|
||||
it("replaces stop with send while the active composer has content", () => {
|
||||
const markup = renderToStaticMarkup(
|
||||
createElement(ComposerPrimaryActions, {
|
||||
...activeTurnProps,
|
||||
isRunning: true,
|
||||
hasSendableContent: true,
|
||||
}),
|
||||
);
|
||||
|
||||
expect(markup).toContain('aria-label="Send message to steer active turn"');
|
||||
expect(markup).not.toContain('aria-label="Stop generation"');
|
||||
});
|
||||
});
|
||||
@@ -75,7 +75,6 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
|
||||
? { onPointerDown: preventPointerFocus }
|
||||
: undefined;
|
||||
const environmentIdentificationMode = useEnvironmentIdentificationMode();
|
||||
const isSendDisabled = sendDisabledReason !== null;
|
||||
const stageBackdropVariant = useSidebarStageBackdropVariant(
|
||||
environmentIdentificationMode === "artwork",
|
||||
);
|
||||
@@ -150,19 +149,7 @@ export const ComposerPrimaryActions = memo(function ComposerPrimaryActions({
|
||||
}
|
||||
|
||||
if (isRunning && !hasSendableContent) {
|
||||
return (
|
||||
<button
|
||||
type="button"
|
||||
className="flex size-8 cursor-pointer items-center justify-center rounded-full bg-destructive/90 text-white shadow-xs shadow-destructive/24 inset-shadow-[0_1px_--theme(--color-white/16%)] transition-all duration-150 hover:bg-destructive hover:scale-105 active:inset-shadow-[0_1px_--theme(--color-black/8%)] active:shadow-none sm:h-8 sm:w-8"
|
||||
{...pointerFocusProps}
|
||||
onClick={onInterrupt}
|
||||
aria-label="Stop generation"
|
||||
>
|
||||
<svg width="12" height="12" viewBox="0 0 12 12" fill="currentColor" aria-hidden="true">
|
||||
<rect x="2" y="2" width="8" height="8" rx="1.5" />
|
||||
</svg>
|
||||
</button>
|
||||
);
|
||||
return renderStopGenerationButton(false);
|
||||
}
|
||||
|
||||
if (showPlanFollowUpPrompt) {
|
||||
|
||||
Reference in new issue
Block a user