Skip to content

feat: allow hiding account modal quick actions#600

Merged
Agilulfo1820 merged 3 commits intovechain:mainfrom
Emilvooo:feat/hide-wallet-modal-quick-actions
Mar 10, 2026
Merged

feat: allow hiding account modal quick actions#600
Agilulfo1820 merged 3 commits intovechain:mainfrom
Emilvooo:feat/hide-wallet-modal-quick-actions

Conversation

@Emilvooo
Copy link
Copy Markdown
Contributor

@Emilvooo Emilvooo commented Mar 9, 2026

Summary

  • add a hiddenQuickActions provider config to control which account modal quick actions are shown
  • filter the quick actions section based on that config and hide the section when no actions remain

Why

  • some integrators may not want every quick action exposed in the account modal because it can conflict with their own platform flows or product decisions, so they need a simple way to hide actions like swap/send/receive

Summary by CodeRabbit

  • New Features
    • Configure and hide specific quick actions (send, swap, receive) in the account modal via provider/config.
    • Account modal layout now adapts dynamically to the number of visible quick actions.
    • Notification indicators (red dots) for quick actions respect configured hidden actions.
    • If all quick actions are hidden, the quick-actions section is omitted from the modal.

@github-actions
Copy link
Copy Markdown

github-actions Bot commented Mar 9, 2026

👋 Thanks for your contribution!

Since this PR comes from a forked repository, the lint and build will only run for internal PRs for security reasons.
Please ensure that your PR is coming from a meaningful branch name. Eg. feature/my-feature not main

      **Next steps:**
      1. A maintainer will review your code
      2. If approved, they'll add the `safe-to-build` label to trigger build and test
      3. **After each new commit**, the maintainer will need to remove and re-add the label for security

Thank you for your patience! 🙏

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 9, 2026

📝 Walkthrough

Walkthrough

The PR adds a new AccountQuickAction type and a hiddenQuickActions configuration in the VeChainKit provider, passes it through context, and updates QuickActionsSection to filter, early-return, and dynamically lay out quick action buttons based on the hidden list.

Changes

Cohort / File(s) Summary
Provider Configuration
packages/vechain-kit/src/providers/VeChainKitProvider.tsx
Add new public type `AccountQuickAction = 'send'
Quick Actions Filtering & UI
packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx
Add id: AccountQuickAction to quick-action entries and use string ids ('send', 'swap', 'receive'); compute visibleQuickActions by filtering with hiddenQuickActions; early-return null when none visible; use visibleQuickActions.length to set grid templateColumns; map/render visibleQuickActions with key={action.id} and pass showRedDot accordingly.

Sequence Diagram(s)

sequenceDiagram
  participant Provider as VeChainKitProvider
  participant Context as KitContext
  participant UI as QuickActionsSection
  participant Button as QuickActionButton

  Provider->>Context: initialize value (hiddenQuickActions: [])
  Note right of Context: consumer reads config
  UI->>Context: read hiddenQuickActions
  UI->>UI: filter QUICK_ACTIONS -> visibleQuickActions
  alt visibleQuickActions not empty
    UI->>UI: compute grid columns based on count
    UI->>Button: render each visible action (id,label,showRedDot)
  else none visible
    UI-->>UI: return null (no rendering)
  end
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 I nibbled code and hid a few,
Buttons vanish, neat and true,
Grid stretches, shrinks with pride,
Quick hops match what you hide,
A tiny rabbit winked—confetti inside! 🎉

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and specifically describes the main change: adding functionality to hide quick actions in the account modal.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 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
Copy Markdown

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/vechain-kit/src/providers/VeChainKitProvider.tsx (1)

160-183: ⚠️ Potential issue | 🟠 Major

Keep the exported config type backward-compatible.

VeChainKitConfig is re-exported from the package, so making hiddenQuickActions required is a compile-time breaking change for downstream mocks/builders that already satisfy this public type. Please keep the public field optional, or split out an internal “resolved config” type for the context value instead.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@packages/vechain-kit/src/providers/VeChainKitProvider.tsx` around lines 160 -
183, The exported VeChainKitConfig currently makes hiddenQuickActions required,
which is a breaking change; change hiddenQuickActions to optional on the public
VeChainKitConfig (i.e., hiddenQuickActions?: AccountQuickAction[]), or
alternatively introduce an internal ResolvedVeChainKitConfig (or
VeChainKitInternalConfig) used by the provider/context that includes the
required hiddenQuickActions while keeping the exported VeChainKitConfig
unchanged; update usages in VeChainKitProvider (where you read/normalize config)
to accept the optional field and populate a resolved/internal config before use.
🧹 Nitpick comments (1)
packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx (1)

