diff --git a/src/features/dapp/models/dapp.tsx b/src/features/dapp/models/dapp.tsx index c5cf23c..18755a8 100644 --- a/src/features/dapp/models/dapp.tsx +++ b/src/features/dapp/models/dapp.tsx @@ -23,6 +23,7 @@ export interface Dapp { banner: string; logo: string; screenshots: Array; + mobileScreenshots: Array; }; metrics: { dappId: string; diff --git a/src/pages/dapp/index.tsx b/src/pages/dapp/index.tsx index 3ce5475..627ef9e 100644 --- a/src/pages/dapp/index.tsx +++ b/src/pages/dapp/index.tsx @@ -457,6 +457,22 @@ function DappList(props) { const app = useSelector(getApp); const { query } = useRouter(); const [isReviewModalOpen, setIsReviewModalOpen] = useState(false); + const [isMobile, setIsMobile] = useState(false); + + useEffect(() => { + const isMobile = window.innerWidth < 1080; + setIsMobile(isMobile); + + const handleResize = () => { + const isMobile = window.innerWidth < 1080; + setIsMobile(isMobile); + }; + + window.addEventListener("resize", handleResize); + + return () => window.removeEventListener("resize", handleResize); + }, []); + useEffect(() => { if (isClaimOpen) { document.body.style.overflow = "hidden"; @@ -500,6 +516,7 @@ function DappList(props) { if (!data) return Missing post!; const dApp: Dapp = data.data[0]; + const screenShots = isMobile ? (dApp?.images?.mobileScreenshots || dApp?.images?.screenshots) : (dApp?.images?.screenshots || dApp?.images?.mobileScreenshots) if (isLoading || isFetching) return ( @@ -614,7 +631,7 @@ function DappList(props) {

{customCategory}

-

+

{dApp.name} {dApp?.verification && dApp?.verification?.icon && ( -

+
{AppStrings.visitDapp}
)} - {dApp.images.screenshots?.length && ( + {screenShots?.length && ( <>
- {dApp.images.screenshots?.map((e, idx) => ( + {screenShots?.map((e, idx) => ( DApp Screenshot ))}