chore: tweak dashboard modal displays

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

View File

@ -20,6 +20,8 @@ export default function NostrProviderDialog({
provider, provider,
showEndpoints, showEndpoints,
showEditor, showEditor,
showBalance,
showEstimate,
showForwards, showForwards,
showBalanceHistory, showBalanceHistory,
showStreamKeys, showStreamKeys,
@ -27,6 +29,8 @@ export default function NostrProviderDialog({
}: { }: {
provider: NostrStreamProvider; provider: NostrStreamProvider;
showEndpoints: boolean; showEndpoints: boolean;
showBalance?: boolean;
showEstimate?: boolean;
showEditor: boolean; showEditor: boolean;
showForwards: boolean; showForwards: boolean;
showBalanceHistory: boolean; showBalanceHistory: boolean;
@ -173,25 +177,6 @@ export default function NostrProviderDialog({
</div> </div>
)} )}
{ep && <StreamKey ep={ep} />} {ep && <StreamKey ep={ep} />}
<div>
<p>
<FormattedMessage defaultMessage="Balance" id="H5+NAX" />
</p>
<div className="flex gap-2">
<div className="bg-layer-2 rounded-xl w-full flex items-center px-3">
<FormattedMessage
defaultMessage="{amount} sats"
id="vrTOHJ"
values={{ amount: info.balance?.toLocaleString() }}
/>
</div>
<AccountTopup provider={provider} onFinish={loadInfo} />
<AccountWithdrawl provider={provider} onFinish={loadInfo} />
</div>
<small>
<FormattedMessage defaultMessage="About {estimate}" id="Q3au2v" values={{ estimate: calcEstimate() }} />
</small>
</div>
<div> <div>
<p className="pb-2"> <p className="pb-2">
<FormattedMessage defaultMessage="Features" id="ZXp0z1" /> <FormattedMessage defaultMessage="Features" id="ZXp0z1" />
@ -202,6 +187,35 @@ export default function NostrProviderDialog({
); );
} }
function currentBalance() {
if (!info) return;
return <div>
<p>
<FormattedMessage defaultMessage="Balance" id="H5+NAX" />
</p>
<div className="flex gap-2">
<div className="bg-layer-2 rounded-xl w-full flex items-center px-3">
<FormattedMessage
defaultMessage="{amount} sats"
id="vrTOHJ"
values={{ amount: info.balance?.toLocaleString() }}
/>
</div>
<AccountTopup provider={provider} onFinish={loadInfo} />
<AccountWithdrawl provider={provider} onFinish={loadInfo} />
</div>
</div>
}
function balanceTimeEstimate() {
if (!info) return;
return <div>
<small>
<FormattedMessage defaultMessage="About {estimate}" values={{ estimate: calcEstimate() }} />
</small>
</div>
}
function streamEditor() { function streamEditor() {
if (!info || !showEditor) return; if (!info || !showEditor) return;
if (info.tosAccepted === false) { if (info.tosAccepted === false) {
@ -274,6 +288,8 @@ export default function NostrProviderDialog({
return ( return (
<> <>
{showEndpoints && streamEndpoints()} {showEndpoints && streamEndpoints()}
{showBalance&& currentBalance()}
{showEstimate && balanceTimeEstimate()}
{streamEditor()} {streamEditor()}
{forwardInputs()} {forwardInputs()}
{balanceHist()} {balanceHist()}

View File

@ -17,8 +17,9 @@ export default function BalanceHistoryModal({ provider }: { provider: NostrStrea
<NostrProviderDialog <NostrProviderDialog
provider={provider} provider={provider}
showBalanceHistory={true} showBalanceHistory={true}
showBalance={true}
showEditor={false} showEditor={false}
showEndpoints={true} showEndpoints={false}
showForwards={false} showForwards={false}
showStreamKeys={false} showStreamKeys={false}
/> />

View File

@ -22,6 +22,8 @@ export function DashboardSettingsButton({ ev }: { ev?: TaggedNostrEvent }) {
provider={provider} provider={provider}
ev={ev} ev={ev}
showEndpoints={true} showEndpoints={true}
showBalance={true}
showEstimate={true}
showForwards={true} showForwards={true}
showEditor={false} showEditor={false}
showBalanceHistory={false} showBalanceHistory={false}