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

DSL connection: Add new default wallet toggle top bar #3448

Merged
merged 17 commits into from
Jun 12, 2023
Merged

Conversation

Shadowfiend
Copy link
Contributor

@Shadowfiend Shadowfiend commented Jun 6, 2023

To do this, we also restructure the top bar and, in the process,
the tab bar's management in CorePage. These give us the space
and tools to set up the new DAppConnection component, which now
contains the default wallet toggle and the current dApp connection's
information.

More changes in here than I would like, but it's mostly moving stuff
around from TopMenu into DAppConnection, ActiveDAppConnection, and
DAppConnectionDefaultToggle. I do want to move a lot of the permission
tomfoolery out of the components and into redux and/or the services, but
that'll be later.

Screenshot 2023-06-06 at 01 02 09

Testing

  • Toggle the top bar's default wallet setting and make sure it is doing what it's supposed to do! Including turning white when on other wallet and green when on Taho.
  • Check for fade in and fade out when interacting with the dApp connection info lightning bolt, both on tabs where you are already connected and tabs where you are not.
  • Make sure the lightning bolt is illuminated when the current tab is connected.
  • Make sure the dApp connection info is still correct when the current tab is connected.

Latest build: extension-builds-3448 (as of Mon, 12 Jun 2023 01:01:56 GMT).

Base automatically changed from dial-up-connection to main June 6, 2023 17:03
This was being handled in Popup, but these bars are really a property of
the page itself—for example, the transaction signing page has a
different top bar and no tab bar, pages like Settings have the tab bar
but no top bar, and the wallet has both.

While this commit does not move all bar handling into the pages
themselves, it does start moving the management of them into the page
definitions by having `CorePage` take charge of rendering the tab and
top bars (or not) depending on the parameters it is passed.
`onColor` and `offColor` parameters allow modifying the colors that the
toggle's bulb takes on when it's turned on as well as when it's turned
off. `leftToRight`, defaulting to `true`, indicates that the toggle is
off on the left and on when on the right. Passing it as `false` flips
the two horizontally.
Mostly this means we get to drop an extraneous div, and simplify styling
overall to let flexbox do its thing instead of forcing widths and
heights in several places.
The default toggle is always visible now, so showing the banner when a
recent change has been made is unnecessary.
This component allows the user to manage the active dApp connection, as
well as allowing them to always toggle the default wallet to/from Taho.

The popup window with information on connecting to dApps when they are
not connected yet needs some refinement for the new default connection
approach, but that will be done separately.
These had drifted from the design system at some point, and are now
anchored back to the values in Figma. All of the green shades and a few
others have been tweaked.
This needs to be paired with a delayed removal of the component from the
DOM, which cannot be handled in CSS unfortunately...
@Shadowfiend Shadowfiend marked this pull request as ready for review June 6, 2023 18:46
This gives all icons that have accessible labels also have proper
tooltips for regular users.
Copy link
Contributor

@hyphenized hyphenized left a comment

Choose a reason for hiding this comment

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

Looks good, left some comments. Are we reverting the color changes in this PR or do we want to do that in the other one and merge that here?

ui/pages/Swap.tsx Show resolved Hide resolved
Comment on lines +84 to +86
SharedToggleButton.defaultProps = {
leftToRight: true,
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's move this to default parameters

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's not really what we've been doing... If we want to do that we should systematically convert to it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

To wit:

shadowfiend@theano ~/g/t/extension /cable-connection> ag -l defaultProps | wc -l
      20

Copy link
Contributor

Choose a reason for hiding this comment

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

Ahh yeah there are also a few places where we're doing both. My reasoning is that there's no real advantage to use default props over parameter defaulting and it doesn't play well with typescript ( one known issue with forwarding refs ). Default props is also getting deprecated but, while I don't think it's happening anytime soon I feel this just provides another place where we could miss out potential bugs. If we're going back to defaultProps then I suggest we should create an issue like #1120.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would love an issue--but to move away from defaultProps. I just don't want to do it inconsistently, I think using the language feature rather than the framework feature is the right call.

For context, IIRC when we first built things out we had issues with typing and linting and param defaults which, combined with how common defaultProps was in the react literature, convinced us to stick to that to start with.

ui/public/index.css Outdated Show resolved Hide resolved
ui/public/index.css Outdated Show resolved Hide resolved
ui/components/DAppConnection/DAppConnection.tsx Outdated Show resolved Hide resolved
ui/components/Shared/SharedToggleButton.tsx Show resolved Hide resolved
@@ -36,16 +37,15 @@ export default function CorePage(props: Props): ReactElement {
align-items: center;
background-color: var(--hunter-green);
z-index: 10;
height: calc(100vh - ${barSpace}px);
margin-top: ${hasTopBar ? "0px" : "-64px"};
height: 100%;
Copy link
Contributor

Choose a reason for hiding this comment

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

This is making pages larger which adds scrolling where it not needed 👀

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, I remember having to disentangle some serious stuff when I tackled this a few months ago. I think this is the least bad option without going deep on the DOM (which I'm planning to do next week), since the bar space situation has changed with the new work.

Are there any places where this seems egregious right now?

ui/components/Core/CorePage.tsx Show resolved Hide resolved
I personally would love to make everything in CSS kebab-case, but we're
deep into using snake_case. Notably, fadeIn is in camelCase; it will
be converted to snake_case soon.
This reverts commit 76ec40e.

While there has been significant drift between these colors and the same
named ones used in Figma, checking in with design indicated that the
drift is a Figma issue. Pending a review on the design side of what's in
Figma, we're bringing these back to their current values.
@Shadowfiend
Copy link
Contributor Author

Made all of the changes I'm down for rn, but happy to discuss the other stuff further if desired!

ui/public/index.css Outdated Show resolved Hide resolved
Co-authored-by: Jorge Luis <28708889+hyphenized@users.noreply.github.com>
Copy link
Contributor

@hyphenized hyphenized left a comment

Choose a reason for hiding this comment

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

🚢 🚢 🚢

@hyphenized hyphenized merged commit a8504f6 into main Jun 12, 2023
@hyphenized hyphenized deleted the dsl-connection branch June 12, 2023 01:01
@kkosiorowska
Copy link
Contributor

I noticed one small style issue caused by these changes when the feature flag is enabled. I just reported it. #3474

@Shadowfiend
Copy link
Contributor Author

Good catch thank you!

@kkosiorowska kkosiorowska mentioned this pull request Jun 15, 2023
jagodarybacka added a commit that referenced this pull request Jun 16, 2023
## What's Changed
* Fix broken E2E test removing wallet by @michalinacienciala in
#3463
* DSL connection: Add new default wallet toggle top bar by @Shadowfiend
in #3448
* Pull asset prices from on chain oracles by @0xDaedalus in
#3264
* Cable Connection: Implement standard flow for dApp connect popup by
@Shadowfiend in #3451
* Slide On Over: Drop an unnecessary z-index on CorePage by @Shadowfiend
in #3476
* Restructure the settings page by @kkosiorowska in
#3450
* Exclude `article` and `result` types for abilities by @kkosiorowska in
#3479
* Release 0.37.0 by @Shadowfiend in
#3461


**Full Changelog**:
v0.37.0...v0.38.0

Latest build:
[extension-builds-3480](https://github.com/tahowallet/extension/suites/13630673975/artifacts/752046785)
(as of Thu, 15 Jun 2023 13:51:01 GMT).
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.

3 participants