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 approval editor #3614

Merged
merged 8 commits into from
May 7, 2024
Merged

feat: redesign approval editor #3614

merged 8 commits into from
May 7, 2024

Conversation

schmanu
Copy link
Member

@schmanu schmanu commented Apr 25, 2024

What it solves

Resolves #3607

TODO

  • Maintain order of approvals as they are in the transaction or fix update function

How this PR fixes it

  • Changes layout / design of approval editor
  • Groups approvals by spender address
  • Fetches and displays contract name for spender address

How to test it

  • Use any app that requires approvals OR transaction builder to craft specific approval payloads
  • Observe the approval editor

Screenshots

Screenshot 2024-04-25 at 13 46 12 Screenshot 2024-04-25 at 13 46 19 Screenshot 2024-04-25 at 13 46 26 Screenshot 2024-04-25 at 13 28 17

Checklist

  • I've tested the branch on mobile πŸ“±
  • I've documented how it affects the analytics (if at all) πŸ“Š
  • [] I've written a unit/e2e test for it (if applicable) πŸ§‘β€πŸ’»

Copy link

github-actions bot commented Apr 25, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: βœ… success
  • Annotations: 0 total

Report generated by eslint-plus-action

Copy link

github-actions bot commented Apr 25, 2024

πŸ“¦ Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. πŸ€–

⚠️ Global Bundle Size Increased

Page Size (compressed)
global 1006.5 KB (🟑 +184 B)
Details

The global bundle is the javascript bundle that loads alongside every page. It is in its own category because its impact is much higher - an increase to its size means that every page on your website loads slower, and a decrease means every page loads faster.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

If you want further insight into what is behind the changes, give @next/bundle-analyzer a try!

Five Pages Changed Size

The following pages changed size from the code in this PR compared to its base branch:

Page Size (compressed) First Load
/apps 50.06 KB (🟑 +3.47 KB) 1.03 MB
/apps/custom 41.68 KB (🟑 +3.47 KB) 1.02 MB
/apps/open 78.6 KB (🟑 +3.47 KB) 1.06 MB
/home 63.24 KB (🟑 +3.47 KB) 1.04 MB
/settings/safe-apps 25.33 KB (🟑 +3.47 KB) 1.01 MB
Details

Only the gzipped size is provided here based on an expert tip.

First Load is the size of the global bundle plus the bundle for the individual page. If a user were to show up to your website and land on a given page, the first load size represents the amount of javascript that user would need to download. If next/link is used, subsequent page loads would only need to download that page's bundle (the number in the "Size" column), since the global bundle has already been downloaded.

Any third party scripts you have added directly to your app using the <script> tag are not accounted for in this analysis

Next to the size is how much the size has increased or decreased compared with the base branch of this PR. If this percentage has increased by 20% or more, there will be a red status indicator applied, indicating that special attention should be given to this.

Copy link

github-actions bot commented Apr 25, 2024

Coverage report

St.❔
Category Percentage Covered / Total
🟑 Statements
79.33% (+0.26% πŸ”Ό)
11296/14239
πŸ”΄ Branches
58.76% (+0.23% πŸ”Ό)
2674/4551
🟑 Functions
66.45% (+0.35% πŸ”Ό)
1830/2754
🟒 Lines
80.61% (+0.28% πŸ”Ό)
10176/12623
Show new covered files 🐣
St.❔
File Statements Branches Functions Lines
🟒
... / EditableApprovalItem.tsx
95.65% 100% 75% 100%
🟒
... / SpenderField.tsx
100% 100% 100% 100%
Show files with reduced coverage πŸ”»
St.❔
File Statements Branches Functions Lines
🟑
... / web3.ts
70.83% (-0.6% πŸ”»)
25% 57.14%
67.57% (-0.85% πŸ”»)
🟑
... / safe-messages.ts
79.66% (-1.59% πŸ”»)
72% (-2.07% πŸ”»)
100%
77.36% (-0.82% πŸ”»)
🟒
... / SignMessage.tsx
89.89% (-1.29% πŸ”»)
83.33% (+6.06% πŸ”Ό)
66.67% (-2.56% πŸ”»)
90.7% (-1.22% πŸ”»)
🟒
... / ApprovalEditorForm.tsx
100%
50% (-25% πŸ”»)
100% 100%
🟒
... / ApprovalValueField.tsx
88.46% (-6.99% πŸ”»)
78.57% (+7.14% πŸ”Ό)
87.5% (-12.5% πŸ”»)
88% (-7.24% πŸ”»)
🟒
... / ApprovalItem.tsx
92.31% (-7.69% πŸ”»)
33.33% (-66.67% πŸ”»)
75% (-25% πŸ”»)
90.91% (-9.09% πŸ”»)
πŸ”΄
... / index.tsx
44.83% (-0.33% πŸ”»)
0% 0%
46.43% (-0.24% πŸ”»)
🟒
... / SendAmountBlock.tsx
87.5% (-12.5% πŸ”»)
0%
0% (-100% πŸ”»)
100%
🟒
... / index.tsx
75% (-25% πŸ”»)
100%
0% (-100% πŸ”»)
100%

