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

Fix: EVM contract details according to acceptance test #1237

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

Poafs1
Copy link
Collaborator

@Poafs1 Poafs1 commented Feb 18, 2025

Summary by CodeRabbit

  • Bug Fixes

    • Resolved mobile layout issues on the contract details screen for a smoother experience.
  • New Features

    • Introduced auto-scroll behavior when switching tabs.
    • Enhanced contract details with clear verification indicators, updated "Read/Write" controls, and additional proxy contract information.
  • Style

    • Refreshed the secondary color palette.
    • Improved component styling and responsiveness for a cleaner, more adaptive interface.
  • Documentation

    • Added a changelog entry highlighting the mobile layout fix.

Copy link

vercel bot commented Feb 18, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
celatone-frontend-staging ✅ Ready (Inspect) Visit Preview 💬 Add feedback Feb 18, 2025 1:02pm
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
celatone-frontend-main ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 1:02pm
initia-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 1:02pm
neutron-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 1:02pm
osmosis-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 1:02pm
sei-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 1:02pm
terra-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 18, 2025 1:02pm

Copy link

coderabbitai bot commented Feb 18, 2025

Walkthrough

This update introduces several UI and configuration enhancements. The changelog now records a bug fix for the EVM contract details layout on mobile. The secondary color palette in the theme has been updated. The TypeSwitch component now scrolls to the top on tab changes, and the error message block has been removed from the verification process. Multiple EVM contract details components are updated to improve their layout and verify status display. Interaction components now feature responsive design adjustments, updated button styles, and mobile-specific behavior with revised proxy verification handling.

Changes

