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: copiable-addresses, execute-button and etherscan-redirection #62

Merged

Conversation

kemuru
Copy link
Contributor

@kemuru kemuru commented Jun 13, 2024

PR-Codex overview

This PR adds transactionHash to various components and functions, updates button logic, and improves address display in the UI.

Detailed summary

  • Added transactionHash to components and functions
  • Updated button logic for transactions
  • Improved address display in the UI

The following files were skipped due to too many changes: subgraph/mappings/escrow.ts, web/src/assets/svgs/icons/etherscan.svg, web/src/components/PreviewCard/Terms/Description.tsx

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

Summary by CodeRabbit

  • New Features

    • Added ExecuteTransactionButton component for executing transactions.
    • Enhanced PreviewCard and TransactionInfo components to display and copy ENS names for addresses.
  • Improvements

    • PreviewCard component now includes transactionHash.
    • Simplified props for AcceptSettlementButton by removing toggleModal.
  • Bug Fixes

    • Updated address checks in shortenAddress function to handle empty addresses.
  • UI Enhancements

    • Header component now links to Etherscan based on transactionHash.
  • Error Handling

    • Introduced toast notifications for errors in user settings.
  • Refactor

    • Refactored Buttons component to PreviewCardButtons with conditional logic for ExecuteTransactionButton.
  • GraphQL Schema

    • Added transactionHash field to Escrow type.

Copy link

netlify bot commented Jun 13, 2024

Deploy Preview for kleros-escrow-v2 ready!

Name Link
🔨 Latest commit 883f8bc
🔍 Latest deploy log https://app.netlify.com/sites/kleros-escrow-v2/deploys/666d60048ebe270008b8a1bf
😎 Deploy Preview https://deploy-preview-62--kleros-escrow-v2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@kemuru kemuru changed the title feat: copiable addresses feat: copiable-addresses, execute-button and etherscan-redirection Jun 13, 2024
Copy link
Contributor

coderabbitai bot commented Jun 13, 2024

Walkthrough

This update enhances several components across the project, focusing on integrating new properties, refactoring existing logic, and improving user experiences. Key changes include adding a transactionHash property for better tracking, introducing a new ExecuteTransactionButton component, improving address handling with ENS name resolution and copy functionality, and utilizing react-toastify for error notifications. Minor logic adjustments and graphical tweaks further optimize the overall user interface and functionality.

Changes

File(s) Change Summary
web/src/components/PreviewCard/index.tsx Added transactionHash property to the PreviewCard component, updated interface and component usage.
web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/AcceptSettlementButton.tsx Removed toggleModal prop.
web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/ExecuteTransactionButton.tsx Added new ExecuteTransactionButton component and related imports.
web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/index.tsx Added ExecuteTransactionButton to PreviewCardButtons with conditional rendering logic.
web/src/components/PreviewCard/Terms/Description.tsx Introduced Copiable, useEnsName imports to enhance address display with ENS resolution and copy capability.
web/src/components/TransactionInfo/index.tsx Added Copiable and useEnsName imports for improved address representation and copying features.
web/src/utils/shortenAddress.ts Added a check for an empty address in shortenAddress function.
subgraph/mappings/escrow.ts Updated createEscrow function to include and use transactionHash parameter. Modified event handlers accordingly.
subgraph/schema.graphql Added transactionHash field to Escrow type in GraphQL schema.
web/src/components/PreviewCard/Header.tsx Enhanced Header to display Etherscan link using transactionHash.
web/src/hooks/queries/useTransactionsQuery.ts Included transactionHash in transactionFragment query results.
web/src/pages/MyTransactions/TransactionDetails/index.tsx Added transactionHash prop to the TransactionDetails component.
web/src/hooks/queries/useUserSettings.tsx Introduced react-toastify for displaying error messages when user settings fetch fails.
web/src/pages/NewTransaction/NavigationButtons/NextButton.tsx Modified email check logic to handle an empty string comparison more efficiently.

Sequence Diagram

