diff --git a/src/components/media/MediaCard.tsx b/src/components/media/MediaCard.tsx index 392e9c2e..c73b1651 100644 --- a/src/components/media/MediaCard.tsx +++ b/src/components/media/MediaCard.tsx @@ -42,6 +42,10 @@ function checkReleased(media: MediaItem): boolean { return isReleased; } +function getBaseUrl(): string { + return window.location.origin; +} + function MediaCardContent({ media, linkable, @@ -53,11 +57,13 @@ function MediaCardContent({ setOverlayVisible, handleMouseEnter, handleMouseLeave, + link, }: MediaCardProps & { overlayVisible: boolean; setOverlayVisible: React.Dispatch>; handleMouseEnter: () => void; handleMouseLeave: () => void; + link: string; }) { const { t } = useTranslation(); const percentageString = `${Math.round(percentage ?? 0).toFixed(0)}%`; @@ -71,6 +77,7 @@ function MediaCardContent({ const [searchQuery] = useSearchQuery(); const [, copyToClipboard] = useCopyToClipboard(); + const [hasCopied, setHasCopied] = useState(false); if (media.year) { dotListContent.push(media.year.toFixed()); @@ -92,6 +99,13 @@ function MediaCardContent({ window.open(url, "_blank"); }; + const handleCopyClick = (event: React.MouseEvent) => { + event.preventDefault(); + copyToClipboard(link); + setHasCopied(true); + setTimeout(() => setHasCopied(false), 2000); + }; + return (
{!overlayVisible ? ( @@ -253,85 +267,50 @@ function MediaCardContent({ ? `linear-gradient(rgba(0, 0, 0, 0.2), rgba(0, 0, 0, 0.8)), url(${media.poster})` : undefined, }} - > - {series ? ( -
-

- {t("media.episodeDisplay", { - season: series.season || 1, - episode: series.episode, - })} -

-
- ) : null} - - {percentage !== undefined ? ( - <> -
-
-
-
-
-
-
- - ) : null} -
+ />
- {/* Add more buttons here */} + + {canLink ? ( + + ) : null} + -