Test suite run success

1422 tests passing in 198 suites.

Report generated by πŸ§ͺjest coverage report action from 2084973

@schmanu schmanu marked this pull request as draft April 25, 2024 13:26
@compojoom
Copy link
Contributor

works nice! No storybook?

src/components/tx/ApprovalEditor/ApprovalValueField.tsx Outdated Show resolved Hide resolved
src/components/tx/ApprovalEditor/ApprovalEditorForm.tsx Outdated Show resolved Hide resolved
src/components/tx/ApprovalEditor/ApprovalItem.tsx Outdated Show resolved Hide resolved
<Stack direction="row" alignItems="center" gap={2} className={css.approvalField}>
<Box display="flex" flexDirection="row" alignItems="center" gap="4px">
<TokenIcon size={32} logoUri={approval.tokenInfo?.logoUri} tokenSymbol={approval.tokenInfo?.symbol} />
<Typography>{approval.tokenInfo?.symbol || shortenAddress(approval.tokenAddress)}</Typography>
Copy link
Member

Choose a reason for hiding this comment

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

Imo this makes the alignment in the Box worse than before especially if we show a shortened address. Can it even happen that there is no symbol for a Token?
Screenshot 2024-04-26 at 14 31 38
Screenshot 2024-04-26 at 14 31 53

Copy link
Member

Choose a reason for hiding this comment

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

One alternative would be to show the Symbol as a Suffix to the value i.e. Set allowance to 1 COW but it seems hard to achieve in the input element. Maybe @TanyaEfremova has another idea?

Copy link
Contributor

Choose a reason for hiding this comment

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

@usame-algan I think adding a suffix to the label w
Screenshot 2024-04-26 at 10 17 42
orks!

Copy link
Member Author

Choose a reason for hiding this comment

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

I think we will have to convert these labels to template strings as it should be e.g. "Set WETH allowance to 5"
Or "Increase SAFE allowance by 20"

src/components/tx/ApprovalEditor/index.tsx Outdated Show resolved Hide resolved
@schmanu schmanu marked this pull request as ready for review April 29, 2024 06:56
Copy link

github-actions bot commented Apr 29, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: βœ… success
  • Annotations: 0 total

Report generated by eslint-plus-action

@schmanu schmanu requested a review from usame-algan May 2, 2024 07:57
Copy link
Member

@usame-algan usame-algan left a comment

Choose a reason for hiding this comment

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

Just have a small adjustment for the readOnly mode but looks good otherwise πŸ‘

Copy link

github-actions bot commented May 2, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: βœ… success
  • Annotations: 0 total

Report generated by eslint-plus-action

@liliya-soroka
Copy link
Member

  1. Change the text under what is Allow access to the text from the design
image

@liliya-soroka
Copy link
Member

  1. Question about the spender truncated address view.
    Could we truncate the address only for the low-resolution?
image image

@schmanu
Copy link
Member Author

schmanu commented May 3, 2024

  1. Change the text under what is Allow access to the text from the design
image

As part of the review this was changed. Tanya also confirmed this change: See here

@liliya-soroka
Copy link
Member

Validation error confusing
image

Copy link

github-actions bot commented May 7, 2024

ESLint Summary View Full Report

Annotations are provided inline on the Files Changed tab. You can also see all annotations that were generated on the annotations page.

Type Occurrences Fixable
Errors 0 0
Warnings 0 0
Ignored 0 N/A
  • Result: βœ… success
  • Annotations: 0 total

Report generated by eslint-plus-action

@schmanu schmanu merged commit 1e1597d into dev May 7, 2024
14 checks passed
@schmanu schmanu deleted the feat/redesign-approval-editor branch May 7, 2024 07:48
@github-actions github-actions bot locked and limited conversation to collaborators May 7, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Redesign Approval editor
5 participants