From 4e8cfe4cbb110787a52c126e4aec9c6ea1877853 Mon Sep 17 00:00:00 2001 From: Greg Pabian <35925521+grzpab@users.noreply.github.com> Date: Wed, 3 Jan 2024 11:54:10 +0100 Subject: [PATCH] INT-2373 do not initialize the VSCE if there is no active workspace --- intuita-webview/src/main/App.css | 7 +++++++ intuita-webview/src/main/App.tsx | 17 +++++++++++++++-- src/components/webview/MainProvider.ts | 3 ++- src/selectors/selectMainWebviewViewProps.ts | 4 ++++ 4 files changed, 28 insertions(+), 3 deletions(-) diff --git a/intuita-webview/src/main/App.css b/intuita-webview/src/main/App.css index fdab19d9..d3abbc51 100644 --- a/intuita-webview/src/main/App.css +++ b/intuita-webview/src/main/App.css @@ -65,3 +65,10 @@ height: 4em; width: 100%; } + +.warning { + font-size: var(--type-ramp-base-font-size); + line-height: var(--type-ramp-base-line-height); + display: block; + color: var(--foreground); +} diff --git a/intuita-webview/src/main/App.tsx b/intuita-webview/src/main/App.tsx index 8e671a05..04273242 100644 --- a/intuita-webview/src/main/App.tsx +++ b/intuita-webview/src/main/App.tsx @@ -90,7 +90,10 @@ function App() { }, []); useEffect(() => { - if (mainWebviewViewProps.toaster === null) { + if ( + mainWebviewViewProps === null || + mainWebviewViewProps.toaster === null + ) { return; } @@ -122,7 +125,7 @@ function App() { kind: 'webview.main.setToaster', value: null, }); - }, [mainWebviewViewProps.toaster]); + }, [mainWebviewViewProps, mainWebviewViewProps?.toaster]); const handlePanelTabClick = (id: ActiveTabId) => { vscode.postMessage({ @@ -131,6 +134,16 @@ function App() { }); }; + if (mainWebviewViewProps === null) { + return ( +
+

+ Open a workspace folder to use the Intuita VSCode Extension. +

+
+ ); + } + return (
, executionQueue: ReadonlyArray, ) => { + if (rootUri === null) { + return null; + } + if (state.activeTabId === 'codemods') { return { activeTabId: state.activeTabId,