feat: history stream link
This commit is contained in:
parent
875a5b9ed9
commit
e2cac2f55d
@ -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 => (
|
||||
<>
|
||||
<div>{new Date(a.created * 1000).toLocaleString()}</div>
|
||||
<div>{a.desc}</div>
|
||||
<div>
|
||||
{a.type === 0 ? "+" : "-"}
|
||||
{a.amount}
|
||||
</div>
|
||||
</>
|
||||
))}
|
||||
{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>
|
||||
{ev ? (
|
||||
<Link to={`/${eventLink(ev)}`} className="text-primary">
|
||||
<FormattedMessage defaultMessage="Past Stream" />
|
||||
</Link>
|
||||
) : (
|
||||
a.desc
|
||||
)}
|
||||
</div>
|
||||
<div>
|
||||
{a.type === 0 ? "+" : "-"}
|
||||
<FormattedNumber value={a.amount} />
|
||||
</div>
|
||||
</>
|
||||
);
|
||||
})}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
@ -140,6 +140,9 @@
|
||||
"69hmpj": {
|
||||
"defaultMessage": "Raid from {name}"
|
||||
},
|
||||
"6PK5Jy": {
|
||||
"defaultMessage": "Past Stream"
|
||||
},
|
||||
"6Z2pvJ": {
|
||||
"defaultMessage": "Stream Providers"
|
||||
},
|
||||
|
@ -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://",
|
||||
|
Loading…
x
Reference in New Issue
Block a user