From c675a328a8f3dea2b5f2c436f22ebd9278c09c0e Mon Sep 17 00:00:00 2001 From: Allan Carr Date: Mon, 15 Dec 2025 12:40:43 -0800 Subject: [PATCH] IO-3464 Remove extra edit route Signed-off-by: Allan Carr --- client/src/App/App.jsx | 4 --- .../document-editor-local.container.jsx | 34 ------------------- .../document-editor.container.jsx | 22 ++++++++++-- 3 files changed, 19 insertions(+), 41 deletions(-) delete mode 100644 client/src/components/document-editor/document-editor-local.container.jsx diff --git a/client/src/App/App.jsx b/client/src/App/App.jsx index 69da6f077..e14162274 100644 --- a/client/src/App/App.jsx +++ b/client/src/App/App.jsx @@ -7,7 +7,6 @@ import { connect } from "react-redux"; import { Route, Routes, useNavigate } from "react-router-dom"; import { createStructuredSelector } from "reselect"; import DocumentEditorContainer from "../components/document-editor/document-editor.container"; -import DocumentEditorLocalContainer from "../components/document-editor/document-editor-local.container"; import ErrorBoundary from "../components/error-boundary/error-boundary.component"; import LoadingSpinner from "../components/loading-spinner/loading-spinner.component"; import DisclaimerPage from "../pages/disclaimer/disclaimer.page"; @@ -242,9 +241,6 @@ export function App({ }> } /> - }> - } /> - diff --git a/client/src/components/document-editor/document-editor-local.container.jsx b/client/src/components/document-editor/document-editor-local.container.jsx deleted file mode 100644 index ce8aab23d..000000000 --- a/client/src/components/document-editor/document-editor-local.container.jsx +++ /dev/null @@ -1,34 +0,0 @@ -import { useQuery } from "@apollo/client"; -import queryString from "query-string"; -import { useEffect } from "react"; -import { connect } from "react-redux"; -import { useLocation } from "react-router-dom"; -import { QUERY_BODYSHOP } from "../../graphql/bodyshop.queries"; -import { setBodyshop } from "../../redux/user/user.actions"; -import DocumentEditorLocalComponent from "./document-editor-local.component"; - -const mapDispatchToProps = (dispatch) => ({ - setBodyshop: (bs) => dispatch(setBodyshop(bs)) -}); - -export default connect(null, mapDispatchToProps)(DocumentEditorLocalContainer); - -export function DocumentEditorLocalContainer({ setBodyshop }) { - // Get the imageUrl, filename, jobid from the search string. - const { imageUrl, filename, jobid } = queryString.parse(useLocation().search); - - const { data: dataShop } = useQuery(QUERY_BODYSHOP, { - fetchPolicy: "network-only", - nextFetchPolicy: "network-only" - }); - - useEffect(() => { - if (dataShop) setBodyshop(dataShop.bodyshops[0]); - }, [dataShop, setBodyshop]); - - return ( -
- -
- ); -} diff --git a/client/src/components/document-editor/document-editor.container.jsx b/client/src/components/document-editor/document-editor.container.jsx index d19fb9ce3..e10483694 100644 --- a/client/src/components/document-editor/document-editor.container.jsx +++ b/client/src/components/document-editor/document-editor.container.jsx @@ -11,6 +11,7 @@ import { setBodyshop } from "../../redux/user/user.actions"; import AlertComponent from "../alert/alert.component"; import LoadingSpinner from "../loading-spinner/loading-spinner.component"; import DocumentEditor from "./document-editor.component"; +import { DocumentEditorLocalComponent } from "./document-editor-local.component"; const mapDispatchToProps = (dispatch) => ({ setBodyshop: (bs) => dispatch(setBodyshop(bs)) @@ -21,7 +22,7 @@ export default connect(null, mapDispatchToProps)(DocumentEditorContainer); export function DocumentEditorContainer({ setBodyshop }) { //Get the image details for the image to be saved. //Get the document id from the search string. - const { documentId } = queryString.parse(useLocation().search); + const { documentId, imageUrl, filename, jobid } = queryString.parse(useLocation().search); const { t } = useTranslation(); const { loading: loadingShop, @@ -36,6 +37,21 @@ export function DocumentEditorContainer({ setBodyshop }) { if (dataShop) setBodyshop(dataShop.bodyshops[0]); }, [dataShop, setBodyshop]); + if (loadingShop) return ; + if (errorShop) return ; + + if (dataShop?.bodyshops[0]?.uselocalmediaserver) { + if (imageUrl && filename && jobid) { + return ( +
+ +
+ ); + } else { + return ; + } + } + const { loading, error, data } = useQuery(GET_DOCUMENT_BY_PK, { variables: { documentId }, skip: !documentId, @@ -43,8 +59,8 @@ export function DocumentEditorContainer({ setBodyshop }) { nextFetchPolicy: "network-only" }); - if (loading || loadingShop) return ; - if (error || errorShop) return ; + if (loading) return ; + if (error) return ; if (!data || !data.documents_by_pk) return ; return (