diff --git a/pages/top-holders.tsx b/pages/top-holders.tsx index 0b7085e4dc806a967d0b239413a9adc8009162f2..4b4927ef79b63f03f494340fd02bb508cde338a9 100644 --- a/pages/top-holders.tsx +++ b/pages/top-holders.tsx @@ -11,7 +11,7 @@ import DataExport from "@/components/DataExport"; import CustomPagination from "@/components/CustomPagination"; import useTopHolders, { CoinType, BalanceType } from "@/hooks/api/common/useTopHolders"; import { config } from "@/Config"; -import { Loader2 } from "lucide-react"; +import { Loader2, ChevronDown } from "lucide-react"; import { getHiveAvatarUrl } from "@/utils/HiveBlogUtils"; import Image from "next/image"; import Link from "next/link"; @@ -19,12 +19,19 @@ import useDynamicGlobal from "@/hooks/api/homePage/useDynamicGlobal"; import { convertVestsToHP } from "@/utils/Calculations"; import { useHiveChainContext } from "@/contexts/HiveChainContext"; import Hive from "@/types/Hive"; +import { cn } from "@/lib/utils"; import { Label } from "@/components/ui/label"; import { Switch } from "@/components/ui/switch"; import { useSettings } from "@/contexts/SettingsContext"; import ScrollTopButton from "@/components/ScrollTopButton"; +import { Popover, PopoverTrigger, PopoverContent } from "@/components/ui/popover"; +import { RadioGroup, RadioGroupItem } from "@/components/ui/radio-group"; -export default function TopHoldersPage() { +interface TopHoldersPageProps { + isMobile?: boolean; +} + +export default function TopHoldersPage({ isMobile }: TopHoldersPageProps) { const { t } = useI18n(); const router = useRouter(); const { settings } = useSettings(); @@ -82,7 +89,7 @@ export default function TopHoldersPage() { if (coin === "VESTS") { return unit === "hp" ? convertVestsToHP(hiveChain, value, totalVestingFundHive, totalVestingShares) - : hiveChain.formatter.format(hiveChain.vests(value)); // only append VESTS once in UI + : hiveChain.formatter.format(hiveChain.vests(value)); } else if (coin === "HIVE") { return hiveChain.formatter.format(hiveChain.hive(value)); } else if (coin === "HBD") { @@ -105,7 +112,6 @@ export default function TopHoldersPage() { const exportFileName = `${t("export.topHolders")}_${coinType.toLowerCase()}.csv`; - const HolderRow = ({ rank, account, value, index }: { rank: number; account: string; value: string; index: number }) => { const displayRank = rank > 0 ? rank : index + 1 + (page - 1) * pageSize; @@ -135,6 +141,9 @@ export default function TopHoldersPage() { ); + const [isCoinPopoverOpen, setIsCoinPopoverOpen] = useState(false); + const [isBalancePopoverOpen, setIsBalancePopoverOpen] = useState(false); + return (
@@ -154,25 +163,89 @@ export default function TopHoldersPage() { {isFiltersVisible && (
- - - + + {/* Coin Type Dropdown */} + + +
+ {coinType} + +
+
+ + + { + setCoinType(val as CoinType); + setIsCoinPopoverOpen(false); + }} + > + + + + + +
+ + {/* Balance Type Dropdown */} + + +
+ {balanceType === "savings_balance" ? t("filters.savings") : t("filters.balance")} + +
+
+ + {coinType !== "VESTS" && ( + + { + setBalanceType(val as BalanceType); + setIsBalancePopoverOpen(false); + }} + > + + + + + )} +
+
)}