Skip to content

Commit 11d9f3e

Browse files
committed
Dashboard: Migrate marketplace contract pages from chakra to tailwind (#7730)
<!-- ## title your PR with this format: "[SDK/Dashboard/Portal] Feature/Fix: Concise title for the changes" If you did not copy the branch name from Linear, paste the issue tag here (format is TEAM-0000): ## Notes for the reviewer Anything important to call out? Be sure to also clarify these in your comments. ## How to test Unit tests, playground, etc. --> <!-- start pr-codex --> --- ## PR-Codex overview This PR focuses on improving the UI components and their functionality in the dashboard application, particularly around NFT listings, by enhancing type safety, optimizing rendering, and updating UI elements for better usability. ### Detailed summary - Made `image_url` optional in `getWalletNFTs.ts`. - Updated button styles and sizes in `list-button.tsx`. - Enhanced `CurrencySelector` component with better class management. - Refactored `ContractDirectListingsPage` and `ContractEnglishAuctionsPage` to use `props`. - Improved `ListingDrawer` layout and added table components for better data presentation. - Refined `MarketplaceTable` to handle pagination and data fetching more efficiently. - Updated listing forms to use new UI components and improved validation. - Enhanced error handling and loading states across various components. > ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your question}` <!-- end pr-codex --> <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Enhanced currency selector with an icon-based back button and improved styling flexibility. * **Refactor** * Migrated marketplace listing forms and tables to a new custom UI component library for a more consistent and modern interface. * Simplified and streamlined marketplace table and drawer components, removing legacy dependencies and improving layout. * Updated listing and auction pages to delegate call-to-action buttons for better composability. * Improved listing details drawer with a structured table layout and clearer asset information. * **Bug Fixes** * Improved handling of missing NFT images to prevent errors when image URLs are unavailable. * **Style** * Updated button and icon styles for a more polished user experience. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
1 parent c7fab9f commit 11d9f3e

File tree

11 files changed

+888
-912
lines changed

11 files changed

+888
-912
lines changed

apps/dashboard/src/@/actions/getWalletNFTs.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ export async function getWalletNFTs(params: {
9898
type OwnedNFTInsightResponse = {
9999
name: string;
100100
description: string;
101-
image_url: string;
101+
image_url?: string;
102102
background_color: string;
103103
external_url: string;
104104
metadata_url: string;
@@ -186,7 +186,7 @@ async function getWalletNFTsFromInsight(params: {
186186
description: nft.description,
187187
external_url: nft.external_url,
188188
image: isDev
189-
? nft.image_url.replace("ipfscdn.io/", "thirdwebstorage-dev.com/")
189+
? nft.image_url?.replace("ipfscdn.io/", "thirdwebstorage-dev.com/")
190190
: nft.image_url,
191191
name: nft.name,
192192
uri: isDev

apps/dashboard/src/@/components/blocks/CurrencySelector.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import { ArrowLeftIcon } from "lucide-react";
12
import { useMemo, useState } from "react";
23
import { isAddress, NATIVE_TOKEN_ADDRESS, ZERO_ADDRESS } from "thirdweb";
34
import { Button } from "@/components/ui/button";
@@ -109,10 +110,10 @@ export function CurrencySelector({
109110
className="rounded-r-none rounded-l-md"
110111
onClick={() => setIsAddingCurrency(false)}
111112
>
112-
&lt;-
113+
<ArrowLeftIcon className="size-4" />
113114
</Button>
114115
<Input
115-
className="w-full rounded-none"
116+
className={cn("w-full rounded-none", className)}
116117
onChange={(e) => setEditCustomCurrency(e.target.value)}
117118
placeholder="ERC20 Address"
118119
required
@@ -156,7 +157,7 @@ export function CurrencySelector({
156157
: value?.toLowerCase()
157158
}
158159
>
159-
<SelectTrigger>
160+
<SelectTrigger className={className}>
160161
<SelectValue placeholder="Select Currency" />
161162
</SelectTrigger>
162163
<SelectContent>

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

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -23,29 +23,27 @@ export const CancelTab: React.FC<CancelTabProps> = ({
2323
: cancelListing({ contract, listingId: BigInt(id) });
2424
const cancelQuery = useSendAndConfirmTransaction();
2525
return (
26-
<div className="flex flex-col gap-3 pt-3">
27-
<TransactionButton
28-
className="self-end"
29-
client={contract.client}
30-
isLoggedIn={isLoggedIn}
31-
isPending={cancelQuery.isPending}
32-
onClick={() => {
33-
const promise = cancelQuery.mutateAsync(transaction, {
34-
onError: (error) => {
35-
console.error(error);
36-
},
37-
});
38-
toast.promise(promise, {
39-
error: "Failed to cancel",
40-
loading: `Cancelling ${isAuction ? "auction" : "listing"}`,
41-
success: "Item cancelled successfully",
42-
});
43-
}}
44-
transactionCount={1}
45-
txChainID={contract.chain.id}
46-
>
47-
Cancel {isAuction ? "Auction" : "Listing"}
48-
</TransactionButton>
49-
</div>
26+
<TransactionButton
27+
className="self-end"
28+
client={contract.client}
29+
isLoggedIn={isLoggedIn}
30+
isPending={cancelQuery.isPending}
31+
onClick={() => {
32+
const promise = cancelQuery.mutateAsync(transaction, {
33+
onError: (error) => {
34+
console.error(error);
35+
},
36+
});
37+
toast.promise(promise, {
38+
error: "Failed to cancel",
39+
loading: `Cancelling ${isAuction ? "auction" : "listing"}`,
40+
success: "Item cancelled successfully",
41+
});
42+
}}
43+
transactionCount={1}
44+
txChainID={contract.chain.id}
45+
>
46+
Cancel {isAuction ? "Auction" : "Listing"}
47+
</TransactionButton>
5048
);
5149
};

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,14 @@ export const CreateListingButton: React.FC<CreateListingButtonProps> = ({
5151
<ListerOnly contract={contract}>
5252
<Sheet onOpenChange={setOpen} open={open}>
5353
<SheetTrigger asChild>
54-
<Button variant="primary" {...restButtonProps} disabled={!address}>
55-
{createText} <PlusIcon className="ml-2 size-5" />
54+
<Button
55+
{...restButtonProps}
56+
disabled={!address}
57+
className="gap-2"
58+
size="sm"
59+
>
60+
<PlusIcon className="size-4" />
61+
{createText}
5662
</Button>
5763
</SheetTrigger>
5864
<SheetContent className="w-full overflow-y-auto sm:min-w-[540px] lg:min-w-[700px]">

0 commit comments

Comments
 (0)