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,
showEndpoints,
showEditor,
showBalance,
showEstimate,
showForwards,
showBalanceHistory,
showStreamKeys,
@ -27,6 +29,8 @@ export default function NostrProviderDialog({
}: {
provider: NostrStreamProvider;
showEndpoints: boolean;
showBalance?: boolean;
showEstimate?: boolean;
showEditor: boolean;
showForwards: boolean;
showBalanceHistory: boolean;
@ -173,25 +177,6 @@ export default function NostrProviderDialog({
</div>
)}
{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>
<p className="pb-2">
<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() {
if (!info || !showEditor) return;
if (info.tosAccepted === false) {
@ -274,6 +288,8 @@ export default function NostrProviderDialog({
return (
<>
{showEndpoints && streamEndpoints()}
{showBalance&& currentBalance()}
{showEstimate && balanceTimeEstimate()}
{streamEditor()}
{forwardInputs()}
{balanceHist()}

View File

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

View File

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