|
|
@ -1,9 +1,11 @@ |
|
|
|
|
|
|
|
import c from "classnames"; |
|
|
|
import { useTranslation } from "react-i18next"; |
|
|
|
import { useTranslation } from "react-i18next"; |
|
|
|
import { Link } from "react-router-dom"; |
|
|
|
import { Link } from "react-router-dom"; |
|
|
|
|
|
|
|
|
|
|
|
import { TMDBMediaToId } from "@/backend/metadata/tmdb"; |
|
|
|
import { TMDBMediaToId } from "@/backend/metadata/tmdb"; |
|
|
|
import { MWMediaMeta } from "@/backend/metadata/types/mw"; |
|
|
|
import { MWMediaMeta } from "@/backend/metadata/types/mw"; |
|
|
|
import { DotList } from "@/components/text/DotList"; |
|
|
|
import { DotList } from "@/components/text/DotList"; |
|
|
|
|
|
|
|
import { Flare } from "@/components/utils/Flare"; |
|
|
|
|
|
|
|
|
|
|
|
import { IconPatch } from "../buttons/IconPatch"; |
|
|
|
import { IconPatch } from "../buttons/IconPatch"; |
|
|
|
import { Icons } from "../Icon"; |
|
|
|
import { Icons } from "../Icon"; |
|
|
@ -39,19 +41,27 @@ function MediaCardContent({ |
|
|
|
if (media.year) dotListContent.push(media.year); |
|
|
|
if (media.year) dotListContent.push(media.year); |
|
|
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
return ( |
|
|
|
<div |
|
|
|
<Flare.Base |
|
|
|
className={`group -m-3 mb-2 rounded-xl bg-denim-300 bg-opacity-0 transition-colors duration-100 ${ |
|
|
|
className={`group -m-3 mb-2 rounded-xl bg-background-main transition-colors duration-100 ${ |
|
|
|
canLink ? "hover:bg-opacity-100" : "" |
|
|
|
canLink ? "hover:bg-mediaCard-hoverBackground" : "" |
|
|
|
}`}
|
|
|
|
}`}
|
|
|
|
> |
|
|
|
> |
|
|
|
<article |
|
|
|
<Flare.Light |
|
|
|
|
|
|
|
flareSize={300} |
|
|
|
|
|
|
|
cssColorVar="--colors-mediaCard-hoverAccent" |
|
|
|
|
|
|
|
backgroundClass="bg-mediaCard-hoverBackground duration-100" |
|
|
|
|
|
|
|
className={c({ |
|
|
|
|
|
|
|
"rounded-xl bg-background-main group-hover:opacity-100": canLink, |
|
|
|
|
|
|
|
})} |
|
|
|
|
|
|
|
/> |
|
|
|
|
|
|
|
<Flare.Child |
|
|
|
className={`pointer-events-auto relative mb-2 p-3 transition-transform duration-100 ${ |
|
|
|
className={`pointer-events-auto relative mb-2 p-3 transition-transform duration-100 ${ |
|
|
|
canLink ? "group-hover:scale-95" : "" |
|
|
|
canLink ? "group-hover:scale-95" : "" |
|
|
|
}`}
|
|
|
|
}`}
|
|
|
|
> |
|
|
|
> |
|
|
|
<div |
|
|
|
<div |
|
|
|
className={[ |
|
|
|
className={[ |
|
|
|
"relative mb-4 aspect-[2/3] w-full overflow-hidden rounded-xl bg-denim-500 bg-cover bg-center transition-[border-radius] duration-100", |
|
|
|
"relative mb-4 aspect-[2/3] w-full overflow-hidden rounded-xl bg-mediaCard-hoverBackground bg-cover bg-center transition-[border-radius] duration-100", |
|
|
|
closable ? "" : "group-hover:rounded-lg", |
|
|
|
closable ? "" : "group-hover:rounded-lg", |
|
|
|
].join(" ")} |
|
|
|
].join(" ")} |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
@ -61,13 +71,12 @@ function MediaCardContent({ |
|
|
|
{series ? ( |
|
|
|
{series ? ( |
|
|
|
<div |
|
|
|
<div |
|
|
|
className={[ |
|
|
|
className={[ |
|
|
|
"absolute right-2 top-2 rounded-md bg-denim-200 px-2 py-1 transition-colors", |
|
|
|
"absolute right-2 top-2 rounded-md bg-mediaCard-badge px-2 py-1 transition-colors", |
|
|
|
closable ? "" : "group-hover:bg-denim-500", |
|
|
|
|
|
|
|
].join(" ")} |
|
|
|
].join(" ")} |
|
|
|
> |
|
|
|
> |
|
|
|
<p |
|
|
|
<p |
|
|
|
className={[ |
|
|
|
className={[ |
|
|
|
"text-center text-xs font-bold text-slate-400 transition-colors", |
|
|
|
"text-center text-xs font-bold text-mediaCard-badgeText transition-colors", |
|
|
|
closable ? "" : "group-hover:text-white", |
|
|
|
closable ? "" : "group-hover:text-white", |
|
|
|
].join(" ")} |
|
|
|
].join(" ")} |
|
|
|
> |
|
|
|
> |
|
|
@ -82,19 +91,19 @@ function MediaCardContent({ |
|
|
|
{percentage !== undefined ? ( |
|
|
|
{percentage !== undefined ? ( |
|
|
|
<> |
|
|
|
<> |
|
|
|
<div |
|
|
|
<div |
|
|
|
className={`absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-denim-300 to-transparent transition-colors ${ |
|
|
|
className={`absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-mediaCard-shadow to-transparent transition-colors ${ |
|
|
|
canLink ? "group-hover:from-denim-100" : "" |
|
|
|
canLink ? "group-hover:from-mediaCard-hoverShadow" : "" |
|
|
|
}`}
|
|
|
|
}`}
|
|
|
|
/> |
|
|
|
/> |
|
|
|
<div |
|
|
|
<div |
|
|
|
className={`absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-denim-300 to-transparent transition-colors ${ |
|
|
|
className={`absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-mediaCard-shadow to-transparent transition-colors ${ |
|
|
|
canLink ? "group-hover:from-denim-100" : "" |
|
|
|
canLink ? "group-hover:from-mediaCard-hoverShadow" : "" |
|
|
|
}`}
|
|
|
|
}`}
|
|
|
|
/> |
|
|
|
/> |
|
|
|
<div className="absolute inset-x-0 bottom-0 p-3"> |
|
|
|
<div className="absolute inset-x-0 bottom-0 p-3"> |
|
|
|
<div className="relative h-1 overflow-hidden rounded-full bg-denim-600"> |
|
|
|
<div className="relative h-1 overflow-hidden rounded-full bg-mediaCard-barColor"> |
|
|
|
<div |
|
|
|
<div |
|
|
|
className="absolute inset-y-0 left-0 rounded-full bg-bink-700" |
|
|
|
className="absolute inset-y-0 left-0 rounded-full bg-mediaCard-barFillColor" |
|
|
|
style={{ |
|
|
|
style={{ |
|
|
|
width: percentageString, |
|
|
|
width: percentageString, |
|
|
|
}} |
|
|
|
}} |
|
|
@ -105,13 +114,13 @@ function MediaCardContent({ |
|
|
|
) : null} |
|
|
|
) : null} |
|
|
|
|
|
|
|
|
|
|
|
<div |
|
|
|
<div |
|
|
|
className={`absolute inset-0 flex items-center justify-center bg-denim-200 bg-opacity-80 transition-opacity duration-200 ${ |
|
|
|
className={`absolute inset-0 flex items-center justify-center bg-mediaCard-badge bg-opacity-80 transition-opacity duration-200 ${ |
|
|
|
closable ? "opacity-100" : "pointer-events-none opacity-0" |
|
|
|
closable ? "opacity-100" : "pointer-events-none opacity-0" |
|
|
|
}`}
|
|
|
|
}`}
|
|
|
|
> |
|
|
|
> |
|
|
|
<IconPatch |
|
|
|
<IconPatch |
|
|
|
clickable |
|
|
|
clickable |
|
|
|
className="text-2xl text-slate-400" |
|
|
|
className="text-2xl text-mediaCard-badgeText" |
|
|
|
onClick={() => closable && onClose?.()} |
|
|
|
onClick={() => closable && onClose?.()} |
|
|
|
icon={Icons.X} |
|
|
|
icon={Icons.X} |
|
|
|
/> |
|
|
|
/> |
|
|
@ -121,8 +130,8 @@ function MediaCardContent({ |
|
|
|
<span>{media.title}</span> |
|
|
|
<span>{media.title}</span> |
|
|
|
</h1> |
|
|
|
</h1> |
|
|
|
<DotList className="text-xs" content={dotListContent} /> |
|
|
|
<DotList className="text-xs" content={dotListContent} /> |
|
|
|
</article> |
|
|
|
</Flare.Child> |
|
|
|
</div> |
|
|
|
</Flare.Base> |
|
|
|
); |
|
|
|
); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|