chore: formatting
Some checks reported errors
continuous-integration/drone/push Build encountered an error

This commit is contained in:
kieran 2024-07-19 14:52:59 +01:00
parent 0006b16314
commit ce92a7fa19
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941
5 changed files with 50 additions and 27 deletions

View File

@ -3,23 +3,35 @@ import { useEffect, useState } from "react";
import { FormattedMessage } from "react-intl";
export default function BalanceHistory({ provider }: { provider?: NostrStreamProvider }) {
const [page,] = useState(0);
const [page] = useState(0);
const [rows, setRows] = useState<BalanceHistoryResult>();
useEffect(() => {
if (!provider) return;
provider.history(page)
.then(setRows);
provider.history(page).then(setRows);
}, []);
return <div className="grid auto-rows-auto grid-cols-3 gap-1">
<div><FormattedMessage defaultMessage="Time" /></div>
<div><FormattedMessage defaultMessage="Description" /></div>
<div><FormattedMessage defaultMessage="Amount" /></div>
{rows?.items.map(a => <>
return (
<div className="grid auto-rows-auto grid-cols-3 gap-1">
<div>
<FormattedMessage defaultMessage="Time" />
</div>
<div>
<FormattedMessage defaultMessage="Description" />
</div>
<div>
<FormattedMessage defaultMessage="Amount" />
</div>
{rows?.items.map(a => (
<>
<div>{new Date(a.created * 1000).toLocaleString()}</div>
<div>{a.desc}</div>
<div>{a.type === 0 ? "+" : "-"}{a.amount}</div>
</>)}
<div>
{a.type === 0 ? "+" : "-"}
{a.amount}
</div>
</>
))}
</div>
);
}

View File

@ -269,7 +269,7 @@ export default function NostrProviderDialog({
<FormattedMessage defaultMessage="Balance History" />
</h3>
<div className="flex flex-col gap-1">
<BalanceHistory provider={provider}/>
<BalanceHistory provider={provider} />
</div>
</div>
);

View File

@ -639,6 +639,9 @@
"bbUGS7": {
"defaultMessage": "Recommended Stream Settings"
},
"bdH+0f": {
"defaultMessage": "Balance History"
},
"bfvyfs": {
"defaultMessage": "Anon"
},
@ -906,6 +909,9 @@
"uYw2LD": {
"defaultMessage": "Stream"
},
"ug01Mk": {
"defaultMessage": "Time"
},
"uksRSi": {
"defaultMessage": "Latest Videos"
},

View File

@ -92,7 +92,10 @@ export class NostrStreamProvider implements StreamProvider {
}
async withdraw(invoice: string) {
return await this.#getJson<{ fee: number; preimage: string, error?: string }>("POST", `withdraw?invoice=${invoice}`);
return await this.#getJson<{ fee: number; preimage: string; error?: string }>(
"POST",
`withdraw?invoice=${invoice}`,
);
}
async acceptTos(): Promise<void> {
@ -212,11 +215,11 @@ interface TopUpResponse {
export interface BalanceHistoryResult {
items: Array<{
created: number,
type: number,
amount: number,
desc?: string
}>
page: number,
pageSize: number
created: number;
type: number;
amount: number;
desc?: string;
}>;
page: number;
pageSize: number;
}

View File

@ -210,6 +210,7 @@
"aqjZxs": "Raid!",
"bD/ZwY": "Edit Cards",
"bbUGS7": "Recommended Stream Settings",
"bdH+0f": "Balance History",
"bfvyfs": "Anon",
"c3LlRO": "{n}KiB",
"cPIKU2": "Following",
@ -298,6 +299,7 @@
"tzMNF3": "Status",
"u6uD94": "Create an Account",
"uYw2LD": "Stream",
"ug01Mk": "Time",
"uksRSi": "Latest Videos",
"vP4dFa": "Visit {link} to get some sweet zap.stream merch!",
"vrTOHJ": "{amount} sats",