Skip to content

Commit 7dea7a3

Browse files
committed
feat(ui): port welcome visuals from PR #8470 (no Cloud Agent)
1 parent 63d408c commit 7dea7a3

File tree

3 files changed

+27
-61
lines changed

3 files changed

+27
-61
lines changed

webview-ui/src/components/chat/ChatView.tsx

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,6 @@ import { CloudUpsellDialog } from "@src/components/cloud/CloudUpsellDialog"
4444

4545
import TelemetryBanner from "../common/TelemetryBanner"
4646
import VersionIndicator from "../common/VersionIndicator"
47-
import { useTaskSearch } from "../history/useTaskSearch"
4847
import HistoryPreview from "../history/HistoryPreview"
4948
import Announcement from "./Announcement"
5049
import BrowserSessionRow from "./BrowserSessionRow"
@@ -118,7 +117,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
118117
customModes,
119118
telemetrySetting,
120119
hasSystemPromptOverride,
121-
historyPreviewCollapsed, // Added historyPreviewCollapsed
122120
soundEnabled,
123121
soundVolume,
124122
cloudIsAuthenticated,
@@ -131,20 +129,6 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
131129
messagesRef.current = messages
132130
}, [messages])
133131

134-
const { tasks } = useTaskSearch()
135-
136-
// Initialize expanded state based on the persisted setting (default to expanded if undefined)
137-
const [isExpanded, setIsExpanded] = useState(
138-
historyPreviewCollapsed === undefined ? true : !historyPreviewCollapsed,
139-
)
140-
141-
const toggleExpanded = useCallback(() => {
142-
const newState = !isExpanded
143-
setIsExpanded(newState)
144-
// Send message to extension to persist the new collapsed state
145-
vscode.postMessage({ type: "setHistoryPreviewCollapsed", bool: !newState })
146-
}, [isExpanded])
147-
148132
// Leaving this less safe version here since if the first message is not a
149133
// task, then the extension is in a bad state and needs to be debugged (see
150134
// Cline.abort).
@@ -1810,53 +1794,35 @@ const ChatViewComponent: React.ForwardRefRenderFunction<ChatViewRef, ChatViewPro
18101794
)}
18111795
</>
18121796
) : (
1813-
<div className="flex-1 min-h-0 overflow-y-auto flex flex-col gap-4 relative">
1814-
{/* Moved Task Bar Header Here */}
1815-
{tasks.length !== 0 && (
1816-
<div className="flex text-vscode-descriptionForeground w-full mx-auto px-5 pt-3">
1817-
<div className="flex items-center gap-1 cursor-pointer" onClick={toggleExpanded}>
1818-
{tasks.length < 10 && (
1819-
<span className={`font-medium text-xs `}>{t("history:recentTasks")}</span>
1820-
)}
1821-
<span
1822-
className={`codicon ${isExpanded ? "codicon-eye" : "codicon-eye-closed"} scale-90`}
1823-
/>
1824-
</div>
1825-
</div>
1826-
)}
1827-
<div
1828-
className={` w-full flex flex-col gap-4 m-auto ${isExpanded && tasks.length > 0 ? "mt-0" : ""} px-3.5 min-[370px]:px-10 pt-5 transition-all duration-300`}>
1829-
{/* Version indicator in top-right corner - only on welcome screen */}
1797+
<div className="flex flex-col h-full justify-center p-6 min-h-0 overflow-y-auto gap-4 relative">
1798+
<div className="flex flex-col items-start gap-2 justify-center max-w-md h-full">
18301799
<VersionIndicator
18311800
onClick={() => setShowAnnouncementModal(true)}
18321801
className="absolute top-2 right-3 z-10"
18331802
/>
1834-
1835-
<RooHero />
1836-
1837-
<div className="mb-2.5">
1838-
{cloudIsAuthenticated || taskHistory.length < 4 ? (
1839-
<RooTips />
1840-
) : (
1841-
<>
1842-
<DismissibleUpsell
1843-
upsellId="taskList"
1844-
icon={<Cloud className="size-4 mt-0.5 shrink-0" />}
1845-
onClick={() => openUpsell()}
1846-
dismissOnClick={false}
1847-
className="bg-vscode-editor-background p-4 !text-base">
1848-
<Trans
1849-
i18nKey="cloud:upsell.taskList"
1850-
components={{
1851-
learnMoreLink: <VSCodeLink href="#" />,
1852-
}}
1853-
/>
1854-
</DismissibleUpsell>
1855-
</>
1856-
)}
1803+
<div className="flex flex-col gap-4 w-full">
1804+
<RooHero />
1805+
{/* Show RooTips when authenticated or when user is new */}
1806+
{(cloudIsAuthenticated || taskHistory.length < 4) && <RooTips />}
1807+
{/* Everyone should see their task history if any */}
1808+
{taskHistory.length > 0 && <HistoryPreview />}
18571809
</div>
1858-
{/* Show the task history preview if expanded and tasks exist */}
1859-
{taskHistory.length > 0 && isExpanded && <HistoryPreview />}
1810+
{/* Logged out users should see a one-time upsell, but not for brand new users */}
1811+
{!cloudIsAuthenticated && taskHistory.length >= 4 && (
1812+
<DismissibleUpsell
1813+
upsellId="taskList"
1814+
icon={<Cloud className="size-5 mt-0.5 shrink-0" />}
1815+
onClick={() => openUpsell()}
1816+
dismissOnClick={false}
1817+
className="!bg-vscode-editor-background mt-6 border-border rounded-xl pl-4 pr-3 py-3 !text-base">
1818+
<Trans
1819+
i18nKey="cloud:upsell.taskList"
1820+
components={{
1821+
learnMoreLink: <VSCodeLink href="#" />,
1822+
}}
1823+
/>
1824+
</DismissibleUpsell>
1825+
)}
18601826
</div>
18611827
</div>
18621828
)}

webview-ui/src/components/history/__tests__/HistoryPreview.spec.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe("HistoryPreview", () => {
100100
const { container } = render(<HistoryPreview />)
101101

102102
// Should render the container but no task items
103-
expect(container.firstChild).toHaveClass("flex", "flex-col", "gap-3")
103+
expect(container.firstChild).toHaveClass("flex", "flex-col", "gap-1")
104104
expect(screen.queryByTestId(/task-item-/)).not.toBeInTheDocument()
105105
})
106106

@@ -226,6 +226,6 @@ describe("HistoryPreview", () => {
226226

227227
const { container } = render(<HistoryPreview />)
228228

229-
expect(container.firstChild).toHaveClass("flex", "flex-col", "gap-3")
229+
expect(container.firstChild).toHaveClass("flex", "flex-col", "gap-1")
230230
})
231231
})

webview-ui/src/components/history/__tests__/TaskItem.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,6 @@ describe("TaskItem", () => {
107107
)
108108

109109
const taskItem = screen.getByTestId("task-item-1")
110-
expect(taskItem).toHaveClass("hover:bg-vscode-list-hoverBackground")
110+
expect(taskItem).toHaveClass("hover:bg-vscode-editor-foreground/10")
111111
})
112112
})

0 commit comments

Comments
 (0)