-
Notifications
You must be signed in to change notification settings - Fork 5
Tap to load gating for html media #1759
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
dea4b9a
tap to load gating for html media
ragnep 45edae7
Merge branch 'main' into homepage-artwork-disable-autoplay
ragnep 392e70d
wip
ragnep 94169e5
Merge branch 'main' into homepage-artwork-disable-autoplay
ragnep 7a095f5
wip
ragnep 6b4f660
Merge branch 'main' into homepage-artwork-disable-autoplay
ragnep feccf52
wip
ragnep f1c2a80
added interactive icon for the tap to load button
ragnep f124013
wip
ragnep f6ae892
Merge branch 'main' into homepage-artwork-disable-autoplay
ragnep File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| interface InteractiveIconProps { | ||
| readonly className?: string; | ||
| } | ||
|
|
||
| export default function InteractiveIcon({ | ||
| className, | ||
| }: InteractiveIconProps) { | ||
| return ( | ||
| <svg | ||
| viewBox="45 15 170 230" | ||
| className={className} | ||
| fill="currentColor" | ||
| aria-hidden="true" | ||
| focusable="false" | ||
| > | ||
| <path d="M195.4,107.9c-2.6,0-5,0.4-7.4,1.2c-0.2-0.1-0.5-0.2-0.8-0.3c-4.4-7.1-12-11.4-20.4-11.4c-2.9,0-5.7,0.5-8.4,1.4c-4.4-7.4-12.1-11.9-20.8-11.9c-1.6,0-3.1,0.1-4.6,0.4V73.9c0-14-10.7-24.9-24.4-24.9c-13.8,0-25,11.2-25,24.9v65.8l-3.9-3.9c-4.5-4.4-10.7-6.9-17.5-6.9c-6.9,0-13.6,2.6-17.9,6.9c-9.4,9.4-12.5,25.7-1.5,36.7l56.2,55.9c1.3,1.3,2.8,2.4,4.4,3.4c10.5,8.6,23.1,14.2,49.7,14.2c61.8,0,66.9-36.2,66.9-73.3v-40C220.1,118.8,209.4,107.9,195.4,107.9L195.4,107.9z M210.3,172.8c0,36-4.2,63.5-57.1,63.5c-24,0-34.5-4.7-43.7-12.2l-0.6-0.4c-1.1-0.7-2-1.4-2.9-2.2l-56.2-55.8c-7.3-7.3-3.5-17.8,1.5-22.8c2.5-2.5,6.7-4,10.9-4c4.2,0,8,1.4,10.6,4l20.6,20.5V73.8c0-8.3,6.8-15.1,15.2-15.1c8.2,0,14.6,6.6,14.6,15.1v28.5l0.1-0.1v29.3c0,2.7,2.2,4.9,4.9,4.9c2.7,0,4.9-2.2,4.9-4.9V97.4c1.4-0.4,2.9-0.7,4.5-0.7c6.3,0,11.6,3.9,13.8,10.2l0.6,1.8v32.1c0,2.7,2.2,4.9,4.9,4.9c2.7,0,4.9-2.2,4.9-4.9V108c1.6-0.5,3.3-0.9,4.9-0.9c6.3,0,11.6,3.9,13.8,10.2l0.3,1v32.1c0,2.7,2.2,4.9,4.9,4.9c2.7,0,4.9-2.2,4.9-4.9v-31.8c1.6-0.6,3.2-1,5.2-1c8.2,0,14.4,6.5,14.4,15.1V172.8L210.3,172.8z M68.4,120.1c0.9,0.7,1.9,1,2.9,1c1.5,0,3-0.7,4-2c1.6-2.2,1.2-5.3-1-6.9C61.1,102.4,53.5,87.4,53.5,71c0-28.3,23-51.2,51.2-51.2S156,42.8,156,71c0,3.4-0.3,6.9-1,10.2c-0.5,2.6,1.2,5.3,3.9,5.8c2.6,0.5,5.3-1.2,5.8-3.9c0.8-4,1.2-8.1,1.2-12.1c0-33.6-27.4-61-61-61S43.7,37.4,43.7,71.1C43.7,90.3,52.9,108.6,68.4,120.1L68.4,120.1z" /> | ||
| </svg> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 ( | ||
| <div className="tw-flex tw-w-full tw-items-start tw-justify-center"> | ||
| <NFTImage nft={nft} animation={true} height={650} showBalance={true} /> | ||
| <div className="tw-relative tw-w-full"> | ||
| <NFTImage | ||
| nft={nft} | ||
| animation={shouldAnimate} | ||
| height={650} | ||
| showBalance={true} | ||
| /> | ||
| {shouldGate && !interactiveEnabled && ( | ||
| <button | ||
| type="button" | ||
| onClick={() => setInteractiveEnabled(true)} | ||
| className="tw-absolute tw-inset-0 tw-flex tw-items-center tw-justify-center tw-bg-transparent" | ||
| aria-label="Load interactive artwork" | ||
| > | ||
| <span className="tw-inline-flex tw-items-center tw-justify-center tw-gap-2 tw-rounded-full tw-border tw-border-white/20 tw-bg-iron-950/90 tw-px-4 tw-py-2 tw-text-xs tw-font-semibold tw-text-white tw-shadow-[0_16px_40px_rgba(0,0,0,0.65)] tw-ring-1 tw-ring-white/10 tw-transition hover:tw-bg-iron-900"> | ||
| <InteractiveIcon className="tw-size-4 tw-flex-shrink-0" /> | ||
| Tap to load | ||
| </span> | ||
| </button> | ||
| )} | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.