/* * 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 Link from '@mui/material/Link'; import { Link as RouterLink } from 'react-router-dom'; import Box from '@mui/material/Box'; import Card from '@mui/material/Card'; import CardActionArea from '@mui/material/CardActionArea'; import Stack from '@mui/material/Stack'; import Tooltip from '@mui/material/Tooltip'; import { styled } from '@mui/material/styles'; import { useRef } from 'react'; import { SpinnerImage } from '@/components/util/SpinnerImage.tsx'; import { MangaOptionButton } from '@/components/manga/MangaOptionButton.tsx'; import { GridLayout } from '@/components/context/LibraryOptionsContext.tsx'; import { Mangas } from '@/lib/data/Mangas.ts'; import { SpecificMangaCardProps } from '@/components/manga/MangaCard.types.tsx'; import { TypographyMaxLines } from '@/components/atoms/TypographyMaxLines'; const BottomGradient = styled('div')({ position: 'absolute', bottom: 0, width: '100%', height: '30%', background: 'linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%)', }); const BottomGradientDoubledDown = styled('div')({ position: 'absolute', bottom: 0, width: '100%', height: '20%', background: 'linear-gradient(180deg, rgba(0,0,0,0) 0%, rgba(0,0,0,1) 100%)', }); export const MangaGridCard = ({ manga, longPressBind, popupState, handleClick, mangaLinkTo, selected, inLibraryIndicator, isInLibrary, gridLayout, handleSelection, continueReadingButton, mangaBadges, mode, }: SpecificMangaCardProps) => { const optionButtonRef = useRef(null); const { id, title } = manga; return ( popupState.open(optionButtonRef.current))} onClick={handleClick} to={mangaLinkTo} state={{ mangaTitle: title }} sx={{ textDecoration: 'none', touchCallout: 'none' }} > theme.palette.primary.main, backgroundColor: (theme) => (selected ? theme.palette.primary.main : undefined), '@media (hover: hover) and (pointer: fine)': { '&:hover .manga-option-button': { visibility: 'visible', pointerEvents: 'all', }, '&:hover .source-manga-library-state-button': { display: 'inline-flex', }, '&:hover .source-manga-library-state-indicator': { display: mode === 'source' ? 'none' : 'flex', }, }, }} > theme.spacing(1), left: (theme) => theme.spacing(1), right: (theme) => theme.spacing(1), }} > {mangaBadges} <> {gridLayout !== GridLayout.Comfortable && ( <> )} {gridLayout !== GridLayout.Comfortable && ( {title} )} {continueReadingButton} {gridLayout === GridLayout.Comfortable && ( (selected ? theme.palette.primary.contrastText : 'text.primary'), height: '3rem', pt: 0.5, }} > {title} )} ); };