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(pages): EVM verify external docs link and EVM contract details mobile #1238

Merged
merged 2 commits into from
Feb 19, 2025

Conversation

Poafs1
Copy link
Collaborator

@Poafs1 Poafs1 commented Feb 19, 2025

Summary by CodeRabbit

  • New Features

    • Enhanced documentation links now automatically open externally when needed.
    • Improved contract details with updated "Read" and "Write" buttons featuring icons and responsive visibility.
    • Optimized command layout for consistent display across all screen sizes.
    • Refined interaction behavior on mobile devices for a more intuitive experience.
  • Bug Fixes

    • Fixed issues with the EVM verification external documentation link and improved mobile display of EVM contract details.
  • Style

    • Updated button appearance with a new, cohesive outline design.

Copy link

vercel bot commented Feb 19, 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 19, 2025 8:38am
6 Skipped Deployments
Name Status Preview Comments Updated (UTC)
celatone-frontend-main ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 8:38am
initia-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 8:38am
neutron-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 8:38am
osmosis-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 8:38am
sei-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 8:38am
terra-celatone-frontend ⬜️ Ignored (Inspect) Visit Preview Feb 19, 2025 8:38am

Copy link

coderabbitai bot commented Feb 19, 2025

Walkthrough

This pull request introduces several enhancements across multiple components. In the UserDocsLink component, a new handleLink function centralizes URL determination based on the isExternal and isDevTool flags, along with an update to its props. In the EVM contract details pages, button styles, icons, and responsive layouts are refined, and the logic for determining interaction types is updated to account for mobile conditions. Finally, the ContractLicenseInfoAccordion now forwards the new isExternal property to UserDocsLink, ensuring consistent link behavior.

Changes

File(s) Summary
src/lib/components/UserDocsLink.tsx Added new handleLink function, updated UserDocsLinkProps with optional isExternal flag, and refactored URL construction logic.
.../evm-contract-details/components/EvmContractDetailsTop.tsx
.../evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx
Updated Button variants (from outline-white to outline-primary), added leftIcon properties, adjusted display settings, and enhanced responsive layout via Flex adjustments.
.../evm-contract-details/components/interact-evm-contract/index.tsx Modified control flow for determining interactType by expanding the condition to include mobile state and removing a redundant useEffect hook.
.../evm-contract-verify/components/ContractLicenseInfoAccordion.tsx Integrated the new isExternal property into the UserDocsLink component usage.
CHANGELOG.md Added a new entry for bug fixes related to EVM verification and mobile display improvements.

Sequence Diagram(s)

sequenceDiagram
  participant U as UserDocsLink
  participant H as handleLink
  participant L as Link Component
  U->>H: Pass href, isExternal, isDevTool
  H-->>U: Return computed URL
  U->>L: Render Link with URL
Loading
sequenceDiagram
  participant C as InteractComponent
  participant S as SelectedType
  participant M as Mobile Flag
  C->>C: Evaluate condition (SelectedType starts with "read" OR isMobile true)
  alt Condition met
    C-->>C: Set interactType = Read
  else Condition not met
    C-->>C: Set interactType = SelectedType
  end
Loading

Possibly related PRs

  • feat: evm nonce #1226 – The changes in the main PR are related to the addition of the isExternal property in the UserDocsLink component, which is also referenced in the retrieved PR's ContractLicenseInfoAccordion component.
  • Feat: update verify contract layout #1230 – The changes in the main PR are related to the addition of the isExternal property in the UserDocsLink component, which is also referenced in the ContractLicenseInfoAccordion component.
  • Feat: wireup verifications #1232 – The changes in the main PR involve the introduction of the isExternal property in the UserDocsLink component, which is also utilized in the ContractLicenseInfoAccordion component.

Suggested reviewers

  • evilpeach
  • songwongtp

Poem

I'm a bouncy little rabbit, coding with delight,
Hopping through the changes, under the moonlight.
My whiskers twitch at refactored flows, so neat,
URL logic and responsive views all meet.
Code carrots crunch as I celebrate the night!
🥕🐇


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 (3)
src/lib/components/UserDocsLink.tsx (2)

42-42: Consider memoizing the link value.

Since handleLink is called on every render, consider memoizing its result using useMemo to optimize performance, especially if the component re-renders frequently.

