/* * Copyright (C) Contributors to the Suwayomi project * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at https://mozilla.org/MPL/2.0/. */ import IconButton from '@mui/material/IconButton'; import SettingsIcon from '@mui/icons-material/Settings'; import Stack from '@mui/material/Stack'; import AppSettingsAltIcon from '@mui/icons-material/AppSettingsAlt'; import FormatListBulletedIcon from '@mui/icons-material/FormatListBulleted'; import { alpha } from '@mui/material/styles'; import { bindDialog, bindTrigger, usePopupState } from 'material-ui-popup-state/hooks'; import Dialog from '@mui/material/Dialog'; import DialogContent from '@mui/material/DialogContent'; import Tooltip from '@mui/material/Tooltip'; import { useTranslation } from 'react-i18next'; import Slide from '@mui/material/Slide'; import { memo, useLayoutEffect } from 'react'; import { ReaderBottomBarMobileProps } from '@/modules/reader/types/ReaderOverlay.types.ts'; import { MobileReaderProgressBar } from '@/modules/reader/components/overlay/progress-bar/variants/MobileReaderProgressBar.tsx'; import { ReaderChapterList } from '@/modules/reader/components/overlay/navigation/ReaderChapterList.tsx'; import { ReaderBottomBarMobileQuickSettings } from '@/modules/reader/components/overlay/navigation/mobile/ReaderBottomBarMobileQuickSettings.tsx'; import { useReaderStateChaptersContext } from '@/modules/reader/contexts/state/ReaderStateChaptersContext.tsx'; import { useReaderScrollbarContext } from '@/modules/reader/contexts/ReaderScrollbarContext.tsx'; import { ReaderStateChapters, TReaderScrollbarContext } from '@/modules/reader/types/Reader.types.ts'; import { withPropsFrom } from '@/modules/core/hoc/withPropsFrom.tsx'; const BaseReaderBottomBarMobile = ({ openSettings, isVisible, currentChapter, chapters, scrollbarXSize, scrollbarYSize, }: ReaderBottomBarMobileProps & Pick & Pick) => { const { t } = useTranslation(); const chapterListPopupState = usePopupState({ variant: 'dialog', popupId: 'reader-chapter-list-dialog' }); const quickSettingsPopupState = usePopupState({ variant: 'dialog', popupId: 'reader-quick-settings-dialog' }); useLayoutEffect(() => { chapterListPopupState.close(); }, [currentChapter?.id]); return ( <> alpha(theme.palette.background.paper, 0.95), pb: `max(${scrollbarXSize}px, env(safe-area-inset-bottom))`, boxShadow: 2, }} > {chapterListPopupState.isOpen && ( )} {quickSettingsPopupState.isOpen && ( )} ); }; export const ReaderBottomBarMobile = withPropsFrom( memo(BaseReaderBottomBarMobile), [useReaderStateChaptersContext, useReaderScrollbarContext], ['currentChapter', 'chapters', 'scrollbarXSize', 'scrollbarYSize'], );