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

Replace old token symbol by chain specific token symbol or auto-sdk testnet constant #965

Merged

Conversation

marc-aurele-besner
Copy link
Collaborator

@marc-aurele-besner marc-aurele-besner commented Nov 18, 2024

User description

Replace old token symbol by chain specific token symbol or auto-sdk testnet constant

  • on Accounts list, replace tSSC by chain specific token symbol
  • on testnet rewards page, replace tSSC by auto-sdk testnet token symbol

PR Type

enhancement


Description

  • Replaced hardcoded token symbol 'tSSC' with a dynamic chain-specific token symbol in the AccountList component.
  • Updated the TestnetRewardsTable to use TESTNET_TOKEN.symbol instead of the hardcoded 'tSSC'.
  • Enhanced the code by utilizing dynamic token symbols, improving flexibility and maintainability.

Changes walkthrough 📝

Relevant files
Enhancement
AccountList.tsx
Replace hardcoded token symbol with dynamic chain-specific symbol

explorer/src/components/Consensus/Account/AccountList.tsx

  • Added tokenSymbol to the useChains hook.
  • Replaced hardcoded 'tSSC' with dynamic tokenSymbol in headers.
  • Updated dependencies in the useMemo hook.
  • +4/-4     
    TestnetRewardsTable.tsx
    Use dynamic testnet token symbol in rewards table               

    explorer/src/components/TestnetRewards/TestnetRewardsTable.tsx

  • Imported TESTNET_TOKEN from auto-utils.
  • Replaced hardcoded 'tSSC' with TESTNET_TOKEN.symbol.
  • Updated earnings display to use dynamic token symbol.
  • +6/-6     

    💡 PR-Agent usage: Comment /help "your question" on any pull request to receive relevant information

    @marc-aurele-besner marc-aurele-besner linked an issue Nov 18, 2024 that may be closed by this pull request
    Copy link

    netlify bot commented Nov 18, 2024

    Deploy Preview for dev-astral ready!

    Name Link
    🔨 Latest commit 29275f4
    🔍 Latest deploy log https://app.netlify.com/sites/dev-astral/deploys/673b6fcffd3b840008b77028
    😎 Deploy Preview https://deploy-preview-965--dev-astral.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.

    Copy link

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    ⏱️ Estimated effort to review: 2 🔵🔵⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Recommended focus areas for review

    Dynamic Token Usage
    Ensure that the dynamic token symbol usage does not affect existing functionalities or display incorrect data in UI components.

    Token Symbol Consistency
    Verify that the replacement of the hardcoded token symbol with TESTNET_TOKEN.symbol and DEFAULT_TOKEN_SYMBOL is consistent and correctly implemented across different testnet phases and conditions.

    Copy link

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Prevent potential runtime errors by ensuring tokenSymbol is defined before usage

    Ensure that tokenSymbol is not undefined before using it in the header string to
    prevent runtime errors.

    explorer/src/components/Consensus/Account/AccountList.tsx [119]

    -header: `Locked (${tokenSymbol})`,
    +header: `Locked (${tokenSymbol ?? 'defaultSymbol'})`,
    Suggestion importance[1-10]: 7

    Why: Adding a fallback for tokenSymbol enhances robustness by preventing undefined values from being used, which could lead to runtime errors or incorrect UI displays.

    7
    Ensure TESTNET_TOKEN.symbol is defined to avoid displaying undefined in the UI

    Verify that TESTNET_TOKEN.symbol is always defined or provide a fallback to prevent
    potential undefined behavior in UI.

    explorer/src/components/TestnetRewards/TestnetRewardsTable.tsx [248]

    -EARNINGS, % {TESTNET_TOKEN.symbol}
    +EARNINGS, % {TESTNET_TOKEN.symbol ?? 'defaultSymbol'}
    Suggestion importance[1-10]: 7

    Why: Providing a fallback for TESTNET_TOKEN.symbol is a good practice to ensure that the UI does not display undefined values, which can improve user experience and prevent potential errors.

    7

    @marc-aurele-besner marc-aurele-besner merged commit aeec606 into main Nov 18, 2024
    12 checks passed
    @marc-aurele-besner marc-aurele-besner deleted the chore/948-old-token-symbol-still-use-on-some-page branch November 18, 2024 16:54
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Old token symbol still use on some page
    3 participants