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

Sync prod with main #789

Merged
merged 59 commits into from
Aug 2, 2024
Merged

Sync prod with main #789

merged 59 commits into from
Aug 2, 2024

Conversation

marc-aurele-besner
Copy link
Collaborator

@marc-aurele-besner marc-aurele-besner commented Aug 2, 2024

User description

Sync prod with main

Just quickly syncing prod with main as I'm assuming we will take a bit more time to test main branch after pottentially merging the new staking squid integration next

Including PR's


PR Type

Enhancement, Bug fix


Description

  • Updated various URLs from subspace.network to autonomys.xyz across multiple files.
  • Enhanced StatusIcon component to handle pending and failed statuses.
  • Renamed ConfirmedDomainBlock to ConfirmedDomainExecutionReceipt and updated related logic and type definitions.
  • Cleaned up extra whitespace in Farming component.

Changes walkthrough 📝

Relevant files
Enhancement
11 files
index.tsx
Update image source URL and clean up whitespace                   

explorer/src/components/Farming/index.tsx

  • Updated image source URL to autonomys.xyz.
  • Removed extra whitespace.
  • +1/-3     
    PendingTransactions.tsx
    Enhance `StatusIcon` handling for transaction statuses     

    explorer/src/components/WalletSideKick/PendingTransactions.tsx

  • Updated StatusIcon component to handle pending and success statuses.
  • +4/-1     
    StatusIcon.tsx
    Add failed status icon and enhance `StatusIcon` component

    explorer/src/components/common/StatusIcon.tsx

  • Added XCircleIcon for failed status.
  • Updated StatusIcon component to handle pending and failed statuses.
  • +5/-3     
    metadata.ts
    Update metadata URL to `autonomys.xyz`                                     

    explorer/src/constants/metadata.ts

    • Updated URL from subspace.network to autonomys.xyz.
    +1/-1     
    routes.ts
    Update external routes to `autonomys.xyz`                               

    explorer/src/constants/routes.ts

    • Updated various external routes to use autonomys.xyz.
    +2/-2     
    useConsensusData.ts
    Rename `ConfirmedDomainBlock` to `ConfirmedDomainExecutionReceipt`

    explorer/src/hooks/useConsensusData.ts

  • Renamed ConfirmedDomainBlock to ConfirmedDomainExecutionReceipt.
  • Updated related logic to use the new type.
  • +8/-7     
    consensus.ts
    Update consensus state management for renamed type             

    explorer/src/states/consensus.ts

  • Renamed ConfirmedDomainBlock to ConfirmedDomainExecutionReceipt.
  • Updated state management to reflect the new type.
  • +8/-6     
    consensus.ts
    Update type definition for renamed consensus type               

    explorer/src/types/consensus.ts

  • Renamed ConfirmedDomainBlock to ConfirmedDomainExecutionReceipt.
  • Updated type definition to reflect the new structure.
  • +2/-6     
    nova.ts
    Update auth provider domain to `autonomys.xyz`                     

    explorer/src/utils/auth/providers/nova.ts

    • Updated domain from subspace.network to autonomys.xyz.
    +1/-1     
    next.config.js
    Update remote image hostname to `autonomys.xyz`                   

    explorer/next.config.js

    • Updated remote image hostname to autonomys.xyz.
    +1/-1     
    package.json
    Update package author URL to `autonomys.xyz`                         

    indexers/staking-squid/package.json

    • Updated author URL from autonomys.net to autonomys.xyz.
    +1/-1     
    Documentation
    2 files
    README.md
    Update README URLs to `autonomys.xyz`                                       

    README.md

    • Updated URLs from subspace.network to autonomys.xyz.
    +1/-1     
    README.md
    Update staking squid README URLs to `autonomys.xyz`           

    indexers/staking-squid/README.md

    • Updated URLs from subspace.network to autonomys.xyz.
    +1/-1     

    💡 PR-Agent usage:
    Comment /help on the PR to get a list of all available PR-Agent tools and their descriptions

    Copy link

    netlify bot commented Aug 2, 2024

    Deploy Preview for dev-astral canceled.

    Name Link
    🔨 Latest commit e8a6164
    🔍 Latest deploy log https://app.netlify.com/sites/dev-astral/deploys/66ad5dadff387600081990b9

    Copy link

    netlify bot commented Aug 2, 2024

    Deploy Preview for astral-prod canceled.

    Name Link
    🔨 Latest commit e8a6164
    🔍 Latest deploy log https://app.netlify.com/sites/astral-prod/deploys/66ad5dadc8e2c200084eeaa4

    Copy link

    github-actions bot commented Aug 2, 2024

    PR Reviewer Guide 🔍

    ⏱️ Estimated effort to review: 3 🔵🔵🔵⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ Key issues to review

    Logic Change
    The logic for displaying the StatusIcon has changed significantly. Previously, the icon was displayed if the transaction status was not pending. Now, it checks explicitly for success and pending statuses. This change could affect how transaction statuses are represented in the UI. It's important to ensure that this new logic correctly handles all expected transaction statuses and that there are no edge cases or statuses that are not accounted for.

    Component Update
    The StatusIcon component now handles an additional prop isPending and includes a new icon for the pending state. This change requires careful testing to ensure that the icons are rendered correctly in all scenarios where StatusIcon is used. Additionally, the removal of the ClockIcon in the failure state and its replacement with the XCircleIcon should be verified for correct visual representation and user understanding.

    Copy link

    github-actions bot commented Aug 2, 2024

    PR Code Suggestions ✨

    CategorySuggestion                                                                                                                                    Score
    Possible issue
    Improve data handling and error checking in setLatestConfirmedDomainExecutionReceipt to prevent runtime errors

    When setting state for latestConfirmedDomainExecutionReceipt, ensure that the data
    structure and types are correctly handled to prevent runtime errors. This includes
    proper handling of nullable or undefined values and ensuring that the data conforms
    to expected types.

    explorer/src/hooks/useConsensusData.ts [110-113]

     setLatestConfirmedDomainExecutionReceipt(
    -  latestConfirmedDomainExecutionReceipt.map((domainBlock) => ({
    -    id: parseInt((domainBlock[0].toHuman() as string[])[0]),
    -    ...(domainBlock[1].toJSON() as Omit<ConfirmedDomainExecutionReceipt, 'id'>),
    -  })),
    +  latestConfirmedDomainExecutionReceipt.map((domainBlock) => {
    +    const id = parseInt((domainBlock[0].toHuman() as string[])[0]);
    +    const receipt = domainBlock[1].toJSON() as Omit<ConfirmedDomainExecutionReceipt, 'id'>;
    +    return { id, ...receipt };
    +  }).filter(item => !isNaN(item.id) && item != null),
     )
     
    Suggestion importance[1-10]: 10

    Why: The suggestion improves data handling and error checking, which is crucial for preventing runtime errors. This enhancement is highly valuable for maintaining robust and error-free code.

    10
    Possible bug
    Add handling for non-pending and unsuccessful transaction status in the StatusIcon component

    The StatusIcon component should handle a case where isPending is false and status is
    also false. Currently, it only checks for isPending and then directly returns the
    ClockIcon. This might lead to incorrect icon display when the transaction is neither
    pending nor successful.

    explorer/src/components/common/StatusIcon.tsx [10]

    -if (isPending) return <ClockIcon className='size-5' stroke='orange' />
    +if (isPending) {
    +  return <ClockIcon className='size-5' stroke='orange' />
    +} else if (!status) {
    +  return <XCircleIcon className='size-5' stroke='#D70040' />
    +}
     
    Suggestion importance[1-10]: 9

    Why: The suggestion correctly identifies a potential bug where the icon might not display correctly for failed transactions. The improved code ensures that all possible statuses are handled, improving the component's reliability.

    9
    Best practice
    Use environment variables for managing external URLs to improve maintainability and security

    Consider using environment variables or a configuration file for managing URLs such
    as image sources. This approach enhances maintainability and security by
    centralizing URL management, making it easier to update or secure URLs without
    modifying component files directly.

    explorer/src/components/Farming/index.tsx [190]

    -src='https://docs.autonomys.xyz/assets/images/space-acres-setup-7-3490cba2e75635efdea0006d06da9936.png'
    +src={process.env.REACT_APP_SPACE_ACRES_IMAGE_URL}
     
    Suggestion importance[1-10]: 8

    Why: Using environment variables for URLs is a best practice that improves maintainability and security. This suggestion is valid and beneficial, although it addresses a minor issue.

    8
    Enhancement
    Ensure StatusIcon handles all transaction statuses including failed transactions

    The StatusIcon component usage in PendingTransactions.tsx should include a default
    case for when neither status is Success nor Pending. This ensures that the icon
    correctly represents the transaction status in all scenarios.

    explorer/src/components/WalletSideKick/PendingTransactions.tsx [163-165]

     <StatusIcon
       status={tx.status === TransactionStatus.Success}
       isPending={tx.status === TransactionStatus.Pending}
    +  isFailed={tx.status === TransactionStatus.Failed}
     />
     
    Suggestion importance[1-10]: 7

    Why: The suggestion enhances the StatusIcon usage by ensuring it handles all transaction statuses, including failed transactions. However, the PR code does not define a Failed status, making this suggestion less immediately applicable.

    7

    @marc-aurele-besner marc-aurele-besner merged commit 9ea961d into production Aug 2, 2024
    38 of 39 checks passed
    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.

    2 participants