diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Publish/PublishFlowButton.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Publish/PublishFlowButton.tsx index 418f21e3d8..0366a3173b 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Publish/PublishFlowButton.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/Publish/PublishFlowButton.tsx @@ -14,7 +14,6 @@ import React, { useState } from "react"; import { useAsync } from "react-use"; import Input from "ui/shared/Input"; -import { urls } from ".."; import { AlteredNode, AlteredNodesSummaryContent, @@ -22,7 +21,9 @@ import { ValidationChecks, } from "./PublishDialog"; -export const PublishFlowButton = () => { +export const PublishFlowButton: React.FC<{ previewURL: string }> = ({ + previewURL, +}) => { const [ flowId, publishFlow, @@ -147,7 +148,7 @@ export const PublishFlowButton = () => { {`Preview these content changes in-service before publishing `} - + {`here (opens in a new tab).`} diff --git a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/index.tsx b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/index.tsx index 65434a0e0c..51c1522901 100644 --- a/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/index.tsx +++ b/editor.planx.uk/src/pages/FlowEditor/components/Sidebar/index.tsx @@ -24,14 +24,6 @@ import StyledTab from "./StyledTab"; type SidebarTabs = "PreviewBrowser" | "History" | "Search" | "Console"; -const baseUrl = `${window.location.origin}${rootFlowPath(false)}`; - -export const urls = { - preview: baseUrl + "/preview", - draft: baseUrl + "/draft", - analytics: baseUrl + "/published" + "?analytics=false", -}; - const Root = styled(Box)(({ theme }) => ({ position: "relative", top: "0", @@ -111,10 +103,21 @@ const Sidebar: React.FC = React.memo(() => { const [activeTab, setActiveTab] = useState("PreviewBrowser"); - const handleChange = (event: React.SyntheticEvent, newValue: SidebarTabs) => { + const handleChange = ( + _event: React.SyntheticEvent, + newValue: SidebarTabs, + ) => { setActiveTab(newValue); }; + const baseUrl = `${window.location.origin}${rootFlowPath(false)}`; + + const urls = { + preview: baseUrl + "/preview", + draft: baseUrl + "/draft", + analytics: baseUrl + "/published" + "?analytics=false", + }; + return (
@@ -166,7 +169,7 @@ const Sidebar: React.FC = React.memo(() => { )} - +