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: redesign send rpc transfer flow #6000

Merged
merged 1 commit into from
Dec 17, 2024

Conversation

alter-eggo
Copy link
Collaborator

@alter-eggo alter-eggo commented Dec 9, 2024

Try out Leather build f56dbcdExtension build, Test report, Storybook, Chromatic

redesign rpc send transfer using approver ux

Copy link
Collaborator

@kyranjamie kyranjamie left a comment

Choose a reason for hiding this comment

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

Great work @alter-eggo, leaving some comments.

I'll merge my PR now, which has some of the changes to focusTab helper you can use here

src/app/common/focus-tab.ts Outdated Show resolved Hide resolved
Comment on lines 119 to 120
titleLeft: capitalize(type),
captionLeft: time,
Copy link
Collaborator

Choose a reason for hiding this comment

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

Shouldn't these presentation/formatting concerns be directly in component?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

we will use it in other bitcoin flows as well, so prefer keep in this file, though took it out of fees hook

src/app/components/error/form-error.tsx Outdated Show resolved Hide resolved
src/app/components/fees/fee-item-icon.tsx Outdated Show resolved Hide resolved
src/app/pages/rpc-send-transfer/rpc-send-transfer.tsx Outdated Show resolved Hide resolved
src/app/pages/rpc-send-transfer/rpc-send-transfer.tsx Outdated Show resolved Hide resolved
@alter-eggo alter-eggo force-pushed the feat/redesign-send-transfer branch from b4cd122 to 7489cae Compare December 11, 2024 12:31
@alter-eggo alter-eggo marked this pull request as ready for review December 11, 2024 12:52
@@ -1,34 +1,245 @@
import { useMemo, useState } from 'react';
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe you can use a .layout file to help split this up between logic and presentation?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

don't understand how to split tbh and why need? what should be in .layout?

Copy link
Collaborator

@kyranjamie kyranjamie Dec 12, 2024

Choose a reason for hiding this comment

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

There are components with many style props, can't they be in a layout component?

In getAddresses the entire Approver component is in the layout, such that the root RPC compoent can be focused on business logic/event passing behaviours, and not layout and styles.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

looking at this file I believe main problem here is with huge approve logic. I will try to move this to sep file.
actually we'll need this in other bitcoin related flows as well

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

same with selected fee

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

and prob then will be way easier to move it to layout file. will try

Copy link
Contributor

@pete-watters pete-watters left a comment

Choose a reason for hiding this comment

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

Great work here @alter-eggo 🚀 huge PR!

I added a few suggestions but looking good to me overall

@alter-eggo alter-eggo force-pushed the feat/redesign-send-transfer branch 2 times, most recently from 0703d98 to b1af26d Compare December 11, 2024 23:08
Copy link
Contributor

@fbwoolf fbwoolf left a comment

Choose a reason for hiding this comment

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

Nice work @alter-eggo! I migrated some of the bitcoin fees code to the mono repo for mobile. I have an issue open to install it back into the extension to make sure it is shared, but that can come later.

feeType: type,
feeRate: feeRate ?? 0,
baseUnitsValue: baseUnitsFeeValue ?? 0,
titleLeft: capitalize(type),
Copy link
Collaborator

@kyranjamie kyranjamie Dec 12, 2024

Choose a reason for hiding this comment

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

Building on earlier comment, why don't we do the capitalize in the view too? How we format/present data is a concern of the UI so better lives where it's set to a component.

My thinking is that if I as a dev need to go and make visual changes, they can be mostly scoped to a set of .layout components. But in this file, we have a mix of mathematics and formatting, that I can't help but feel should live separately.

e.g. <style.span>{capitalize(type)}</styled.span>

Then, the utils file knows nothing about where (titleLeft), or how (capitalised), the data needs to be displayed, focusing on accurate data only.

What's your thinking for putting it here, and are there reasons I'm missing why it's beneficial to group it here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I tried to do FeeItem as dumb as possible, so general idea here was to gen and pass ready to use parts of the fee component, title/caption left/right

yeah, maybe better to capitalize in component itself, and so remove titleLeft, I just thought it would be better to keep all these parts in one place.

so in stx I can do the same - get raw fee => then gen ready to use parts of fee component

