Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: new chain logos #7438

Merged
merged 8 commits into from
Oct 10, 2023
Merged

feat: new chain logos #7438

merged 8 commits into from
Oct 10, 2023

Conversation

cartcrom
Copy link
Contributor

Description

Updates interface to use new network icons. Removes logoUrl, circleLogoUrl, and squareLogoUrl from ChainInfo.

New l2 icons are react components that build and return an based on props rather than static svg files, in order to enable lightmode vs darkmode and dynamic border radius based on size. The only new static svg files are the symbols inside of the chain logos themselves.

Screen capture

Before After
image image
image image
image image
image image
image image
image image
image image
image image
image image

Test plan

QA (ie manual testing)

  • Click through areas of the app that utilize a chain logo, ensure there aren't any styling issues

@cartcrom cartcrom requested review from JackShort, tinaszheng, just-toby and a team October 10, 2023 17:44
@vercel
Copy link

vercel bot commented Oct 10, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
interface ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 10, 2023 9:11pm

@codecov
Copy link

codecov bot commented Oct 10, 2023

Codecov Report

Merging #7438 (8954a7c) into main (27ec2e0) will increase coverage by 0.03%.
Report is 4 commits behind head on main.
The diff coverage is 84.94%.

Flag Coverage Δ
cloud-tests 83.60% <ø> (ø)
unit-tests 42.47% <84.94%> (+0.03%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

@cypress
Copy link

cypress bot commented Oct 10, 2023

Copy link
Contributor

@mattbspector mattbspector left a comment

Choose a reason for hiding this comment

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

nothing codewise sticks out, a lot of files so will test the deploy as well

Copy link
Contributor

@cbachmeier cbachmeier left a comment

Choose a reason for hiding this comment

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

See a couple more logos left in the files. Can these be deleted?

  • src/assets/images/celoCircle.png
  • src/assets/svg/avax_logo.svg
  • src/assets/svg/bnb-logo.svg
  • src/assets/svg/celo_logo.svg
  • src/assets/svg/ethereum_square_logo.svg

There's also a function getNetworkLogoUrl that uses old images, it seems to be only used in one place. Can that be replaced as well?

Copy link
Contributor

@tinaszheng tinaszheng left a comment

Choose a reason for hiding this comment

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

bunch of nits but overall lgtm

{...props}
/>
)
return <PortfolioLogo currencies={[currency]} chainId={chainId} {...props} />
Copy link
Contributor

Choose a reason for hiding this comment

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

ooh this [currency] should be memoized to prevent rerendering

Copy link
Contributor Author

Choose a reason for hiding this comment

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

gr8 point, i think this is an issue elsewhere, I made a ticket to fix this across all PortfolioLogo callsites

src/components/NavBar/SearchBarDropdown.tsx Outdated Show resolved Hide resolved
src/components/NetworkAlert/NetworkAlert.tsx Outdated Show resolved Hide resolved
src/components/Tokens/TokenDetails/BalanceSummary.tsx Outdated Show resolved Hide resolved
@@ -212,7 +212,7 @@ export default function TokenDetails({
</BreadcrumbNavLink>
<TokenInfoContainer data-testid="token-info-container">
<TokenNameCell>
<CurrencyLogo currency={detailedToken} size="32px" hideL2Icon={false} />
<PortfolioLogo currencies={[detailedToken]} chainId={detailedToken.chainId} size="32px" />
Copy link
Contributor

Choose a reason for hiding this comment

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

and here

Copy link
Contributor Author

Choose a reason for hiding this comment

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

typechecking gets ugly trying to memo here so I'm gonna fix this one in the ticket i mentioned above

src/components/TransactionConfirmationModal/index.tsx Outdated Show resolved Hide resolved
src/pages/PoolDetails/PoolDetailsHeader.tsx Outdated Show resolved Hide resolved
src/components/DoubleLogo/index.tsx Outdated Show resolved Hide resolved
src/components/DoubleLogo/index.tsx Outdated Show resolved Hide resolved
src/components/Logo/QueryTokenLogo.tsx Outdated Show resolved Hide resolved
src/components/NavBar/SearchBarDropdown.tsx Outdated Show resolved Hide resolved

type NetworkAlertChains = keyof typeof SHOULD_SHOW_ALERT

const BG_COLORS_BY_DARK_MODE_AND_CHAIN_ID: {
Copy link
Contributor

Choose a reason for hiding this comment

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

beautiful

padding: 6px 8px;
text-decoration: none !important;
width: 100%;
const TitleText = styled(ThemedText.BodyPrimary).attrs({ fontWeight: 535 })<{ color: string }>`
Copy link
Contributor

Choose a reason for hiding this comment

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

why did you use the attrs pattern here over adding the fontWeight 535 as a style below?

Copy link
Contributor

Choose a reason for hiding this comment

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

nit: $color for var name of a css style

Copy link
Contributor Author

Choose a reason for hiding this comment

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

setting it in the style didn't work?! I've noticed I've had to manually set it in attr's lately. I can investigate why separately

src/components/NetworkAlert/NetworkAlert.tsx Outdated Show resolved Hide resolved
@just-toby just-toby removed their request for review October 10, 2023 18:47
@cartcrom
Copy link
Contributor Author

See a couple more logos left in the files. Can these be deleted?

  • src/assets/images/celoCircle.png
  • src/assets/svg/avax_logo.svg
  • src/assets/svg/bnb-logo.svg
  • src/assets/svg/celo_logo.svg
  • src/assets/svg/ethereum_square_logo.svg

There's also a function getNetworkLogoUrl that uses old images, it seems to be only used in one place. Can that be replaced as well?

eth square and celo circle can be removed! ty. the others are still used as native currency logos.

getNetworkLogoUrl is used in a cloudflare function so I don't wanna couple any changes to that in this PR

Copy link
Contributor

@cbachmeier cbachmeier left a comment

Choose a reason for hiding this comment

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

Remove unused style StyledLogo from src/components/TransactionConfirmationModal/index.tsx

{...props}
/>
)
return <PortfolioLogo currencies={useMemo(() => [currency], [currency])} chainId={chainId} {...props} />
Copy link
Contributor

Choose a reason for hiding this comment

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

another idea is instead of declaring currency as the constant above, make it

const currencies = useMemo(() => {
   return props.token ? [gqlToCurrency(props.token)] : undefined
}, [props.token])

return <PortfolioLogo currencies={currencies} chainId={chainId} {...props} />

@cartcrom cartcrom merged commit e16348e into main Oct 10, 2023
23 checks passed
@cartcrom cartcrom deleted the update_chain_logos branch October 10, 2023 22:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants