Skip to content

Conversation

@AMIRKHANEF
Copy link
Member

@AMIRKHANEF AMIRKHANEF commented Oct 19, 2025

fixes the fade on scroll issue on accounts list (extension)

Summary by CodeRabbit

  • Bug Fixes

    • Improved navigation flow when no accounts are present to avoid unexpected behavior in empty states
  • Refactor

    • Internal navigation handling moved to the router for more consistent routing behavior
  • Style

    • Clipped overflow and updated container/row spacing and animations for a cleaner account list appearance
    • Account panels now support per-section styling for improved visual polish

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 19, 2025

Walkthrough

Replaces ActionContext navigation with React Router's useNavigate in BodySection, adds a VelvetBox prop childrenStyle, applies overflow clipping to the accounts Grid container, and tweaks AccountRowSimple animation and horizontal spacing.

Changes

Cohort / File(s) Change Summary
Navigation & VelvetBox prop
packages/extension-polkagate/src/popup/accountsLists/BodySection.tsx
Replaces ActionContext-based navigation with useNavigate; calls navigate('/') when flatAccounts is empty; updates useEffect dependency to navigate. Passes new childrenStyle prop into VelvetBox to control per-children styling (e.g., borderRadius, overflow). Removes ActionContext import.
Grid container styling
packages/extension-polkagate/src/popup/accountsLists/index.tsx
Adds overflow: 'hidden' to the Grid container sx to clip overflowing content.
Row layout & animation
packages/extension-polkagate/src/popup/accountsLists/AccountRowSimple.tsx
Reduces mount animation vertical offset (y: 10y: 5) and replaces horizontal margin mx: '1px' with horizontal padding px: '1px', adjusting spacing.

Sequence Diagram(s)

sequenceDiagram
  participant UI as AccountsList UI
  participant Body as BodySection.tsx
  participant Router as React Router

  rect rgb(220,235,255)
    UI->>Body: user action / accounts removed
    Body->>Body: compute flatAccounts === []
    alt empty accounts
      Body->>Router: navigate('/')
      Router-->>UI: route -> root
    else non-empty
      Body-->>UI: render accounts list
    end
  end
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Poem

🐰 I hopped through code with nimble paws,
Replaced old paths with Router laws.
VelvetBox now dresses its child,
Clipped edges tidy, spacing mild —
A small, clean spring for UI flaws. 🌿

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title Check ✅ Passed The PR title "style: resolve fade on scroll issue on accounts list" accurately captures the primary objective stated in the PR description. The changeset contains styling modifications (adding overflow: 'hidden', adjusting animation offsets, modifying padding) that directly address scroll and fade rendering issues on the accounts list component. While the PR also includes navigation refactoring with useNavigate and a new VelvetBox prop, these appear to be supporting changes to achieve the main goal rather than the primary focus. The title is specific, clear, and would enable a teammate to understand the core purpose when scanning pull request history.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Contributor

@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: 3

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 65fb07f and e03ce8f.

📒 Files selected for processing (2)
  • packages/extension-polkagate/src/popup/accountsLists/BodySection.tsx (4 hunks)
  • packages/extension-polkagate/src/popup/accountsLists/index.tsx (1 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: build
🔇 Additional comments (2)
packages/extension-polkagate/src/popup/accountsLists/index.tsx (1)

76-76: LGTM - Overflow clipping supports fade effect.

Adding overflow: 'hidden' to the Grid container appropriately clips overflow content, which is essential for the fade-on-scroll effect to work correctly.

packages/extension-polkagate/src/popup/accountsLists/BodySection.tsx (1)

107-107: VelvetBox correctly accepts the childrenStyle prop—no issues found.

VelvetBox's interface (VelvetBoxProp) defines childrenStyle?: React.CSSProperties (line 24 in packages/extension-polkagate/src/style/VelvetBox.tsx), and the component properly destructures it with a default value. The usage in BodySection.tsx passing borderRadius and overflow is valid and correctly typed.

import { Box, Container, Stack } from '@mui/material';
import { AddCircle, Trash } from 'iconsax-react';
import React, { memo, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { useNavigate } from 'react-router-dom';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🔴 Critical

Critical: useNavigate is not available in react-router-dom v5.3.3.

The project uses react-router-dom v5.3.3, but useNavigate is a v6+ API. This import will fail at runtime.

Based on learnings.

Use the v5 equivalent instead:

-import { useNavigate } from 'react-router-dom';
+import { useHistory } from 'react-router-dom';

Committable suggestion skipped: line range outside the PR's diff.

🤖 Prompt for AI Agents
In packages/extension-polkagate/src/popup/accountsLists/BodySection.tsx around
line 9, the code imports useNavigate which is a react-router-dom v6 API and will
fail at runtime with v5.3.3; replace the import with useHistory from
'react-router-dom' and update any navigation calls to use history.push(...) or
history.replace(...) accordingly (obtain history via const history =
useHistory() and use history.push/replace where useNavigate() would have been
used).

Copy link
Contributor

@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

♻️ Duplicate comments (3)
packages/extension-polkagate/src/popup/accountsLists/BodySection.tsx (3)

9-9: Critical: useNavigate is not available in react-router-dom v5.3.3.

This issue was previously flagged and remains unresolved. The project uses react-router-dom v5.3.3, which does not support the useNavigate hook (v6+ API). This will cause a runtime error.

Based on learnings.

Replace with the v5 equivalent:

-import { useNavigate } from 'react-router-dom';
+import { useHistory } from 'react-router-dom';

52-52: Critical: Replace useNavigate with useHistory.

This issue was previously flagged and remains unresolved. Use the v5-compatible hook:

Based on learnings.

-  const navigate = useNavigate();
+  const history = useHistory();

68-70: Critical: Update navigation to use v5 API.

This issue was previously flagged and remains unresolved. The navigation logic must use the v5 history.push() method, and the as void cast is unnecessary.

Based on learnings.

   useEffect(() => {
     if (flatAccounts.length === 0) {
-      navigate('/') as void;
+      history.push('/');
     }
-  }, [flatAccounts.length, navigate]);
+  }, [flatAccounts.length, history]);
🧹 Nitpick comments (1)
packages/extension-polkagate/src/popup/accountsLists/AccountRowSimple.tsx (1)

60-60: Verify the margin-to-padding change doesn't affect layout.

Changing from mx: '1px' (horizontal margin) to px: '1px' (horizontal padding) alters the box model. This could affect the element's total width and click target area. Please verify that this change produces the intended visual result and doesn't introduce layout shifts.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between e03ce8f and 71e4dfb.

📒 Files selected for processing (2)
  • packages/extension-polkagate/src/popup/accountsLists/AccountRowSimple.tsx (1 hunks)
  • packages/extension-polkagate/src/popup/accountsLists/BodySection.tsx (4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Analyze (javascript)
  • GitHub Check: build
🔇 Additional comments (3)
packages/extension-polkagate/src/popup/accountsLists/AccountRowSimple.tsx (1)

57-57: Animation refinement looks good.

The reduced initial offset (10 → 5) creates a more subtle entrance animation.

packages/extension-polkagate/src/popup/accountsLists/BodySection.tsx (2)

107-107: Verify VelvetBox supports the childrenStyle prop.

The new childrenStyle prop with overflow: 'hidden' aligns well with the PR objective to fix the fade-on-scroll issue. Please confirm that the VelvetBox component's API includes this prop to avoid runtime errors.


108-108: Height constraints and scroll behavior look appropriate.

The explicit height constraints with overflowY: 'auto' enable the scrollable area that the FadeOnScroll component (line 156) operates on. This aligns with the PR objective.

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