chore: removing fallback rarity provider (#6408)
This commit is contained in:
parent
fcc6a2d560
commit
3900cdd0dc
Binary file not shown.
Before Width: | Height: | Size: 1.2 KiB |
@ -29,7 +29,6 @@ import { buildActivityAsset } from 'nft/utils/buildActivityAsset'
|
|||||||
import { formatEth, formatEthPrice } from 'nft/utils/currency'
|
import { formatEth, formatEthPrice } from 'nft/utils/currency'
|
||||||
import { getTimeDifference, isValidDate } from 'nft/utils/date'
|
import { getTimeDifference, isValidDate } from 'nft/utils/date'
|
||||||
import { putCommas } from 'nft/utils/putCommas'
|
import { putCommas } from 'nft/utils/putCommas'
|
||||||
import { fallbackProvider, getRarityProviderLogo } from 'nft/utils/rarity'
|
|
||||||
import { MouseEvent, useMemo, useState } from 'react'
|
import { MouseEvent, useMemo, useState } from 'react'
|
||||||
import styled from 'styled-components/macro'
|
import styled from 'styled-components/macro'
|
||||||
import { ExternalLink } from 'theme'
|
import { ExternalLink } from 'theme'
|
||||||
@ -339,9 +338,7 @@ interface RankingProps {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const Ranking = ({ rarity, collectionName, rarityVerified }: RankingProps) => {
|
const Ranking = ({ rarity, collectionName, rarityVerified }: RankingProps) => {
|
||||||
const source = (rarity as TokenRarity).source || (rarity as Rarity).primaryProvider
|
|
||||||
const rank = (rarity as TokenRarity).rank || (rarity as Rarity).providers?.[0].rank
|
const rank = (rarity as TokenRarity).rank || (rarity as Rarity).providers?.[0].rank
|
||||||
const rarityProviderLogo = getRarityProviderLogo(source)
|
|
||||||
|
|
||||||
if (!rank) return null
|
if (!rank) return null
|
||||||
|
|
||||||
@ -351,12 +348,10 @@ const Ranking = ({ rarity, collectionName, rarityVerified }: RankingProps) => {
|
|||||||
text={
|
text={
|
||||||
<Row>
|
<Row>
|
||||||
<Box display="flex" marginRight="4">
|
<Box display="flex" marginRight="4">
|
||||||
<img src={rarityProviderLogo} alt="cardLogo" width={16} />
|
<img src="/nft/svgs/gem.svg" alt="cardLogo" width={16} />
|
||||||
</Box>
|
</Box>
|
||||||
<Box width="full" fontSize="14">
|
<Box width="full" fontSize="14">
|
||||||
{rarityVerified
|
{rarityVerified ? `Verified by ${collectionName}` : `Ranking by Rarity Sniper`}
|
||||||
? `Verified by ${collectionName}`
|
|
||||||
: `Ranking by ${source === 'Genie' ? fallbackProvider : source}`}
|
|
||||||
</Box>
|
</Box>
|
||||||
</Row>
|
</Row>
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,6 @@ import { formatEth, formatEthPrice } from 'nft/utils/currency'
|
|||||||
import { isAudio } from 'nft/utils/isAudio'
|
import { isAudio } from 'nft/utils/isAudio'
|
||||||
import { isVideo } from 'nft/utils/isVideo'
|
import { isVideo } from 'nft/utils/isVideo'
|
||||||
import { putCommas } from 'nft/utils/putCommas'
|
import { putCommas } from 'nft/utils/putCommas'
|
||||||
import { fallbackProvider, getRarityProviderLogo } from 'nft/utils/rarity'
|
|
||||||
import { useCallback, useMemo, useReducer, useState } from 'react'
|
import { useCallback, useMemo, useReducer, useState } from 'react'
|
||||||
import InfiniteScroll from 'react-infinite-scroll-component'
|
import InfiniteScroll from 'react-infinite-scroll-component'
|
||||||
import { useInfiniteQuery, useQuery } from 'react-query'
|
import { useInfiniteQuery, useQuery } from 'react-query'
|
||||||
@ -424,7 +423,6 @@ export const AssetDetails = ({ asset, collection }: AssetDetailsProps) => {
|
|||||||
|
|
||||||
const rarity = asset?.rarity?.providers?.[0]
|
const rarity = asset?.rarity?.providers?.[0]
|
||||||
const [showHolder, setShowHolder] = useState(false)
|
const [showHolder, setShowHolder] = useState(false)
|
||||||
const rarityProviderLogo = getRarityProviderLogo(rarity?.provider)
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Column>
|
<Column>
|
||||||
@ -456,11 +454,9 @@ export const AssetDetails = ({ asset, collection }: AssetDetailsProps) => {
|
|||||||
text={
|
text={
|
||||||
<HoverContainer>
|
<HoverContainer>
|
||||||
<HoverImageContainer>
|
<HoverImageContainer>
|
||||||
<img src={rarityProviderLogo} alt="cardLogo" width={16} />
|
<img src="/nft/svgs/gem.svg" alt="cardLogo" width={16} />
|
||||||
</HoverImageContainer>
|
</HoverImageContainer>
|
||||||
<ContainerText>
|
<ContainerText>Ranking by Rarity Sniper</ContainerText>
|
||||||
{`Ranking by ${rarity.provider === 'Genie' ? fallbackProvider : rarity.provider}`}
|
|
||||||
</ContainerText>
|
|
||||||
</HoverContainer>
|
</HoverContainer>
|
||||||
}
|
}
|
||||||
placement="top"
|
placement="top"
|
||||||
|
@ -12,7 +12,6 @@ export * from './listNfts'
|
|||||||
export * from './numbers'
|
export * from './numbers'
|
||||||
export * from './pooledAssets'
|
export * from './pooledAssets'
|
||||||
export * from './putCommas'
|
export * from './putCommas'
|
||||||
export * from './rarity'
|
|
||||||
export * from './roundAndPluralize'
|
export * from './roundAndPluralize'
|
||||||
export * from './timeSince'
|
export * from './timeSince'
|
||||||
export * from './transactionResponse'
|
export * from './transactionResponse'
|
||||||
|
@ -1,16 +0,0 @@
|
|||||||
// change this if we change the fallback provider
|
|
||||||
export const fallbackProvider = 'PopRank'
|
|
||||||
export const fallbackProviderLogo = '/nft/logos/poprank.png'
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add provider mappings based on provider name returned from the backend here
|
|
||||||
*/
|
|
||||||
export const rarityProviderLogo: { [key: string]: string } = {
|
|
||||||
'Rarity Sniper': '/nft/svgs/gem.svg',
|
|
||||||
Genie: fallbackProviderLogo,
|
|
||||||
}
|
|
||||||
|
|
||||||
export const getRarityProviderLogo = (source?: string): string | undefined => {
|
|
||||||
if (!source) return undefined
|
|
||||||
return rarityProviderLogo[source] || fallbackProviderLogo
|
|
||||||
}
|
|
Loading…
Reference in New Issue
Block a user