Skip to content

Commit

Permalink
chore: Rename state variable to control sidebar
Browse files Browse the repository at this point in the history
  • Loading branch information
DafyddLlyr committed May 17, 2024
1 parent 9f41dcb commit 3297a11
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions editor.planx.uk/src/pages/FlowEditor/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const LastEdited = () => {
const FlowEditor: React.FC<any> = ({ flow, breadcrumbs }) => {
const scrollContainerRef = useRef<HTMLDivElement>(null);
useScrollControlsAndRememberPosition(scrollContainerRef);
const showPreview = useStore((state) => state.showPreview);
const showSidebar = useStore((state) => state.showSidebar);

return (
<EditorContainer id="editor-container">
Expand All @@ -129,7 +129,7 @@ const FlowEditor: React.FC<any> = ({ flow, breadcrumbs }) => {
<Flow flow={flow} breadcrumbs={breadcrumbs} />
</Box>
</Box>
{showPreview && (
{showSidebar && (
<Sidebar
url={`${window.location.origin}${rootFlowPath(false)}/published`}
/>
Expand Down
6 changes: 3 additions & 3 deletions editor.planx.uk/src/pages/FlowEditor/lib/store/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ const send = (ops: Array<any>) => {

export interface EditorUIStore {
flowLayout: FlowLayout;
showPreview: boolean;
showSidebar: boolean;
togglePreview: () => void;
isTestEnvBannerVisible: boolean;
hideTestEnvBanner: () => void;
Expand All @@ -51,10 +51,10 @@ export const editorUIStore: StateCreator<
> = (set, get) => ({
flowLayout: FlowLayout.TOP_DOWN,

showPreview: true,
showSidebar: true,

togglePreview: () => {
set({ showPreview: !get().showPreview });
set({ showSidebar: !get().showSidebar });
},

isTestEnvBannerVisible: !window.location.href.includes(".uk"),
Expand Down

0 comments on commit 3297a11

Please sign in to comment.