Commit 0b9fda5b authored by Jordan Frankfurt's avatar Jordan Frankfurt Committed by GitHub

feat(token-details): fix crash on undefined object access (#4712)

feat(token-details): fix crash on undefined object access +some small errors
parent 47816f25
......@@ -51,11 +51,12 @@ export default function TokenWarningMessage({ warning, tokenAddress }: TokenWarn
</TitleRow>
<DetailsRow>
{heading && [heading, '. ']}
{heading}
{Boolean(heading) && ' '}
{description}
{Boolean(description) && ' '}
{tokenAddress && (
<ExternalLink href={TOKEN_SAFETY_ARTICLE}>
{' '}
<Trans>Learn more</Trans>
</ExternalLink>
)}
......
......@@ -15,8 +15,8 @@ export function getWarningCopy(warning: Warning | null, plural = false) {
description = null
if (warning) {
if (warning.canProceed) {
heading = <Plural value={plural ? 2 : 1} _1="This token isn't verified" other="These tokens aren't verified" />
description = <Trans>{'Please do your own research before trading.'}</Trans>
heading = <Plural value={plural ? 2 : 1} _1="This token isn't verified." other="These tokens aren't verified." />
description = <Trans>Please do your own research before trading.</Trans>
} else {
description = (
<Plural
......
......@@ -158,7 +158,7 @@ export default function TokenDetails() {
const tokenProject = query.tokenProjects?.[0]
const tokenProjectMarket = tokenProject?.markets?.[0]
const tokenMarket = tokenProject?.tokens[0].market
const tokenMarket = tokenProject?.tokens?.[0]?.market
// TODO: Fix this logic to not automatically redirect on refresh, yet still catch invalid addresses
//const location = useLocation()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment