+
+ Badges
+
+
+ {isLoading ? (
+
+ {Array.from({ length: 5 }, (_, index) => (
+
+ ))}
+
+ ) : isError ? (
+
+ Couldn't load badges.
+
+
+ ) : (
+ <>
+ {earned.length === 0 && (
+
+ No badges earned yet. Complete the activities below to earn
+ your first badge.
+
+ )}
+
+ {earned.length > 0 && (
+
+ {earned.map(badge => {
+ const Icon = badge.icon;
+ return (
+
+
+
+
+ {badge.name}
+
+
+ {formatEarnedDate(badge.earnedAt)}
+
+
+
+ );
+ })}
+
+ )}
+
+ {locked.length > 0 && (
+
+ {locked.map(badge => (
+
+
+
+
+ {badge.name}
+
+
+ {badge.criteria}
+
+
+ Locked
+
+
+
+ ))}
+
+ )}
+ >
+ )}
+
+ );
+}
diff --git a/src/hooks/useWallet.ts b/src/hooks/useWallet.ts
index 3ff76d6f..b9e03ae9 100644
--- a/src/hooks/useWallet.ts
+++ b/src/hooks/useWallet.ts
@@ -12,7 +12,11 @@ import { useKeyCostBasis } from '@/hooks/useKeyCostBasis';
import showToast from '@/utils/toast.util';
import { getSignatureErrorMessage } from '@/utils/errorHandling.utils';
import { fetchWalletActivityPage } from '@/services/walletActivity.service';
-import { fetchWalletHoldings } from '@/services/wallet.service';
+import {
+ fetchWalletBadges,
+ fetchWalletHoldings,
+} from '@/services/wallet.service';
+import type { WalletBadge } from '@/utils/walletBadges.utils';
import { fetchTradeHistoryPage } from '@/services/tradeHistory.service';
export function useWalletHoldings(address: string) {
@@ -23,6 +27,14 @@ export function useWalletHoldings(address: string) {
});
}
+export function useWalletBadges(address: string) {
+ return useQuery