From 8caa77413ea372e5cbd2980a9922d701af359c04 Mon Sep 17 00:00:00 2001
From: Max Nanis
Date: Wed, 28 May 2025 04:41:37 +0100
Subject: initial commit

---
 src/pages/CashoutMethods.tsx | 48 ++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)
 create mode 100644 src/pages/CashoutMethods.tsx

(limited to 'src/pages/CashoutMethods.tsx')

diff --git a/src/pages/CashoutMethods.tsx b/src/pages/CashoutMethods.tsx
new file mode 100644
index 0000000..86727ee
--- /dev/null
+++ b/src/pages/CashoutMethods.tsx
@@ -0,0 +1,48 @@
+import React, {useEffect, useState} from 'react'
+
+import {Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle} from "@/components/ui/card.tsx";
+import {GRLWidgetSettings} from "@/Widget.tsx"
+import {CashoutMethodsResponse, WalletApi} from "@/api"
+import {CashoutMethod} from "@/models/CashoutMethod.ts";
+
+const CashoutMethodPreview: React.FC<{ cashout_method: CashoutMethod }> = ({cashout_method}) => {
+
+    return (
+        <Card key={cashout_method.id}>
+            <CardHeader>
+                {cashout_method.name}
+            </CardHeader>
+
+            <CardContent>
+                <img className="blur-xs grayscale" src={cashout_method.imageUrl}/>
+            </CardContent>
+        </Card>
+    )
+}
+
+const CashoutMethodsPage: React.FC<GRLWidgetSettings> = ({settings}) => {
+    const [cashoutMethods, setCashoutMethods] = useState([]);
+
+    useEffect(() => {
+        const x = new WalletApi();
+        x.getCashoutMethodsProductIdCashoutMethodsGet(settings.bpid, settings.bpuid)
+            .then(res => {
+                const data: CashoutMethodsResponse = res.data;
+                setCashoutMethods(data.cashout_methods);
+            })
+            .catch(err => console.log(err));
+    }, []); // ← empty array means "run once"
+
+    return (
+        <div className="grid grid-cols-3 gap-1 p-1">
+            {
+                cashoutMethods.map((m, index) => {
+                    const cm = new CashoutMethod(m);
+                    return <CashoutMethodPreview key={index} cashout_method={cm} />;
+                })
+            }
+        </div>
+    );
+}
+
+export {CashoutMethodsPage}
\ No newline at end of file
-- 
cgit v1.2.3

