diff --git a/packages/web/src/auth/UnlockContentsDialog.tsx b/packages/web/src/auth/UnlockContentsDialog.tsx index 422e6ac4..0e937669 100644 --- a/packages/web/src/auth/UnlockContentsDialog.tsx +++ b/packages/web/src/auth/UnlockContentsDialog.tsx @@ -51,6 +51,7 @@ export const UnlockContentsDialog = ({ ...state, isLibraryUnlocked: true })) + closeModalWithNavigation() } else { setError( diff --git a/packages/web/src/home/HomeScreen.tsx b/packages/web/src/home/HomeScreen.tsx index 1c58f4b1..b5e57e55 100644 --- a/packages/web/src/home/HomeScreen.tsx +++ b/packages/web/src/home/HomeScreen.tsx @@ -18,7 +18,12 @@ export const HomeScreen = memo(() => { return ( - + {continueReadingBooks.length === 0 && !isPending && ( diff --git a/packages/web/src/library/LibraryBooksScreen.tsx b/packages/web/src/library/LibraryBooksScreen.tsx index 33407dcd..b7b0873a 100644 --- a/packages/web/src/library/LibraryBooksScreen.tsx +++ b/packages/web/src/library/LibraryBooksScreen.tsx @@ -10,15 +10,7 @@ import { Box } from "@mui/material" import makeStyles from "@mui/styles/makeStyles" -import { - AppsRounded, - TuneRounded, - ListRounded, - SortRounded, - NoEncryptionRounded, - BlurOffRounded, - FormatListBulletedRounded -} from "@mui/icons-material" +import { TuneRounded, SortRounded } from "@mui/icons-material" import { LibraryFiltersDrawer } from "./LibraryFiltersDrawer" import EmptyLibraryAsset from "../assets/empty-library.svg" import { useCSS, useMeasureElement } from "../common/utils" @@ -28,7 +20,6 @@ import { } from "./states" import { UploadBookDrawer } from "./UploadBookDrawer" import { SortByDialog } from "../books/bookList/SortByDialog" -import { useLocalSettings } from "../settings/states" import { useCallback } from "react" import { useTranslation } from "react-i18next" import { useBooks } from "./useBooks" @@ -38,14 +29,12 @@ import { ViewModeIconButton } from "../common/lists/ListActionsToolbar" export const LibraryBooksScreen = () => { const styles = useStyles() - const classes = useClasses() const theme = useTheme() const [isFiltersDrawerOpened, setIsFiltersDrawerOpened] = useState(false) const isUploadBookDrawerOpened = useSignalValue( isUploadBookDrawerOpenedStateSignal ) const [isSortingDialogOpened, setIsSortingDialogOpened] = useState(false) - const localSettings = useLocalSettings() const library = useSignalValue(libraryStateSignal) let numberOfFiltersApplied = 0 @@ -138,25 +127,6 @@ export const LibraryBooksScreen = () => { : "Date added"} - {library.isLibraryUnlocked && ( -
- {localSettings.unBlurWhenProtectedVisible && ( - - )} - { - libraryStateSignal.setValue((state) => ({ - ...state, - isLibraryUnlocked: false - })) - }} - color="primary" - size="large" - > - - -
- )} { @@ -269,16 +239,3 @@ const useStyles = () => { [] ) } - -const useClasses = makeStyles((theme) => ({ - extraInfo: { - display: "flex", - flexFlow: "row", - alignItems: "center", - marginLeft: theme.spacing(1), - overflow: "hidden", - "@media (max-width:370px)": { - display: "none" - } - } -})) diff --git a/packages/web/src/library/LibraryTopTabNavigator.tsx b/packages/web/src/library/LibraryTopTabNavigator.tsx index dd236d3e..a10ce8fe 100644 --- a/packages/web/src/library/LibraryTopTabNavigator.tsx +++ b/packages/web/src/library/LibraryTopTabNavigator.tsx @@ -50,6 +50,7 @@ export const LibraryTopTabNavigator = () => { title="Library" showBack={false} hasSearch + hasLockLibrary rightComponent={TopBarNavigationRightComponent} /> ["color"] rightComponent?: React.ReactNode hasSearch?: boolean + hasLockLibrary?: boolean goBackDefaultTo?: string onMoreClick?: () => void }> = memo( @@ -33,8 +37,13 @@ export const TopBarNavigation: FC<{ rightComponent, hasSearch = false, onMoreClick, - goBackDefaultTo + goBackDefaultTo, + hasLockLibrary }) => { + const isLibraryUnlocked = useSignalValue( + libraryStateSignal, + ({ isLibraryUnlocked }) => isLibraryUnlocked + ) const { styles, classes } = useStyles({ color }) const { goBack } = useSafeGoBack() const navigate = useNavigate() @@ -46,21 +55,21 @@ export const TopBarNavigation: FC<{ {showBack && ( goBack(goBackDefaultTo)} size="large" + color="inherit" > )} -
+ {!hasSearch && ( {title} )} {hasSearch && ( -
{ navigate(ROUTES.SEARCH) @@ -78,20 +87,31 @@ export const TopBarNavigation: FC<{ }} inputProps={{ "aria-label": "search" }} /> -
+
)} -
- {rightComponent} - {!rightComponent && !!onMoreClick && ( - - - - )} +
+ + {hasLockLibrary && isLibraryUnlocked && ( + { + libraryStateSignal.setValue((state) => ({ + ...state, + isLibraryUnlocked: false + })) + }} + size="large" + color="inherit" + > + + + )} + {rightComponent} + {!rightComponent && !!onMoreClick && ( + + + + )} + @@ -132,7 +152,7 @@ const useStyles = ({ const styles = useCSS( () => ({ menuButton: { - marginRight: theme.spacing(1), + // marginRight: theme.spacing(1), color: color === "transparent" ? "white" : "inherit" }, menuButtonEnd: { diff --git a/packages/web/src/navigation/useModalNavigationControl.ts b/packages/web/src/navigation/useModalNavigationControl.ts index b09846fc..12e867f1 100644 --- a/packages/web/src/navigation/useModalNavigationControl.ts +++ b/packages/web/src/navigation/useModalNavigationControl.ts @@ -38,7 +38,9 @@ export const useModalNavigationControl = ( useEffect(() => { if (id) { const hash = `#modal-${uuidv4()}` + setCurrentHash(hash) + navigate( { hash: window.location.hash,