sequenceDiagram
    participant User
    participant PreviewCard
    participant Header
    participant ExecuteTransactionButton
    participant Backend
    
    User->>+PreviewCard: Load Component
    PreviewCard->>+Header: Pass transactionHash
    Header-->>-PreviewCard: Render with Etherscan link
    
    User->>+ExecuteTransactionButton: Click Execute
    ExecuteTransactionButton->>+Backend: Send Transaction Request
    Backend-->>-ExecuteTransactionButton: Response with Status
    ExecuteTransactionButton-->>-User: Update UI based on Status
Loading

Poem

In code so fine, our changes weave,
Transaction hashes now retrieve.
Buttons new, with logic neat,
Ensuring every user's feat. 🌟
With toasts that pop on errors found,
Our interface, so sweetly sound.
Hoppy coding, without bounds! 🐇💻


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share
Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Outside diff range and nitpick comments (1)
web/src/utils/shortenAddress.ts (1)

Line range hint 6-14: Ensure proper error handling of getAddress. Consider adding a specific error message for better user feedback.

- throw new TypeError("Invalid input, address can't be parsed");
+ throw new TypeError("Invalid input, address can't be parsed: " + address);
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1d5be3b and ccf6c6a.

Files selected for processing (3)
  • web/src/components/PreviewCard/Terms/Description.tsx (3 hunks)
  • web/src/components/TransactionInfo/index.tsx (4 hunks)
  • web/src/utils/shortenAddress.ts (1 hunks)
Additional comments not posted (3)
web/src/utils/shortenAddress.ts (1)

4-4: Good addition to handle empty addresses to prevent errors.

web/src/components/PreviewCard/Terms/Description.tsx (1)

4-7: Integration of Copiable and useEnsName enhances address display and interaction. Ensure that the fallback to shortenAddress behaves correctly when ENS names are not available.

Also applies to: 18-21, 23-25, 53-58

Verification successful

The code in web/src/components/PreviewCard/Terms/Description.tsx correctly implements a fallback to shortenAddress when ENS names are not available, as shown by the lines:

const displayBuyerAddress = buyerEns.data || shortenAddress(buyerAddress);
const displaySellerAddress = sellerEns.data || shortenAddress(sellerAddress);

This ensures that if buyerEns.data or sellerEns.data is undefined, the shortened address will be used instead.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the fallback behavior when ENS names are not available.

# Test: Search for usages of `useEnsName` and check the fallback logic.
rg --type jsx $'useEnsName'

Length of output: 54



Script:

#!/bin/bash
# Description: Verify the fallback behavior when ENS names are not available.

# Test: Search for usages of `useEnsName` and check the fallback logic.
rg --glob '*.tsx' 'useEnsName'

Length of output: 980



Script:

#!/bin/bash
# Description: Extract relevant code sections from `PreviewCard/Terms/Description.tsx` to inspect the fallback logic.

# Extract lines containing `useEnsName` and surrounding context to verify fallback behavior.
rg --glob 'web/src/components/PreviewCard/Terms/Description.tsx' -A 5 -B 5 'useEnsName'

Length of output: 2015

web/src/components/TransactionInfo/index.tsx (1)

4-9: Consistent use of Copiable and useEnsName across components. Verify the component's behavior in different contexts, especially in preview mode.

Also applies to: 97-157

Verification successful

Consistent use of isPreview across multiple components and files has been verified. The TransactionInfo component and its related components handle isPreview correctly.

  • web/src/components/TransactionInfo/index.tsx contains multiple instances of isPreview being used for conditional rendering, ensuring proper behavior in preview mode.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the behavior of `TransactionInfo` in preview mode.

# Test: Search for conditional rendering based on `isPreview`.
rg --type jsx $'isPreview'

Length of output: 53



Script:

#!/bin/bash
# Description: Verify the behavior of `TransactionInfo` in preview mode.

# Test: Search for conditional rendering based on `isPreview`.
rg --type tsx $'isPreview'

Length of output: 53



Script:

#!/bin/bash
# Description: Verify the behavior of `TransactionInfo` in preview mode.

# Test: Search for conditional rendering based on `isPreview`.
rg --type tsx 'isPreview'

Length of output: 53



Script:

#!/bin/bash
# Description: Verify the behavior of `TransactionInfo` in preview mode.

# Test: Search for conditional rendering based on `isPreview`.
rg 'isPreview'