124-142: Optimize data fetching by making hooks conditional on quick action visibility.

The useTotalBalance and useUpgradeRequired hooks execute before checking if any quick actions are visible (line 136–138), so configurations that hide all actions still pay the cost of fetching token balances and upgrade status on every render.

Since useTotalBalance doesn't currently support an enabled parameter, enhance it to accept one (following the pattern already present in useUpgradeRequired at line 80). Then wire both hooks to skip execution when visibleQuickActions is empty:

const hasVisibleActions = visibleQuickActions.length > 0;
const { hasAnyBalance } = useTotalBalance({
    address: account?.address ?? '',
    enabled: hasVisibleActions,
});
const { data: upgradeRequired } = useUpgradeRequired(
    smartAccount?.address ?? '',
    connectedWallet?.address ?? '',
    3,
    hasVisibleActions,
);

This aligns with the coding guidelines for conditional query enabling and ensures the hidden section carries negligible cost.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx`
around lines 124 - 142, The code currently calls useTotalBalance and
useUpgradeRequired unconditionally which triggers unnecessary fetches even when
all quick actions are hidden; add a local boolean (e.g., hasVisibleActions =
visibleQuickActions.length > 0) and update calls so useTotalBalance accepts and
uses an enabled flag (mirror useUpgradeRequired's pattern) and pass enabled:
hasVisibleActions when invoking useTotalBalance, and pass hasVisibleActions as
the last parameter to useUpgradeRequired (instead of calling it
unconditionally); update the useTotalBalance hook implementation to accept and
forward an enabled option to its underlying query so it skips fetching when
hasVisibleActions is false.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In `@packages/vechain-kit/src/providers/VeChainKitProvider.tsx`:
- Around line 160-183: The exported VeChainKitConfig currently makes
hiddenQuickActions required, which is a breaking change; change
hiddenQuickActions to optional on the public VeChainKitConfig (i.e.,
hiddenQuickActions?: AccountQuickAction[]), or alternatively introduce an
internal ResolvedVeChainKitConfig (or VeChainKitInternalConfig) used by the
provider/context that includes the required hiddenQuickActions while keeping the
exported VeChainKitConfig unchanged; update usages in VeChainKitProvider (where
you read/normalize config) to accept the optional field and populate a
resolved/internal config before use.

---

Nitpick comments:
In
`@packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx`:
- Around line 124-142: The code currently calls useTotalBalance and
useUpgradeRequired unconditionally which triggers unnecessary fetches even when
all quick actions are hidden; add a local boolean (e.g., hasVisibleActions =
visibleQuickActions.length > 0) and update calls so useTotalBalance accepts and
uses an enabled flag (mirror useUpgradeRequired's pattern) and pass enabled:
hasVisibleActions when invoking useTotalBalance, and pass hasVisibleActions as
the last parameter to useUpgradeRequired (instead of calling it
unconditionally); update the useTotalBalance hook implementation to accept and
forward an enabled option to its underlying query so it skips fetching when
hasVisibleActions is false.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e0062bbc-3a52-4301-a621-33311a1d72b3

📥 Commits

Reviewing files that changed from the base of the PR and between dcacf4c and fb0ba62.

📒 Files selected for processing (2)
  • packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx
  • packages/vechain-kit/src/providers/VeChainKitProvider.tsx

Copy link
Copy Markdown

@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.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx (1)

158-158: ⚠️ Potential issue | 🟠 Major

Bug: showRedDot condition references non-existent action label.

The condition action.label === 'Settings' will always be false because none of the quick actions have the label 'Settings'. The available labels are 'Send', 'Swap', and 'Receive'.

This means the red dot indicator for upgrade notifications will never appear on any quick action button.

If the red dot should not appear on any quick action, simplify by removing the condition entirely. Otherwise, update the condition to reference the correct action label.

🐛 Proposed fix (if red dot should not appear on quick actions)
                     onClick={() => action.onClick(setCurrentContent)}
                     isDisabled={action.isDisabled?.(hasAnyBalance)}
-                    showRedDot={showRedDot && action.label === 'Settings'}
                 />
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In
`@packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx`
at line 158, The showRedDot check uses a non-existent label 'Settings', so
update the expression in QuickActionsSection.tsx where the quick action button
passes showRedDot: either remove the label comparison so the prop is simply
showRedDot (if the dot should appear on all quick actions) or change the
comparison to a valid label from the actions list (e.g., replace action.label
=== 'Settings' with action.label === 'Receive') depending on the intended UX.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Outside diff comments:
In
`@packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx`:
- Line 158: The showRedDot check uses a non-existent label 'Settings', so update
the expression in QuickActionsSection.tsx where the quick action button passes
showRedDot: either remove the label comparison so the prop is simply showRedDot
(if the dot should appear on all quick actions) or change the comparison to a
valid label from the actions list (e.g., replace action.label === 'Settings'
with action.label === 'Receive') depending on the intended UX.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 2b71403d-8051-4b5c-a3f6-3b167f0ce335

📥 Commits

Reviewing files that changed from the base of the PR and between fb0ba62 and 7ed38a3.

📒 Files selected for processing (2)
  • packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx
  • packages/vechain-kit/src/providers/VeChainKitProvider.tsx

@Emilvooo
Copy link
Copy Markdown
Contributor Author

Emilvooo commented Mar 9, 2026

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)

packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx (1)> 158-158: ⚠️ Potential issue | 🟠 Major

Bug: showRedDot condition references non-existent action label.
The condition action.label === 'Settings' will always be false because none of the quick actions have the label 'Settings'. The available labels are 'Send', 'Swap', and 'Receive'.
This means the red dot indicator for upgrade notifications will never appear on any quick action button.
If the red dot should not appear on any quick action, simplify by removing the condition entirely. Otherwise, update the condition to reference the correct action label.

🐛 Proposed fix (if red dot should not appear on quick actions)

                     onClick={() => action.onClick(setCurrentContent)}
                     isDisabled={action.isDisabled?.(hasAnyBalance)}
-                    showRedDot={showRedDot && action.label === 'Settings'}
                 />

🤖 Prompt for AI Agents

Verify each finding against the current code and only fix it if needed.

In
`@packages/vechain-kit/src/components/AccountModal/Components/QuickActionsSection.tsx`
at line 158, The showRedDot check uses a non-existent label 'Settings', so
update the expression in QuickActionsSection.tsx where the quick action button
passes showRedDot: either remove the label comparison so the prop is simply
showRedDot (if the dot should appear on all quick actions) or change the
comparison to a valid label from the actions list (e.g., replace action.label
=== 'Settings' with action.label === 'Receive') depending on the intended UX.

🤖 Prompt for all review comments with AI agents

ℹ️ Review info

This is a valid pre-existing issue, but not introduced by this PR.
action.label === 'Settings' can never match here because the quick actions are only Send, Swap, and Receive, so the red dot never renders. I’d prefer to keep that out of scope for this PR and handle it in a small follow-up once the intended UX is clear.

@Agilulfo1820 Agilulfo1820 added safe-to-deploy Label to approve external PRs to preview environment safe-to-build labels Mar 10, 2026
@Agilulfo1820 Agilulfo1820 merged commit e089048 into vechain:main Mar 10, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

safe-to-build safe-to-deploy Label to approve external PRs to preview environment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants