Skip to content

Commit 1cd11a8

Browse files
committed
[Dashboard] Remove unnecessary chakra-ui Tabs in Listing sheet (#5076)
Remove unnecessary Tabs, just put the button at the bottom, since there's ever been only 1 tab anyway ![image.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/VtULqGKSp33n0VHOzNJK/53a75b30-20b2-471c-9566-4b022a96b616.png) <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on refactoring the marketplace components by removing unused files and consolidating the listing cancellation functionality into a single component, `CancelTab`. It also enhances the `ListingDrawer` component with improved UI elements for displaying asset information. ### Detailed summary - Deleted `CancelDirectListing.tsx` and `CancelEnglishAuction.tsx`. - Introduced `CancelTab` for handling cancellation of listings and auctions. - Updated `ListingDrawer` to use `CancelTab`. - Replaced `useTxNotifications` with `toast` for transaction feedback. - Added `CopyAddressButton` and `CopyTextButton` for better user interaction. - Refactored asset details display in `ListingDrawer` for improved readability. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex -->
1 parent 9da5cd7 commit 1cd11a8

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)