chore: removing fallback rarity provider (#6408)

This commit is contained in:
Jack Short 2023-04-21 11:56:13 -04:00 committed by GitHub
parent fcc6a2d560
commit 3900cdd0dc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 4 additions and 30 deletions

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 { getTimeDifference, isValidDate } from 'nft/utils/date'
import { putCommas } from 'nft/utils/putCommas'
import { fallbackProvider, getRarityProviderLogo } from 'nft/utils/rarity'
import { MouseEvent, useMemo, useState } from 'react'
import styled from 'styled-components/macro'
import { ExternalLink } from 'theme'
@ -339,9 +338,7 @@ interface 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 rarityProviderLogo = getRarityProviderLogo(source)
if (!rank) return null
@ -351,12 +348,10 @@ const Ranking = ({ rarity, collectionName, rarityVerified }: RankingProps) => {
text={
<Row>
<Box display="flex" marginRight="4">
<img src={rarityProviderLogo} alt="cardLogo" width={16} />
<img src="/nft/svgs/gem.svg" alt="cardLogo" width={16} />
</Box>
<Box width="full" fontSize="14">
{rarityVerified
? `Verified by ${collectionName}`
: `Ranking by ${source === 'Genie' ? fallbackProvider : source}`}
{rarityVerified ? `Verified by ${collectionName}` : `Ranking by Rarity Sniper`}
</Box>
</Row>
}

@ -17,7 +17,6 @@ import { formatEth, formatEthPrice } from 'nft/utils/currency'
import { isAudio } from 'nft/utils/isAudio'
import { isVideo } from 'nft/utils/isVideo'
import { putCommas } from 'nft/utils/putCommas'
import { fallbackProvider, getRarityProviderLogo } from 'nft/utils/rarity'
import { useCallback, useMemo, useReducer, useState } from 'react'
import InfiniteScroll from 'react-infinite-scroll-component'
import { useInfiniteQuery, useQuery } from 'react-query'
@ -424,7 +423,6 @@ export const AssetDetails = ({ asset, collection }: AssetDetailsProps) => {
const rarity = asset?.rarity?.providers?.[0]
const [showHolder, setShowHolder] = useState(false)
const rarityProviderLogo = getRarityProviderLogo(rarity?.provider)
return (
<Column>
@ -456,11 +454,9 @@ export const AssetDetails = ({ asset, collection }: AssetDetailsProps) => {
text={
<HoverContainer>
<HoverImageContainer>
<img src={rarityProviderLogo} alt="cardLogo" width={16} />
<img src="/nft/svgs/gem.svg" alt="cardLogo" width={16} />
</HoverImageContainer>
<ContainerText>
{`Ranking by ${rarity.provider === 'Genie' ? fallbackProvider : rarity.provider}`}
</ContainerText>
<ContainerText>Ranking by Rarity Sniper</ContainerText>
</HoverContainer>
}
placement="top"

@ -12,7 +12,6 @@ export * from './listNfts'
export * from './numbers'
export * from './pooledAssets'
export * from './putCommas'
export * from './rarity'
export * from './roundAndPluralize'
export * from './timeSince'
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
}