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

Fix: add chain check in Delete Tx modal #4656

Merged
merged 3 commits into from
Dec 18, 2024
Merged

Fix: add chain check in Delete Tx modal #4656

merged 3 commits into from
Dec 18, 2024

Conversation

katspaugh
Copy link
Member

What it solves

This modal was lacking a check for the current chain causing cryptic error messages.

Screenshot 2024-12-13 at 12 53 00

Copy link

github-actions bot commented Dec 13, 2024

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Code review by ChatGPT

{isLoading ? <CircularProgress size={20} /> : 'Yes, delete'}
</Button>
)}
</CheckWallet>
</DialogActions>
</Dialog>
)

Choose a reason for hiding this comment

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

  1. Avoid inline styles like sx={{ minWidth: '122px', minHeight: '36px' }}. Use styled-components or a CSS class for maintainability.
  2. Consider extracting the <CheckWallet> rendering logic from the component to adhere to the Single Responsibility Principle by separating business logic from UI presentation.

@@ -79,7 +79,7 @@ const DeleteTxButton = ({
<Tooltip
arrow
placement="top"
title={isDeletable ? '' : 'You can only delete the last transaction in the queue or duplicates'}
title={isDeletable ? '' : 'You can only delete the last transaction in the queue, or a duplicate transaction.'}
>
<span style={{ width: '100%' }}>
<Track {...REJECT_TX_EVENTS.DELETE_OFFCHAIN_BUTTON} as="div">

Choose a reason for hiding this comment

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

Consider extracting the inline style for the <span> to a CSS class to enhance readability and maintainability. This aligns with best practices to avoid inline styles and keeps styles centralized.

Copy link

github-actions bot commented Dec 13, 2024

📦 Next.js Bundle Analysis for safe-wallet-web

This analysis was generated by the Next.js Bundle Analysis action. 🤖

🎉 Global Bundle Size Decreased

Page Size (compressed)
global 1016.48 KB (-1 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!

Copy link

github-actions bot commented Dec 13, 2024

Coverage report

St.
Category Percentage Covered / Total
🟡 Statements
73.91% (-0.01% 🔻)
14399/19483
🔴 Branches
51.44% (-0.01% 🔻)
3437/6681
🔴 Functions 56.86% 2044/3595
🟡 Lines
75.44% (-0.01% 🔻)
13059/17311
Show files with reduced coverage 🔻
St.
File Statements Branches Functions Lines
🟢
... / useTxPendingStatuses.ts
77.5% (-0.83% 🔻)
64.06% (-1.56% 🔻)
68.18%
86.41% (-0.97% 🔻)

Test suite run success

1712 tests passing in 232 suites.

Report generated by 🧪jest coverage report action from 6bc704a

color="primary"
onClick={onConfirm}
disabled={!isOk || isLoading}
sx={{ minWidth: '122px', minHeight: '36px' }}
Copy link
Contributor

Choose a reason for hiding this comment

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

can we extend this component to avoid "inline" styles?

@clovisdasilvaneto
Copy link
Contributor

Would be nice if we can cover it with unit tests by the way

@francovenica
Copy link
Contributor

Gotta say never thought about this. Well spotted.

Looks good to me.

@katspaugh katspaugh merged commit 8423515 into dev Dec 18, 2024
15 checks passed
@katspaugh katspaugh deleted the deletetx branch December 18, 2024 08:01
@github-actions github-actions bot locked and limited conversation to collaborators Dec 18, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants