From 74890e251dee3e0f195583431cb48b9f3a58ecc9 Mon Sep 17 00:00:00 2001
From: Max Nanis
Date: Mon, 9 Jun 2025 16:05:52 +0700
Subject: Cashout Methods page: adding walletSlice and cashoutmethodsSlice so
 they're in the stored state. Iterating with fix vs variable filters. Pulling
 old validators from old code and setting up the wallet fetch.

---
 src/components/app-sidebar.tsx | 31 ++++++++++++++++++++++++-------
 1 file changed, 24 insertions(+), 7 deletions(-)

(limited to 'src/components/app-sidebar.tsx')

diff --git a/src/components/app-sidebar.tsx b/src/components/app-sidebar.tsx
index e8cbd4c..f314c9f 100644
--- a/src/components/app-sidebar.tsx
+++ b/src/components/app-sidebar.tsx
@@ -1,13 +1,12 @@
 "use client"
 
 import * as React from "react"
-import {CircleDollarSign, MessageCircle, SquareStack} from "lucide-react"
+import {CircleDollarSign, SquareStack} from "lucide-react"
 
 import {NavMain} from "@/components/nav-main"
 import {
     Sidebar,
     SidebarContent,
-    SidebarFooter,
     SidebarGroup,
     SidebarGroupContent,
     SidebarGroupLabel,
@@ -17,10 +16,16 @@ import {
     SidebarMenuItem,
     useSidebar,
 } from "@/components/ui/sidebar"
-import {useAppSelector} from "@/hooks.ts";
+import {useAppDispatch, useAppSelector} from "@/hooks.ts";
+import {setPage} from "@/models/appSlice.ts";
+import {Badge} from "@/components/ui/badge.tsx";
+import {useSelector} from "react-redux";
+import {selectCashoutMethods} from "@/models/cashoutMethodSlice.ts";
 
 export function AppSidebar({...props}: React.ComponentProps<typeof Sidebar>) {
     const app = useAppSelector(state => state.app)
+    const dispatch = useAppDispatch()
+    const cashoutMethods = useSelector(selectCashoutMethods)
 
     const {isMobile} = useSidebar()
 
@@ -50,12 +55,24 @@ export function AppSidebar({...props}: React.ComponentProps<typeof Sidebar>) {
                     <SidebarGroupContent>
                         <SidebarMenu>
 
-                            <SidebarMenuItem key="cashout_methods">
+                            <SidebarMenuItem
+                                key="cashout_methods"
+                                className="cursor-pointer"
+                            >
                                 <SidebarMenuButton asChild>
-                                    <a href="#">
+                                    <a
+                                        onClick={() => dispatch(setPage("cashout_methods"))}
+                                    >
                                         <CircleDollarSign/>
-                                        <span>Methods</span>
-                                    </a>
+                                        <span>
+                                Methods <Badge
+                                            className="absolute top-2 right-2 h-5 min-w-5 rounded-full px-1 font-mono tabular-nums cursor-pointer"
+                                            variant="outline"
+                                            title={`${cashoutMethods.length.toLocaleString()} cashout methods available`}
+                                        >{cashoutMethods.length.toLocaleString()}</Badge>
+                            </span> </a>
+
+
                                 </SidebarMenuButton>
                             </SidebarMenuItem>
 
-- 
cgit v1.2.3

