/* * 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 Stack from '@mui/material/Stack'; import MoreVertIcon from '@mui/icons-material/MoreVert'; import { bindMenu, bindTrigger, usePopupState } from 'material-ui-popup-state/hooks'; import MenuItem from '@mui/material/MenuItem'; import Menu from '@mui/material/Menu'; import Link from '@mui/material/Link'; import { Link as RouterLink } from 'react-router-dom'; import Slide from '@mui/material/Slide'; import type { Ref } from 'react'; import { memo } from 'react'; import { useLingui } from '@lingui/react/macro'; import { CustomTooltip } from '@/base/components/CustomTooltip.tsx'; import { TypographyMaxLines } from '@/base/components/texts/TypographyMaxLines.tsx'; import type { MobileHeaderProps } from '@/features/reader/overlay/ReaderOverlay.types.ts'; import { LoadingPlaceholder } from '@/base/components/feedback/LoadingPlaceholder.tsx'; import { AppRoutes } from '@/base/AppRoute.constants.ts'; import { ReaderLibraryButton } from '@/features/reader/overlay/navigation/components/ReaderLibraryButton.tsx'; import { ReaderBookmarkButton } from '@/features/reader/overlay/navigation/components/ReaderBookmarkButton.tsx'; import { FALLBACK_CHAPTER } from '@/features/chapter/Chapter.constants.ts'; import { FALLBACK_MANGA } from '@/features/manga/Manga.constants.ts'; import { ReaderExitButton } from '@/features/reader/overlay/navigation/components/ReaderExitButton.tsx'; import { requestManager } from '@/lib/requests/RequestManager.ts'; import { useReaderChaptersStore, useReaderScrollbarStore, useReaderStore, } from '@/features/reader/stores/ReaderStore.ts'; import { copyToClipboard } from '@/lib/HelperFunctions.ts'; import { MATERIAL_YOU_VISUALS } from '@/features/theme/services/MaterialYouVisualTokens.ts'; const DEFAULT_MANGA = { ...FALLBACK_MANGA, title: '' }; const BaseReaderOverlayHeaderMobile = ({ isVisible, ref }: MobileHeaderProps & { ref?: Ref }) => { const { t } = useLingui(); const popupState = usePopupState({ popupId: 'reader-overlay-more-menu', variant: 'popover' }); const currentChapter = useReaderChaptersStore('currentChapter'); const manga = useReaderStore('manga'); const scrollbar = useReaderScrollbarStore((state) => state); const { id: mangaId, title } = manga ?? DEFAULT_MANGA; const { id: chapterId, name, realUrl, isBookmarked } = currentChapter ?? FALLBACK_CHAPTER; return ( `max(env(safe-area-inset-top), ${theme.spacing(2)})`, backgroundColor: (theme) => theme.alpha(theme.palette.background.paper, MATERIAL_YOU_VISUALS.readerChromeOpacity), backdropFilter: 'blur(20px) saturate(1.15)', pointerEvents: 'all', borderBottom: '1px solid', borderColor: 'divider', }} > {manga && currentChapter ? ( <> {title} {name} ) : ( )} {t`Open in browser`} {t`Open in WebView`} copyToClipboard(title)}> {t`Share`} ); }; export const ReaderOverlayHeaderMobile = memo(BaseReaderOverlayHeaderMobile);