Skip to content

Commit

Permalink
mount before rendering dates
Browse files Browse the repository at this point in the history
  • Loading branch information
saml33 committed Dec 18, 2023
1 parent fbc4559 commit 0a868de
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 5 deletions.
20 changes: 16 additions & 4 deletions app/components/explore/token-page/TokenInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
} from '@heroicons/react/20/solid'
import Link from 'next/link'
import { BirdeyeOverviewData } from '../../../types/birdeye'
import SheenLoader from '../../shared/SheenLoader'
dayjs.extend(relativeTime)

const TokenInfo = ({
Expand All @@ -36,6 +37,17 @@ const TokenInfo = ({
setTimeout(() => setCopied(false), 2000)
}, [copied])

const [mounted, setMounted] = useState(false)
useEffect(() => setMounted(true), [])
if (!mounted)
return (
<SheenLoader className="flex flex-1">
<div
className={`h-[264px] lg:h-[344px] w-full rounded-lg bg-th-bkg-2`}
/>
</SheenLoader>
)

return (
<>
<h2 className="text-base mb-2">Info and stats</h2>
Expand Down Expand Up @@ -117,14 +129,14 @@ const TokenInfo = ({
</span>
) : null}
</span>
{/* {coingeckoData?.market_data?.ath_date?.usd ? (
{coingeckoData?.market_data?.ath_date?.usd ? (
<span className="text-xs text-th-fgd-4 text-right">
{dayjs(coingeckoData.market_data.ath_date.usd).format(
'DD MMM YYYY',
)}{' '}
({dayjs().to(coingeckoData.market_data.ath_date.usd)})
</span>
) : null} */}
) : null}
</span>
) : (
'–'
Expand Down Expand Up @@ -154,14 +166,14 @@ const TokenInfo = ({
</span>
) : null}
</span>
{/* {coingeckoData?.market_data?.atl_date?.usd ? (
{coingeckoData?.market_data?.atl_date?.usd ? (
<span className="text-xs text-th-fgd-4 text-right">
{dayjs(coingeckoData.market_data.atl_date.usd).format(
'DD MMM YYYY',
)}{' '}
({dayjs().to(coingeckoData.market_data.atl_date.usd)})
</span>
) : null} */}
) : null}
</span>
) : (
'–'
Expand Down
2 changes: 1 addition & 1 deletion tsconfig.tsbuildinfo

Large diffs are not rendered by default.

1 comment on commit 0a868de

@vercel
Copy link

@vercel vercel bot commented on 0a868de Dec 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.