Skip to content

Commit

Permalink
hide the print button on audio projects
Browse files Browse the repository at this point in the history
  • Loading branch information
danielc-n committed Sep 12, 2024
1 parent 3a51358 commit b645b67
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 17 deletions.
5 changes: 5 additions & 0 deletions renderer/src/components/context/ProjectContext.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -550,6 +553,7 @@ const ProjectContextProvider = ({ children }) => {
openPdfPopup,
listResourcesForPdf,
importedBookCodes,
contextProjectType,
},
actions: {
setDrawer,
Expand Down Expand Up @@ -578,6 +582,7 @@ const ProjectContextProvider = ({ children }) => {
setOpenPdfPopup,
setListResourcesForPdf,
setImportedBookCodes,
setContextProjectType,
},
};

Expand Down
37 changes: 20 additions & 17 deletions renderer/src/layouts/editor/SubMenuBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export default function SubMenuBar() {
editorSave,
selectedProject,
openPdfPopup,
selectedProjectMeta,
},
actions: {
setOpenSideBar,
Expand Down Expand Up @@ -299,23 +300,25 @@ export default function SubMenuBar() {
{/* <div className={`group ${menuStyles.saved}`} title={`Network status : ${networkState.online ? 'Online' : 'Offline' }`}>
<WifiIcon className={`w-6 h-6 ${networkState.online ? 'fill-green-500' : 'fill-red-500'}`} />
</div> */}


<div
aria-label="add-panels"
title={'Print to PDF'}
// title={t('TODO')}
type="div"
role="button"
className={`group ${menuStyles.btn} transition-all`}
onClick={() => setOpenPdfPopup(true)}
>
<PrinterIcon
aria-label="open-lock"
className="h-6 w-6 text-black cursor-pointer"
aria-hidden="true"
/>
</div>
{console.log("contextProjectType", selectedProjectMeta?.type?.flavorType?.flavor?.name)}

{selectedProjectMeta?.type?.flavorType?.flavor?.name !== 'audioTranslation' && (
<div
aria-label="add-panels"
title={'Print to PDF'}
// title={t('TODO')}
type="div"
role="button"
className={`group ${menuStyles.btn} transition-all`}
onClick={() => setOpenPdfPopup(true)}
>
<PrinterIcon
aria-label="open-lock"
className="h-6 w-6 text-black cursor-pointer"
aria-hidden="true"
/>
</div>
)}

{/* <div
aria-label="add-panels"
Expand Down

0 comments on commit b645b67

Please sign in to comment.