Length of output: 5302

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 1d5be3b and 84b72db.

Files selected for processing (3)
  • web/src/components/PreviewCard/Terms/Description.tsx (3 hunks)
  • web/src/components/TransactionInfo/index.tsx (4 hunks)
  • web/src/utils/shortenAddress.ts (1 hunks)
Additional comments not posted (5)
web/src/utils/shortenAddress.ts (1)

Line range hint 6-17: Ensure robust error handling for address parsing.

The function correctly handles cases where the address cannot be parsed by throwing a TypeError. This is a good practice for error management in utility functions.

web/src/components/PreviewCard/Terms/Description.tsx (2)

4-7: Ensure all new imports are used effectively throughout the component.

The imports for Copiable, useEnsName, and shortenAddress are correctly utilized within the component to enhance address display functionality.


53-70: Validate the logic for displaying addresses with ENS support.

The logic to display either the ENS name or the shortened address using a ternary operator is a clean and effective way to handle conditional rendering based on available data.

Also applies to: 76-84

web/src/components/TransactionInfo/index.tsx (2)

4-9: Ensure all new imports are used effectively throughout the component.

The imports for Copiable, useEnsName, and shortenAddress are correctly utilized within the component, similar to Description.tsx, to enhance the address display functionality.


Line range hint 97-157: Review the conditional rendering of addresses in the TransactionInfo component.

The conditional rendering based on the isPreview prop is a good use of React's capabilities to adapt component behavior based on props.

web/src/utils/shortenAddress.ts Show resolved Hide resolved
coderabbitai[bot]
coderabbitai bot previously approved these changes Jun 13, 2024
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 2

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 84b72db and 7438c1d.

