From 4e0c16a39bf9cc31c98525751c1cc16b0ba398ec Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 20 Sep 2023 15:02:43 +0200 Subject: [PATCH] test out disabling flow editing & publishing buttons --- .../src/pages/FlowEditor/components/PreviewBrowser.tsx | 1 + .../src/pages/FlowEditor/components/forms/FormModal.tsx | 3 +++ 2 files changed, 4 insertions(+) diff --git a/editor.planx.uk/src/pages/FlowEditor/components/PreviewBrowser.tsx b/editor.planx.uk/src/pages/FlowEditor/components/PreviewBrowser.tsx index 892e9812bf..e7d61e2c1d 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/PreviewBrowser.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/PreviewBrowser.tsx @@ -177,6 +177,7 @@ const PreviewBrowser: React.FC<{ sx={{ width: "100% " }} variant="contained" color="primary" + disabled={useStore.getState().getUser().isViewOnly} onClick={async () => { try { setLastPublishedTitle("Checking for changes..."); diff --git a/editor.planx.uk/src/pages/FlowEditor/components/forms/FormModal.tsx b/editor.planx.uk/src/pages/FlowEditor/components/forms/FormModal.tsx index fefee7db0a..16d55539eb 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/forms/FormModal.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/forms/FormModal.tsx @@ -183,6 +183,7 @@ const FormModal: React.FC<{ handleDelete(); navigate(rootFlowPath(true)); }} + disabled={useStore.getState().getUser().isViewOnly} > delete @@ -197,6 +198,7 @@ const FormModal: React.FC<{ makeUnique(id, parent); navigate(rootFlowPath(true)); }} + disabled={useStore.getState().getUser().isViewOnly} > make unique @@ -210,6 +212,7 @@ const FormModal: React.FC<{ variant="contained" color="primary" form="modal" + disabled={useStore.getState().getUser().isViewOnly} > {handleDelete ? `Update ${type}` : `Create ${type}`}