Skip to content

feat(frontend): compact wallet popover for the new layout - #13699

Merged
Abhi1992002 merged 8 commits into
devfrom
abhi/add-new-wallet-for-new-layout
Jul 30, 2026
Merged

feat(frontend): compact wallet popover for the new layout#13699
Abhi1992002 merged 8 commits into
devfrom
abhi/add-new-wallet-for-new-layout

Conversation

@Abhi1992002

Copy link
Copy Markdown
Member

Why / What / How

Why. The wallet popover is 28.5rem wide with an inline top-up form, an auto-refill config form, collapsible task groups, embedded videos and progress bars. That was designed for the classic top navbar. In the new sidebar layout the wallet lives in the sidebar footer as a small $1.00 pill, and opening it throws a panel wider than the sidebar itself over the page. It's far too heavy for what a user wants there: how many credits do I have, how do I get more.

What. A compact popover used only when the wallet renders in the new layout (compact prop, set by SidebarUserActions). The classic navbar keeps the existing panel, byte-for-byte.

How. Wallet.tsx had grown to 360 lines mixing trigger markup, popover content, credits fetching, confetti and websocket wiring. Rather than add a second panel to it, the shared parts were pulled out first:

  • helpers.ts — task-group definitions + getEarnRows()
  • useWallet.ts — credits, balance-flash, completion counts, onboarding websocket + confetti
  • components/WalletFullPanel.tsx — the existing classic panel, moved verbatim
  • components/WalletCompactPanel.tsx — the new one

Wallet.tsx is now ~120 lines and just picks a panel.

The compact panel shows three things: balance, an Add credits row, and a collapsible Earn credits list. To keep the list short, getEarnRows() flattens the three task groups — a group with every task done collapses to one First Wins · 3 of 3 — Done row, while a group still in progress contributes one row per task.

Add credits opens TopUpDialog instead of embedding TopUpForm inline. That dialog's copy was hardcoded to "You're out of automation credits", which is wrong when you open it deliberately with a positive balance, so it gained an add-credits variant. Default is unchanged, so the low-credit banner and daily auto-opener read exactly as before.

