Skip to content

feat: vault headers#327

Merged
antoncoding merged 6 commits into
masterfrom
feat/detail-portfolio
Jan 26, 2026
Merged

feat: vault headers#327
antoncoding merged 6 commits into
masterfrom
feat/detail-portfolio

Conversation

@antoncoding
Copy link
Copy Markdown
Owner

@antoncoding antoncoding commented Jan 26, 2026

Summary by CodeRabbit

  • New Features

    • New unified vault header with asset, allocator and collateral info plus deposit/withdraw controls.
    • Hook now exposes user asset/share calculation for improved personal balance display.
  • Bug Fixes

    • Vaults with zero balance hidden from the user vaults table.
    • Removed an extraneous table description from the transaction preview.
  • Refactor

    • Removed several legacy vault detail cards and summary components; market allocation view simplified.
    • Table description prop made optional.

✏️ Tip: You can customize this high-level summary in your review settings.

@vercel
Copy link
Copy Markdown
Contributor

vercel Bot commented Jan 26, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Review Updated (UTC)
monarch Ready Ready Preview, Comment Jan 26, 2026 9:11am

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 26, 2026

📝 Walkthrough

Walkthrough

Adds a centralized VaultHeader component and ERC4626-derived userAssets; removes several vault-detail card components and collateral view; makes table description optional; filters out zero-balance vaults in user-vaults-table; wires deposit/withdraw through modal hooks and updates vault-view accordingly.

Changes

