Skip to content

Commit 623543e

Browse files
committed
Update
1 parent 9da5cd7 commit 623543e

File tree

7 files changed

+133
-234
lines changed

7 files changed

+133
-234
lines changed

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/CancelDirectListing.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/CancelEnglishAuction.tsx

Lines changed: 0 additions & 14 deletions
This file was deleted.

apps/dashboard/src/app/(dashboard)/(chain)/[chain_id]/[contractAddress]/(marketplace)/components/cancel-tab.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import { TransactionButton } from "components/buttons/TransactionButton";
44
import { useTrack } from "hooks/analytics/useTrack";
55
import { useAllChainsData } from "hooks/chains/allChains";
6-
import { useTxNotifications } from "hooks/useTxNotifications";
6+
import { toast } from "sonner";
77
import type { ThirdwebContract } from "thirdweb";
88
import { cancelAuction, cancelListing } from "thirdweb/extensions/marketplace";
99
import { useSendAndConfirmTransaction } from "thirdweb/react";
@@ -25,14 +25,9 @@ export const CancelTab: React.FC<CancelTabProps> = ({
2525
const transaction = isAuction
2626
? cancelAuction({ contract, auctionId: BigInt(id) })
2727
: cancelListing({ contract, listingId: BigInt(id) });
28-
const { onSuccess, onError } = useTxNotifications(
29-
"Listing cancelled",
30-
"Error cancelling listing",
31-
);
3228
const cancelQuery = useSendAndConfirmTransaction();
3329
return (
3430
<div className="flex flex-col gap-3 pt-3">
35-
{/* maybe some text? */}
3631
<TransactionButton
3732
txChainID={contract.chain.id}
3833
transactionCount={1}
@@ -43,15 +38,14 @@ export const CancelTab: React.FC<CancelTabProps> = ({
4338
action: "cancel-listing",
4439
label: "attempt",
4540
});
46-
cancelQuery.mutate(transaction, {
41+
const promise = cancelQuery.mutateAsync(transaction, {
4742
onSuccess: () => {
4843
trackEvent({
4944
category: "marketplace",
5045
action: "cancel-listing",
5146
label: "success",
5247
network,
5348
});
54-
onSuccess();
5549
},
5650
onError: (error) => {
5751
trackEvent({
@@ -61,14 +55,19 @@ export const CancelTab: React.FC<CancelTabProps> = ({
6155
network,
6256
error,
6357
});
64-
onError(error);
58+
console.error(error);
6559
},
6660
});
61+
toast.promise(promise, {
62+
loading: `Cancelling ${isAuction ? "auction" : "listing"}`,
63+
success: "Item cancelled successfully",
64+
error: "Failed to cancel",
65+
});
6766
}}
6867
colorScheme="primary"
6968
alignSelf="flex-end"
7069
>
71-
Cancel Listing
70+
Cancel {isAuction ? "Auction" : "Listing"}
7271
</TransactionButton>
7372
</div>
7473
);

0 commit comments

Comments
 (0)