From c0264850237e90365dfd722bf87f7c3cd2339e61 Mon Sep 17 00:00:00 2001 From: Krzysztof Czerwinski <34861343+kcze@users.noreply.github.com> Date: Wed, 4 Feb 2026 15:11:41 +0900 Subject: [PATCH] feat(frontend): Disable auto-opening wallet (#11961) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Changes 🏗️ - Disable auto-opening Wallet for first time user and on credit increase - Remove no longer needed `lastSeenCredits` state and storage ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: - [x] Wallet doesn't open automatically --- .../Navbar/components/Wallet/Wallet.tsx | 48 +------------------ 1 file changed, 1 insertion(+), 47 deletions(-) diff --git a/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx b/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx index 4a25c84f92..5a5bb514f3 100644 --- a/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx +++ b/autogpt_platform/frontend/src/components/layout/Navbar/components/Wallet/Wallet.tsx @@ -15,7 +15,6 @@ import { import { cn } from "@/lib/utils"; import { useOnboarding } from "@/providers/onboarding/onboarding-provider"; import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag"; -import { storage, Key as StorageKey } from "@/services/storage/local-storage"; import { WalletIcon } from "@phosphor-icons/react"; import { PopoverClose } from "@radix-ui/react-popover"; import { X } from "lucide-react"; @@ -175,7 +174,6 @@ export function Wallet() { const [prevCredits, setPrevCredits] = useState(credits); const [flash, setFlash] = useState(false); const [walletOpen, setWalletOpen] = useState(false); - const [lastSeenCredits, setLastSeenCredits] = useState(null); const totalCount = useMemo(() => { return groups.reduce((acc, group) => acc + group.tasks.length, 0); @@ -200,38 +198,6 @@ export function Wallet() { setCompletedCount(completed); }, [groups, state?.completedSteps]); - // Load last seen credits from localStorage once on mount - useEffect(() => { - const stored = storage.get(StorageKey.WALLET_LAST_SEEN_CREDITS); - if (stored !== undefined && stored !== null) { - const parsed = parseFloat(stored); - if (!Number.isNaN(parsed)) setLastSeenCredits(parsed); - else setLastSeenCredits(0); - } else { - setLastSeenCredits(0); - } - }, []); - - // Auto-open once if never shown, otherwise open only when credits increase beyond last seen - useEffect(() => { - if (typeof credits !== "number") return; - // Open once for first-time users - if (state && state.walletShown === false) { - requestAnimationFrame(() => setWalletOpen(true)); - // Mark as shown so it won't reopen on every reload - updateState({ walletShown: true }); - return; - } - // Open if user gained more credits than last acknowledged - if ( - lastSeenCredits !== null && - credits > lastSeenCredits && - walletOpen === false - ) { - requestAnimationFrame(() => setWalletOpen(true)); - } - }, [credits, lastSeenCredits, state?.walletShown, updateState, walletOpen]); - const onWalletOpen = useCallback(async () => { if (!state?.walletShown) { updateState({ walletShown: true }); @@ -324,19 +290,7 @@ export function Wallet() { if (credits === null || !state) return null; return ( - { - setWalletOpen(open); - if (!open) { - // Persist the latest acknowledged credits so we only auto-open on future gains - if (typeof credits === "number") { - storage.set(StorageKey.WALLET_LAST_SEEN_CREDITS, String(credits)); - setLastSeenCredits(credits); - } - } - }} - > + setWalletOpen(open)}>