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: UX improvements, bug fix #66

Merged
merged 3 commits into from
Jun 23, 2024
Merged

feat: UX improvements, bug fix #66

merged 3 commits into from
Jun 23, 2024

Conversation

kemuru
Copy link
Contributor

@kemuru kemuru commented Jun 21, 2024

ready for review

address clickable so it leads you to etherscan, bug fix in execute transaction button, real address while creating a new transaction in case the seller address is an ens domain, change url from my-transactions to transactions

PR-Codex overview

The focus of this PR is to update URLs related to transactions from "my-transactions" to "transactions" for consistency across the application.

Detailed summary

  • Updated URLs from "/my-transactions" to "/transactions" for consistency.
  • Updated frontend URLs and paths in multiple files.
  • Updated links and paths in the Explore component.
  • Updated URLs in the DepositPaymentButton component.
  • Updated URLs in the TransactionCard component.
  • Updated URLs in the PreviewCardButtons component.
  • Updated URLs in the TransactionInfo component.
  • Updated URLs in the Description component.

The following files were skipped due to too many changes: contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json

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

Summary by CodeRabbit

  • New Features

    • Enhanced buyer and seller address display with improved links and dynamic URL generation.
    • Added ENS address resolution for seller addresses.
  • Bug Fixes

    • Corrected multiple navigation paths from /my-transactions to /transactions.
  • Style

    • Updated styling for anchor elements to improve visual presentation.
  • Refactor

    • Replaced settlementTimeout with deadline in transaction details logic.
    • Renamed StyledSpan to StyledA for better hyperlink styling.

Copy link
Contributor

coderabbitai bot commented Jun 21, 2024

Walkthrough

The primary change across the escrow application's frontend and backend revolves around updating the URL structure from "my-transactions" to "transactions". Additionally, several components have been enhanced for better address handling, link styling, and dispute policy updates to improve user experience and interface consistency.

Changes

File Path Change Summary
contracts/deploy/00-escrow.ts Updated frontendUrl from "my-transactions" to "transactions".
contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json Updated JSON template fields: frontendUrl, the description for "Pay the Seller" answer option, and policyURI.
web/src/app.tsx Changed MyTransactions route path to match the new URL structure.
web/src/components/PreviewCard/Terms/Description.tsx Imported DEFAULT_CHAIN and SUPPORTED_CHAINS; replaced StyledSpan with StyledA for hyperlinks, and modified StyledCopiable content.
web/src/components/TransactionCard/index.tsx Updated transaction detail paths to the new URL structure.
web/src/components/TransactionInfo/index.tsx Added StyledA component for styling anchor elements and dynamic URL generation for buyer and seller addresses using the block explorer URL.
web/src/layout/Header/navbar/Explore.tsx Updated navigation link to utilize the new URL structure.
web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/index.tsx Replaced settlementTimeout with deadline; updated button visibility logic accordingly.
web/src/pages/NewTransaction/NavigationButtons/DepositPaymentButton.tsx Modified frontend URL and navigation path to use "transactions" instead of "my-transactions".
web/src/pages/NewTransaction/Preview/index.tsx Introduced useEnsAddress hook for ENS resolution in seller address, enhancing the dynamic use of ENS domains.

Sequence Diagram(s)

The changes are largely simple adjustments and do not introduce new features or significantly alter control flows, thus not necessitating a sequence diagram.

Poem

In the land of code and bytes,
URLs change with new delights. 🐰
From "my" to "our" transactions clear,
Pathways shine, no need to fear. 🌟
Links now hover, styled just right,
Buyer, seller, in plain sight.
CodeRabbit hops, updates in queue,
Bringing ease from me to you! 🚀


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

netlify bot commented Jun 21, 2024

Deploy Preview for kleros-escrow-v2 ready!

Name Link
🔨 Latest commit ae73b1b
🔍 Latest deploy log https://app.netlify.com/sites/kleros-escrow-v2/deploys/6675a640707cdc0008a97c04
😎 Deploy Preview https://deploy-preview-66--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 chore: update url from my-transactions to just transactions feat: UX improvements, bug fix Jun 21, 2024
@kemuru kemuru marked this pull request as ready for review June 21, 2024 16:12
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 659d346 and ae73b1b.

Files selected for processing (10)
  • contracts/deploy/00-escrow.ts (1 hunks)
  • contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json (1 hunks)
  • web/src/app.tsx (1 hunks)
  • web/src/components/PreviewCard/Terms/Description.tsx (4 hunks)
  • web/src/components/TransactionCard/index.tsx (2 hunks)
  • web/src/components/TransactionInfo/index.tsx (4 hunks)
  • web/src/layout/Header/navbar/Explore.tsx (1 hunks)
  • web/src/pages/MyTransactions/TransactionDetails/PreviewCardButtons/index.tsx (2 hunks)
  • web/src/pages/NewTransaction/NavigationButtons/DepositPaymentButton.tsx (2 hunks)
  • web/src/pages/NewTransaction/Preview/index.tsx (2 hunks)
Files skipped from review due to trivial changes (1)
  • contracts/deploy/00-escrow.ts
