From ed0dcb64d38bd2060f13be20a55eb41e6596104f Mon Sep 17 00:00:00 2001 From: Andrew Polk Date: Wed, 3 Jul 2024 16:46:07 -0700 Subject: [PATCH] Disable Download for Edit button on mobile (BL-13639) --- src/components/BookDetail/BookDetailHeaderGroup.tsx | 4 ++-- src/components/BookDetail/BookOwnerControlsBox.tsx | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/BookDetail/BookDetailHeaderGroup.tsx b/src/components/BookDetail/BookDetailHeaderGroup.tsx index f61f912a..ed1557fd 100644 --- a/src/components/BookDetail/BookDetailHeaderGroup.tsx +++ b/src/components/BookDetail/BookDetailHeaderGroup.tsx @@ -65,10 +65,10 @@ export const BookDetailHeaderGroup: React.FunctionComponent<{ ArtifactType.shellbook ); const showTranslateButton = - !isEmbedded && // BL-8698, a this point, people embed BL to publish books, not encourage translation. + !isEmbedded && // BL-8698, at this point, people embed BL to publish books, not encourage translation. shellBookSettings && shellBookSettings.decision && // it's OK to download and translate the book - !appHostedMode && // bloomDesktopAVailable would block this normally, but when simulating on a desktop this makes sure. + !appHostedMode && // bloomDesktopAvailable would block this normally, but when simulating on a desktop this makes sure. bloomDesktopAvailable; // and this platform can run the software for doing it const bloomReaderSettings = getArtifactVisibilitySettings( diff --git a/src/components/BookDetail/BookOwnerControlsBox.tsx b/src/components/BookDetail/BookOwnerControlsBox.tsx index 2655b3d8..76e29799 100644 --- a/src/components/BookDetail/BookOwnerControlsBox.tsx +++ b/src/components/BookDetail/BookOwnerControlsBox.tsx @@ -4,7 +4,7 @@ import css from "@emotion/css/macro"; import { jsx } from "@emotion/core"; /** @jsx jsx */ -import React, { Fragment, useEffect, useState } from "react"; +import React, { Fragment, useContext, useEffect, useState } from "react"; import { Book } from "../../model/Book"; import { observer } from "mobx-react-lite"; @@ -24,6 +24,7 @@ import { IUserBookPermissions, useGetPermissions, } from "../../connection/LibraryQueryHooks"; +import { OSFeaturesContext } from "../OSFeaturesContext"; export const BookOwnerControlsBox: React.FunctionComponent<{ book: Book; @@ -31,6 +32,8 @@ export const BookOwnerControlsBox: React.FunctionComponent<{ showDownloadDialog: any; // pass down the ref }> = observer((props) => { const l10n = useIntl(); + const { bloomDesktopAvailable } = useContext(OSFeaturesContext); + const [firebaseUser, setFirebaseUserUrl] = useState( null ); @@ -230,6 +233,7 @@ export const BookOwnerControlsBox: React.FunctionComponent<{ align-self: flex-end; margin-top: 5px; `} + disabled={!bloomDesktopAvailable} >