diff --git a/src/components/icons/index.tsx b/src/components/icons/index.tsx index f65513b..3464619 100644 --- a/src/components/icons/index.tsx +++ b/src/components/icons/index.tsx @@ -33,18 +33,6 @@ export const BackIcon = ({ className }: IconProps) => ( ); -export const ArrowLeftIcon = ({ className }: IconProps) => ( - - - -); - export const ChevronRightIcon = ({ className }: IconProps) => ( { if (!userId) return; const action = overrideAction || subAction; - if ((action === 'extend' || action === 'shorten') && toNumber(subDays, 0) <= 0) return; + if ((action === 'extend' || action === 'shorten') && toNumber(subDays, 0) <= 0) { + notify.error(t('admin.users.detail.subscription.invalidDays')); + return; + } setActionLoading(true); try { const data: UpdateSubscriptionRequest = { diff --git a/src/pages/SavedCards.tsx b/src/pages/SavedCards.tsx index eb73d3a..ef8e5b0 100644 --- a/src/pages/SavedCards.tsx +++ b/src/pages/SavedCards.tsx @@ -10,7 +10,7 @@ import { useDestructiveConfirm } from '../platform/hooks/useNativeDialog'; import { Card } from '@/components/data-display/Card'; import { Button } from '@/components/primitives/Button'; -import { ArrowLeftIcon } from '@/components/icons'; +import { BackIcon } from '@/components/icons'; import { staggerContainer, staggerItem } from '@/components/motion/transitions'; function formatCardDate(dateStr: string): string { @@ -30,7 +30,11 @@ export default function SavedCards() { const { showToast } = useToast(); const confirmDelete = useDestructiveConfirm(); - const { data: savedCardsData, isLoading } = useQuery({ + const { + data: savedCardsData, + isLoading, + isError, + } = useQuery({ queryKey: ['saved-cards'], queryFn: balanceApi.getSavedCards, }); @@ -55,7 +59,8 @@ export default function SavedCards() { message: '', duration: 3000, }); - } catch { + } catch (error) { + console.error('Failed to unlink card:', error); showToast({ type: 'error', title: t('balance.savedCards.unlinkError'), @@ -80,7 +85,7 @@ export default function SavedCards() { onClick={() => navigate('/balance')} className="flex h-10 w-10 items-center justify-center rounded-linear border border-dark-700/30 bg-dark-800/50 text-dark-300 transition-colors hover:bg-dark-700/50 hover:text-dark-100" > - + {t('balance.savedCards.pageTitle')} @@ -112,8 +117,19 @@ export default function SavedCards() { )} + {/* Error state */} + {isError && ( + + + + {t('balance.savedCards.loadError')} + + + + )} + {/* Cards List */} - {!isLoading && savedCards && savedCards.length > 0 ? ( + {!isLoading && !isError && savedCards && savedCards.length > 0 ? ( @@ -150,7 +166,7 @@ export default function SavedCards() { - ) : !isLoading && savedCards ? ( + ) : !isLoading && !isError && savedCards ? ( /* Empty state - only show when data loaded and empty */