Additional context used
Learnings (1)
web/src/pages/NewTransaction/NavigationButtons/DepositPaymentButton.tsx (2)
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.
User: kemuru
PR: kleros/escrow-v2#60
File: web/src/pages/NewTransaction/NavigationButtons/DepositPaymentButton.tsx:63-64
Timestamp: 2024-06-11T17:14:13.327Z
Learning: Errors in the `useContractRead` hook for ERC20 token allowance checks in the `DepositPaymentButton` component are managed by the `wrapWithToast()` function, which logs errors in a notification popup. Additionally, the quantity for the approval is pre-validated and stored in the context of the NewTransactionContext.
Additional comments not posted (15)
web/src/layout/Header/navbar/Explore.tsx (1)

52-52: Updated Navigation Link Approved

The navigation link has been correctly updated from /my-transactions/display/1/desc/all to /transactions/display/1/desc/all. This change aligns with the PR objectives to standardize the transaction URLs across the application.

web/src/app.tsx (1)

30-30: Route Update Approved

The route for the MyTransactions component has been correctly updated from my-transactions/* to transactions/*. This change is consistent with the PR's goal of updating URL paths and should ensure that all related navigation and links within the application are correctly redirected.

web/src/pages/NewTransaction/Preview/index.tsx (3)

3-3: Addition of ENS Address Resolution Approved

The import of useEnsAddress from wagmi and ensDomainPattern from utils/validateAddress is a good enhancement. It allows for dynamic resolution of ENS addresses, which enhances the user experience by potentially replacing cryptic blockchain addresses with human-readable names.

Also applies to: 9-9


33-37: ENS Address Resolution Logic

The use of useEnsAddress for resolving seller addresses is well-implemented. The condition to enable this feature based on a regex test (ensDomainPattern.test(sellerAddress)) is a prudent addition, ensuring that unnecessary requests are avoided.


45-45: Dynamic Address Resolution in UI Component

The resolved seller address is correctly passed to the PreviewCard component. This change ensures that the UI can display either the traditional address or the resolved ENS name, depending on availability, which should improve readability and user trust.

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

84-84: Updated Navigation Paths Approved

The navigation paths within the TransactionCard component have been correctly updated to point to /transactions/${id.toString()} instead of /my-transactions/${id.toString()}. This change is crucial for maintaining consistent navigation following the URL updates across the application.

Also applies to: 99-99

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

6-6: New imports for chain constants:

The addition of DEFAULT_CHAIN and SUPPORTED_CHAINS from consts/chains is aligned with the need to generate dynamic URLs based on chain-specific data. Ensure that these constants are used consistently across other components if similar functionality is required.


24-30: Introduction of StyledA for dynamic URLs:

The new StyledA styled component is introduced for creating hyperlinks. This is a good use of styled-components to maintain consistent styling for links across the application. Ensure that the theme's primaryBlue color is defined and appropriate for all themes (e.g., light, dark).
[APROVED]


70-86: Usage of StyledA in dynamic address links:

The StyledA component is utilized to render buyer and seller addresses as clickable links. This change enhances user experience by allowing easy access to blockchain explorer details. It's crucial to verify that the URLs are correctly formed and that target="_blank" and rel="noreferrer" are used to enhance security and SEO.

Also applies to: 96-112

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

94-94: Updated comparison condition using deadline:

The change from settlementTimeout to deadline in the comparison condition for displaying the transaction execution button aligns with the broader PR goal of standardizing terminology and possibly functionality around transaction deadlines. Ensure that this change is reflected in the context provider and that all related logic correctly interprets the deadline property.

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

75-83: New StyledA styled component for dynamic links:

The introduction of StyledA with hover effects is a good enhancement for user interaction, providing visual feedback when users hover over links. Ensure that the theme colors (primaryText and primaryBlue) are appropriately set in the theme provider to reflect the desired aesthetics.


146-152: Dynamic link rendering for buyer and seller addresses:

The use of StyledA to render buyer and seller addresses as dynamic links inside the TransactionInfo component is a consistent application of the new styled component. It enhances user interaction by linking directly to the relevant blockchain explorer. Double-check that the links are correctly formed and that they open in a new tab with the appropriate security attributes (rel="noreferrer").

Also applies to: 169-175

web/src/pages/NewTransaction/NavigationButtons/DepositPaymentButton.tsx (2)

99-99: Updated frontendUrl in transaction template data:

The update of frontendUrl to use the new /transactions path instead of /my-transactions is consistent with the PR's objectives to standardize URL paths across the application. This change should be reflected wherever transaction URLs are generated or used.


202-202: Updated navigation path after transaction creation:

The navigation path update to /transactions/display/1/desc/all after a transaction is created aligns with the updated URL structure. Ensure that this path is correctly configured in the router and that it leads to the intended page without issues.

contracts/deployments/arbitrumSepoliaDevnet/EscrowUniversal.json (1)

1028-1028: Updated frontendUrl to Match New Routing Structure

The frontendUrl has been correctly updated to reflect the new URL path from /my-transactions to /transactions. This change aligns with the PR's objectives to standardize URL paths across the application.

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 b3bb688 into master Jun 23, 2024
4 of 6 checks passed
@kemuru kemuru deleted the feat/ux-improvements branch June 23, 2024 21:52
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