From 0b2cf43e7b13d5561ab3f7cd74a90f64da96c11b Mon Sep 17 00:00:00 2001 From: feitianbubu Date: Wed, 24 Jun 2026 19:45:10 +0800 Subject: [PATCH] fix(web): hide wallet entry in profile dropdown when wallet module disabled (#5708) The profile dropdown rendered the wallet item unconditionally, so it still showed after an admin disabled the personal/topup (wallet) sidebar module. Reuse the sidebar module visibility check so the dropdown honours the same toggle as the sidebar. Fixes #5696 --- .../src/components/profile-dropdown.tsx | 12 +++++++---- web/default/src/hooks/use-sidebar-config.ts | 20 +++++++++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/web/default/src/components/profile-dropdown.tsx b/web/default/src/components/profile-dropdown.tsx index 7db6d32e..f76199d2 100644 --- a/web/default/src/components/profile-dropdown.tsx +++ b/web/default/src/components/profile-dropdown.tsx @@ -24,6 +24,7 @@ import { useAuthStore } from '@/stores/auth-store' import { getUserAvatarFallback, getUserAvatarStyle } from '@/lib/avatar' import { ROLE } from '@/lib/roles' import useDialogState from '@/hooks/use-dialog' +import { useIsSidebarModuleVisible } from '@/hooks/use-sidebar-config' import { useUserDisplay } from '@/hooks/use-user-display' import { Avatar, AvatarFallback } from '@/components/ui/avatar' import { Button } from '@/components/ui/button' @@ -45,6 +46,7 @@ export function ProfileDropdown() { const user = useAuthStore((state) => state.auth.user) const { displayName, roleLabel } = useUserDisplay(user) const isSuperAdmin = user?.role === ROLE.SUPER_ADMIN + const isWalletVisible = useIsSidebarModuleVisible('/wallet') const avatarName = user?.username || displayName const avatarFallback = getUserAvatarFallback(avatarName) const avatarFallbackStyle = useMemo( @@ -104,10 +106,12 @@ export function ProfileDropdown() { {t('Profile')} - navigate({ to: '/wallet' })}> - - {t('Wallet')} - + {isWalletVisible && ( + navigate({ to: '/wallet' })}> + + {t('Wallet')} + + )} {isSuperAdmin && (