Then, the utils file knows nothing about where (titleLeft), or how (capitalised), the data needs to be displayed, focusing on accurate data only.

if not utils so what's the best place to keep it? other way btw - create bitcoin fee wrapper for shared fee item and keep this logic there

@markmhendrickson
Copy link
Collaborator

markmhendrickson commented Dec 12, 2024

Looking good! Some QA feedback:

  • App favicon isn't showing up in the header
  • "Total spend" doesn't include the fee amount
  • Guide URL takes user to https://leather.io/guides/connect-dapps instead of a relevant guide for sending BTC via an app
  • Do we want to say "Send bitcoin" instead of "Send BTC"? cc @fabric-8 @mica000
  • I'd suggest some additional design QA (by a designer) to double check text styling / sizes, padding, etc.
  • Header for edit fee screen has unexpected top and bottom padding in beige

image
image

@alter-eggo alter-eggo force-pushed the feat/redesign-send-transfer branch from b1af26d to 699bf7d Compare December 13, 2024 13:51
@fabric-8
Copy link
Contributor

Looking great, only some minor feedback:

CleanShot 2024-12-13 at 15 56 38@2x

  • animal icon stroke width are too thin, should generally be same as for the other icons. Maybe they are getting scaled because there's a mismatch of height/width it needs (32x32) vs. actual size after some... padding is applied? If I can help by adjusting the asset lmk, the animation icons are 32x32 vs. 24x24, if turning them into 24x24 fixes this issue I can do it

CleanShot 2024-12-13 at 15 54 43@2x

  • Since were are using the > to indicate that the user can interact with the item (like for account on top), I think we should also add the > to fee settings for consistency cc @mica000

CleanShot 2024-12-13 at 16 01 53@2x

  • Realising that "cancel" in fee settings might get misinterpreted to "cancel the whole approval thing" - Maybe using the word "back" would be better here? cc @markmhendrickson

  • Let's add border-top: 1px solid ink.border-default to the footer

@mica000
Copy link

mica000 commented Dec 13, 2024

This is looking great @alter-eggo! Really nice to see it coming together! Bravo 👏

@mica000
Copy link

mica000 commented Dec 13, 2024

Are we covering advanced details as well on this PR? And is this only for BTC or for STX as well?
If so, here are the details we would need to trigger for Asset transfer BTC and AssetTransferSTX

@mica000
Copy link

mica000 commented Dec 13, 2024

@fabric-8 @markmhendrickson Curious about what you think of the prompt, as it shouldn't show the icon of the application since we are already showing this on the request by. However, it is quite nice to have some reassuring of the app you are connecting to:
CleanShot 2024-12-13 at 18 12 23@2x

Here is how it was intended to work and the respective designs
CleanShot 2024-12-13 at 18 10 12@2x

@mica000
Copy link

mica000 commented Dec 13, 2024

@markmhendrickson @fabric-8 We might not have explicitly specified this in the approval documentation, but when connecting to a BTC account, the total balance should be calculated solely for BTC. Including other assets in the calculation could confuse users, especially if they meet the required balance but not in BTC. Thoughts? And if so, should this be in this PR or a later improvment?

@mica000
Copy link

mica000 commented Dec 13, 2024

Account selection: When selecting an account does it make sense to show create account cta? Maybe better to hide it?
CleanShot 2024-12-13 at 17 41 19@2x

@mica000
Copy link

mica000 commented Dec 13, 2024

Looking great, only some minor feedback:

CleanShot 2024-12-13 at 15 56 38@2x

  • animal icon stroke width are too thin, should generally be same as for the other icons. Maybe they are getting scaled because there's a mismatch of height/width it needs (32x32) vs. actual size after some... padding is applied? If I can help by adjusting the asset lmk, the animation icons are 32x32 vs. 24x24, if turning them into 24x24 fixes this issue I can do it

CleanShot 2024-12-13 at 15 54 43@2x

  • Since were are using the > to indicate that the user can interact with the item (like for account on top), I think we should also add the > to fee settings for consistency cc @mica000

CleanShot 2024-12-13 at 16 01 53@2x

  • Realising that "cancel" in fee settings might get misinterpreted to "cancel the whole approval thing" - Maybe using the word "back" would be better here? cc @markmhendrickson
  • Let's add border-top: 1px solid ink.border-default to the footer

