From b645b6748d521858ae77e1f1c69495a1f2e2863d Mon Sep 17 00:00:00 2001 From: danielc-n Date: Thu, 12 Sep 2024 11:45:33 +0200 Subject: [PATCH] hide the print button on audio projects --- .../src/components/context/ProjectContext.js | 5 +++ renderer/src/layouts/editor/SubMenuBar.js | 37 ++++++++++--------- 2 files changed, 25 insertions(+), 17 deletions(-) diff --git a/renderer/src/components/context/ProjectContext.js b/renderer/src/components/context/ProjectContext.js index 462575b0..225f39d1 100644 --- a/renderer/src/components/context/ProjectContext.js +++ b/renderer/src/components/context/ProjectContext.js @@ -57,6 +57,7 @@ const ProjectContextProvider = ({ children }) => { const [openImportPopUp, setOpenImportPopUp] = useState(false); const [openExportPopUp, setOpenExportPopUp] = useState(false); const [openManageProject, setOpenManageProject] = useState(false); + const [contextProjectType, setContextProjectType] = useState(""); const handleProjectFields = (prop) => (event) => { setNewProjectFields({ ...newProjectFields, [prop]: event.target.value }); @@ -411,6 +412,7 @@ const ProjectContextProvider = ({ children }) => { logger.debug('ProjectContext.js', 'In createProject'); await createProjectCommonUtils(); // common props pass for all project type + setContextProjectType(projectType); const projectMetaObj = { newProjectFields, language, @@ -437,6 +439,7 @@ const ProjectContextProvider = ({ children }) => { const createSupabaseProject = async (call, project, update, projectType) => { createProjectCommonUtils(); // common props pass for all project type + setContextProjectType(projectType); const projectMetaObj = { newProjectFields, language, @@ -550,6 +553,7 @@ const ProjectContextProvider = ({ children }) => { openPdfPopup, listResourcesForPdf, importedBookCodes, + contextProjectType, }, actions: { setDrawer, @@ -578,6 +582,7 @@ const ProjectContextProvider = ({ children }) => { setOpenPdfPopup, setListResourcesForPdf, setImportedBookCodes, + setContextProjectType, }, }; diff --git a/renderer/src/layouts/editor/SubMenuBar.js b/renderer/src/layouts/editor/SubMenuBar.js index 9da674da..3247ec93 100644 --- a/renderer/src/layouts/editor/SubMenuBar.js +++ b/renderer/src/layouts/editor/SubMenuBar.js @@ -61,6 +61,7 @@ export default function SubMenuBar() { editorSave, selectedProject, openPdfPopup, + selectedProjectMeta, }, actions: { setOpenSideBar, @@ -299,23 +300,25 @@ export default function SubMenuBar() { {/*
*/} - - -
setOpenPdfPopup(true)} - > -
+ {console.log("contextProjectType", selectedProjectMeta?.type?.flavorType?.flavor?.name)} + + {selectedProjectMeta?.type?.flavorType?.flavor?.name !== 'audioTranslation' && ( +
setOpenPdfPopup(true)} + > +
+ )} {/*