File(s) Change Summary
CHANGELOG.md
src/config/theme/initia.ts
Added bug fix entry for EVM contract details UI layout; updated secondary color values in the theme configuration.
src/lib/components/TypeSwitch.tsx
src/lib/components/modal/evm-verify-status/EvmVerifyProcess.tsx
Enhanced tab change behavior by adding scroll-to-top functionality; removed error message rendering block in the verification process.
src/lib/pages/evm-contract-details/components/EvmContractDetailsTop.tsx
src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractCode.tsx
src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx
Updated contract details display: added an isVerified property, introduced new navigation buttons, and refactored constructor arguments rendering with layout and spacing adjustments.
src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/*
src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/*
src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx
src/lib/pages/evm-contract-details/index.tsx
Revised interaction components with updated button variants and AccordionButton alignment, introduced responsive layout adjustments, modified proxy target handling, and integrated mobile-specific behavior (including conditional tab labels and using the useMobile hook).

Sequence Diagram(s)

sequenceDiagram
  participant U as User
  participant TS as TypeSwitch Component
  participant DOC as Document ("content" element)
  
  U->>TS: Click on a new tab
  TS->>TS: Trigger onTabChange callback
  TS->>DOC: Scroll content element to the top
Loading
sequenceDiagram
  participant U as User
  participant ECD as EvmContractDetails Page
  participant UM as useMobile Hook
  participant ED as EvmContractDetailsTop
  
  U->>ECD: Visit contract details page
  ECD->>UM: Check if device is mobile
  UM-->>ECD: Return isMobile flag
  ECD->>ED: Pass updated props (including isVerified) and render tab label ("Read" for mobile)
  U->>ED: Click "Read/Write" button
  ED->>Router: Navigate to selected route based on contract address
Loading

Suggested reviewers

  • evilpeach

Poem

I'm a code-hopping rabbit, swift and light,
Skipping through changes under the digital night.
Colors shift like carrots in a vibrant field,
Buttons and scrolls now perfectly revealed.
With every leap, I cheer this code delight!

Warning

There were issues while running some tools. Please review the errors and either fix the tool’s configuration or disable the tool if it’s a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

src/lib/components/TypeSwitch.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

src/lib/pages/evm-contract-details/components/EvmContractDetailsTop.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/ReadBox.tsx

Oops! Something went wrong! :(

ESLint: 8.57.1

ESLint couldn't find the plugin "eslint-plugin-react".

(The package "eslint-plugin-react" was not found when loaded as a Node module from the directory "".)

It's likely that the plugin isn't installed correctly. Try reinstalling by running the following:

npm install eslint-plugin-react@latest --save-dev

The plugin "eslint-plugin-react" was referenced from the config file in ".eslintrc.json".

If you still can't figure out the problem, please stop by https://eslint.org/chat/help to chat with the team.

  • 8 others
✨ Finishing Touches
  • 📝 Generate Docstrings (Beta)

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>, please review it.
    • 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 using 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 generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration 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

@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

🧹 Nitpick comments (2)
src/lib/components/TypeSwitch.tsx (1)

24-27: Consider using React refs instead of direct DOM manipulation.

While the current implementation works, using document.getElementById for DOM manipulation in React is not ideal. Consider using React refs for a more idiomatic approach.

Here's an improved implementation using refs:

-const content = document.getElementById("content");
-if (content) {
-  content.scrollTo({ top: 0 });
-}
+const contentRef = useRef<HTMLDivElement>(null);
+contentRef.current?.scrollTo({ top: 0 });

Remember to:

  1. Add the ref import: import { useRef } from "react";
  2. Pass the ref to the content element: <div ref={contentRef} id="content">
CHANGELOG.md (1)

89-90: Changelog Entry Consistency Check

The newly added entry for [#1237] "Fix EVM contract details UI layout and mobile" is clearly formatted and placed under the Bug fixes section. Please ensure that this entry follows the same style and punctuation conventions as the other entries in this section (e.g., the use of a hyphen at the start and proper linking of the PR number). If any additional context or details from the acceptance tests would enhance understanding for future readers, consider including a brief extra note in the description or in accompanying documentation.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d1fb3f0 and b703dc1.

📒 Files selected for processing (13)
  • CHANGELOG.md (1 hunks)
  • src/config/theme/initia.ts (1 hunks)
  • src/lib/components/TypeSwitch.tsx (1 hunks)
  • src/lib/components/modal/evm-verify-status/EvmVerifyProcess.tsx (0 hunks)
  • src/lib/pages/evm-contract-details/components/EvmContractDetailsTop.tsx (2 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractCode.tsx (3 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx (3 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/ReadBox.tsx (4 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/WriteBox.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (5 hunks)
  • src/lib/pages/evm-contract-details/index.tsx (5 hunks)
💤 Files with no reviewable changes (1)
  • src/lib/components/modal/evm-verify-status/EvmVerifyProcess.tsx
✅ Files skipped from review due to trivial changes (3)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/index.tsx
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-write/WriteBox.tsx
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/index.tsx
🔇 Additional comments (15)
src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx (1)

31-74: LGTM! Layout improvements align with PR objectives.

The spacing and layout adjustments improve the mobile experience while maintaining a clean interface.

src/lib/pages/evm-contract-details/components/EvmContractDetailsTop.tsx (2)

44-58: LGTM! Clean implementation of verification status display.

The addition of the verification icon provides clear visual feedback about the contract's verification status.


89-91: Verify the intentional hiding of Write button on mobile.

The Write button is hidden on mobile devices (display={{ base: "none", md: "block" }}). Please confirm if this is intentional and aligns with the mobile UX requirements.

src/config/theme/initia.ts (1)

31-36: LGTM! Color palette update improves visual harmony.

The new secondary color palette provides better contrast and a more cohesive visual hierarchy, which should enhance readability and user experience.

src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (3)

100-103: LGTM! Mobile-specific behavior enhancement.

Setting default interaction type to "read" on mobile devices improves usability by simplifying the interface for smaller screens.


117-134: LGTM! Enhanced proxy contract UI.

The proxy contract interface has been improved with:

  • Clear implementation address display
  • Better mobile responsiveness with truncated addresses
  • Comprehensive verification info integration

28-28:

❓ Verification inconclusive

Verify proxy contract verification info handling.

The change from proxyTargetAbi to proxyTargetEvmVerifyInfo suggests a more comprehensive verification approach. Please ensure all proxy contract interactions properly handle the new verification info structure.

Also applies to: 36-36, 45-46


🏁 Script executed:

#!/bin/bash
# Search for any remaining uses of proxyTargetAbi
rg "proxyTargetAbi" -A 3

Length of output: 1664


Action Required: Verify Consistent Handling of Proxy Verification Info

The update in src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx correctly switches from using proxyTargetAbi to proxyTargetEvmVerifyInfo. However, in related components—particularly in OverviewVerifiedCmds.tsx—please ensure that all proxy contract interactions consistently derive their ABI and related verification details from proxyTargetEvmVerifyInfo. Although the call to categorizeAbi(proxyTargetEvmVerifyInfo?.abi ?? []) is correctly in place, the derived variables (proxyTargetAbiRead and proxyTargetAbiWrite) still carry the legacy naming. Please verify that:

  • All logic based on the old proxyTargetAbi is now reliably sourced from proxyTargetEvmVerifyInfo.
  • The naming (and any associated documentation) in OverviewVerifiedCmds.tsx is updated or, if retained for backward compatibility, clearly justified.
  • Edge cases (such as when proxyTargetEvmVerifyInfo might be undefined) are appropriately handled across both read and write operations.

This review is to ensure comprehensive consistency in proxy contract verification handling throughout the affected files.

src/lib/pages/evm-contract-details/index.tsx (2)

153-153: LGTM! Improved mobile tab label.

Simplifying the tab label to "Read" on mobile devices improves space utilization while maintaining clarity.


128-131: LGTM! Enhanced verification status handling.

Explicitly passing isVerified status to EvmContractDetailsTop improves the component's ability to render appropriate UI elements based on verification state.

src/lib/pages/evm-contract-details/components/interact-evm-contract/abi-read/ReadBox.tsx (3)

120-126: LGTM! Responsive grid layout enhancement.

The updated grid template provides better organization of content across different screen sizes.


137-165: LGTM! Improved button layout for mobile.

The flex container's responsive properties ensure better button alignment and spacing on mobile devices.


197-215: LGTM! Enhanced copy button accessibility.

The reorganized copy button layout improves accessibility and usability, especially on mobile devices.

src/lib/pages/evm-contract-details/components/evm-contract-details-contract-info/ContractCode.tsx (3)

3-3: LGTM!

The new imports are correctly added and used in the constructor arguments display section.

Also applies to: 8-8


35-38: LGTM! Good refactoring.

Moving the constructor arguments extraction outside the JSX improves code readability by separating the logic from the rendering.


88-96: LGTM! Clean UI implementation.

The conditional rendering provides a clear and user-friendly display of constructor arguments with appropriate styling and fallback message.

@evilpeach evilpeach merged commit e3bfc68 into develop Feb 19, 2025
13 checks passed
@evilpeach evilpeach deleted the fix/evm-contract-details branch February 19, 2025 03:21
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