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 ...@@ -51,11 +51,12 @@ export default function TokenWarningMessage({ warning, tokenAddress }: TokenWarn
</TitleRow> </TitleRow>
<DetailsRow> <DetailsRow>
{heading && [heading, '. ']} {heading}
{Boolean(heading) && ' '}
{description} {description}
{Boolean(description) && ' '}
{tokenAddress && ( {tokenAddress && (
<ExternalLink href={TOKEN_SAFETY_ARTICLE}> <ExternalLink href={TOKEN_SAFETY_ARTICLE}>
{' '}
<Trans>Learn more</Trans> <Trans>Learn more</Trans>
</ExternalLink> </ExternalLink>
)} )}
......
...@@ -15,8 +15,8 @@ export function getWarningCopy(warning: Warning | null, plural = false) { ...@@ -15,8 +15,8 @@ export function getWarningCopy(warning: Warning | null, plural = false) {
description = null description = null
if (warning) { if (warning) {
if (warning.canProceed) { if (warning.canProceed) {
heading = <Plural value={plural ? 2 : 1} _1="This token isn't verified" other="These tokens aren't verified" /> 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> description = <Trans>Please do your own research before trading.</Trans>
} else { } else {
description = ( description = (
<Plural <Plural
......
...@@ -158,7 +158,7 @@ export default function TokenDetails() { ...@@ -158,7 +158,7 @@ export default function TokenDetails() {
const tokenProject = query.tokenProjects?.[0] const tokenProject = query.tokenProjects?.[0]
const tokenProjectMarket = tokenProject?.markets?.[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 // TODO: Fix this logic to not automatically redirect on refresh, yet still catch invalid addresses
//const location = useLocation() //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