Completed rows reuse SealCheckIcon (weight="fill", #00a656) from the copilot TaskProgressBar's "All tasks complete" header, so completion reads the same across the app.

Changes 🏗️

  • Add WalletCompactPanel — balance, Add credits row, collapsible Earn credits list; rendered when compact is set (new layout only)
  • Add getEarnRows() to flatten task groups; completed groups collapse to a single Done row
  • Extract helpers.ts (task groups + row flattening) and useWallet.ts (credits, confetti, websocket) out of Wallet.tsx; move the classic panel to WalletFullPanel.tsx. Wallet.tsx 360 → ~120 lines
  • Compact popover opens side="top" align="start" at 22rem with rounded-2xlarge, sized so long task names wrap rather than truncate
  • Add a variant prop to TopUpDialog (out-of-credits default | add-credits) so the wallet entry point gets accurate copy
  • Reuse SealCheckIcon / CircleIcon from the copilot task-progress treatment for row status
  • Task / TaskGroup interfaces moved from Wallet.tsx to helpers.ts (only importer, WalletTaskGroups.tsx, updated)

No backend changes. No API changes. Reward amounts are unchanged and still mirror backend/data/onboarding.py.

Checklist 📋

For code changes:

  • I have clearly listed my changes in the PR description
  • I have made a test plan
  • I have tested my changes according to the test plan:
    • pnpm format, pnpm lint, pnpm types clean
    • pnpm test:unit — 379 files pass
    • New WalletCompactPanel.test.tsx: row flattening (completed group collapses, in-progress group lists tasks, no task dropped), panel render, accordion collapse, Add credits callback
    • New layout (AUTOGPT_NEW_LAYOUT on): open the wallet from the sidebar footer — compact panel opens up and to the right, fits the viewport, long task names wrap
    • Click Add credits — popover closes, dialog opens titled "Add automation credits", Stripe checkout still reachable
    • Toggle Earn credits — list collapses and expands
    • With ENABLE_PLATFORM_PAYMENT off — Add credits row is hidden, rest of the panel still renders
    • Classic navbar (AUTOGPT_NEW_LAYOUT off): wallet is visually unchanged — inline top-up, auto-refill, task videos, progress bars, confetti on step completion
    • Hit zero credits — low-credit banner and daily auto-opener still say "You're out of automation credits"

Replace the 28.5rem wallet panel with a compact popover when the wallet
renders in the new sidebar layout. The classic navbar keeps the existing
panel unchanged.

- Extract task-group data into helpers.ts and the credits/confetti/websocket
  logic into useWallet.ts, shrinking Wallet.tsx from 360 to ~120 lines
- Add WalletCompactPanel: balance, an Add credits row that opens TopUpDialog,
  and a collapsible Earn credits list
- Collapse fully completed task groups into a single Done row via getEarnRows
- Add an add-credits variant to TopUpDialog so opening it deliberately does
  not claim the user is out of credits
@Abhi1992002
Abhi1992002 requested a review from a team as a code owner July 28, 2026 15:09
@Abhi1992002
Abhi1992002 requested review from Swiftyos and ntindle and removed request for a team July 28, 2026 15:09
@github-project-automation github-project-automation Bot moved this to 🆕 Needs initial review in AutoGPT development kanban Jul 28, 2026
@github-actions github-actions Bot added the platform/frontend AutoGPT Platform - Front end label Jul 28, 2026
@coderabbitai

coderabbitai Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 41fcfa6f-2cc1-4560-b30b-a763882432a7

📥 Commits

Reviewing files that changed from the base of the PR and between 9f1a566 and 5d37c74.

📒 Files selected for processing (6)
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
🚧 Files skipped from review as they are similar to previous changes (6)
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/tests/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/tests/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
📜 Recent review details
⏰ Context from checks skipped due to timeout. (8)
  • GitHub Check: Seer Code Review
  • GitHub Check: check API types
  • GitHub Check: lint
  • GitHub Check: integration_test
  • GitHub Check: Analyze (typescript)
  • GitHub Check: Analyze (python)
  • GitHub Check: end-to-end tests
  • GitHub Check: Check PR Status

Walkthrough

The wallet component delegates state, onboarding task processing, and panel rendering to dedicated helpers, a hook, and compact/full panels. Compact mode opens an add-credits dialog, while TopUpDialog supports distinct add-credits and out-of-credits content. Tests cover wallet, panel, helper, and dialog behavior.

Changes

Wallet refactor

Layer / File(s) Summary
Task data and earn-row transformation
autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts, autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
Onboarding task groups and compact earn rows are modeled in helpers, with task types moved there.
Wallet state and onboarding event handling
autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts, autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
Wallet state, credit refreshes, onboarding notifications, confetti, and credit-change flashing are handled and tested through useWallet.
Wallet panels and integration
autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx, autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/*, autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
Compact and full panels render wallet content, while Wallet selects the panel and wires add-credits behavior; panel and wallet interactions are tested.
Top-up dialog variants
autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx, autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
TopUpDialog renders different copy for add-credits and out-of-credits modes, with variant and dismissal behavior tested.

Estimated code review effort: 4 (Complex) | ~45 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Wallet
  participant useWallet
  participant WalletCompactPanel
  participant TopUpDialog
  Wallet->>useWallet: obtain wallet state and task groups
  useWallet-->>Wallet: return credits and formatted values
  Wallet->>WalletCompactPanel: render compact wallet
  WalletCompactPanel->>Wallet: request add credits
  Wallet->>TopUpDialog: close wallet and open dialog
  TopUpDialog-->>Wallet: report dialog close
Loading

Suggested reviewers: ntindle, swiftyos

Poem

A bunny refactors with paws so light,
Tasks hop into rows, all neat and bright.
Credits flash and confetti flies,
Top-ups bloom in new disguise.
The wallet panels dance just right.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly names the main change: a compact wallet popover for the new layout.
Description check ✅ Passed The description is detailed and directly matches the PR changes, including the compact wallet, helper extraction, and dialog variant.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch abhi/add-new-wallet-for-new-layout

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.

@github-actions

github-actions Bot commented Jul 28, 2026

Copy link
Copy Markdown
Contributor

🔍 PR Overlap Detection

This check compares your PR against all other open PRs targeting the same branch to detect potential merge conflicts early.

🔴 Merge Conflicts Detected

The following PRs have been tested and will have merge conflicts if merged after this PR. Consider coordinating with the authors.

Summary: 2 conflict(s), 0 medium risk, 0 low risk (out of 2 PRs with file overlap)


Auto-generated on push. Ignores: openapi.json, lock files.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (3)
autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx (1)

3-3: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Legacy ScrollArea import.

ScrollArea is pulled from src/components/__legacy__/ui/scroll-area. As per path instructions, Never use src/components/__legacy__/* — use design system components from src/components/.

Also applies to: 43-43

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx`
at line 3, Replace the legacy ScrollArea imports in WalletFullPanel with the
corresponding design-system ScrollArea component from the non-legacy components
path, and update both referenced usages/imports consistently.

Source: Path instructions

autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx (1)

11-49: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

LGTM on the variant logic itself.

Consider adding a small test asserting the title/copy switch between "out-of-credits" (default) and "add-credits", since there's no direct test coverage of this new branch yet.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx`
around lines 11 - 49, Add focused tests for TopUpDialog covering the
default/"out-of-credits" variant and the explicit "add-credits" variant,
asserting each renders its corresponding title and descriptive copy. Reuse the
existing dialog test setup and verify the default behavior when variant is
omitted.
autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts (1)

28-28: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Prefer useMemo over useState+useEffect for completedCount.

completedCount is purely derived from groups/state, same as totalCount (line 32-35). Using state+effect introduces an extra render where completedCount starts as null before the effect runs, whereas a useMemo would compute it synchronously and avoid the transient null (which currently gates the reward-dot/tooltip in Wallet.tsx).

♻️ Proposed refactor
-  const [completedCount, setCompletedCount] = useState<number | null>(null);
-
-  const walletRef = useRef<HTMLButtonElement | null>(null);
-
-  const totalCount = useMemo(
-    () => groups.reduce((acc, group) => acc + group.tasks.length, 0),
-    [groups],
-  );
-
-  useEffect(() => {
-    if (!state) {
-      return;
-    }
-    const completed = groups.reduce(
-      (acc, group) =>
-        acc +
-        group.tasks.filter((task) => state?.completedSteps?.includes(task.id))
-          .length,
-      0,
-    );
-    setCompletedCount(completed);
-  }, [groups, state]);
+  const walletRef = useRef<HTMLButtonElement | null>(null);
+
+  const totalCount = useMemo(
+    () => groups.reduce((acc, group) => acc + group.tasks.length, 0),
+    [groups],
+  );
+
+  const completedCount = useMemo(() => {
+    if (!state) return null;
+    return groups.reduce(
+      (acc, group) =>
+        acc +
+        group.tasks.filter((task) => state.completedSteps?.includes(task.id))
+          .length,
+      0,
+    );
+  }, [groups, state]);

Also applies to: 41-49

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts`
at line 28, Replace the completedCount useState/useEffect derivation in the
wallet hook with a useMemo calculation based on groups and state, matching the
existing totalCount pattern. Compute the value synchronously so it does not
transiently remain null and continue exposing the same completed-count behavior
to the reward-dot and tooltip consumers.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx`:
- Line 6: Replace the lucide-react X import and its usages in WalletFullPanel
with the corresponding -Icon-suffixed close icon imported from
`@phosphor-icons/react`, preserving the existing close-button behavior.

In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts`:
- Line 22: Stabilize the WebSocket initialization in useWallet so onboarding
state changes do not repeatedly rerun the effect through the
groups/handleNotification dependency chain. Move api.connectWebSocket() into a
mount-only or otherwise stable effect, or ensure cleanup tracks only the active
WebSocket detacher so stale cleanups cannot close an existing connection.

---

Nitpick comments:
In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx`:
- Line 3: Replace the legacy ScrollArea imports in WalletFullPanel with the
corresponding design-system ScrollArea component from the non-legacy components
path, and update both referenced usages/imports consistently.

In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts`:
- Line 28: Replace the completedCount useState/useEffect derivation in the
wallet hook with a useMemo calculation based on groups and state, matching the
existing totalCount pattern. Compute the value synchronously so it does not
transiently remain null and continue exposing the same completed-count behavior
to the reward-dot and tooltip consumers.

In
`@autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx`:
- Around line 11-49: Add focused tests for TopUpDialog covering the
default/"out-of-credits" variant and the explicit "add-credits" variant,
asserting each renders its corresponding title and descriptive copy. Reuse the
existing dialog test setup and verify the default behavior when variant is
omitted.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1f5a33d8-292b-4739-bed8-2eb625e41f95

📥 Commits

Reviewing files that changed from the base of the PR and between bdc2b5f and 8865663.

📒 Files selected for processing (8)
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (9)
  • GitHub Check: lint
  • GitHub Check: integration_test
  • GitHub Check: check API types
  • GitHub Check: Seer Code Review
  • GitHub Check: Check PR Status
  • GitHub Check: end-to-end tests
  • GitHub Check: Analyze (python)
  • GitHub Check: check-overlaps
  • GitHub Check: Analyze (typescript)
🧰 Additional context used
📓 Path-based instructions (17)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend development

Format frontend code using pnpm format

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
No linter suppressors (// @ts-ignore``, // eslint-disable) — fix the actual issue

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/__generated__/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

autogpt_platform/frontend/**/*.{ts,tsx}: Use function declarations (not arrow functions) for components/handlers
No any types unless the value genuinely can be anything
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/src/components/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Structure React components as: ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts (exception: small 3-4 line components can be inline; render-only components can be direct files)

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/src/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts, use design system components from src/components/ (atoms, molecules, organisms), and never use src/components/__legacy__/*

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from @/app/api/__generated__/endpoints/ following the pattern use{Method}{Version}{OperationName}, and regenerate with pnpm generate:api
Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local /components folder
Use function declarations for components and handlers, use arrow functions only for callbacks
Do not use useCallback or useMemo unless asked to optimise a given function

autogpt_platform/frontend/src/**/*.{ts,tsx}: Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Always import the -Icon-suffixed alias from @phosphor-icons/react (e.g. TrashIcon, PlusIcon, SquareIcon) — bare exports are deprecated
Do not use useCallback or useMemo unless asked to optimize a given function
Never use src/components/__legacy__/* — use design system components from src/components/

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/**/*.{tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/src/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Component props should use interface Props { ... } (not exported) unless the interface needs to be used outside the component

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never type with any, if no types available use unknown

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

autogpt_platform/frontend/**/*.{tsx,jsx}: No dark: Tailwind classes — the design system handles dark mode
Use Next.js <Link> for internal navigation — never raw <a> tags
Use Tailwind CSS only for styling with design tokens and Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/src/**/components/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Put sub-components in local components/ folder; component props should be type Props = { ... } (not exported) unless used outside the component

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/src/**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Avoid index and barrel files

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}: Use Vitest + RTL + MSW for integration tests as the primary testing approach (~90%, page-level), use Playwright for E2E critical flows, and use Storybook for design system components
Run frontend integration tests with pnpm test:unit (Vitest + RTL + MSW)

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
autogpt_platform/frontend/src/**/__tests__/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Use Orval-generated MSW handlers from @/app/api/__generated__/endpoints/{tag}/{tag}.msw.ts for API mocking

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
autogpt_platform/frontend/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

No barrel files or index.ts re-exports in the frontend

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
autogpt_platform/frontend/src/**/*.ts

📄 CodeRabbit inference engine (AGENTS.md)

Do not type hook returns, let Typescript infer as much as possible

autogpt_platform/frontend/src/**/*.ts: Extract component logic into custom hooks grouped by concern, not by component, with each hook in its own .ts file
Do not type hook returns; let TypeScript infer as much as possible

Files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
🧠 Learnings (10)
📚 Learning: 2026-03-24T02:05:04.672Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx:0-0
Timestamp: 2026-03-24T02:05:04.672Z
Learning: When gating React component logic on a React Query result (e.g., hooks like `useQuery` / `useGetV2GetCopilotUsage`), prefer destructuring and checking `isSuccess` (or aliasing it to a meaningful boolean like `isSuccess: hasUsage`) instead of relying on `!isLoading`. Reason: `isLoading` can be `false` in error/idle states where `data` may still be `undefined`, while `isSuccess` indicates the query completed successfully and `data` is populated.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
📚 Learning: 2026-04-01T18:54:16.035Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 12633
File: autogpt_platform/frontend/src/app/(platform)/library/components/AgentFilterMenu/AgentFilterMenu.tsx:3-10
Timestamp: 2026-04-01T18:54:16.035Z
Learning: In the frontend, the legacy Select component at `@/components/__legacy__/ui/select` is an intentional, codebase-wide visual-consistency pattern. During code reviews, do not flag or block PRs merely for continuing to use this legacy Select. If a migration to the newer design-system Select is desired, bundle it into a single dedicated cleanup/migration PR that updates all Select usages together (e.g., avoid piecemeal replacements).

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
📚 Learning: 2026-04-07T09:24:16.582Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12686
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx:1-19
Timestamp: 2026-04-07T09:24:16.582Z
Learning: In Significant-Gravitas/AutoGPT’s `autogpt_platform/frontend` (Vite + `vitejs/plugin-react` with the automatic JSX transform), do not flag usages of React types/components (e.g., `React.ReactNode`) in `.ts`/`.tsx` files as missing `React` imports. Since the React namespace is made available by the project’s TS/Vite setup, an explicit `import React from 'react'` or `import type { ReactNode } ...` is not required; only treat it as missing if typechecking (e.g., `pnpm types`) would actually fail.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
📚 Learning: 2026-04-02T05:43:49.128Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx:13-13
Timestamp: 2026-04-02T05:43:49.128Z
Learning: Do not flag `import { Question } from "phosphor-icons/react"` as an invalid import. `Question` is a valid named export from `phosphor-icons/react` (as reflected in the package’s generated `.d.ts` files and re-exports via `dist/index.d.ts`), so it should be treated as a supported named export during code reviews.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/useWallet.ts
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
📚 Learning: 2026-04-13T13:11:07.445Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12764
File: autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx:143-145
Timestamp: 2026-04-13T13:11:07.445Z
Learning: In `autogpt_platform/frontend`, do not flag direct interpolation of `executionID` UUID strings into URL query parameters (e.g., `activeItem=${executionID}` in JSX/Next links). If the value is a UUID string matching `[0-9a-f-]`, it contains no reserved URL characters, so additional `encodeURIComponent` or Next.js object-based `href` encoding is unnecessary. Only treat it as an encoding issue if the query-param value is not guaranteed to be UUID-formatted (i.e., may include characters outside `[0-9a-f-]`).

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
📚 Learning: 2026-04-15T22:49:06.896Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/components/ExecutionsTable.tsx:0-0
Timestamp: 2026-04-15T22:49:06.896Z
Learning: In the AutoGPT frontend (React Query + toast/ErrorCard patterns), do not require `Sentry.captureException` in React Query mutation `catch` blocks. React Query handles error propagation for mutation paths, so follow the established pattern: show toast notifications for mutation errors and use `ErrorCard` for render/fetch errors. Only add `Sentry.captureException` for truly manual/unexpected exception paths that are outside React Query’s control (e.g., standalone async utilities or event handlers not wired through React Query).

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
📚 Learning: 2026-07-03T04:19:11.799Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13474
File: autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx:38-38
Timestamp: 2026-07-03T04:19:11.799Z
Learning: When reviewing Tailwind usage in .tsx components, allow intentional raw hex color values if they exactly match the design-spec and there is no equivalent Tailwind design token/utility class available (e.g., a utility like `bg-zinc-50` may be a different shade than the required `#f9f9f9`). Do not flag these as "design-token violations" as long as the reviewer can confirm that an appropriate Tailwind token does not exist or would not match the exact color.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/TopUpDialog/TopUpDialog.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
📚 Learning: 2026-05-16T12:12:12.246Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13138
File: autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/helpers.tsx:1-1
Timestamp: 2026-05-16T12:12:12.246Z
Learning: Code reviews for the Navbar component set should treat the `MenuItemGroup` contract as shared between `AccountMenu` (desktop) and `MobileNavbar`. If a PR attempts to migrate `AccountMenu` off the legacy `IconType` imported from `src/components/__legacy__/ui/icons.tsx`, require that the migration be coordinated with `MobileNavbar` as part of the same follow-up change (or explicitly defer the `MobileNavbar` side to a dedicated follow-up PR) to avoid leaving the shared contract in an inconsistent state. Do not block an otherwise-complete `AccountMenu` PR solely due to the pending cross-consumer legacy `IconType` dependency.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx
📚 Learning: 2026-04-20T13:17:39.951Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12854
File: autogpt_platform/frontend/src/app/(platform)/library/__tests__/briefing.test.tsx:84-84
Timestamp: 2026-04-20T13:17:39.951Z
Learning: In the AutoGPT frontend, `testing-library/react` cleanup is already handled globally after each test via `src/tests/integrations/vitest.setup.tsx`. Therefore, for integration test files under `__tests__/`, do NOT add redundant `afterEach(() => cleanup())`. Only add local `afterEach` teardown for resources that are not covered globally—specifically, when using fake timers, add `afterEach(() => vi.useRealTimers())` (or equivalent) to restore real timers and prevent cross-test interference.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
📚 Learning: 2026-04-20T20:07:22.981Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/__tests__/ExecutionsTable.test.tsx:27-76
Timestamp: 2026-04-20T20:07:22.981Z
Learning: In this codebase, Orval-generated API modules under `src/app/api/__generated__/` are not committed to git and must be generated via `pnpm generate:api` (requires a running backend). In integration tests, it’s acceptable—and expected—to stub generated hooks/modules by mocking them with `vi.mock("`@/app/api/__generated__/endpoints/`{tag}/{tag}")`. Do not treat `vi.mock` of these generated hook modules as a violation of the MSW handler guideline, since the corresponding MSW handlers cannot be imported at test time when generated files are absent.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx
🔇 Additional comments (5)
autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/helpers.ts (1)

1-150: LGTM!

autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletTaskGroups.tsx (1)

7-7: LGTM!

autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletCompactPanel.tsx (1)

1-92: LGTM!

autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx (1)

9-136: LGTM!

autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/WalletCompactPanel.test.tsx (1)

1-159: LGTM!

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 89.41176% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 76.69%. Comparing base (bdc2b5f) to head (5d37c74).

Additional details and impacted files
@@            Coverage Diff             @@
##              dev   #13699      +/-   ##
==========================================
+ Coverage   76.64%   76.69%   +0.04%     
==========================================
  Files        2715     2719       +4     
  Lines      207923   207952      +29     
  Branches    19947    19948       +1     
==========================================
+ Hits       159370   159479     +109     
+ Misses      44153    44059      -94     
- Partials     4400     4414      +14     
Flag Coverage Δ
platform-frontend 47.97% <90.36%> (+0.34%) ⬆️
platform-frontend-e2e 31.04% <52.00%> (-0.20%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
Platform Backend 83.25% <ø> (ø)
Platform Frontend 51.65% <89.41%> (+0.26%) ⬆️
AutoGPT Libs ∅ <ø> (∅)
Classic AutoGPT 28.43% <ø> (ø)
🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Abhi1992002
Abhi1992002 requested a review from 0ubbe July 28, 2026 15:34
@Abhi1992002

Copy link
Copy Markdown
Member Author

Addressed the review round in 439d7e7, 3ed45bf and 9f1a566.

Inline threads

  • WalletFullPanel: lucide-react's XXIcon from @phosphor-icons/react, and ScrollArea now comes from @/components/ui/scroll-area instead of @/components/__legacy__/ui/scroll-area (the non-legacy component is a superset — same props plus an optional showScrollToTop — so it's a drop-in swap). Both were carried over verbatim when the classic panel moved out of Wallet.tsx.
  • useWallet: the websocket subscription is stable now. handleNotification closes over groups (derived from onboarding state), so every state update was detaching the listener and calling connectWebSocket() again. The handler goes through a ref, so the subscription effect only depends on api.

Nitpicks

  • completedCount is a useMemo over groups/state, matching totalCount right above it — no transient null gating the reward dot on first render.
  • Added TopUpDialog.test.tsx covering both variants' title and body copy, the billing link, the closed state, and onClose.

Coverage
The patch check was failing at 47.67%. Added Wallet.test.tsx — it renders the real <Wallet /> in both classic and compact mode and drives useWallet end to end: gated render before credits/onboarding load, reward dot and tooltip, opening each panel, walletShown being set exactly once, the Add credits → dialog handoff, the balance flash, and the onboarding notification path (confetti for tracked steps, credits-only for untracked ones, ignored non-step events, detach on unmount). One of those tests is a direct regression test for the websocket fix — it asserts a single onWebSocketMessage/connectWebSocket pair survives an onboarding state change.

Local coverage on the touched files:

File Lines
Wallet.tsx 100%
useWallet.ts 91%
helpers.ts 100%
WalletCompactPanel.tsx 100%
WalletFullPanel.tsx 100%
TopUpDialog.tsx 100%

38 tests pass across the wallet and top-up suites; prettier, eslint and tsc are clean.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (3)
autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx (1)

7-11: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Use a function declaration for the mocked component.

TopUpForm is a React component and is currently declared as an arrow function. As per coding guidelines, frontend components and handlers must use function declarations rather than arrow functions.

Proposed fix
-vi.mock("../TopUpForm/TopUpForm", () => ({
-  TopUpForm: ({ submitLabel }: { submitLabel?: string }) => (
-    <button type="submit">{submitLabel}</button>
-  ),
-}));
+vi.mock("../TopUpForm/TopUpForm", () => {
+  function MockTopUpForm({ submitLabel }: { submitLabel?: string }) {
+    return <button type="submit">{submitLabel}</button>;
+  }
+
+  return { TopUpForm: MockTopUpForm };
+});
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx`
around lines 7 - 11, Update the mocked TopUpForm component in the vi.mock
factory to use a named function declaration instead of an arrow function,
preserving its submitLabel prop and rendered button behavior.

Source: Coding guidelines

autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx (2)

116-121: 🎯 Functional Correctness | 🔵 Trivial | ⚡ Quick win

Test only covers the credits === null half of the render-nothing condition.

The test title claims both "credits and onboarding state" gate rendering, but only creditsState.credits is nulled; onboardingState.state stays truthy (buildOnboarding()). The !state branch of if (credits === null || !state) return null; in Wallet.tsx is never exercised.

Suggested addition
   it("renders nothing until credits and onboarding state are both available", () => {
     creditsState.credits = null;
     const { container } = render(<Wallet />);

     expect(container.innerHTML).toBe("");
   });
+
+  it("renders nothing until onboarding state is available", () => {
+    onboardingState.state = null;
+    const { container } = render(<Wallet />);
+
+    expect(container.innerHTML).toBe("");
+  });
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx`
around lines 116 - 121, Update the “renders nothing until credits and onboarding
state are both available” test to also set onboardingState.state to null and
assert Wallet renders no content, thereby covering the !state branch alongside
the existing credits === null case.

1-262: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

File exceeds the ~200-line guideline for src/**/*.{ts,tsx}.

At 262 lines, consider splitting along the existing describe boundaries, e.g. keep rendering/interaction tests here and move the "Wallet onboarding notifications" block into a separate Wallet.notifications.test.tsx, sharing the mock setup via a small test-utils module. As per coding guidelines, "Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this."

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx`
around lines 1 - 262, Split the Wallet test file at its existing describe
boundaries to keep the rendering and interaction tests separate from the “Wallet
onboarding notifications” tests. Move the notification suite into a dedicated
Wallet.notifications.test.tsx file, and extract the shared mocks/setup such as
backendAPI, creditsState, onboardingState, and beforeEach into a small test
utility module reused by both files.

Source: Path instructions

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx`:
- Around line 57-63: Update the “calls onClose when the dialog is dismissed”
test to assert that the onClose mock is called exactly once after pressing
Escape, replacing the loose invocation assertion while preserving the existing
setup and dismissal flow.

---

Nitpick comments:
In
`@autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx`:
- Around line 116-121: Update the “renders nothing until credits and onboarding
state are both available” test to also set onboardingState.state to null and
assert Wallet renders no content, thereby covering the !state branch alongside
the existing credits === null case.
- Around line 1-262: Split the Wallet test file at its existing describe
boundaries to keep the rendering and interaction tests separate from the “Wallet
onboarding notifications” tests. Move the notification suite into a dedicated
Wallet.notifications.test.tsx file, and extract the shared mocks/setup such as
backendAPI, creditsState, onboardingState, and beforeEach into a small test
utility module reused by both files.

In
`@autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx`:
- Around line 7-11: Update the mocked TopUpForm component in the vi.mock factory
to use a named function declaration instead of an arrow function, preserving its
submitLabel prop and rendered button behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: d2eb9fc6-2041-46b8-8a62-40b28b9a8edf

📥 Commits

Reviewing files that changed from the base of the PR and between 3ed45bf and 9f1a566.

📒 Files selected for processing (2)
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
📜 Review details
⏰ Context from checks skipped due to timeout. (8)
  • GitHub Check: setup
  • GitHub Check: end-to-end tests
  • GitHub Check: setup
  • GitHub Check: Seer Code Review
  • GitHub Check: check-overlaps
  • GitHub Check: Analyze (typescript)
  • GitHub Check: Analyze (python)
  • GitHub Check: Check PR Status
🧰 Additional context used
📓 Path-based instructions (15)
autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Use Node.js 21+ with pnpm package manager for frontend development
Always run 'pnpm format' for formatting and linting code in frontend development

Format frontend code using pnpm format

autogpt_platform/frontend/**/*.{ts,tsx,js,jsx}: Fully capitalize acronyms in symbols, e.g. graphID, useBackendAPI
No linter suppressors (// @ts-ignore``, // eslint-disable) — fix the actual issue

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{tsx,ts}: Use function declarations for components and handlers (not arrow functions) in React components
Only use arrow functions for small inline lambdas (map, filter, etc.) in React components
Use PascalCase for component names and camelCase with 'use' prefix for hook names in React
Use Tailwind CSS utilities only for styling in frontend components
Use design system components from 'src/components/' (atoms, molecules, organisms) in frontend development
Never use 'src/components/legacy/' in frontend code
Only use Phosphor Icons (@phosphor-icons/react) for icons in frontend components
Use generated API hooks from '@/app/api/__generated__/endpoints/' instead of deprecated 'BackendAPI' or 'src/lib/autogpt-server-api/
'
Use React Query for server state (via generated hooks) in frontend development
Default to client components ('use client') in Next.js; only use server components for SEO or extreme TTFB needs
Use '' component for rendering errors in frontend UI; use toast notifications for mutation errors; use 'Sentry.captureException()' for manual exceptions
Separate render logic from data/behavior in React components; keep comments minimal (code should be self-documenting)

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/**/*.{ts,tsx}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

autogpt_platform/frontend/**/*.{ts,tsx}: No barrel files or 'index.ts' re-exports in frontend code
Regenerate API hooks with 'pnpm generate:api' after backend OpenAPI spec changes in frontend development

autogpt_platform/frontend/**/*.{ts,tsx}: Use function declarations (not arrow functions) for components/handlers
No any types unless the value genuinely can be anything
Keep render functions and hooks under ~50 lines; extract named helpers or sub-components when they grow longer

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/src/components/**/*.{tsx,ts}

📄 CodeRabbit inference engine (.github/copilot-instructions.md)

Structure React components as: ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts (exception: small 3-4 line components can be inline; render-only components can be direct files)

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/src/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts, use design system components from src/components/ (atoms, molecules, organisms), and never use src/components/__legacy__/*

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/src/**/*.{ts,tsx}: Use generated API hooks from @/app/api/__generated__/endpoints/ following the pattern use{Method}{Version}{OperationName}, and regenerate with pnpm generate:api
Separate render logic from business logic using component.tsx + useComponent.ts + helpers.ts pattern, colocate state when possible and avoid creating large components, use sub-components in local /components folder
Use function declarations for components and handlers, use arrow functions only for callbacks
Do not use useCallback or useMemo unless asked to optimise a given function

autogpt_platform/frontend/src/**/*.{ts,tsx}: Keep files under ~200 lines; extract sub-components or hooks into their own files when a file grows beyond this
Use generated API hooks from @/app/api/__generated__/endpoints/ with pattern use{Method}{Version}{OperationName}
Always import the -Icon-suffixed alias from @phosphor-icons/react (e.g. TrashIcon, PlusIcon, SquareIcon) — bare exports are deprecated
Do not use useCallback or useMemo unless asked to optimize a given function
Never use src/components/__legacy__/* — use design system components from src/components/

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/**/*.{tsx,css}

📄 CodeRabbit inference engine (AGENTS.md)

Use Tailwind CSS only for styling, use design tokens, and use Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/src/**/*.tsx

📄 CodeRabbit inference engine (AGENTS.md)

Component props should use interface Props { ... } (not exported) unless the interface needs to be used outside the component

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Never type with any, if no types available use unknown

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

autogpt_platform/frontend/**/*.{test,spec}.{ts,tsx}: Use Vitest + RTL + MSW for integration tests as the primary testing approach (~90%, page-level), use Playwright for E2E critical flows, and use Storybook for design system components
Run frontend integration tests with pnpm test:unit (Vitest + RTL + MSW)

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

autogpt_platform/frontend/**/*.{tsx,jsx}: No dark: Tailwind classes — the design system handles dark mode
Use Next.js <Link> for internal navigation — never raw <a> tags
Use Tailwind CSS only for styling with design tokens and Phosphor Icons only

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/src/**/components/**/*.{tsx,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Put sub-components in local components/ folder; component props should be type Props = { ... } (not exported) unless used outside the component

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/src/**/components/**/*.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Structure components as ComponentName/ComponentName.tsx + useComponentName.ts + helpers.ts

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/src/**/__tests__/**/*.{test,spec}.{ts,tsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Use Orval-generated MSW handlers from @/app/api/__generated__/endpoints/{tag}/{tag}.msw.ts for API mocking

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
autogpt_platform/frontend/src/**/*.{ts,tsx,js,jsx}

📄 CodeRabbit inference engine (autogpt_platform/frontend/AGENTS.md)

Avoid index and barrel files

Files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
🧠 Learnings (11)
📚 Learning: 2026-03-24T02:05:04.672Z
Learnt from: majdyz
Repo: Significant-Gravitas/AutoGPT PR: 12526
File: autogpt_platform/frontend/src/app/(platform)/copilot/CopilotPage.tsx:0-0
Timestamp: 2026-03-24T02:05:04.672Z
Learning: When gating React component logic on a React Query result (e.g., hooks like `useQuery` / `useGetV2GetCopilotUsage`), prefer destructuring and checking `isSuccess` (or aliasing it to a meaningful boolean like `isSuccess: hasUsage`) instead of relying on `!isLoading`. Reason: `isLoading` can be `false` in error/idle states where `data` may still be `undefined`, while `isSuccess` indicates the query completed successfully and `data` is populated.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-04-01T18:54:16.035Z
Learnt from: Bentlybro
Repo: Significant-Gravitas/AutoGPT PR: 12633
File: autogpt_platform/frontend/src/app/(platform)/library/components/AgentFilterMenu/AgentFilterMenu.tsx:3-10
Timestamp: 2026-04-01T18:54:16.035Z
Learning: In the frontend, the legacy Select component at `@/components/__legacy__/ui/select` is an intentional, codebase-wide visual-consistency pattern. During code reviews, do not flag or block PRs merely for continuing to use this legacy Select. If a migration to the newer design-system Select is desired, bundle it into a single dedicated cleanup/migration PR that updates all Select usages together (e.g., avoid piecemeal replacements).

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-04-07T09:24:16.582Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12686
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/__tests__/PainPointsStep.test.tsx:1-19
Timestamp: 2026-04-07T09:24:16.582Z
Learning: In Significant-Gravitas/AutoGPT’s `autogpt_platform/frontend` (Vite + `vitejs/plugin-react` with the automatic JSX transform), do not flag usages of React types/components (e.g., `React.ReactNode`) in `.ts`/`.tsx` files as missing `React` imports. Since the React namespace is made available by the project’s TS/Vite setup, an explicit `import React from 'react'` or `import type { ReactNode } ...` is not required; only treat it as missing if typechecking (e.g., `pnpm types`) would actually fail.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-07-28T15:32:54.931Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13699
File: autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/components/WalletFullPanel.tsx:0-0
Timestamp: 2026-07-28T15:32:54.931Z
Learning: In AutoGPT's frontend (autogpt_platform/frontend), prefer importing the non-legacy ScrollArea component from `@/components/ui/scroll-area` over `@/components/__legacy__/ui/scroll-area` for new or migrated code. The non-legacy component is a drop-in superset: it preserves the legacy component’s props and additionally supports the optional `showScrollToTop` prop—so reviewers should flag new legacy imports unless there’s a specific, documented reason they can’t use the non-legacy version.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-04-02T05:43:49.128Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12640
File: autogpt_platform/frontend/src/app/(no-navbar)/onboarding/steps/WelcomeStep.tsx:13-13
Timestamp: 2026-04-02T05:43:49.128Z
Learning: Do not flag `import { Question } from "phosphor-icons/react"` as an invalid import. `Question` is a valid named export from `phosphor-icons/react` (as reflected in the package’s generated `.d.ts` files and re-exports via `dist/index.d.ts`), so it should be treated as a supported named export during code reviews.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-04-13T13:11:07.445Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12764
File: autogpt_platform/frontend/src/app/(platform)/library/components/SitrepItem/SitrepItem.tsx:143-145
Timestamp: 2026-04-13T13:11:07.445Z
Learning: In `autogpt_platform/frontend`, do not flag direct interpolation of `executionID` UUID strings into URL query parameters (e.g., `activeItem=${executionID}` in JSX/Next links). If the value is a UUID string matching `[0-9a-f-]`, it contains no reserved URL characters, so additional `encodeURIComponent` or Next.js object-based `href` encoding is unnecessary. Only treat it as an encoding issue if the query-param value is not guaranteed to be UUID-formatted (i.e., may include characters outside `[0-9a-f-]`).

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-04-15T22:49:06.896Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/components/ExecutionsTable.tsx:0-0
Timestamp: 2026-04-15T22:49:06.896Z
Learning: In the AutoGPT frontend (React Query + toast/ErrorCard patterns), do not require `Sentry.captureException` in React Query mutation `catch` blocks. React Query handles error propagation for mutation paths, so follow the established pattern: show toast notifications for mutation errors and use `ErrorCard` for render/fetch errors. Only add `Sentry.captureException` for truly manual/unexpected exception paths that are outside React Query’s control (e.g., standalone async utilities or event handlers not wired through React Query).

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-07-03T04:19:11.799Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13474
File: autogpt_platform/frontend/src/app/(platform)/PlatformChrome/PlatformChrome.tsx:38-38
Timestamp: 2026-07-03T04:19:11.799Z
Learning: When reviewing Tailwind usage in .tsx components, allow intentional raw hex color values if they exactly match the design-spec and there is no equivalent Tailwind design token/utility class available (e.g., a utility like `bg-zinc-50` may be a different shade than the required `#f9f9f9`). Do not flag these as "design-token violations" as long as the reviewer can confirm that an appropriate Tailwind token does not exist or would not match the exact color.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-04-20T13:17:39.951Z
Learnt from: 0ubbe
Repo: Significant-Gravitas/AutoGPT PR: 12854
File: autogpt_platform/frontend/src/app/(platform)/library/__tests__/briefing.test.tsx:84-84
Timestamp: 2026-04-20T13:17:39.951Z
Learning: In the AutoGPT frontend, `testing-library/react` cleanup is already handled globally after each test via `src/tests/integrations/vitest.setup.tsx`. Therefore, for integration test files under `__tests__/`, do NOT add redundant `afterEach(() => cleanup())`. Only add local `afterEach` teardown for resources that are not covered globally—specifically, when using fake timers, add `afterEach(() => vi.useRealTimers())` (or equivalent) to restore real timers and prevent cross-test interference.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-04-20T20:07:22.981Z
Learnt from: ntindle
Repo: Significant-Gravitas/AutoGPT PR: 11235
File: autogpt_platform/frontend/src/app/(platform)/admin/diagnostics/__tests__/ExecutionsTable.test.tsx:27-76
Timestamp: 2026-04-20T20:07:22.981Z
Learning: In this codebase, Orval-generated API modules under `src/app/api/__generated__/` are not committed to git and must be generated via `pnpm generate:api` (requires a running backend). In integration tests, it’s acceptable—and expected—to stub generated hooks/modules by mocking them with `vi.mock("`@/app/api/__generated__/endpoints/`{tag}/{tag}")`. Do not treat `vi.mock` of these generated hook modules as a violation of the MSW handler guideline, since the corresponding MSW handlers cannot be imported at test time when generated files are absent.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx
  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
📚 Learning: 2026-05-16T12:12:12.246Z
Learnt from: Abhi1992002
Repo: Significant-Gravitas/AutoGPT PR: 13138
File: autogpt_platform/frontend/src/components/layout/Navbar/components/AccountMenu/helpers.tsx:1-1
Timestamp: 2026-05-16T12:12:12.246Z
Learning: Code reviews for the Navbar component set should treat the `MenuItemGroup` contract as shared between `AccountMenu` (desktop) and `MobileNavbar`. If a PR attempts to migrate `AccountMenu` off the legacy `IconType` imported from `src/components/__legacy__/ui/icons.tsx`, require that the migration be coordinated with `MobileNavbar` as part of the same follow-up change (or explicitly defer the `MobileNavbar` side to a dedicated follow-up PR) to avoid leaving the shared contract in an inconsistent state. Do not block an otherwise-complete `AccountMenu` PR solely due to the pending cross-consumer legacy `IconType` dependency.

Applied to files:

  • autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx
🔇 Additional comments (4)
autogpt_platform/frontend/src/components/layout/TopUpPrompt/__tests__/TopUpDialog.test.tsx (1)

1-5: LGTM!

Also applies to: 13-55

autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/__tests__/Wallet.test.tsx (3)

1-113: LGTM!


123-190: LGTM! Assertions line up with onWalletOpen, the !compact reward-dot/tooltip gating, and the walletShown guard in useWallet.ts/Wallet.tsx.


193-262: Solid regression coverage for the stable-subscription fix.

The "subscribes once and keeps the connection across onboarding updates" test (lines 201-218) correctly targets the notificationRef fix: it verifies onWebSocketMessage/connectWebSocket are called exactly once even after an onboarding state change that would previously have re-created handleNotification and torn down/reattached the listener. The confetti-gating and unmount-detach tests likewise match useWallet.ts behavior precisely.

0ubbe
0ubbe previously approved these changes Jul 29, 2026

@0ubbe 0ubbe left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Nice 🏁 , a couple of nits ☕️

Comment thread autogpt_platform/frontend/src/services/feature-flags/use-get-flag.ts Outdated
@github-project-automation github-project-automation Bot moved this from 🆕 Needs initial review to 👍🏼 Mergeable in AutoGPT development kanban Jul 29, 2026
The wallet PR accidentally carried local flag toggles: AGENT_BRIEFING
true -> false and TASK_PROGRESS_BAR false -> true. Neither is used by the
wallet. Restore both to their dev values so no flag defaults on when
LaunchDarkly fails to resolve.
…p state

Per review: useCallback/useMemo are not the house style here, so groups,
totalCount and completedCount are plain derived values and the handlers
are function declarations. The notification ref is now refreshed on every
render, which keeps the websocket subscription mounted exactly as before.

The TopUpDialog open state and its handlers move out of Wallet.tsx into
the hook, leaving the component render-only.
@Abhi1992002

Copy link
Copy Markdown
Member Author

/reapprove

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Re-approved at the request of @Abhi1992002 (#13699 (comment))

@Abhi1992002
Abhi1992002 added this pull request to the merge queue Jul 30, 2026
Merged via the queue into dev with commit 9d30196 Jul 30, 2026
36 checks passed
@Abhi1992002
Abhi1992002 deleted the abhi/add-new-wallet-for-new-layout branch July 30, 2026 06:35
@github-project-automation github-project-automation Bot moved this from 👍🏼 Mergeable to ✅ Done in AutoGPT development kanban Jul 30, 2026
@github-project-automation github-project-automation Bot moved this to Done in Frontend Jul 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

platform/frontend AutoGPT Platform - Front end size/xl

Projects

Status: ✅ Done
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants