feat: history stream link

This commit is contained in:
kieran 2024-07-19 15:03:38 +01:00
parent 875a5b9ed9
commit e2cac2f55d
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
3 changed files with 32 additions and 11 deletions

View File

@ -1,6 +1,9 @@
import { BalanceHistoryResult, NostrStreamProvider } from "@/providers/zsz";
import { eventLink } from "@/utils";
import { NostrEvent } from "@snort/system";
import { useEffect, useState } from "react";
import { FormattedMessage } from "react-intl";
import { FormattedMessage, FormattedNumber } from "react-intl";
import { Link } from "react-router-dom";
export default function BalanceHistory({ provider }: { provider?: NostrStreamProvider }) {
const [page] = useState(0);
@ -22,16 +25,30 @@ export default function BalanceHistory({ provider }: { provider?: NostrStreamPro
<div>
<FormattedMessage defaultMessage="Amount" />
</div>
{rows?.items.map(a => (
{rows?.items.map(a => {
let ev: NostrEvent | undefined;
if (a.desc && a.desc.startsWith("{")) {
ev = JSON.parse(a.desc) as NostrEvent;
}
return (
<>
<div>{new Date(a.created * 1000).toLocaleString()}</div>
<div>{a.desc}</div>
<div>
{ev ? (
<Link to={`/${eventLink(ev)}`} className="text-primary">
<FormattedMessage defaultMessage="Past Stream" />
</Link>
) : (
a.desc
)}
</div>
<div>
{a.type === 0 ? "+" : "-"}
{a.amount}
<FormattedNumber value={a.amount} />
</div>
</>
))}
);
})}
</div>
);
}

View File

@ -140,6 +140,9 @@
"69hmpj": {
"defaultMessage": "Raid from {name}"
},
"6PK5Jy": {
"defaultMessage": "Past Stream"
},
"6Z2pvJ": {
"defaultMessage": "Stream Providers"
},

View File

@ -46,6 +46,7 @@
"5tM0VD": "Stream Started",
"5vMmmR": "Usernames are not unique on Nostr. The nostr address is your unique human-readable address that is unique to you upon registration.",
"69hmpj": "Raid from {name}",
"6PK5Jy": "Past Stream",
"6Z2pvJ": "Stream Providers",
"6pr6hJ": "Minimum amount for text to speech",
"7+bCC1": "Stream url must start with rtmp://",