Skip to content

Commit 2477bdf

Browse files
olasunkanmi.raymondolasunkanmi.raymond
authored andcommitted
isCompletedisCompleted
1 parent ccc3fce commit 2477bdf

6 files changed

Lines changed: 58 additions & 85 deletions

File tree

src/webview-providers/handlers/onboarding-handler.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ function isOnboardingMessage(msg: unknown): msg is OnboardingMessage {
6666

6767
interface OnboardingStateDTO {
6868
shouldShow: boolean;
69+
completed: boolean;
6970
providers: Array<{
7071
id: string;
7172
name: string;
@@ -94,16 +95,14 @@ export class OnboardingHandler implements WebviewMessageHandler {
9495
try {
9596
const shouldShow = svc.shouldShowOnboarding();
9697
const providers = svc.getProviders();
97-
let projectInfo: ProjectInfo | null = null;
98-
let suggestedTasks: Array<{ label: string; prompt: string }> = [];
9998

100-
if (shouldShow) {
101-
projectInfo = await svc.detectProjectInfo();
102-
suggestedTasks = svc.getSuggestedTasks(projectInfo);
103-
}
99+
// Always detect project info so the WelcomeScreen can show it
100+
const projectInfo = await svc.detectProjectInfo();
101+
const suggestedTasks = svc.getSuggestedTasks(projectInfo);
104102

105103
const dto: OnboardingStateDTO = {
106104
shouldShow,
105+
completed: !shouldShow,
107106
providers,
108107
projectInfo,
109108
suggestedTasks,
@@ -121,6 +120,7 @@ export class OnboardingHandler implements WebviewMessageHandler {
121120
command: "onboarding-state",
122121
data: {
123122
shouldShow: false,
123+
completed: false,
124124
providers: [],
125125
projectInfo: null,
126126
suggestedTasks: [],

webviewUi/src/components/webview.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -517,13 +517,7 @@ export const WebviewUI = () => {
517517
<div style={{ minWidth: 0, maxWidth: "100%" }}>
518518
{/* Show welcome screen when there are no messages */}
519519
{streamedMessages.length === 0 && !isBotLoading && !isCommandExecuting ? (
520-
<WelcomeScreen
521-
username={username}
522-
onGetStarted={() => {
523-
// Optional: Focus on the input or trigger a sample prompt
524-
console.log("User is ready to start!");
525-
}}
526-
/>
520+
<WelcomeScreen username={username} />
527521
) : (
528522
<>
529523
{memoizedMessages}

webviewUi/src/components/welcomeUI.tsx

Lines changed: 37 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,9 @@
11
import React, { useEffect, useState } from "react";
22
import { useTranslation } from "react-i18next";
33
import styled, { keyframes } from "styled-components";
4-
import {
5-
WelcomeHero,
6-
WelcomeLogo,
7-
WelcomeSubtitle as OnboardingSubtitle,
8-
FeatureList,
9-
FeatureItem,
10-
FeatureIcon,
11-
FeatureText,
12-
} from "./onboarding/styles";
13-
import {
14-
CodeBuddyLogo,
15-
ChatBubbleIcon,
16-
SearchIcon,
17-
LockIcon,
18-
GlobeIcon,
19-
WrenchIcon,
20-
RefreshIcon,
21-
} from "./onboarding/icons";
4+
import { WelcomeHero, WelcomeLogo } from "./onboarding/styles";
5+
import { CodeBuddyLogo } from "./onboarding/icons";
6+
import { useOnboardingStore } from "../stores/onboarding.store";
227

238
interface WelcomeScreenProps {
249
username?: string;
@@ -55,9 +40,37 @@ const GreetingTitle = styled.h1`
5540
text-align: center;
5641
`;
5742

43+
const Tagline = styled.p`
44+
font-size: 13px;
45+
color: var(--vscode-descriptionForeground, #999);
46+
margin: 0 0 24px 0;
47+
text-align: center;
48+
max-width: 380px;
49+
line-height: 1.5;
50+
`;
51+
52+
const SetupCTA = styled.button`
53+
background: var(--vscode-button-background);
54+
color: var(--vscode-button-foreground);
55+
border: none;
56+
border-radius: 6px;
57+
padding: 8px 20px;
58+
font-size: 13px;
59+
font-weight: 500;
60+
cursor: pointer;
61+
transition: background 0.15s ease;
62+
63+
&:hover {
64+
background: var(--vscode-button-hoverBackground);
65+
}
66+
`;
67+
5868
export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ username }) => {
5969
const { t } = useTranslation();
6070
const [displayedText, setDisplayedText] = useState("");
71+
const isCompleted = useOnboardingStore((s) => s.isCompleted);
72+
const show = useOnboardingStore((s) => s.show);
73+
6174
const greeting = username
6275
? t("welcome.greetingWithName", { username })
6376
: t("welcome.greetingDefault");
@@ -83,53 +96,12 @@ export const WelcomeScreen: React.FC<WelcomeScreenProps> = ({ username }) => {
8396
<CodeBuddyLogo />
8497
</WelcomeLogo>
8598
<GreetingTitle>{displayedText}</GreetingTitle>
86-
<OnboardingSubtitle>
87-
{t("welcome.subtitle")}
88-
</OnboardingSubtitle>
89-
<FeatureList>
90-
<FeatureItem>
91-
<FeatureIcon><ChatBubbleIcon /></FeatureIcon>
92-
<FeatureText>
93-
<strong>{t("welcome.featureAgentMode")}</strong>
94-
{t("welcome.featureAgentModeDesc")}
95-
</FeatureText>
96-
</FeatureItem>
97-
<FeatureItem>
98-
<FeatureIcon><SearchIcon /></FeatureIcon>
99-
<FeatureText>
100-
<strong>{t("welcome.featureAskMode")}</strong>
101-
{t("welcome.featureAskModeDesc")}
102-
</FeatureText>
103-
</FeatureItem>
104-
<FeatureItem>
105-
<FeatureIcon><GlobeIcon /></FeatureIcon>
106-
<FeatureText>
107-
<strong>{t("welcome.featureProviders")}</strong>
108-
{t("welcome.featureProvidersDesc")}
109-
</FeatureText>
110-
</FeatureItem>
111-
<FeatureItem>
112-
<FeatureIcon><LockIcon /></FeatureIcon>
113-
<FeatureText>
114-
<strong>{t("welcome.featureDiffReview")}</strong>
115-
{t("welcome.featureDiffReviewDesc")}
116-
</FeatureText>
117-
</FeatureItem>
118-
<FeatureItem>
119-
<FeatureIcon><WrenchIcon /></FeatureIcon>
120-
<FeatureText>
121-
<strong>{t("welcome.featureMCP")}</strong>
122-
{t("welcome.featureMCPDesc")}
123-
</FeatureText>
124-
</FeatureItem>
125-
<FeatureItem>
126-
<FeatureIcon><RefreshIcon /></FeatureIcon>
127-
<FeatureText>
128-
<strong>{t("welcome.featureMentions")}</strong>
129-
{t("welcome.featureMentionsDesc")}
130-
</FeatureText>
131-
</FeatureItem>
132-
</FeatureList>
99+
<Tagline>{t("welcome.subtitle")}</Tagline>
100+
{!isCompleted && (
101+
<SetupCTA onClick={show}>
102+
{t("welcome.setupCTA")}
103+
</SetupCTA>
104+
)}
133105
</WelcomeHero>
134106
</WelcomeContainer>
135107
);

webviewUi/src/hooks/useMessageDispatcher.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -491,10 +491,11 @@ export function useMessageDispatcher(streamingChat: StreamingChatAPI) {
491491
// ── Onboarding ──
492492
case "onboarding-state": {
493493
const ob = useOnboardingStore.getState();
494+
ob.setCompleted(message.data?.completed ?? false);
495+
ob.setProviders(message.data?.providers ?? []);
496+
ob.setProjectInfo(message.data?.projectInfo ?? null);
497+
ob.setSuggestedTasks(message.data?.suggestedTasks ?? []);
494498
if (message.data?.shouldShow) {
495-
ob.setProviders(message.data.providers ?? []);
496-
ob.setProjectInfo(message.data.projectInfo ?? null);
497-
ob.setSuggestedTasks(message.data.suggestedTasks ?? []);
498499
ob.show();
499500
}
500501
break;
@@ -525,6 +526,7 @@ export function useMessageDispatcher(streamingChat: StreamingChatAPI) {
525526
}
526527
case "onboarding-completed":
527528
useOnboardingStore.getState().setVisible(false);
529+
useOnboardingStore.getState().setCompleted(true);
528530
break;
529531
case "onboarding-request-hydrate":
530532
useOnboardingStore.getState().hydrate();

webviewUi/src/i18n/en.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@
8585
"featureMCP": "MCP Tools",
8686
"featureMCPDesc": "Extend with GitHub, GitLab, and custom integrations",
8787
"featureMentions": "@ Mentions",
88-
"featureMentionsDesc": "Use @filename to include specific files as context"
88+
"featureMentionsDesc": "Use @filename to include specific files as context",
89+
"setupCTA": "Complete Setup"
8990
},
9091

9192
"webview": {

webviewUi/src/stores/onboarding.store.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ export const STEP_ORDER: OnboardingStep[] = [
5050

5151
interface OnboardingState {
5252
isVisible: boolean;
53+
isCompleted: boolean;
5354
currentStep: OnboardingStep;
5455
providers: ProviderInfo[];
5556
projectInfo: ProjectInfo | null;
@@ -82,12 +83,14 @@ interface OnboardingState {
8283
setStepCompleting: (completing: boolean) => void;
8384
setSavedKeyProvider: (provider: string | null) => void;
8485
setIsSavingKey: (saving: boolean) => void;
86+
setCompleted: (completed: boolean) => void;
8587
}
8688

8789
// ─── Store ──────────────────────────────────────────────
8890

8991
export const useOnboardingStore = create<OnboardingState>()((set, get) => ({
9092
isVisible: false,
93+
isCompleted: false,
9194
currentStep: "welcome",
9295
providers: [],
9396
projectInfo: null,
@@ -109,12 +112,12 @@ export const useOnboardingStore = create<OnboardingState>()((set, get) => ({
109112

110113
dismiss: () => {
111114
vscode.postMessage({ command: "onboarding-dismiss" });
112-
set({ isVisible: false });
115+
set({ isVisible: false, isCompleted: true });
113116
},
114117

115118
skip: () => {
116119
vscode.postMessage({ command: "onboarding-skip" });
117-
set({ isVisible: false });
120+
set({ isVisible: false, isCompleted: true });
118121
},
119122

120123
nextStep: () => {
@@ -125,7 +128,7 @@ export const useOnboardingStore = create<OnboardingState>()((set, get) => ({
125128
} else {
126129
// Last step — complete the wizard
127130
vscode.postMessage({ command: "onboarding-dismiss" });
128-
set({ isVisible: false });
131+
set({ isVisible: false, isCompleted: true });
129132
}
130133
},
131134

@@ -212,4 +215,5 @@ export const useOnboardingStore = create<OnboardingState>()((set, get) => ({
212215
setSavedKeyProvider: (provider) =>
213216
set({ savedKeyProvider: provider, isSavingKey: false }),
214217
setIsSavingKey: (saving) => set({ isSavingKey: saving }),
218+
setCompleted: (completed) => set({ isCompleted: completed }),
215219
}));

0 commit comments

Comments
 (0)