Yes for adding > to fee settings for consistency

@markmhendrickson
Copy link
Collaborator

markmhendrickson commented Dec 14, 2024

Realising that "cancel" in fee settings might get misinterpreted to "cancel the whole approval thing" - Maybe using the word "back" would be better here? cc @markmhendrickson

Agreed

Curious about what you think of the prompt, as it shouldn't show the icon of the application since we are already showing this on the request by. However, it is quite nice to have some reassuring of the app you are connecting to:

I do like the idea of including the app icon, though it takes up a lot of space in the current prompt design. It seems perhaps best to just rely on this placement so we don't push the other content below the fold?

image

We might not have explicitly specified this in the approval documentation, but when connecting to a BTC account, the total balance should be calculated solely for BTC. Including other assets in the calculation could confuse users, especially if they meet the required balance but not in BTC. Thoughts? And if so, should this be in this PR or a later improvment?

It seems best that we either 1) show just a fiat value (for the total account value including all assets, as here in the PR currently) or 2) show the fiat value for the specific asset in question (e.g. BTC value in USD here) and that asset's literal value (e.g. BTC balance itself here) right below it, as in your designs. By placing these two values together vertically, it'll presumably be clear to the user just which subset of value they're looking at it in this context.

We could add this enhancement (2) later or tackle as part of this PR – both work for me.

@alter-eggo alter-eggo force-pushed the feat/redesign-send-transfer branch from 699bf7d to f2f8a70 Compare December 16, 2024 11:44
@alter-eggo
Copy link
Collaborator Author

alter-eggo commented Dec 16, 2024

  • removed app icon
  • fixed icons
  • added chevron in fees item and border in footer actions
  • changed cancel to back

Screenshot 2024-12-16 at 15 43 30
Screenshot 2024-12-16 at 15 43 00
Screenshot 2024-12-16 at 15 42 52

@mica000 re: create new acc btn - I'd prefer to do it in sep pr since will lead to some refactoring, which I don't want to do here, since pr is already quite big

@alter-eggo alter-eggo force-pushed the feat/redesign-send-transfer branch from f2f8a70 to 1362849 Compare December 16, 2024 12:09
@mica000
Copy link

mica000 commented Dec 16, 2024

Thanks @alter-eggo!

Icons for fees remains 1 px stroke?
CleanShot 2024-12-16 at 11 50 34@2x

@mica000
Copy link

mica000 commented Dec 16, 2024

@alter-eggo About the account picker cta, no worries!

In relation to the component on the approval however, lets do the second option suggested by @markmhendrickson in this comment?

  1. show the fiat value for the specific asset in question (e.g. BTC value in USD here) and that asset's literal value (e.g. BTC balance itself here) right below it, as in your designs. By placing these two values together vertically, it'll presumably be clear to the user just which subset of value they're looking at it in this context.

In add, @markmhendrickson I believe we can hide one of the address, depending on the network being used.
so it would look more like this:
CleanShot 2024-12-16 at 12 00 09@2x

@alter-eggo alter-eggo force-pushed the feat/redesign-send-transfer branch from 1362849 to 92be09a Compare December 17, 2024 10:03
@alter-eggo
Copy link
Collaborator Author

@mica000 done
Screenshot 2024-12-17 at 14 01 40 1

@mica000
Copy link

mica000 commented Dec 17, 2024

@alter-eggo thanks! Looking good!

@camerow camerow changed the base branch from dev to feat/display-sbtc December 17, 2024 20:04
@camerow camerow force-pushed the feat/redesign-send-transfer branch from 92be09a to f56dbcd Compare December 17, 2024 20:09
@fbwoolf fbwoolf merged commit 0b53769 into feat/display-sbtc Dec 17, 2024
19 checks passed
@fbwoolf fbwoolf deleted the feat/redesign-send-transfer branch December 17, 2024 20:23
@markmhendrickson
Copy link
Collaborator

@alter-eggo it appears this change is still needed given my latest testing:

Guide URL takes user to https://leather.io/guides/connect-dapps instead of a relevant guide for sending BTC via an app

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.

7 participants