Skip to content

Commit

Permalink
Switched to toggleOverlay (#197)
Browse files Browse the repository at this point in the history
* Switched to toggleOverlay

* Switched to toggleOverlay

---------

Co-authored-by: nang-dev <[email protected]>
  • Loading branch information
nang-dev and nang-dev authored Nov 27, 2024
1 parent 125113f commit 70382c8
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 11 deletions.
2 changes: 1 addition & 1 deletion core/protocol/ideWebview.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ export type ToWebviewFromIdeProtocol = ToWebviewFromIdeOrCoreProtocol & {
addPerplexityContextinChat: [{ text: string, language: string }, void];
navigateToCreator: [undefined, void];
navigateToSearch: [undefined, void];
navigateToInventory: [undefined, void];
toggleOverlay: [undefined, void];
navigateToInventoryHome: [undefined, void];
getCurrentTab: [undefined, string];
setAiderProcessStateInGUI: [AiderState, void];
Expand Down
6 changes: 3 additions & 3 deletions extensions/vscode/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@
"group": "PearAI"
},
{
"command": "pearai.toggleInventory",
"command": "pearai.toggleOverlay",
"category": "PearAI",
"title": "Toggle PearAI Inventory",
"group": "PearAI"
Expand Down Expand Up @@ -361,7 +361,7 @@
"key": "ctrl+1"
},
{
"command": "pearai.toggleInventory",
"command": "pearai.toggleOverlay",
"mac": "cmd+shift+1",
"key": "ctrl+shift+1"
},
Expand Down Expand Up @@ -484,7 +484,7 @@
"command": "pearai.toggleSearch"
},
{
"command": "pearai.toggleInventory"
"command": "pearai.toggleOverlay"
},
{
"command": "pearai.focusContinueInput"
Expand Down
4 changes: 2 additions & 2 deletions extensions/vscode/src/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -382,8 +382,8 @@ const commandsMap: (
"pearai.toggleSearch": async () => {
await handleIntegrationShortcutKey("navigateToSearch", "perplexityMode", sidebar, [PEAR_OVERLAY_VIEW_ID]);
},
"pearai.toggleInventory": async () => {
await handleIntegrationShortcutKey("navigateToInventory", "inventory", sidebar, [PEAR_OVERLAY_VIEW_ID, PEAR_CONTINUE_VIEW_ID]);
"pearai.toggleOverlay": async () => {
await handleIntegrationShortcutKey("toggleOverlay", "inventory", sidebar, [PEAR_OVERLAY_VIEW_ID, PEAR_CONTINUE_VIEW_ID]);
},
"pearai.toggleInventoryHome": async () => {
await handleIntegrationShortcutKey("navigateToInventoryHome", "home", sidebar, [PEAR_OVERLAY_VIEW_ID, PEAR_CONTINUE_VIEW_ID]);
Expand Down
5 changes: 2 additions & 3 deletions extensions/vscode/src/util/integrationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,9 @@ export async function handleIntegrationShortcutKey(protocol: keyof ToWebviewProt

if (!isOverlayVisible) {
// If overlay isn't open, open it first
// Navigate to creator tab via webview protocol
await sidebar.webviewProtocol?.request(protocol, undefined, webviews);
await vscode.commands.executeCommand("pearai.showOverlay");
}

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

2 changes: 1 addition & 1 deletion gui/src/pages/inventory.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ export default function Inventory() {
useWebviewListener("navigateToInventoryHome", () => handleTabChange("home"), []);
useWebviewListener("navigateToCreator", () => handleTabChange("aiderMode"), []);
useWebviewListener("navigateToSearch", () => handleTabChange("perplexityMode"), []);
useWebviewListener("navigateToInventory", () => handleTabChange("inventory"), []);
useWebviewListener("toggleOverlay", () => handleTabChange("inventory"), []);
useWebviewListener("getCurrentTab", async () => activeTab, [activeTab]);

const handleTabChange = async (value: string) => {
Expand Down
2 changes: 1 addition & 1 deletion gui/src/pages/onboarding/OnboardingTutorial.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -373,7 +373,7 @@ const OnboardingTutorial: React.FC<OnboardingTutorialProps> = ({
);

useWebviewListener(
"navigateToInventory",
"toggleOverlay",
async () => {
if (currentPage === pages.length - 1) {
onClose();
Expand Down

0 comments on commit 70382c8

Please sign in to comment.