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

Move CSS reset, font loading and theme switch outside React to prevent flicker #494

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

Danziger
Copy link
Contributor

@Danziger Danziger commented Oct 15, 2024

  • Add different icons for development (plasmo does that automatically but we were overriding that from JS).
  • Move CSS reset and font definitions to a CSS file to remove font loading flicker.
  • Unify theme logic into a single provider and persist background color in localStorage to remove theme flicker.

@Danziger Danziger marked this pull request as draft October 15, 2024 08:24
@Danziger Danziger changed the base branch from production to development October 15, 2024 08:25
@@ -26,10 +26,9 @@ export const Wrapper = styled(motion.div)<{
expanded?: boolean;
}>`
position: relative;
width: ${(props) => (props.responsive ? "100%" : "377.5px")};
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This .5 seem to fix some rendering issues (underflow) in some cases but cause another issue (overflow) in some other cases. I'd just leave it as 377px which is the actual value this should have everywhere and fix it later by laying out the components differently.

min-height: ${(props) => (props.expanded ? "100vh" : "600px")};
max-height: max-content;
background-color: rgb(${(props) => props.theme.background});
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The background is set on the body by the ThemeProvider in the components library, so no need to set it again here.

src/popup.tsx Outdated
</ExpandedViewWrapper>
</HardwareWalletTheme>
</Provider>
<ArConnectThemeProvider>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ArConnectThemeProvider replaces Provider + HardwareWalletTheme and used the useTheme hook internally.

@@ -356,7 +372,50 @@ export default function Transaction({ id: rawId, gw, message }: Props) {
{browser.i18n.getMessage("transaction_from")}
</PropertyName>
<PropertyValue>
{formatAddress(transaction.owner.address, 6)}
<div>
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Eventually, it would be better to turn this into a bunch of individual components.

In any case, the reason for this change is that before the UI would only prompt users to add the "to" address as contact. After this change, it would prompt for both "to" and "from", and it would also take into account if an address is yours and display "(you)" next to it.

@Danziger Danziger marked this pull request as ready for review October 15, 2024 10:59
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.

1 participant