chore: formatting

This commit is contained in:
kieran 2024-10-10 21:39:09 +01:00
parent 2e789b222c
commit 52fe83d815
No known key found for this signature in database
GPG Key ID: DE71CEB3925BE941
3 changed files with 31 additions and 25 deletions

View File

@ -189,31 +189,35 @@ export default function NostrProviderDialog({
function currentBalance() { function currentBalance() {
if (!info) return; if (!info) return;
return <div> return (
<p> <div>
<FormattedMessage defaultMessage="Balance" id="H5+NAX" /> <p>
</p> <FormattedMessage defaultMessage="Balance" id="H5+NAX" />
<div className="flex gap-2"> </p>
<div className="bg-layer-2 rounded-xl w-full flex items-center px-3"> <div className="flex gap-2">
<FormattedMessage <div className="bg-layer-2 rounded-xl w-full flex items-center px-3">
defaultMessage="{amount} sats" <FormattedMessage
id="vrTOHJ" defaultMessage="{amount} sats"
values={{ amount: info.balance?.toLocaleString() }} id="vrTOHJ"
/> values={{ amount: info.balance?.toLocaleString() }}
/>
</div>
<AccountTopup provider={provider} onFinish={loadInfo} />
<AccountWithdrawl provider={provider} onFinish={loadInfo} />
</div> </div>
<AccountTopup provider={provider} onFinish={loadInfo} />
<AccountWithdrawl provider={provider} onFinish={loadInfo} />
</div> </div>
</div> );
} }
function balanceTimeEstimate() { function balanceTimeEstimate() {
if (!info) return; if (!info) return;
return <div> return (
<small> <div>
<FormattedMessage defaultMessage="About {estimate}" values={{ estimate: calcEstimate() }} /> <small>
</small> <FormattedMessage defaultMessage="About {estimate}" values={{ estimate: calcEstimate() }} />
</div> </small>
</div>
);
} }
function streamEditor() { function streamEditor() {
@ -288,7 +292,7 @@ export default function NostrProviderDialog({
return ( return (
<> <>
{showEndpoints && streamEndpoints()} {showEndpoints && streamEndpoints()}
{showBalance&& currentBalance()} {showBalance && currentBalance()}
{showEstimate && balanceTimeEstimate()} {showEstimate && balanceTimeEstimate()}
{streamEditor()} {streamEditor()}
{forwardInputs()} {forwardInputs()}

View File

@ -31,9 +31,9 @@ export function useCurrentStreamFeed(link: NostrLink, leaveOpen = false, evPrelo
const q = useRequestBuilder(sub); const q = useRequestBuilder(sub);
return useMemo(() => { return useMemo(() => {
const hosting = [...q, ...(evPreload ? [evPreload] : [])].filter( const hosting = [...q, ...(evPreload ? [evPreload] : [])]
a => getHost(a) === author || a.pubkey === author .filter(a => getHost(a) === author || a.pubkey === author)
).sort((a, b) => (b.created_at > a.created_at ? 1 : -1)); .sort((a, b) => (b.created_at > a.created_at ? 1 : -1));
return hosting.at(0); return hosting.at(0);
}, [q]); }, [q]);
} }

View File

@ -171,9 +171,11 @@ export class NostrStreamProvider implements StreamProvider {
const u = `${this.url}${path}`; const u = `${this.url}${path}`;
const token = await pub.generic(eb => { const token = await pub.generic(eb => {
return eb.kind(EventKind.HttpAuthentication) return eb
.kind(EventKind.HttpAuthentication)
.content("") .content("")
.tag(["u", u]).tag(["method", method]) .tag(["u", u])
.tag(["method", method])
.createdAt(unixNow() + Math.floor(TimeSync / 1000)); .createdAt(unixNow() + Math.floor(TimeSync / 1000));
}); });
const rsp = await fetch(u, { const rsp = await fetch(u, {