Skip to content

Commit

Permalink
Merge pull request #303 from CommandDash/290-onboarding-in-steps
Browse files Browse the repository at this point in the history
290 onboarding in steps
  • Loading branch information
samyakkkk authored Jun 18, 2024
2 parents 9a68aab + a64f2ac commit 1f28afa
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 15 deletions.
4 changes: 2 additions & 2 deletions vscode/media/onboarding/onboarding.html
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
playMode="normal" loop autoplay></dotlottie-player>
</div>
<p class="break-words mb-5">Visit <a class="underline cursor-pointer"
href="https://makersuite.google.com/app/apikey">Markesuite by Google</a> and create
href="https://aistudio.google.com/app/apikey">AI Studio by Google</a> and create
your
free API key and enter below.</p>

Expand All @@ -97,7 +97,7 @@
</div>
<div id="executable-container">
<div class="inline-flex flex-row items-center">
<p class="break-words">Step 3. Executable download</p>
<p class="break-words">Step 3. Setting up engine</p>
<div class="inline-flex flex-row ml-1">
<svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" viewBox="0 0 12 12"
id="executable-tick">
Expand Down
15 changes: 12 additions & 3 deletions vscode/media/onboarding/onboarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -1231,15 +1231,16 @@ function handleTriggerMessage(event) {
githubCross.classList.remove('hidden');
githubTick.classList.add('hidden');
githubLogin.classList.remove("hidden");
apiKeyContainer.classList.remove("hidden");
apiKeyContainer.classList.add("hidden");
executableContainer.classList.add("hidden");
break;

case 1:
isApiKeyPending = true;
apiKeyCross.classList.remove('hidden');
apiKeyTick.classList.add('hidden');
googleApiKeyTextInput.classList.remove("hidden");
executableContainer.classList.remove("hidden");
executableContainer.classList.add("hidden");
break;

case 2:
Expand All @@ -1257,13 +1258,18 @@ function handleTriggerMessage(event) {
githubCross.classList.add("hidden");
githubTick.classList.remove("hidden");
githubLogin.classList.add("hidden");
apiKeyContainer.classList.remove("hidden");
}
if (!isApiKeyPending) {
isApiKeyPending = false;
apiKeyContainer.classList.remove("hidden");
apiKeyCross.classList.add("hidden");
apiKeyTick.classList.remove("hidden");
googleApiKeyTextInput.classList.add("hidden");

vscode.postMessage({
type: "executeDownload",
});
executableContainer.classList.remove("hidden");
}
if (!isExecutableDownloadPending) {
isExecutableDownloadPending = false;
Expand All @@ -1290,13 +1296,16 @@ function handleTriggerMessage(event) {
apiKeyCross.classList.add("hidden");
apiKeyTick.classList.remove("hidden");
googleApiKeyTextInput.classList.add("hidden");
executableContainer.classList.remove("hidden");
allStepsCompleted();
break;
case 'githubLoggedIn':
isGithubLoginPending = false;
githubCross.classList.add("hidden");
githubTick.classList.remove("hidden");
githubLogin.classList.add("hidden");
apiKeyContainer.classList.remove("hidden");
executableContainer.classList.add("hidden");
allStepsCompleted();
break;
case 'cleanUpEventListener':
Expand Down
28 changes: 18 additions & 10 deletions vscode/src/providers/chat_view_provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,17 @@ export class FlutterGPTViewProvider implements vscode.WebviewViewProvider {
this._fetchAgentsAPI();
break;
}
case "executeDownload":
{
this.setupManager.pendingSetupSteps.forEach((steps: SetupStep) => {
if (steps === SetupStep.executable) {
this.setupManager.setupExecutable((progress: number) => {
this.postMessageToWebview({ type: 'executableDownloadProgress', value: progress });
});
}
});
break;
}
}
});
this._fetchAgentsAPI(true);
Expand Down Expand Up @@ -330,18 +341,8 @@ export class FlutterGPTViewProvider implements vscode.WebviewViewProvider {

private async _setupManager() {

this.setupManager.pendingSetupSteps.forEach((steps: SetupStep) => {
if (steps === SetupStep.executable) {
this.setupManager.setupExecutable((progress: number) => {
this.postMessageToWebview({ type: 'executableDownloadProgress', value: progress });
});
}
});

this._view?.webview.postMessage({ type: 'pendingSteps', value: JSON.stringify(this.setupManager.pendingSetupSteps) });

// this.setupManager.deleteGithub();

this.setupManager.onDidChangeSetup(event => {
switch (event) {
case SetupStep.github:
Expand All @@ -351,6 +352,13 @@ export class FlutterGPTViewProvider implements vscode.WebviewViewProvider {
case SetupStep.apiKey:
console.log('apikey');
this._view?.webview.postMessage({ type: 'apiKeySet' });
this.setupManager.pendingSetupSteps.forEach((steps: SetupStep) => {
if (steps === SetupStep.executable) {
this.setupManager.setupExecutable((progress: number) => {
this.postMessageToWebview({ type: 'executableDownloadProgress', value: progress });
});
}
});
break;
case SetupStep.executable:
console.log('executable');
Expand Down

0 comments on commit 1f28afa

Please sign in to comment.