added detection that something is an nft link

This commit is contained in:
Martina 2021-08-30 13:51:45 -07:00
parent b6b17e1551
commit 48d59d3f95
3 changed files with 13 additions and 1 deletions

View File

@ -182,6 +182,8 @@ export const gateways = {
export const hostname = "https://slate.host";
export const NFTDomains = ["foundation.app", "zora.co", "opensea.io"];
// more important filetypes to consider:
// midi
// txt, rtf, docx

View File

@ -1,4 +1,5 @@
import * as Strings from "~/common/strings";
import * as Constants from "~/common/constants";
import JSZip from "jszip";
@ -280,3 +281,10 @@ export const isUnityFile = async (file) => {
return false;
}
};
export const isNFTLink = async (file) => {
let domain = file?.data?.link?.domain;
if (!domain) return false;
domain = domain.toLowerCase();
return Constants.NFTDomains.includes(domain);
};

View File

@ -34,6 +34,8 @@ export default class SlateLinkObject extends React.Component {
const url = this.props.file.url;
const link = this.props.file.data.link;
const { html, iFrameAllowed } = link;
const isNFTLink = Validations.isNFTLink(this.props.file);
if (html) {
return (
<div
@ -43,7 +45,7 @@ export default class SlateLinkObject extends React.Component {
}}
/>
);
} else if (iFrameAllowed && !isMobile) {
} else if (iFrameAllowed && !isMobile && !isNFTLink) {
return (
<div
style={{ position: "relative", display: "block", width: "100%", height: "100%" }}