Skip to content

Commit edd936c

Browse files
fix the enable Minting button
it was mistakenly greied out all the times, now we have a new field in InfoReply that informs us on the status of the minting.
1 parent d3a772e commit edd936c

File tree

2 files changed

+18
-9
lines changed

2 files changed

+18
-9
lines changed

src/generated/client/types.gen.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,14 @@ export type AnonPublicData = {
126126
/**
127127
* --------------------------- Quote info request
128128
*/
129+
130+
export type MintingStatus = {
131+
status: 'Disabled'
132+
} | {
133+
status: 'Enabled';
134+
minted: number;
135+
};
136+
129137
export type InfoReply = {
130138
bill: BillInfo;
131139
id: string;
@@ -160,6 +168,7 @@ export type InfoReply = {
160168
keyset_id: string;
161169
discounted: number;
162170
status: 'Accepted';
171+
minting_status: MintingStatus;
163172
} | {
164173
bill: BillInfo;
165174
id: string;

src/pages/quotes/QuotePage.tsx

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -220,13 +220,13 @@ function DenyConfirmDrawer({ children, onSubmit, ...drawerProps }: DenyConfirmDr
220220
function QuoteActions({
221221
value,
222222
isFetching,
223-
newKeyset,
223+
mintingEnabled,
224224
ebillPaid,
225225
requestedToPay,
226226
}: {
227227
value: InfoReply
228228
isFetching: boolean
229-
newKeyset: boolean
229+
mintingEnabled: boolean
230230
ebillPaid: boolean
231231
requestedToPay: boolean
232232
}) {
@@ -471,7 +471,7 @@ function QuoteActions({
471471
trigger={
472472
<Button
473473
className="flex-1"
474-
disabled={isFetching || enableMintingMutation.isPending || !newKeyset}
474+
disabled={isFetching || enableMintingMutation.isPending || mintingEnabled}
475475
variant="default"
476476
>
477477
Enable Minting {enableMintingMutation.isPending && <LoaderIcon className="stroke-1 animate-spin" />}
@@ -482,7 +482,7 @@ function QuoteActions({
482482
<></>
483483
)}
484484

485-
{value.status === "Accepted" && "keyset_id" in value && !ebillPaid && !newKeyset && !requestedToPay ? (
485+
{value.status === "Accepted" && "keyset_id" in value && !ebillPaid && !requestedToPay ? (
486486
<ConfirmDrawer
487487
title="Confirm requesting to pay"
488488
description="Are you sure you want to request to pay this e-bill?"
@@ -706,7 +706,7 @@ function Quote({ value, isFetching }: { value: InfoReply; isFetching: boolean })
706706
const paymentAddress = paymentData?.data?.payment_details?.address_to_pay ?? ""
707707

708708
const ebillPaid = keysetData?.data && "active" in keysetData.data && keysetData.data.active === false
709-
const newKeyset = "keyset_id" in value && (!keysetData?.data || !("active" in keysetData.data))
709+
const mintingEnabled = value.status === "Accepted" && value.minting_status.status === "Enabled"
710710

711711
return (
712712
<div className="flex flex-col gap-1">
@@ -736,10 +736,10 @@ function Quote({ value, isFetching }: { value: InfoReply; isFetching: boolean })
736736
{ebillPaid ? "Paid" : "Unpaid"}
737737
</Badge>
738738
<Badge
739-
variant={newKeyset ? "default" : "destructive"}
740-
className={newKeyset ? "bg-red-500" : "bg-blue-500"}
739+
variant={mintingEnabled ? "default" : "destructive"}
740+
className={mintingEnabled ? "bg-red-500" : "bg-blue-500"}
741741
>
742-
{newKeyset ? "Disabled" : "Enabled"}
742+
{mintingEnabled ? "Disabled" : "Enabled"}
743743
</Badge>
744744
</TableCell>
745745
</TableRow>
@@ -828,7 +828,7 @@ function Quote({ value, isFetching }: { value: InfoReply; isFetching: boolean })
828828
<QuoteActions
829829
value={value}
830830
isFetching={isFetching}
831-
newKeyset={newKeyset}
831+
mintingEnabled={mintingEnabled}
832832
ebillPaid={ebillPaid ?? false}
833833
requestedToPay={requestedToPay ?? false}
834834
/>

0 commit comments

Comments
 (0)