Skip to content

useDisplayName Hook and Integration into <Name/> Component#22734

Merged
dbrans merged 5 commits intodevelopfrom
dbrans/petnames-useDisplayName
Jan 31, 2024
Merged

useDisplayName Hook and Integration into <Name/> Component#22734
dbrans merged 5 commits intodevelopfrom
dbrans/petnames-useDisplayName

Conversation

@dbrans
Copy link
Copy Markdown
Contributor

@dbrans dbrans commented Jan 30, 2024

Description

This PR introduces a new useDisplayName hook, aimed at including logic for displaying token names within the <Name/> component. This hook replicates existing display logic, before Petnames.

Details

Development of useDisplayName Hook

  • Functionality: The new useDisplayName hook encapsulates the existing logic for determining a token's displayName. It performs sequential checks for:
    • Petname: Prioritizes the petname if available.
    • Token Metadata: Fetches the name from static or dynamic token lists.

Integration with <Name/> Component

  • Replacement of Logic: The existing useName logic within the <Name/> component is replaced by the useDisplayName hook.

  • Icon Display: The component adjusts the displayed icon (either a bookmark or a warning sign) based on the presence or absence of a resolved name.

Related issues

Fixes: #22735

Manual testing steps

Screenshots/Recordings

Before

image

After

image

Pre-merge author checklist

  • I’ve followed MetaMask Coding Standards.
  • I've clearly explained what problem this PR is solving and how it is solved.
  • I've linked related issues
  • I've included manual testing steps
  • I've included screenshots/recordings if applicable
  • I’ve included tests if applicable
  • I’ve documented my code using JSDoc format if applicable
  • I’ve applied the right labels on the PR (see labeling guidelines). Not required for external contributors.
  • I’ve properly set the pull request status:
    • In case it's not yet "ready for review", I've set it to "draft".
    • In case it's "ready for review", I've changed it from "draft" to "non-draft".

Pre-merge reviewer checklist

  • I've manually tested the PR (e.g. pull and build branch, run the app, test code being changed).
  • I confirm that this PR addresses all acceptance criteria described in the ticket it closes and includes the necessary testing evidence such as recordings and or screenshots.

@github-actions
Copy link
Copy Markdown
Contributor

CLA Signature Action: All authors have signed the CLA. You may need to manually re-run the blocking PR check if it doesn't pass in a few minutes.

@dbrans dbrans added the team-confirmations-system-deprecated DEPRECATED: please use "team-confirmations" instead label Jan 30, 2024
@dbrans dbrans marked this pull request as ready for review January 30, 2024 20:22
@dbrans dbrans requested a review from a team as a code owner January 30, 2024 20:22
@metamaskbot
Copy link
Copy Markdown
Collaborator

Builds ready [a6c7e8c]
Page Load Metrics (757 ± 18 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint97138108126
domContentLoaded10201531
load7008477573818
domInteractive10201531
Bundle size diffs
  • background: 0 Bytes (0.00%)
  • ui: 741 Bytes (0.01%)
  • common: 0 Bytes (0.00%)

@dbrans dbrans merged commit 12627a0 into develop Jan 31, 2024
@dbrans dbrans deleted the dbrans/petnames-useDisplayName branch January 31, 2024 18:42
@github-actions github-actions bot locked and limited conversation to collaborators Jan 31, 2024
@metamaskbot metamaskbot added the release-11.11.0 Issue or pull request that will be included in release 11.11.0 label Jan 31, 2024
@sleepytanya
Copy link
Copy Markdown
Contributor

Works as expected on Chrome 121.0.6167.139 and Firefox 122.0:

2PR

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

QA Passed release-11.11.0 Issue or pull request that will be included in release 11.11.0 team-confirmations-system-deprecated DEPRECATED: please use "team-confirmations" instead

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Show contract names in petnames by default

5 participants