From 10fea96921d31b1f3c340d2d9ad1d611baa0dd39 Mon Sep 17 00:00:00 2001 From: Jakob Date: Wed, 19 Jun 2024 13:40:53 -0700 Subject: [PATCH] add radonly overlay in variables window --- .../VariableWindow/VariableWindow.tsx | 81 ++++++++++++------- 1 file changed, 51 insertions(+), 30 deletions(-) diff --git a/packages/client/editor/src/components/VariableWindow/VariableWindow.tsx b/packages/client/editor/src/components/VariableWindow/VariableWindow.tsx index 9a0f8d0bf4..e55ba5c194 100644 --- a/packages/client/editor/src/components/VariableWindow/VariableWindow.tsx +++ b/packages/client/editor/src/components/VariableWindow/VariableWindow.tsx @@ -6,6 +6,7 @@ import { import { Tab, useConfig } from '@magickml/providers' import { Window } from 'client/core' import { + selectEngineRunning, selectGraphJson, useGetSpellByNameQuery, useSaveSpellMutation, @@ -45,6 +46,9 @@ export const VariableWindow = (props: Props) => { const graphJson = useSelector(selectGraphJson(tab.id)) const { projectId } = useConfig() const [saveSpellMutation] = useSaveSpellMutation() + const engineRunning = useSelector(selectEngineRunning) + + const readOnly = engineRunning const onInputChange = (e: React.ChangeEvent) => { setNewVariableName(e.target.value) @@ -162,37 +166,54 @@ export const VariableWindow = (props: Props) => { return ( -
- - -
-
- {variables - .sort((a, b) => a.name.localeCompare(b.name)) - .map(variable => { - return ( - { - deleteAllVariableNodes(variable) - }} - updateVariable={saveVariable} - deleteVariable={deleteVariable} +
+ {readOnly ? ( +
+
Read-Only Mode
+
+ Run your spell to modify your Agent +
+
+ ) : ( + <> +
+ - ) - })} + +
+
+ {variables + .sort((a, b) => a.name.localeCompare(b.name)) + .map(variable => { + return ( + { + deleteAllVariableNodes(variable) + }} + updateVariable={saveVariable} + deleteVariable={deleteVariable} + /> + ) + })} +
+ + )}
)