Skip to content

Commit fe35c95

Browse files
committed
fix(webapp): keep draft chat composer in the hero block
1 parent 7088a1a commit fe35c95

1 file changed

Lines changed: 34 additions & 16 deletions

File tree

apps/webapp/app/components/dashboard-agent/DashboardAgentChat.tsx

Lines changed: 34 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -449,18 +449,48 @@ export function DashboardAgentChat({
449449
onActivityChange?.(chatId, activity);
450450
}, [chatId, activity, onActivityChange]);
451451

452+
const isDraftState = messages.length === 0 && !pendingFirstMessage;
453+
454+
const contextBanner = (
455+
<DashboardAgentContextBanner
456+
projectSlug={projectSlug}
457+
environmentSlug={environmentSlug}
458+
currentPage={currentPage}
459+
/>
460+
);
461+
452462
return (
453463
<>
454464
<WatchChips
455465
watches={watches.filter((watch) => watch.status === "active")}
456466
onCancel={onCancelWatch}
457467
/>
458-
{messages.length === 0 && !pendingFirstMessage ? (
468+
{isDraftState ? (
459469
<DashboardAgentHero
460470
onSelect={submit}
461471
pageContext={clientData.pageContext}
462472
promoted={promotedPrompt}
463473
promptsDisabledReason={atMessageCap ? MESSAGE_QUOTA_REACHED_REASON : undefined}
474+
composer={
475+
atMessageCap ? (
476+
<AgentUpgradeBlock
477+
limit={messageCapLimit}
478+
planResolved={messageCapPlanResolved}
479+
context={contextBanner}
480+
/>
481+
) : (
482+
<DashboardAgentComposer
483+
layout="hero"
484+
value={input}
485+
onChange={setInput}
486+
onSubmit={() => submit(input)}
487+
onStop={stop}
488+
isStreaming={isStreaming}
489+
focusKey={sendRequest?.seq}
490+
context={contextBanner}
491+
/>
492+
)
493+
}
464494
/>
465495
) : (
466496
<DashboardAgentMessages
@@ -477,17 +507,11 @@ export function DashboardAgentChat({
477507
/>
478508
)}
479509
{watchCard ? <div className="px-3 pb-2">{watchCard}</div> : null}
480-
{atMessageCap ? (
510+
{isDraftState ? null : atMessageCap ? (
481511
<AgentUpgradeBlock
482512
limit={messageCapLimit}
483513
planResolved={messageCapPlanResolved}
484-
context={
485-
<DashboardAgentContextBanner
486-
projectSlug={projectSlug}
487-
environmentSlug={environmentSlug}
488-
currentPage={currentPage}
489-
/>
490-
}
514+
context={contextBanner}
491515
/>
492516
) : (
493517
<>
@@ -498,13 +522,7 @@ export function DashboardAgentChat({
498522
onStop={stop}
499523
isStreaming={isStreaming}
500524
focusKey={sendRequest?.seq}
501-
context={
502-
<DashboardAgentContextBanner
503-
projectSlug={projectSlug}
504-
environmentSlug={environmentSlug}
505-
currentPage={currentPage}
506-
/>
507-
}
525+
context={contextBanner}
508526
trailingAction={
509527
showNewChat && (
510528
<Button

0 commit comments

Comments
 (0)