Skip to content

Commit d5b5c12

Browse files
committed
Dashboard: Add Marketplace in project
1 parent b371bf9 commit d5b5c12

File tree

12 files changed

+959
-80
lines changed

12 files changed

+959
-80
lines changed

apps/dashboard/src/@/analytics/report.ts

Lines changed: 27 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -269,22 +269,6 @@ export function reportAssetBuyFailed(properties: {
269269

270270
// Assets Landing Page ----------------------------
271271

272-
/**
273-
* ### Why do we need to report this event?
274-
* - To track number of asset creation started from the assets page
275-
* - To track which asset types are being created the most
276-
*
277-
* ### Who is responsible for this event?
278-
* @MananTank
279-
*/
280-
export function reportAssetCreationStarted(properties: {
281-
assetType: "nft" | "coin";
282-
}) {
283-
posthog.capture("asset creation started", {
284-
assetType: properties.assetType,
285-
});
286-
}
287-
288272
/**
289273
* ### Why do we need to report this event?
290274
* - To track number of assets imported successfully from the assets page
@@ -386,9 +370,35 @@ export function reportAssetCreationFailed(
386370
});
387371
}
388372

373+
/**
374+
* ### Why do we need to report this event?
375+
* - To track number of successful asset creations
376+
* - To track which asset types are being created the most
377+
*
378+
* ### Who is responsible for this event?
379+
* @MananTank
380+
*/
381+
export function reportMarketCreationSuccessful() {
382+
posthog.capture("market creation successful");
383+
}
384+
385+
/**
386+
* ### Why do we need to report this event?
387+
* - To track number of failed marketplace creations
388+
* - To track the errors that users encounter when trying to create a marketplace
389+
*
390+
* ### Who is responsible for this event?
391+
* @MananTank
392+
*/
393+
export function reportMarketCreationFailed(properties: { error: string }) {
394+
posthog.capture("market creation failed", {
395+
error: properties.error,
396+
});
397+
}
398+
389399
type UpsellParams = {
390400
content: "storage-limit";
391-
campaign: "create-coin" | "create-nft";
401+
campaign: "create-coin" | "create-nft" | "create-marketplace";
392402
sku: Exclude<ProductSKU, null>;
393403
};
394404

apps/dashboard/src/@/components/contract-components/tables/contract-table.tsx

Lines changed: 26 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ export function ContractTable(props: {
4848
teamId: string;
4949
projectId: string;
5050
client: ThirdwebClient;
51-
variant: "asset" | "contract";
51+
variant: "token" | "contract" | "marketplace";
5252
teamSlug: string;
5353
projectSlug: string;
5454
}) {
@@ -76,7 +76,7 @@ export function ContractTableUI(props: {
7676
pageSize: number;
7777
removeContractFromProject: (contractId: string) => Promise<void>;
7878
client: ThirdwebClient;
79-
variant: "asset" | "contract";
79+
variant: "token" | "contract" | "marketplace";
8080
teamSlug: string;
8181
projectSlug: string;
8282
}) {
@@ -143,7 +143,7 @@ export function ContractTableUI(props: {
143143
<TableHeader className="z-0">
144144
<TableRow>
145145
<TableHead>Name</TableHead>
146-
<TableHead>Type</TableHead>
146+
{props.variant !== "marketplace" && <TableHead>Type</TableHead>}
147147
<TableHead className="tracking-normal">
148148
<NetworkFilterCell
149149
chainId={
@@ -163,7 +163,7 @@ export function ContractTableUI(props: {
163163
<TableHead>Contract Address</TableHead>
164164
)}
165165

166-
{props.variant === "asset" && <TableHead> Token Page</TableHead>}
166+
{props.variant === "token" && <TableHead> Token Page</TableHead>}
167167

168168
<TableHead>Actions</TableHead>
169169
</TableRow>
@@ -188,23 +188,25 @@ export function ContractTableUI(props: {
188188
/>
189189
</TableCell>
190190

191-
<TableCell>
192-
{contract.contractType &&
193-
props.variant === "asset" &&
194-
contractTypeToAssetTypeRecord[contract.contractType] ? (
195-
<ContractTypeCellUI
196-
name={
197-
contractTypeToAssetTypeRecord[contract.contractType]
198-
}
199-
/>
200-
) : (
201-
<ContractTypeCell
202-
chainId={contract.chainId}
203-
client={props.client}
204-
contractAddress={contract.contractAddress}
205-
/>
206-
)}
207-
</TableCell>
191+
{props.variant !== "marketplace" && (
192+
<TableCell>
193+
{contract.contractType &&
194+
props.variant === "token" &&
195+
contractTypeToAssetTypeRecord[contract.contractType] ? (
196+
<ContractTypeCellUI
197+
name={
198+
contractTypeToAssetTypeRecord[contract.contractType]
199+
}
200+
/>
201+
) : (
202+
<ContractTypeCell
203+
chainId={contract.chainId}
204+
client={props.client}
205+
contractAddress={contract.contractAddress}
206+
/>
207+
)}
208+
</TableCell>
209+
)}
208210

209211
<TableCell>
210212
<ChainNameCell
@@ -224,7 +226,7 @@ export function ContractTableUI(props: {
224226
</TableCell>
225227
)}
226228

227-
{props.variant === "asset" && (
229+
{props.variant === "token" && (
228230
<TableCell>
229231
<Button asChild size="sm" variant="ghost">
230232
<Link
@@ -261,11 +263,8 @@ export function ContractTableUI(props: {
261263
{contracts.length === 0 && (
262264
<div className="flex h-[350px] items-center justify-center text-muted-foreground">
263265
<div className="text-center">
264-
{props.variant === "asset" ? (
265-
<p className="mb-3">No tokens found</p>
266-
) : (
267-
<p className="mb-3">No contracts found</p>
268-
)}
266+
<p className="mb-3">No {props.variant}s</p>
267+
269268
{props.variant === "contract" && (
270269
<Button asChild className="bg-background" variant="outline">
271270
<Link

apps/dashboard/src/@/components/contracts/import-contract/modal.tsx

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ type ImportModalProps = {
4040
projectSlug: string;
4141
teamSlug: string;
4242
client: ThirdwebClient;
43-
type: "contract" | "asset";
43+
type: "contract" | "token" | "marketplace";
4444
onSuccess?: () => void;
4545
};
4646

@@ -60,7 +60,7 @@ export const ImportModal: React.FC<ImportModalProps> = (props) => {
6060
>
6161
<DialogHeader className="p-6">
6262
<DialogTitle className="font-semibold text-2xl tracking-tight">
63-
Import {props.type === "contract" ? "Contract" : "Token"}
63+
Import {props.type}
6464
</DialogTitle>
6565
<DialogDescription>
6666
Import a deployed contract in your project
@@ -103,7 +103,7 @@ function ImportForm(props: {
103103
teamSlug: string;
104104
projectSlug: string;
105105
client: ThirdwebClient;
106-
type: "contract" | "asset";
106+
type: "contract" | "token" | "marketplace";
107107
onSuccess?: () => void;
108108
}) {
109109
const router = useDashboardRouter();
@@ -197,7 +197,7 @@ function ImportForm(props: {
197197
<FormItem>
198198
<FormLabel>Contract Address</FormLabel>
199199
<FormControl>
200-
<Input placeholder="0x..." {...field} />
200+
<Input placeholder="0x..." {...field} className="bg-card" />
201201
</FormControl>
202202
<FormMessage />
203203
</FormItem>
@@ -211,6 +211,8 @@ function ImportForm(props: {
211211
chainId={form.watch("chainId")}
212212
client={props.client}
213213
disableChainId
214+
disableDeprecated
215+
className="bg-card"
214216
onChange={(v) => form.setValue("chainId", v)}
215217
side="top"
216218
/>

apps/dashboard/src/@/hooks/project-contracts.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,13 @@ export function useAddContractToProject() {
1010
projectId: string;
1111
contractAddress: string;
1212
chainId: string;
13-
deploymentType: "asset" | undefined;
14-
contractType: "DropERC20" | "DropERC721" | "DropERC1155" | undefined;
13+
deploymentType: "asset" | "marketplace" | undefined;
14+
contractType:
15+
| "DropERC20"
16+
| "DropERC721"
17+
| "DropERC1155"
18+
| "MarketplaceV3"
19+
| undefined;
1520
}) => {
1621
const res = await apiServerProxy({
1722
body: JSON.stringify({
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import { TabPathLinks } from "@/components/ui/tabs";
2+
3+
export function AssetsHeader(props: { teamSlug: string; projectSlug: string }) {
4+
return (
5+
<div>
6+
<div className="container max-w-7xl pt-8 pb-4">
7+
<h1 className="font-semibold text-2xl tracking-tight lg:text-3xl">
8+
Tokens
9+
</h1>
10+
<p className="text-muted-foreground">
11+
Create and manage tokens for your project
12+
</p>
13+
</div>
14+
15+
<TabPathLinks
16+
scrollableClassName="container max-w-7xl"
17+
links={[
18+
{
19+
name: "Tokens",
20+
path: `/team/${props.teamSlug}/${props.projectSlug}/tokens`,
21+
},
22+
{
23+
name: "NFT Marketplace",
24+
path: `/team/${props.teamSlug}/${props.projectSlug}/tokens/marketplace`,
25+
},
26+
]}
27+
/>
28+
</div>
29+
);
30+
}

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/cards.tsx

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import Link from "next/link";
55
import { useState } from "react";
66
import type { ThirdwebClient } from "thirdweb";
77
import {
8-
reportAssetCreationStarted,
98
reportAssetImportStarted,
109
reportAssetImportSuccessful,
1110
} from "@/analytics/report";
@@ -36,30 +35,20 @@ export function Cards(props: {
3635
projectSlug={props.projectSlug}
3736
teamId={props.teamId}
3837
teamSlug={props.teamSlug}
39-
type="asset"
38+
type="token"
4039
/>
4140

4241
<CardLink
4342
description="Launch your own ERC-20 coin"
4443
href={`/team/${props.teamSlug}/${props.projectSlug}/tokens/create/token`}
4544
icon={CoinsIcon}
46-
onClick={() => {
47-
reportAssetCreationStarted({
48-
assetType: "coin",
49-
});
50-
}}
5145
title="Create Coin"
5246
/>
5347

5448
<CardLink
5549
description="Launch your own NFT collection"
5650
href={`/team/${props.teamSlug}/${props.projectSlug}/tokens/create/nft`}
5751
icon={ImagesIcon}
58-
onClick={() => {
59-
reportAssetCreationStarted({
60-
assetType: "nft",
61-
});
62-
}}
6352
title="Create NFT Collection"
6453
/>
6554

apps/dashboard/src/app/(app)/team/[team_slug]/[project_slug]/(sidebar)/tokens/create/_common/storage-error-upsell.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import { tryCatch } from "@/utils/try-catch";
1515

1616
export function StorageErrorPlanUpsell(props: {
1717
teamSlug: string;
18-
trackingCampaign: "create-coin" | "create-nft";
18+
trackingCampaign: "create-coin" | "create-nft" | "create-marketplace";
1919
onRetry: () => void;
2020
}) {
2121
const [isPlanUpdated, setIsPlanUpdated] = useState(false);

0 commit comments

Comments
 (0)