Skip to content
Open
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
37 changes: 18 additions & 19 deletions dapp/src/components/availability-check/AvailabilityCheck.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,6 @@ function PurchaseName({ name, nameRecordData, onPurchase }: PurchaseNameProps) {
}

const isAvailable = nameRecordData?.type === 'available';
const isUnavailable = nameRecordData?.type === 'unavailable';

function handlePurchase() {
onPurchase();
Expand All @@ -382,24 +381,24 @@ function PurchaseName({ name, nameRecordData, onPurchase }: PurchaseNameProps) {

return (
<>
<NamePurchaseCard
name={name}
isAvailable={isAvailable}
price={formattedPurchasePrice}
priceSupportingText={isAvailable ? 'Price' : undefined}
statusMessage={isAvailable ? undefined : 'Name cannot be purchased.'}
>
{isUnavailable ? null : isConnected ? (
<Button
type={ButtonType.Secondary}
text="Buy"
onClick={() => setPurchaseDialogOpen(true)}
/>
) : (
<ConnectButton />
)}
</NamePurchaseCard>

{isAvailable && (
<NamePurchaseCard
name={name}
isAvailable={isAvailable}
price={formattedPurchasePrice}
priceSupportingText="Price"
>
{isConnected ? (
<Button
type={ButtonType.Secondary}
text="Buy"
onClick={() => setPurchaseDialogOpen(true)}
/>
) : (
<ConnectButton />
)}
</NamePurchaseCard>
)}
{isPurchaseDialogOpen && (
<PurchaseNameDialog
name={name}
Expand Down
Loading