-
{/* Glow effect */}
{
};
export const LeadingCard = ({ drop, rank }: LeadingCardProps) => {
+ const { hasTouchScreen } = useDeviceInfo();
const media = drop.parts[0]?.media[0];
const isTabletOrSmaller = useMediaQuery("(max-width: 1023px)");
const mediaImageScale = isTabletOrSmaller
? ImageScale.AUTOx450
: ImageScale.AUTOx600;
+ const isHtml = media?.mime_type === "text/html";
+ const shouldGate = hasTouchScreen && isHtml;
+ const [interactiveEnabled, setInteractiveEnabled] = useState(!shouldGate);
- const previewImageUrl = useMemo(
- () => getDropPreviewImageUrl(drop.metadata),
- [drop.metadata]
- );
+ useEffect(() => {
+ if (shouldGate) {
+ setInteractiveEnabled(false);
+ return;
+ }
+ setInteractiveEnabled(true);
+ }, [drop.id, shouldGate]);
const title =
drop.title ??
@@ -45,6 +51,42 @@ export const LeadingCard = ({ drop, rank }: LeadingCardProps) => {
"Untitled";
const author = drop.author;
const rankLabelClass = getRankLabelClass(rank);
+ const mediaContent = (() => {
+ if (!media) {
+ return (
+
+ No image
+
+ );
+ }
+
+ if (shouldGate && !interactiveEnabled) {
+ return (
+
+
+
+ );
+ }
+
+ return (
+
+ );
+ })();
return (
@@ -64,21 +106,7 @@ export const LeadingCard = ({ drop, rank }: LeadingCardProps) => {
- {media ? (
-
- ) : (
-
- No image
-
- )}
+ {mediaContent}
diff --git a/components/home/now-minting/NowMintingArtwork.tsx b/components/home/now-minting/NowMintingArtwork.tsx
index afdfc94fa3..b418c85900 100644
--- a/components/home/now-minting/NowMintingArtwork.tsx
+++ b/components/home/now-minting/NowMintingArtwork.tsx
@@ -1,14 +1,59 @@
+"use client";
+
+import { useEffect, useMemo, useState } from "react";
import NFTImage from "@/components/nft-image/NFTImage";
+import { getMediaType } from "@/components/nft-image/utils/media-type";
import type { NFTWithMemesExtendedData } from "@/entities/INFT";
+import useDeviceInfo from "@/hooks/useDeviceInfo";
+import InteractiveIcon from "@/components/drops/media/InteractiveIcon";
interface NowMintingArtworkProps {
readonly nft: NFTWithMemesExtendedData;
}
export default function NowMintingArtwork({ nft }: NowMintingArtworkProps) {
+ const { hasTouchScreen } = useDeviceInfo();
+ const isHtml = useMemo(() => getMediaType(nft, true) === "html", [nft]);
+ const [hasMounted, setHasMounted] = useState(false);
+ const shouldGate = hasTouchScreen && isHtml;
+ const [interactiveEnabled, setInteractiveEnabled] = useState(false);
+
+ useEffect(() => {
+ setHasMounted(true);
+ }, []);
+
+ useEffect(() => {
+ setInteractiveEnabled(false);
+ }, [nft.id, shouldGate]);
+
+ let shouldAnimate = true;
+ if (isHtml) {
+ shouldAnimate = hasMounted && (interactiveEnabled || !shouldGate);
+ }
+
return (
-
+
+
+ {shouldGate && !interactiveEnabled && (
+
+ )}
+
);
}
diff --git a/components/home/now-minting/NowMintingSection.tsx b/components/home/now-minting/NowMintingSection.tsx
index 801330a1ed..e65f70fc2f 100644
--- a/components/home/now-minting/NowMintingSection.tsx
+++ b/components/home/now-minting/NowMintingSection.tsx
@@ -57,7 +57,7 @@ export default function NowMintingSection() {
-
+
diff --git a/package-lock.json b/package-lock.json
index 86818088c8..4080279bd2 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -29207,6 +29207,23 @@
}
}
},
+ "node_modules/tailwindcss/node_modules/yaml": {
+ "version": "2.8.2",
+ "resolved": "https://registry.npmjs.org/yaml/-/yaml-2.8.2.tgz",
+ "integrity": "sha512-mplynKqc1C2hTVYxd0PU2xQAc22TI1vShAYGksCCfxbn/dFwnHTNi1bvYsBTkhdUNtGIf5xNOg938rrSSYvS9A==",
+ "license": "ISC",
+ "optional": true,
+ "peer": true,
+ "bin": {
+ "yaml": "bin.mjs"
+ },
+ "engines": {
+ "node": ">= 14.6"
+ },
+ "funding": {
+ "url": "https://github.com/sponsors/eemeli"
+ }
+ },
"node_modules/tapable": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/tapable/-/tapable-2.3.0.tgz",