-  const link = handleLink(href, isExternal, isDevTool);
+  const link = useMemo(
+    () => handleLink(href, isExternal, isDevTool),
+    [href, isExternal, isDevTool]
+  );

47-49: Track website after stopPropagation.

The event propagation is stopped after tracking, which could prevent tracking if stopPropagation throws an error.

-        trackWebsite(link);
-        e.stopPropagation();
+        e.stopPropagation();
+        trackWebsite(link);
src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (1)

41-44: Verify if mobile write access restriction is intentional.

The current implementation forces read-only mode on mobile devices. While this might be intentional for security or UX reasons, consider adding a configuration option to allow write access on mobile when necessary.

Consider adding a prop to override mobile read-only restriction:

 interface InteractEvmContractProps {
   contractAddress: HexAddr20;
   contractAbi: JsonFragment[];
   selectedType: InteractTabsIndex;
   selectedFn?: string;
   proxyTargetEvmVerifyInfo: Option<EvmVerifyInfo>;
+  allowMobileWrite?: boolean;
 }

 export const InteractEvmContract = ({
   contractAddress,
   contractAbi,
   selectedType,
   selectedFn,
   proxyTargetEvmVerifyInfo,
+  allowMobileWrite = false,
 }: InteractEvmContractProps) => {
   const isMobile = useMobile();
   const navigate = useInternalNavigate();

   const interactType =
-    isMobile || selectedType.startsWith("read")
+    (!allowMobileWrite && isMobile) || selectedType.startsWith("read")
       ? InteractType.Read
       : InteractType.Write;
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 06017c8 and 64972f9.

📒 Files selected for processing (5)
  • src/lib/components/UserDocsLink.tsx (5 hunks)
  • src/lib/pages/evm-contract-details/components/EvmContractDetailsTop.tsx (3 hunks)
  • src/lib/pages/evm-contract-details/components/evm-contract-details-overview/OverviewVerifiedCmds.tsx (1 hunks)
  • src/lib/pages/evm-contract-details/components/interact-evm-contract/index.tsx (1 hunks)
  • src/lib/pages/evm-contract-verify/components/ContractLicenseInfoAccordion.tsx (1 hunks)
🔇 Additional comments (6)
src/lib/pages/evm-contract-verify/components/ContractLicenseInfoAccordion.tsx (1)

48-48: LGTM!

The addition of isExternal prop is appropriate for the GitHub documentation link.

src/lib/components/UserDocsLink.tsx (1)

10-19: LGTM! Well-structured URL handling logic.

The handleLink function effectively centralizes URL determination logic, making it easier to maintain and test.

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

41-48: LGTM! Improved responsive layout.

The responsive flexDirection provides a better mobile experience while maintaining desktop layout.


54-58: LGTM! Consistent command availability.

Removing the mobile check for write commands ensures consistent functionality across devices.

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

64-66: LGTM! Enhanced button styling and usability.

The changes improve the UI by:

  • Using consistent outline-primary variant
  • Adding descriptive icons for better recognition

Also applies to: 80-82


92-92: LGTM! Improved Write button visibility.

Making the Write button visible on medium and larger screens aligns with the PR objectives for mobile improvements.

@Poafs1 Poafs1 merged commit fda9341 into develop Feb 19, 2025
12 of 13 checks passed
@Poafs1 Poafs1 deleted the fix/mobile-evm-contract-details branch February 19, 2025 08:34
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 (1)
CHANGELOG.md (1)

91-96: Clarify the Changelog Entries for EVM Fixes

The new bug fix entry
- [#1238](https://github.com/alleslabs/celatone-frontend/pull/1238) Fix EVM verify external docs link and EVM contract details mobile
directly addresses the PR objectives and clearly communicates the enhanced external docs link and improved mobile handling for the EVM contract details page.

However, note that the previous entry
- [#1237](https://github.com/alleslabs/celatone-frontend/pull/1237) Fix EVM contract details UI layout and mobile
is still present immediately after. This might create potential confusion if the intent was to replace or consolidate the fixes into a single entry. Please confirm whether both entries should remain or if the [#1237] entry is now obsolete given the updated fix in [#1238].

📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 64972f9 and 64ddf5e.

📒 Files selected for processing (1)
  • CHANGELOG.md (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Analyze (javascript)

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.

3 participants