Skip to content

Commit

Permalink
Merge branch 'dev' of github.com:reservoirprotocol/reservoir-hub into…
Browse files Browse the repository at this point in the history
… dev
  • Loading branch information
pedromcunha committed Dec 6, 2023
2 parents be80037 + b73d606 commit 5b13721
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 29 deletions.
15 changes: 5 additions & 10 deletions components/common/ChainToggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,9 @@ const ChainToggle: FC = () => {
key={supportedChain.id}
css={{ py: '$3', px: '$1', display: 'flex', gap: '$2' }}
onClick={() => {
const newUrl = router.asPath.replace(
chain.routePrefix,
supportedChain.routePrefix
)
router.query.chain = supportedChain.routePrefix
router.push(router, undefined, { shallow: true })

router.replace(newUrl, undefined, { scroll: false })
switchCurrentChain(supportedChain.id)
}}
>
Expand Down Expand Up @@ -139,12 +136,10 @@ const ChainToggle: FC = () => {
value={chainOption.name}
disabled={chainOption.name === chain.name}
onClick={() => {
const newUrl = router.asPath.replace(
chain.routePrefix,
chainOption.routePrefix
)
router.query.chain = chainOption.routePrefix
router.push(router, undefined, { shallow: true })

switchCurrentChain(chainOption.id)
router.replace(newUrl, undefined, { scroll: false })
}}
>
<Box
Expand Down
10 changes: 5 additions & 5 deletions components/common/MintsPeriodDropdown.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ export type MintsSortingOption = NonNullable<
>

const sortingOptions: MintsSortingOption[] = [
'24h',
'6h',
'1h',
'30m',
'10m',
'5m',
'10m',
'30m',
'1h',
'6h',
'24h',
]

const nameForSortingOption = (option: MintsSortingOption, compact: boolean) => {
Expand Down
5 changes: 2 additions & 3 deletions components/navbar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,7 @@ const Navbar = () => {
const isMobile = useMediaQuery({ query: '(max-width: 960px' })
const isMounted = useMounted()
const { routePrefix } = useMarketplaceChain()
const { address } = useAccount();

const { address } = useAccount()

let searchRef = useRef<HTMLInputElement>(null)

Expand Down Expand Up @@ -241,7 +240,7 @@ const Navbar = () => {
</HoverCard.Root>
</Box>
{isConnected && (
<Link href={`/portfolio/${address || ''}`}>
<Link href={`/portfolio/${address || ''}?chain=${routePrefix}`}>
<Box css={{ mr: '$2' }}>
<NavItem>Portfolio</NavItem>
</Box>
Expand Down
27 changes: 17 additions & 10 deletions components/rankings/MintRankingsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,17 +25,17 @@ type Props = {
}

const gridColumns = {
gridTemplateColumns: '520px repeat(3, 0.5fr) 250px',
gridTemplateColumns: '520px repeat(5, 0.5fr) 250px',
'@md': {
gridTemplateColumns: '420px 1fr 1fr 1fr',
},

'@lg': {
gridTemplateColumns: '360px repeat(3, 0.5fr) 250px',
gridTemplateColumns: '360px repeat(5, 0.5fr) 250px',
},

'@xl': {
gridTemplateColumns: '520px repeat(3, 0.5fr) 250px',
gridTemplateColumns: '520px repeat(5, 0.5fr) 250px',
},
}

Expand Down Expand Up @@ -93,15 +93,12 @@ const RankingsTableRow: FC<RankingsTableRowProps> = ({ mint, rank }) => {
const isSmallDevice = useMediaQuery({ maxWidth: 900 })

const collectionImage = useMemo(() => {
return optimizeImage(mint.image as string, 250)
return optimizeImage(mint?.image || mint?.sampleImages?.[0], 250)
}, [mint.image])

const mintPrice = mint.mintPrice?.toString()

// @ts-ignore
const sampleImages: string[] = mint?.sampleImages
// @ts-ignore
const openseaVerificationStatus = mint?.openseaVerificationStatus
const sampleImages: string[] = mint?.sampleImages || []

if (isSmallDevice) {
return (
Expand Down Expand Up @@ -134,7 +131,7 @@ const RankingsTableRow: FC<RankingsTableRowProps> = ({ mint, rank }) => {
{mint?.name}
</Text>
<OpenSeaVerified
openseaVerificationStatus={openseaVerificationStatus}
openseaVerificationStatus={mint?.openseaVerificationStatus}
/>
</Flex>
<Flex align="center">
Expand Down Expand Up @@ -207,7 +204,7 @@ const RankingsTableRow: FC<RankingsTableRowProps> = ({ mint, rank }) => {
{mint?.name}
</Text>
<OpenSeaVerified
openseaVerificationStatus={openseaVerificationStatus}
openseaVerificationStatus={mint?.openseaVerificationStatus}
/>
</Flex>
</Flex>
Expand Down Expand Up @@ -253,6 +250,14 @@ const RankingsTableRow: FC<RankingsTableRowProps> = ({ mint, rank }) => {
</Flex>
</TableCell>

<TableCell desktopOnly>
<Text style="subtitle1">{mint?.oneHourCount}</Text>
</TableCell>

<TableCell desktopOnly>
<Text style="subtitle1">{mint?.sixHourCount}</Text>
</TableCell>

<TableCell desktopOnly>
<Flex
css={{
Expand Down Expand Up @@ -297,6 +302,8 @@ const headings = [
'Mint Price',
'Floor Price',
'Total Mints',
'1H Mints',
'6h Mints',
'Recent Mints',
]

Expand Down
6 changes: 6 additions & 0 deletions context/ChainContextProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@ const ChainContextProvider: FC<any> = ({ children }) => {
(chain) => chain.id === +savedChainId
)
}

if (!router.query.chain && selectedChain) {
router.query.chain = selectedChain.routePrefix
router.push(router, undefined, { shallow: true })
}

const id = selectedChain?.id || DefaultChain.id
setGlobalChainId(id)
localStorage.setItem('reservoir.chainId', `${id}`)
Expand Down
2 changes: 1 addition & 1 deletion pages/portfolio/[[...address]].tsx
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ const IndexPage: NextPage = () => {
router.query.tab = tabValue
router.push(router, undefined, { shallow: true })
}
}, [tabValue])
}, [tabValue, router])

if (!isMounted) {
return null
Expand Down

0 comments on commit 5b13721

Please sign in to comment.