Cohort / File(s) Summary
Common table component
src/components/common/table-container-with-header.tsx, src/features/history/components/transaction-history-preview.tsx
description prop made optional and rendered conditionally; transaction-history-preview no longer supplies a description.
Removed vault detail cards
src/features/autovault/components/vault-detail/collateral-view.tsx, src/features/autovault/components/vault-detail/total-supply-card.tsx, src/features/autovault/components/vault-detail/vault-allocator-card.tsx, src/features/autovault/components/vault-detail/vault-collaterals-card.tsx, src/features/autovault/components/vault-detail/vault-summary-metrics.tsx
Deleted components and their exported prop types; UI responsibilities consolidated into VaultHeader/vault-view.
New vault header & allocations change
src/features/autovault/components/vault-detail/vault-header.tsx (new), src/features/autovault/components/vault-detail/vault-market-allocations.tsx
Added VaultHeader (identity, stats, actions, expandable details, copy-to-clipboard); simplified market allocations by removing collateral-view branching.
Vault view consolidation
src/features/autovault/vault-view.tsx
Replaced per-card header/cards with VaultHeader; wired deposit/withdraw to modal system; extracts token/collateral metadata and removed usages of the deleted cards.
Address identity formatting
src/components/shared/address-identity.tsx
Reformatted conditional rendering for the icon (stylistic only).
User vaults filtering
src/features/positions/components/user-vaults-table.tsx
Filter vaults to only active (balance > 0); render placeholder when none; APY fallback shows '-' when undefined.
Vault hook extension
src/hooks/useVaultV2.ts
Hook now queries ERC4626 fields (balanceOf, totalSupply) and exposes new `userAssets: bigint

Sequence Diagram(s)

mermaid
sequenceDiagram
participant User
participant VaultHeader
participant ModalService
participant useVaultV2
participant Backend
Note over User,VaultHeader: User triggers deposit/withdraw
User->>VaultHeader: click Deposit/Withdraw
VaultHeader->>ModalService: open modal with token metadata
ModalService->>useVaultV2: request latest vault/token data
useVaultV2->>Backend: read vault, balanceOf, totalSupply
Backend-->>useVaultV2: return vault + ERC4626 data
useVaultV2-->>ModalService: provide data (including userAssets)
ModalService-->>User: show modal UI
User->>ModalService: confirm action
ModalService->>Backend: submit transaction
Backend-->>ModalService: tx result
ModalService->>VaultHeader: trigger refetch/onSuccess
VaultHeader->>useVaultV2: refetch vault data
useVaultV2->>Backend: read updated vault state
Backend-->>useVaultV2: updated data
useVaultV2-->>VaultHeader: updated values

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

Possibly related PRs

  • antoncoding/monarch#276 — Related wiring of deposit/withdraw to centralized modal system and adjustments to total-supply UI.
  • antoncoding/monarch#166 — Overlapping changes to vault allocations, collateral/market view and related components/hooks.
  • antoncoding/monarch#250 — Touches the same table-container-with-header changes (description handling).
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 28.57% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: introducing a new VaultHeader component that consolidates vault header UI and replaces multiple legacy card components.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/detail-portfolio

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.

@coderabbitai coderabbitai Bot added feature request Specific feature ready to be implemented ui User interface labels Jan 26, 2026
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.

Actionable comments posted: 4

🤖 Fix all issues with AI agents
In `@src/features/autovault/components/vault-detail/vault-header.tsx`:
- Around line 105-112: The icon-only buttons in VaultHeader (the copy button
using LuCopy and the overflow/options icon button) lack accessible names; add
descriptive aria-label attributes to each (e.g., aria-label="Copy vault address"
on the button that calls handleCopyVaultAddress, and aria-label="Open vault
options" on the overflow/options button), or use aria-labelledby if you add
visually hidden text, ensuring the buttons remain icon-only but are announced
correctly by screen readers.
- Around line 102-105: The symbol badge is rendered even when `symbol` can be
empty; update the JSX in the vault header component (vault-header.tsx, inside
the element that renders {title} and the span with class "rounded bg-hovered
...") to render the <span> only when `symbol` is non-empty (e.g., check
Boolean(symbol) or symbol?.trim() before rendering) so empty or whitespace-only
symbols do not produce a blank pill.

In `@src/features/autovault/vault-view.tsx`:
- Around line 160-186: Create a single boolean (e.g., isAssetDataAvailable =
!!assetAddress && !!tokenSymbol && tokenDecimals !== undefined) and use it to
disable the Deposit/Withdraw buttons where they are rendered, and also guard the
handlers handleDeposit and handleWithdraw: if you keep the early return, replace
the silent return with a user-visible fallback (e.g., showToast or notification)
so clicking when disabled gives feedback; update references in the file to use
isAssetDataAvailable for button disabled props and call the toast function
inside handleDeposit/handleWithdraw before returning if data is missing.

In `@src/features/positions/components/user-vaults-table.tsx`:
- Around line 54-59: The component currently returns null when activeVaults is
empty, which hides the header/refresh button; instead, update the render logic
in user-vaults-table (e.g., UserVaultsTable) to not early-return on
activeVaults.length === 0. Keep the header and refresh control rendered
unconditionally (or when vaults.length > 0) and render an empty state
message/placeholder when vaults exist but all balances are zero (i.e.,
vaults.length > 0 && activeVaults.length === 0). Locate the activeVaults and
vaults usage and replace the early return with conditional rendering that shows
the table rows for activeVaults when present and an empty-state row/message plus
the existing refresh button when not.
🧹 Nitpick comments (1)
src/features/autovault/vault-view.tsx (1)

116-142: Consider a tiny formatter helper for balance labels.
totalAssetsLabel and userShareBalanceLabel repeat the same formatting logic.

Comment thread src/features/autovault/components/vault-detail/vault-header.tsx
Comment thread src/features/autovault/components/vault-detail/vault-header.tsx
Comment thread src/features/autovault/vault-view.tsx
Comment thread src/features/positions/components/user-vaults-table.tsx
@antoncoding antoncoding merged commit 8b393f2 into master Jan 26, 2026
4 checks passed
@antoncoding antoncoding deleted the feat/detail-portfolio branch January 26, 2026 09:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

feature request Specific feature ready to be implemented ui User interface

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant