Skip to content

Commit

Permalink
onboarding end (#187)
Browse files Browse the repository at this point in the history
* progress dont push

* working

* working

* Added cmd 1

* Added fix for cmd1 toggle

* Removed comment

---------

Co-authored-by: nang-dev <[email protected]>
  • Loading branch information
nang-dev and nang-dev committed Feb 4, 2025
1 parent 873509d commit 13e623b
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 16 deletions.
4 changes: 2 additions & 2 deletions core/protocol/ide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ export type ToIdeFromWebviewOrCoreProtocol = {
lockOverlay: [undefined, void];
unlockOverlay: [undefined, void];

/* dont overuse invokeVSCodeCommandById, use it only for devving,
and if you find yourself writing redundant code just to invoke a
/* dont overuse invokeVSCodeCommandById, use it only for devving,
and if you find yourself writing redundant code just to invoke a
command not related to pearai. (workbench, other extension)
*/
invokeVSCodeCommandById: [
Expand Down
12 changes: 6 additions & 6 deletions extensions/vscode/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -376,16 +376,16 @@ const commandsMap: (
core.invoke("context/indexDocs", { reIndex: true });
},
"pearai.toggleCreator": async () => {
await handleIntegrationShortcutKey("navigateToCreator", "aiderMode", sidebar, PEAR_OVERLAY_VIEW_ID);
await handleIntegrationShortcutKey("navigateToCreator", "aiderMode", sidebar, [PEAR_OVERLAY_VIEW_ID]);
},
"pearai.toggleSearch": async () => {
await handleIntegrationShortcutKey("navigateToSearch", "perplexityMode", sidebar, PEAR_OVERLAY_VIEW_ID);
await handleIntegrationShortcutKey("navigateToSearch", "perplexityMode", sidebar, [PEAR_OVERLAY_VIEW_ID]);
},
"pearai.toggleInventory": async () => {
await handleIntegrationShortcutKey("navigateToInventory", "inventory", sidebar, PEAR_OVERLAY_VIEW_ID);
await handleIntegrationShortcutKey("navigateToInventory", "inventory", sidebar, [PEAR_OVERLAY_VIEW_ID, PEAR_CONTINUE_VIEW_ID]);
},
"pearai.toggleInventoryHome": async () => {
await handleIntegrationShortcutKey("navigateToInventoryHome", "inventory", sidebar, PEAR_OVERLAY_VIEW_ID);
await handleIntegrationShortcutKey("navigateToInventoryHome", "home", sidebar, [PEAR_OVERLAY_VIEW_ID, PEAR_CONTINUE_VIEW_ID]);
},
"pearai.startOnboarding": async () => {
if (isFirstLaunch(extensionContext)) {
Expand Down Expand Up @@ -642,7 +642,7 @@ const commandsMap: (
},
"pearai.aiderMode": async () => {
//await openAiderPanel(core, sidebar, extensionContext);
await handleIntegrationShortcutKey("navigateToCreator", "aiderMode", sidebar, PEAR_OVERLAY_VIEW_ID);
await handleIntegrationShortcutKey("navigateToCreator", "aiderMode", sidebar, [PEAR_OVERLAY_VIEW_ID]);
},
"pearai.aiderCtrlC": async () => {
await aiderCtrlC(core);
Expand All @@ -658,7 +658,7 @@ const commandsMap: (
},
"pearai.perplexityMode": async () => {
// handlePerplexityMode(sidebar, extensionContext);
await handleIntegrationShortcutKey("navigateToSearch", "perplexityMode", sidebar, PEAR_OVERLAY_VIEW_ID);
await handleIntegrationShortcutKey("navigateToSearch", "perplexityMode", sidebar, [PEAR_OVERLAY_VIEW_ID]);
},
"pearai.addPerplexityContext": (msg) => {
const fullScreenTab = getFullScreenTab();
Expand Down
6 changes: 3 additions & 3 deletions extensions/vscode/src/util/integrationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ export function getIntegrationTab(webviewName: string) {
});
}

export async function handleIntegrationShortcutKey(protocol: keyof ToWebviewProtocol, integrationName: string, sidebar: ContinueGUIWebviewViewProvider, webview: string) {
export async function handleIntegrationShortcutKey(protocol: keyof ToWebviewProtocol, integrationName: string, sidebar: ContinueGUIWebviewViewProvider, webviews: string[]) {
const isOverlayVisible = await vscode.commands.executeCommand('pearai.isOverlayVisible');
const currentTab = await sidebar.webviewProtocol.request("getCurrentTab", undefined, [webview]);
const currentTab = await sidebar.webviewProtocol.request("getCurrentTab", undefined, webviews);

if (isOverlayVisible && currentTab === integrationName) {
// close overlay
Expand All @@ -50,6 +50,6 @@ export async function handleIntegrationShortcutKey(protocol: keyof ToWebviewProt
}

// Navigate to creator tab via webview protocol
await sidebar.webviewProtocol?.request(protocol, undefined, [webview]);
await sidebar.webviewProtocol?.request(protocol, undefined, webviews);
}

4 changes: 2 additions & 2 deletions gui/src/pages/gui.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
} from "@heroicons/react/24/outline";
import { JSONContent } from "@tiptap/react";
import { InputModifiers } from "core";
import { usePostHog } from "posthog-js/react";
import { PostHog, usePostHog } from "posthog-js/react";
import {
Fragment,
useCallback,
Expand Down Expand Up @@ -50,7 +50,7 @@ import {
isMetaEquivalentKeyPressed,
} from "../util";
import { FREE_TRIAL_LIMIT_REQUESTS } from "../util/freeTrial";
import { getLocalStorage, setLocalStorage } from "../util/localStorage";
import { getLocalStorage, setLocalStorage } from "@/util/localStorage";
import OnboardingTutorial from "./onboarding/OnboardingTutorial";
import { setActiveFilePath } from "@/redux/slices/uiStateSlice";

Expand Down
35 changes: 32 additions & 3 deletions gui/src/pages/onboarding/OnboardingTutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
import DelayedMessage from "@/components/DelayedMessage";
import CopyButtonWithText from "@/components/markdown/CopyButtonWithText";
import { Button } from "@/components/ui/button";
import { setLocalStorage } from "@/util/localStorage";
import { IdeMessengerContext } from "@/context/IdeMessenger";
import useHistory from "@/hooks/useHistory";
import { useWebviewListener } from "@/hooks/useWebviewListener";
Expand Down Expand Up @@ -248,7 +249,7 @@ const OnboardingTutorial: React.FC<OnboardingTutorialProps> = ({
description: (
<>
<p>
Try asking anything about your entire codebase by typing in prompt then
Try asking anything about your entire codebase by typing in prompt then
pressing{" "}
<b>
<kbd className="font-mono">{getMetaKeyAndShortcutLabel()}</kbd>
Expand All @@ -271,6 +272,11 @@ const OnboardingTutorial: React.FC<OnboardingTutorialProps> = ({
<>
<p>
Lastly, press{" "}
<b>
<kbd className="font-mono">{getMetaKeyAndShortcutLabel()}</kbd>
&nbsp;<kbd className="font-mono">1</kbd>
</b>{" "}
/ {" "}
<b>
<kbd className="font-mono">{getMetaKeyAndShortcutLabel()}</kbd>
&nbsp;<kbd className="font-mono">E</kbd>
Expand All @@ -292,10 +298,13 @@ const OnboardingTutorial: React.FC<OnboardingTutorialProps> = ({
const nextPage = () => {
setIsTransitioning(true);
setSlideDirection("right");
setCurrentPage((prev) => Math.min(prev + 1, pages.length - 1));
const nextPageNum = Math.min(currentPage + 1, pages.length - 1);
setCurrentPage(nextPageNum);

if (currentPage === 1) {
saveSession();
}

setTimeout(() => setIsTransitioning(false), 600);
};

Expand Down Expand Up @@ -358,6 +367,26 @@ const OnboardingTutorial: React.FC<OnboardingTutorialProps> = ({
[currentPage],
);

useWebviewListener(
"navigateToInventoryHome",
async () => {
if (currentPage === pages.length - 1) {
onClose();
}
},
[currentPage, onClose, pages.length]
);

useWebviewListener(
"navigateToInventory",
async () => {
if (currentPage === pages.length - 1) {
onClose();
}
},
[currentPage, onClose, pages.length]
);

useEffect(() => {
if (currentPage === 3) {
const handleEnterKey = (event: KeyboardEvent) => {
Expand Down Expand Up @@ -451,7 +480,7 @@ const OnboardingTutorial: React.FC<OnboardingTutorialProps> = ({
/>
))}
</div>
<div className="text-xs mt-3">copy prompts by clicking them</div>
<div className="text-xs mt-3">copy prompts by clicking them</div>
</ExamplesSection>
)}
</ContentWrapper>
Expand Down

0 comments on commit 13e623b

Please sign in to comment.