From c7ae918563c58a6b19dc7772e3ce2e53f084189d Mon Sep 17 00:00:00 2001 From: Anaglyphic <97275120+Anaglyph-ic@users.noreply.github.com> Date: Wed, 28 Feb 2024 15:21:36 +0100 Subject: [PATCH] =?UTF-8?q?feat:=20=F0=9F=92=84=20Anaverse=20integration?= =?UTF-8?q?=20(#386)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Update container.tsx Add anav button * Update index.js add link to anav svg * Add files via upload * Update container.tsx var -> let * fix: 🔀 reactify * fix: 🎨 use fullname for anaverse * feat: 💄 add open in anaverse button * fix: 🚑 use absolute units * feat: 💄 passdown the viewer address to anaverse * fix: 🦊 on FF navigate instead of iframe * fix: 🦊 use window.chrome for the check also reorder the condition (it was the opposite) * refactor: 💄 not not * fix 🐛: typo remove extra & char * feat ⚡: add event linking to blogpost --------- Co-authored-by: melMass Co-authored-by: Mel Massadian --- src/components/header/sample_events.js | 8 ++ src/components/media-types/container.tsx | 103 ++++++++++++++----- src/components/media-types/index.module.scss | 9 ++ src/icons/index.js | 1 + src/icons/svgs/enter_anav.svg | 1 + src/pages/objkt-display/tabs/Info.jsx | 17 ++- 6 files changed, 111 insertions(+), 28 deletions(-) create mode 100644 src/icons/svgs/enter_anav.svg diff --git a/src/components/header/sample_events.js b/src/components/header/sample_events.js index 016f8d7ae..6f97f1638 100644 --- a/src/components/header/sample_events.js +++ b/src/components/header/sample_events.js @@ -1,5 +1,13 @@ // DEV SAMPLES export const sample_events = [ + { + title: 'Anaverse Integration', + icon: '🖼️', + link: 'https://blog.teia.art/blog/anaverse-integration-announcement', + subtitle: 'new feature', + content: + 'Teia just received a nice little new feature: 3D previews for your NFTs! This new addition allows you to experience your tokens in a immersive genertive 3D space.', + }, { title: 'Tez4Pal', icon: '🇵🇸', diff --git a/src/components/media-types/container.tsx b/src/components/media-types/container.tsx index 5f21a8d9a..7a1d7f7d2 100644 --- a/src/components/media-types/container.tsx +++ b/src/components/media-types/container.tsx @@ -6,10 +6,11 @@ import classnames from 'classnames' import { iOS } from '@utils/os' import styles from '@style' import './style.css' -import { FullScreenEnterIcon, FullScreenExitIcon } from '@icons' +import { FullScreenEnterIcon, FullScreenExitIcon, EnterAnav } from '@icons' import { NFT } from '@types' import { Button } from '@atoms/button' -import { MIMETYPE } from '@constants' +import { HEN_CONTRACT_FA2, MIMETYPE } from '@constants' +import { useUserStore } from '@context/userStore' /** * Currently fullscreen is disabled on iOS @@ -17,10 +18,37 @@ import { MIMETYPE } from '@constants' */ /** - * This component handles fullscreen mode - * and inView prop for lazy loading -y* + * This component handles + * - fullscreen mode + * - inView prop for lazy loading + * - the Anaverse viewer + * **/ + +/** + * Builds the anaverse URL + */ +const getAnaverseUrl = (tokenId: string, viewer_address?: string) => { + return viewer_address + ? `https://anaver.se/?gallery=1&loadsingle=1&singlecontract=${HEN_CONTRACT_FA2}&singletokenid=${tokenId}&wallet=${viewer_address}&partnerPlatform=teia.art` + : `https://anaver.se/?gallery=1&loadsingle=1&singlecontract=${HEN_CONTRACT_FA2}&singletokenid=${tokenId}&partnerPlatform=teia.art` +} + +/** + * iFrame wrapper of Anaverse + */ +const AnaverseViewer = (tokenId: string, address?: string) => { + const url = getAnaverseUrl(tokenId, address) + return ( +