Files ignored due to path filters (1)
  • web/src/assets/svgs/icons/etherscan.svg is excluded by !**/*.svg
Files selected for processing (6)
  • subgraph/mappings/escrow.ts (8 hunks)
  • subgraph/schema.graphql (1 hunks)
  • web/src/components/PreviewCard/Header.tsx (2 hunks)
  • web/src/components/PreviewCard/index.tsx (3 hunks)
  • web/src/hooks/queries/useTransactionsQuery.ts (1 hunks)
  • web/src/pages/MyTransactions/TransactionDetails/index.tsx (2 hunks)
Additional comments not posted (6)
subgraph/schema.graphql (1)

44-44: The addition of the transactionHash field as a non-nullable type is a robust choice for tracking transactions in the Escrow schema.

web/src/hooks/queries/useTransactionsQuery.ts (1)

23-23: The addition of the transactionHash field in the TransactionDetails fragment aligns well with the schema changes and ensures that transaction details are fetched correctly.

Verification successful

The transactionHash field is being correctly utilized in multiple components and contexts within the codebase. It is referenced in components such as PreviewCard and TransactionDetails, ensuring that the transaction details, including the transactionHash, are properly integrated and displayed in the UI.

  • Confirmed usage in PreviewCard and TransactionDetails components.
  • Proper integration within the useTransactionsQuery hook.
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the correct usage of the transactionHash field in UI components.

# Test: Search for the usage of the TransactionDetails fragment in UI components.
fd --exec rg 'TransactionDetails'

Length of output: 63055



Script:

#!/bin/bash
# Description: Verify the correct usage of the transactionHash field in UI components.

# Test: Search for the usage of the transactionHash field in the relevant files.
fd --exec rg 'transactionHash' ./web/src/pages/MyTransactions ./web/src/components ./web/src/hooks/queries ./web/src/context

Length of output: 428358

web/src/components/PreviewCard/index.tsx (1)

57-57: The integration of the transactionHash property in the PreviewCard component and its correct propagation to the Header component is well-implemented. Ensure that the full integration path of transactionHash from the GraphQL layer to the UI is tested.

Also applies to: 102-102

Verification successful

The initial verification shows that the transactionHash property is used in various files. To ensure that the full integration path from the GraphQL layer to the UI is correctly implemented, we need to verify the following:

  1. GraphQL Schema: Ensure transactionHash is defined in the GraphQL schema.
  2. GraphQL Queries: Verify that transactionHash is queried in GraphQL queries.
  3. React Components: Check that transactionHash is passed down and used in the React components.

Let's generate shell scripts to verify these aspects.


The transactionHash property is correctly defined in the GraphQL schema, queried in the GraphQL queries, and used in the React components. This confirms the full integration path from the GraphQL layer to the UI.

  • subgraph/schema.graphql: transactionHash: Bytes!
  • web/src/hooks/queries/useTransactionsQuery.ts: transactionHash
  • web/src/components/PreviewCard/index.tsx: transactionHash is passed to the Header component and used.

The integration of the transactionHash property is well-implemented.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify the full integration path of the transactionHash property from the GraphQL layer to the UI.

# Test: Search for the usage of the transactionHash property in the UI components.
fd --exec rg 'transactionHash'

Length of output: 11803



Script:

#!/bin/bash
# Verify that `transactionHash` is defined in the GraphQL schema
rg 'transactionHash' --glob '*.graphql'

# Verify that `transactionHash` is queried in GraphQL queries
rg 'transactionHash' --glob '*.ts'

# Verify that `transactionHash` is used in React components
rg 'transactionHash' --glob '*.tsx'

Length of output: 1258

web/src/pages/MyTransactions/TransactionDetails/index.tsx (1)

100-100: The transactionHash is passed correctly to the PreviewCard component. Confirm that PreviewCard handles this new prop effectively.

Verification successful

The PreviewCard component in web/src/components/PreviewCard/index.tsx does handle the transactionHash prop. It is defined as a string and is used within the component.

  • web/src/components/PreviewCard/index.tsx
    • transactionHash: string;
    • transactionHash,
    • <Header {...{ escrowType, escrowTitle, status, transactionHash, isCard: false }} />
Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify if `PreviewCard` component handles `transactionHash` prop.
ast-grep --lang javascript --pattern $'const PreviewCard = $_ => {
  $$$
  transactionHash: $_,
  $$$
}'

Length of output: 105



Script:

#!/bin/bash
# Locate the PreviewCard component definition
rg 'const PreviewCard' --files-with-matches | xargs -I {} sh -c 'echo "File: {}"; rg "const PreviewCard" {}'

# Inspect the implementation of PreviewCard for handling the transactionHash prop
rg 'PreviewCard' | xargs -I {} sh -c 'echo "File: {}"; rg "transactionHash" {}'

Length of output: 3315



Script:

#!/bin/bash
# Inspect the PreviewCard component implementation for handling the transactionHash prop
rg 'transactionHash' web/src/components/PreviewCard/index.tsx

Length of output: 195

subgraph/mappings/escrow.ts (2)

135-135: The transactionHash parameter is correctly used in the handleNativeTransactionCreated and handleERC20TransactionCreated events to create or update escrow records. This is a crucial update for tracking transactions directly in the subgraph. Ensure that the transaction hash is always available when these events are triggered.

Also applies to: 167-167


Line range hint 25-37: The addition of transactionHash to the createEscrow function is well-implemented. It ensures that every new escrow record now tracks the transaction hash. Ensure that all calls to createEscrow are updated to pass this new parameter.

Verification successful

The search results show that the createEscrow function is called in two places within the subgraph/mappings/escrow.ts file:

  1. Inside the handleNativeTransactionCreated function
  2. Inside the handleERC20TransactionCreated function

Both instances include the transactionHash parameter as expected.

  • handleNativeTransactionCreated: createEscrow(escrowId, event.transaction.hash)
  • handleERC20TransactionCreated: createEscrow(escrowId, event.transaction.hash)

This confirms that all calls to createEscrow have been updated to pass the new transactionHash parameter.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify all calls to `createEscrow` include the new `transactionHash` parameter.
ast-grep --lang javascript --pattern $'createEscrow($$$, $_)'

Length of output: 62



Script:

#!/bin/bash
# Description: Find all instances of `createEscrow` calls and verify they include the `transactionHash` parameter.
rg 'createEscrow\(' --context 2

Length of output: 1182

@kemuru kemuru marked this pull request as ready for review June 14, 2024 16:26
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

Outside diff range and nitpick comments (2)
web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/index.tsx (2)

21-27: The IPreviewCardButtons interface is well-defined, clearly indicating the props required for the component. Ensure that these props are properly documented to improve maintainability.


Line range hint 93-134: The conditional logic for displaying the ExecuteTransactionButton is sound, ensuring it only appears under specific conditions. However, consider adding a comment explaining the condition status === "NoDispute" && currentTime >= settlementTimeout for clarity.

+ // Display the ExecuteTransactionButton only when there is no dispute and the current time is beyond the settlement timeout.
Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 7438c1d and efdfbcb.

Files selected for processing (4)
  • web/src/components/PreviewCard/index.tsx (5 hunks)
  • web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/AcceptSettlementButton.tsx (1 hunks)
  • web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/ExecuteTransactionButton.tsx (1 hunks)
  • web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/index.tsx (4 hunks)
Files skipped from review due to trivial changes (1)
  • web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/AcceptSettlementButton.tsx
Files skipped from review as they are similar to previous changes (1)
  • web/src/components/PreviewCard/index.tsx
Additional context used
Learnings (1)
web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/index.tsx (1)
User: kemuru
PR: kleros/escrow-v2#60
File: web/src/pages/NewTransaction/NavigationButtons/DepositPaymentButton.tsx:180-180
Timestamp: 2024-06-11T17:11:32.906Z
Learning: The `refetchAllowance` function call is necessary in the `DepositPaymentButton` component to ensure the frontend updates correctly after an approval action.
Additional comments not posted (1)
web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/index.tsx (1)

12-12: The import of ExecuteTransactionButton is correctly placed and follows the project's modular structure.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between efdfbcb and 883f8bc.

Files selected for processing (2)
  • web/src/hooks/queries/useUserSettings.tsx (2 hunks)
  • web/src/pages/NewTransaction/NavigationButtons/NextButton.tsx (1 hunks)
Additional comments not posted (2)
web/src/hooks/queries/useUserSettings.tsx (1)

27-27: Proper implementation of error handling using react-toastify.

Ensure that the OPTIONS object from utils/wrapWithToast is appropriately configured to handle the toast appearance and behavior as expected.

web/src/pages/NewTransaction/NavigationButtons/NextButton.tsx (1)

92-92: Updated email validation logic to include empty string check.

Ensure this logic works as expected in scenarios where the email is empty, a valid email, or invalid. Consider adding unit tests to cover these cases.

Verification successful

The provided context confirms that the email validation logic has been updated to include an empty string check. This ensures that notificationEmail is either the same as userSettings.email or an empty string. This change appears to be a good practice to ensure robustness.

The new logic is as follows:

![userSettings.email, ""].includes(notificationEmail)

This checks if notificationEmail is neither the user's saved email nor an empty string, which is a valid check for ensuring a proper email is provided.

Here are the key points from the code:

  • notificationEmail is checked against userSettings.email and an empty string.
  • The logic is part of a broader validation that includes other fields and conditions.

The change aligns with the expected behavior from a user experience perspective, ensuring that invalid or empty emails are handled correctly.

Next Steps

To ensure comprehensive validation, it would be beneficial to add unit tests covering various scenarios, such as:

  • notificationEmail is the same as userSettings.email.
  • notificationEmail is an empty string.
  • notificationEmail is a valid email but different from userSettings.email.
  • notificationEmail is an invalid email.

These tests will help confirm that the logic works as expected in all edge cases.

Scripts executed

The following scripts were executed for the analysis:


Script:

#!/bin/bash
# Description: Verify that the email validation logic correctly handles various edge cases.

# Test: Check if the empty string and undefined cases are handled correctly.
cat web/src/pages/NewTransaction/NavigationButtons/NextButton.tsx | grep -A 20 'notificationEmail'

Length of output: 2409

Copy link
Contributor

@Harman-singh-waraich Harman-singh-waraich left a comment

Choose a reason for hiding this comment

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

lgtm

@kemuru kemuru merged commit 7fc6397 into master Jun 17, 2024
6 checks passed
@kemuru kemuru deleted the feat/copiable-addresses-execute-button-and-etherscan-redirection branch June 17, 2024 10:54
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.

2 participants