Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions src/generated/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,14 @@ export type AnonPublicData = {
/**
* --------------------------- Quote info request
*/

export type MintingStatus = {
status: 'Disabled'
} | {
status: 'Enabled';
minted: number;
};

export type InfoReply = {
bill: BillInfo;
id: string;
Expand Down Expand Up @@ -160,6 +168,7 @@ export type InfoReply = {
keyset_id: string;
discounted: number;
status: 'Accepted';
minting_status: MintingStatus;
} | {
bill: BillInfo;
id: string;
Expand Down
18 changes: 9 additions & 9 deletions src/pages/quotes/QuotePage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,13 +220,13 @@ function DenyConfirmDrawer({ children, onSubmit, ...drawerProps }: DenyConfirmDr
function QuoteActions({
value,
isFetching,
newKeyset,
mintingEnabled,
ebillPaid,
requestedToPay,
}: {
value: InfoReply
isFetching: boolean
newKeyset: boolean
mintingEnabled: boolean
ebillPaid: boolean
requestedToPay: boolean
}) {
Expand Down Expand Up @@ -471,7 +471,7 @@ function QuoteActions({
trigger={
<Button
className="flex-1"
disabled={isFetching || enableMintingMutation.isPending || !newKeyset}
disabled={isFetching || enableMintingMutation.isPending || mintingEnabled}
variant="default"
>
Enable Minting {enableMintingMutation.isPending && <LoaderIcon className="stroke-1 animate-spin" />}
Expand All @@ -482,7 +482,7 @@ function QuoteActions({
<></>
)}

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

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

return (
<div className="flex flex-col gap-1">
Expand Down Expand Up @@ -736,10 +736,10 @@ function Quote({ value, isFetching }: { value: InfoReply; isFetching: boolean })
{ebillPaid ? "Paid" : "Unpaid"}
</Badge>
<Badge
variant={newKeyset ? "default" : "destructive"}
className={newKeyset ? "bg-red-500" : "bg-blue-500"}
variant={mintingEnabled ? "default" : "destructive"}
className={mintingEnabled ? "bg-red-500" : "bg-blue-500"}
>
{newKeyset ? "Disabled" : "Enabled"}
{mintingEnabled ? "Disabled" : "Enabled"}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So this button is disabled when minting is enabled? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes
when minting has been enabled already, the button to enable it should be disabled
😅

</Badge>
</TableCell>
</TableRow>
Expand Down Expand Up @@ -828,7 +828,7 @@ function Quote({ value, isFetching }: { value: InfoReply; isFetching: boolean })
<QuoteActions
value={value}
isFetching={isFetching}
newKeyset={newKeyset}
mintingEnabled={mintingEnabled}
ebillPaid={ebillPaid ?? false}
requestedToPay={requestedToPay ?? false}
/>
Expand Down
Loading