diff options
| author | Max Nanis | 2025-05-28 04:41:37 +0100 |
|---|---|---|
| committer | Max Nanis | 2025-05-28 04:41:37 +0100 |
| commit | 8caa77413ea372e5cbd2980a9922d701af359c04 (patch) | |
| tree | 9341e2f70fab6b2678fdff53c002954ef69c7b3e /src/pages/CashoutMethods.tsx | |
| download | panel-ui-8caa77413ea372e5cbd2980a9922d701af359c04.tar.gz panel-ui-8caa77413ea372e5cbd2980a9922d701af359c04.zip | |
initial commit
Diffstat (limited to 'src/pages/CashoutMethods.tsx')
| -rw-r--r-- | src/pages/CashoutMethods.tsx | 48 |
1 files changed, 48 insertions, 0 deletions
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 |
