@medialane/ui 0.299.0 → 0.301.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/collection-page.cjs +2 -11
- package/dist/components/collection-page.cjs.map +1 -1
- package/dist/components/collection-page.js +2 -11
- package/dist/components/collection-page.js.map +1 -1
- package/dist/components/collection-provenance-tab.cjs +206 -0
- package/dist/components/collection-provenance-tab.cjs.map +1 -0
- package/dist/components/collection-provenance-tab.d.cts +8 -0
- package/dist/components/collection-provenance-tab.d.ts +8 -0
- package/dist/components/collection-provenance-tab.js +172 -0
- package/dist/components/collection-provenance-tab.js.map +1 -0
- package/dist/components/fast-mint/fast-mint.d.cts +2 -2
- package/dist/components/fast-mint/fast-mint.d.ts +2 -2
- package/dist/components/launchpad/collection-picker.cjs +1 -1
- package/dist/components/launchpad/collection-picker.cjs.map +1 -1
- package/dist/components/launchpad/collection-picker.js +1 -1
- package/dist/components/launchpad/collection-picker.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +2 -2
- package/dist/components/launchpad/edition-mint-schema.d.ts +2 -2
- package/dist/index.cjs +3 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -2
- package/dist/index.d.ts +1 -2
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.cts +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.ts +1 -1
- package/package.json +1 -1
- package/dist/components/collection-activity-tab.cjs +0 -60
- package/dist/components/collection-activity-tab.cjs.map +0 -1
- package/dist/components/collection-activity-tab.d.cts +0 -8
- package/dist/components/collection-activity-tab.d.ts +0 -8
- package/dist/components/collection-activity-tab.js +0 -36
- package/dist/components/collection-activity-tab.js.map +0 -1
- package/dist/components/collection-traits-tab.cjs +0 -79
- package/dist/components/collection-traits-tab.cjs.map +0 -1
- package/dist/components/collection-traits-tab.d.cts +0 -8
- package/dist/components/collection-traits-tab.d.ts +0 -8
- package/dist/components/collection-traits-tab.js +0 -55
- package/dist/components/collection-traits-tab.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/collection-provenance-tab.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, useEffect, useMemo } from \"react\";\nimport type { ApiActivity } from \"@medialane/sdk\";\nimport { assetHref, profileHref } from \"@medialane/sdk\";\nimport { ExternalLink, Inbox } from \"lucide-react\";\nimport Image from \"./image.js\";\nimport Link from \"./link.js\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { CurrencyIcon } from \"./currency-icon.js\";\nimport { LoadMoreSentinel } from \"./load-more-sentinel.js\";\nimport { useActivities } from \"../utils/use-activities.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\nimport { ACTIVITY_TYPE_CONFIG } from \"../data/activity.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport { cn } from \"../utils/cn.js\";\n\nconst PAGE_SIZE = 30;\n\nconst EVENT_TITLE: Record<string, string> = {\n mint: \"Minted\",\n listing: \"Listed for sale\",\n sale: \"Purchased\",\n offer: \"Offer made\",\n transfer: \"Transferred\",\n cancelled: \"Listing cancelled\",\n};\n\nfunction dayLabel(iso: string): string {\n const date = new Date(iso);\n const today = new Date();\n const yesterday = new Date();\n yesterday.setDate(today.getDate() - 1);\n if (date.toDateString() === today.toDateString()) return \"Today\";\n if (date.toDateString() === yesterday.toDateString()) return \"Yesterday\";\n return date.toLocaleDateString(undefined, { day: \"numeric\", month: \"long\", year: \"numeric\" });\n}\n\nfunction groupByDay(events: ApiActivity[]) {\n const groups: { label: string; events: ApiActivity[] }[] = [];\n for (const event of events) {\n const label = dayLabel(event.timestamp);\n const last = groups[groups.length - 1];\n if (last && last.label === label) last.events.push(event);\n else groups.push({ label, events: [event] });\n }\n return groups;\n}\n\nfunction ProvenanceEvent({ event, showAsset }: { event: ApiActivity; showAsset: boolean }) {\n const resolveImage = useImageUrl();\n const config = ACTIVITY_TYPE_CONFIG[event.type];\n const Icon = config?.icon ?? ExternalLink;\n const contract = event.nftContract ?? event.contractAddress ?? null;\n const tokenId = event.nftTokenId ?? event.tokenId ?? null;\n const actor =\n event.offerer ?? event.fulfiller ?? (event.type === \"mint\" ? event.to : event.from) ?? null;\n const amount = event.amount && Number(event.amount) > 1 ? event.amount : null;\n const name = event.token?.name ?? (tokenId ? `#${tokenId}` : null);\n const image = resolveImage(event.token?.image ?? null);\n\n return (\n <li className=\"relative pl-12 pb-6 last:pb-0\">\n <span\n className={cn(\n \"absolute left-0 top-0 flex h-8 w-8 items-center justify-center rounded-full ring-4 ring-background\",\n config?.bgClass ?? \"bg-muted\"\n )}\n aria-hidden\n >\n <Icon className={cn(\"h-4 w-4\", config?.colorClass ?? \"text-muted-foreground\")} />\n </span>\n\n <div className=\"flex items-start gap-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold leading-8 sm:leading-8\">\n {EVENT_TITLE[event.type] ?? event.type}\n {amount ? <span className=\"ml-1.5 text-xs font-medium text-muted-foreground\">×{amount}</span> : null}\n {actor ? (\n <span className=\"font-normal text-muted-foreground\">\n {\" by \"}\n <Link\n href={profileHref({ address: actor })}\n className=\"hover:text-primary transition-colors\"\n >\n <AddressDisplay address={actor} chars={4} showCopy={false} className=\"text-xs\" />\n </Link>\n </span>\n ) : null}\n </p>\n\n {showAsset && name ? (\n <Link\n href={contract && tokenId ? assetHref(event.chain ?? \"STARKNET\", contract, tokenId) : \"#\"}\n className=\"mt-1 inline-flex max-w-full items-center gap-2 rounded-lg bg-muted/40 py-1 pl-1 pr-3 hover:bg-muted transition-colors\"\n >\n <span className=\"relative h-8 w-8 shrink-0 overflow-hidden rounded-md bg-muted\">\n {image ? (\n <Image src={image} alt=\"\" width={32} height={32} className=\"h-full w-full object-cover\" unoptimized />\n ) : null}\n </span>\n <span className=\"truncate text-xs font-medium\">{name}</span>\n </Link>\n ) : null}\n </div>\n\n <div className=\"flex shrink-0 flex-col items-end gap-0.5 pt-1.5\">\n {event.price?.formatted ? (\n <span className=\"flex items-center gap-1.5 text-sm font-bold tabular-nums\">\n {event.price.currency ? <CurrencyIcon symbol={event.price.currency} size={13} aria-hidden /> : null}\n {formatDisplayPrice(event.price.formatted)}\n </span>\n ) : null}\n <span className=\"flex items-center gap-1.5 text-xs text-muted-foreground\">\n <time dateTime={event.timestamp} title={new Date(event.timestamp).toLocaleString()}>\n {timeAgo(event.timestamp)}\n </time>\n {event.txHash ? (\n <a\n href={`${EXPLORER_URL}/tx/${event.txHash}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"rounded p-0.5 hover:bg-muted hover:text-foreground transition-colors\"\n aria-label=\"View transaction\"\n >\n <ExternalLink className=\"h-3 w-3\" aria-hidden />\n </a>\n ) : null}\n </span>\n </div>\n </div>\n </li>\n );\n}\n\nfunction ProvenanceSkeleton() {\n return (\n <div className=\"space-y-6\" aria-hidden>\n {Array.from({ length: 6 }).map((_, i) => (\n <div key={i} className=\"flex items-start gap-4\">\n <div className=\"h-8 w-8 shrink-0 rounded-full bg-muted animate-pulse\" />\n <div className=\"flex-1 space-y-2 pt-1\">\n <div className=\"h-3.5 w-40 rounded bg-muted animate-pulse\" />\n <div className=\"h-3 w-24 rounded bg-muted animate-pulse\" />\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nexport interface CollectionProvenanceTabProps {\n contract: string;\n}\n\nexport function CollectionProvenanceTab({ contract }: CollectionProvenanceTabProps) {\n const [page, setPage] = useState(1);\n const [all, setAll] = useState<ApiActivity[]>([]);\n const { activities, meta, isLoading } = useActivities({ contract, page, limit: PAGE_SIZE });\n\n useEffect(() => {\n if (activities.length === 0) return;\n setAll((prev) => (page === 1 ? activities : [...prev, ...activities]));\n }, [activities, page]);\n\n const groups = useMemo(() => groupByDay(all), [all]);\n const showAsset = useMemo(\n () => new Set(all.map((e) => e.nftTokenId ?? e.tokenId ?? \"\")).size > 1,\n [all]\n );\n const hasMore = meta ? all.length < (meta.total ?? 0) : false;\n\n if (isLoading && all.length === 0) return <ProvenanceSkeleton />;\n\n if (all.length === 0) {\n return (\n <div className=\"py-20 flex flex-col items-center gap-3 text-center\">\n <Inbox className=\"h-10 w-10 text-muted-foreground/40\" />\n <p className=\"text-sm font-medium text-muted-foreground\">No history yet</p>\n <p className=\"text-xs text-muted-foreground/70 max-w-xs\">\n Mints, transfers, listings and sales will appear here as they happen.\n </p>\n </div>\n );\n }\n\n return (\n <div className=\"mx-auto max-w-2xl\">\n {groups.map((group) => (\n <section key={group.label} className=\"mb-8 last:mb-0\">\n <h3 className=\"mb-4 pl-12 text-xs font-medium text-muted-foreground\">{group.label}</h3>\n <ol className=\"relative before:absolute before:left-4 before:top-4 before:bottom-4 before:w-px before:bg-border\">\n {group.events.map((event, i) => (\n <ProvenanceEvent\n key={`${event.txHash ?? event.orderHash}-${event.type}-${i}`}\n event={event}\n showAsset={showAsset}\n />\n ))}\n </ol>\n </section>\n ))}\n <LoadMoreSentinel hasMore={hasMore} isLoading={isLoading} onLoadMore={() => setPage((p) => p + 1)} />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwEQ;AAtER,mBAA6C;AAE7C,iBAAuC;AACvC,0BAAoC;AACpC,mBAAkB;AAClB,kBAAiB;AACjB,6BAA+B;AAC/B,2BAA6B;AAC7B,gCAAiC;AACjC,4BAA8B;AAC9B,2BAA4B;AAC5B,sBAAqC;AACrC,0BAA6B;AAC7B,oBAAmC;AACnC,kBAAwB;AACxB,gBAAmB;AAEnB,MAAM,YAAY;AAElB,MAAM,cAAsC;AAAA,EAC1C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;A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x-runtime';
|
|
2
|
+
|
|
3
|
+
interface CollectionProvenanceTabProps {
|
|
4
|
+
contract: string;
|
|
5
|
+
}
|
|
6
|
+
declare function CollectionProvenanceTab({ contract }: CollectionProvenanceTabProps): react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { CollectionProvenanceTab, type CollectionProvenanceTabProps };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface CollectionProvenanceTabProps {
|
|
4
|
+
contract: string;
|
|
5
|
+
}
|
|
6
|
+
declare function CollectionProvenanceTab({ contract }: CollectionProvenanceTabProps): react_jsx_runtime.JSX.Element;
|
|
7
|
+
|
|
8
|
+
export { CollectionProvenanceTab, type CollectionProvenanceTabProps };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState, useEffect, useMemo } from "react";
|
|
4
|
+
import { assetHref, profileHref } from "@medialane/sdk";
|
|
5
|
+
import { ExternalLink, Inbox } from "lucide-react";
|
|
6
|
+
import Image from "./image.js";
|
|
7
|
+
import Link from "./link.js";
|
|
8
|
+
import { AddressDisplay } from "./address-display.js";
|
|
9
|
+
import { CurrencyIcon } from "./currency-icon.js";
|
|
10
|
+
import { LoadMoreSentinel } from "./load-more-sentinel.js";
|
|
11
|
+
import { useActivities } from "../utils/use-activities.js";
|
|
12
|
+
import { useImageUrl } from "../utils/use-image-url.js";
|
|
13
|
+
import { ACTIVITY_TYPE_CONFIG } from "../data/activity.js";
|
|
14
|
+
import { EXPLORER_URL } from "../utils/explorer-url.js";
|
|
15
|
+
import { formatDisplayPrice } from "../utils/format.js";
|
|
16
|
+
import { timeAgo } from "../utils/time.js";
|
|
17
|
+
import { cn } from "../utils/cn.js";
|
|
18
|
+
const PAGE_SIZE = 30;
|
|
19
|
+
const EVENT_TITLE = {
|
|
20
|
+
mint: "Minted",
|
|
21
|
+
listing: "Listed for sale",
|
|
22
|
+
sale: "Purchased",
|
|
23
|
+
offer: "Offer made",
|
|
24
|
+
transfer: "Transferred",
|
|
25
|
+
cancelled: "Listing cancelled"
|
|
26
|
+
};
|
|
27
|
+
function dayLabel(iso) {
|
|
28
|
+
const date = new Date(iso);
|
|
29
|
+
const today = /* @__PURE__ */ new Date();
|
|
30
|
+
const yesterday = /* @__PURE__ */ new Date();
|
|
31
|
+
yesterday.setDate(today.getDate() - 1);
|
|
32
|
+
if (date.toDateString() === today.toDateString()) return "Today";
|
|
33
|
+
if (date.toDateString() === yesterday.toDateString()) return "Yesterday";
|
|
34
|
+
return date.toLocaleDateString(void 0, { day: "numeric", month: "long", year: "numeric" });
|
|
35
|
+
}
|
|
36
|
+
function groupByDay(events) {
|
|
37
|
+
const groups = [];
|
|
38
|
+
for (const event of events) {
|
|
39
|
+
const label = dayLabel(event.timestamp);
|
|
40
|
+
const last = groups[groups.length - 1];
|
|
41
|
+
if (last && last.label === label) last.events.push(event);
|
|
42
|
+
else groups.push({ label, events: [event] });
|
|
43
|
+
}
|
|
44
|
+
return groups;
|
|
45
|
+
}
|
|
46
|
+
function ProvenanceEvent({ event, showAsset }) {
|
|
47
|
+
const resolveImage = useImageUrl();
|
|
48
|
+
const config = ACTIVITY_TYPE_CONFIG[event.type];
|
|
49
|
+
const Icon = config?.icon ?? ExternalLink;
|
|
50
|
+
const contract = event.nftContract ?? event.contractAddress ?? null;
|
|
51
|
+
const tokenId = event.nftTokenId ?? event.tokenId ?? null;
|
|
52
|
+
const actor = event.offerer ?? event.fulfiller ?? (event.type === "mint" ? event.to : event.from) ?? null;
|
|
53
|
+
const amount = event.amount && Number(event.amount) > 1 ? event.amount : null;
|
|
54
|
+
const name = event.token?.name ?? (tokenId ? `#${tokenId}` : null);
|
|
55
|
+
const image = resolveImage(event.token?.image ?? null);
|
|
56
|
+
return /* @__PURE__ */ jsxs("li", { className: "relative pl-12 pb-6 last:pb-0", children: [
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
"span",
|
|
59
|
+
{
|
|
60
|
+
className: cn(
|
|
61
|
+
"absolute left-0 top-0 flex h-8 w-8 items-center justify-center rounded-full ring-4 ring-background",
|
|
62
|
+
config?.bgClass ?? "bg-muted"
|
|
63
|
+
),
|
|
64
|
+
"aria-hidden": true,
|
|
65
|
+
children: /* @__PURE__ */ jsx(Icon, { className: cn("h-4 w-4", config?.colorClass ?? "text-muted-foreground") })
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-3", children: [
|
|
69
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
70
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm font-semibold leading-8 sm:leading-8", children: [
|
|
71
|
+
EVENT_TITLE[event.type] ?? event.type,
|
|
72
|
+
amount ? /* @__PURE__ */ jsxs("span", { className: "ml-1.5 text-xs font-medium text-muted-foreground", children: [
|
|
73
|
+
"\xD7",
|
|
74
|
+
amount
|
|
75
|
+
] }) : null,
|
|
76
|
+
actor ? /* @__PURE__ */ jsxs("span", { className: "font-normal text-muted-foreground", children: [
|
|
77
|
+
" by ",
|
|
78
|
+
/* @__PURE__ */ jsx(
|
|
79
|
+
Link,
|
|
80
|
+
{
|
|
81
|
+
href: profileHref({ address: actor }),
|
|
82
|
+
className: "hover:text-primary transition-colors",
|
|
83
|
+
children: /* @__PURE__ */ jsx(AddressDisplay, { address: actor, chars: 4, showCopy: false, className: "text-xs" })
|
|
84
|
+
}
|
|
85
|
+
)
|
|
86
|
+
] }) : null
|
|
87
|
+
] }),
|
|
88
|
+
showAsset && name ? /* @__PURE__ */ jsxs(
|
|
89
|
+
Link,
|
|
90
|
+
{
|
|
91
|
+
href: contract && tokenId ? assetHref(event.chain ?? "STARKNET", contract, tokenId) : "#",
|
|
92
|
+
className: "mt-1 inline-flex max-w-full items-center gap-2 rounded-lg bg-muted/40 py-1 pl-1 pr-3 hover:bg-muted transition-colors",
|
|
93
|
+
children: [
|
|
94
|
+
/* @__PURE__ */ jsx("span", { className: "relative h-8 w-8 shrink-0 overflow-hidden rounded-md bg-muted", children: image ? /* @__PURE__ */ jsx(Image, { src: image, alt: "", width: 32, height: 32, className: "h-full w-full object-cover", unoptimized: true }) : null }),
|
|
95
|
+
/* @__PURE__ */ jsx("span", { className: "truncate text-xs font-medium", children: name })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
) : null
|
|
99
|
+
] }),
|
|
100
|
+
/* @__PURE__ */ jsxs("div", { className: "flex shrink-0 flex-col items-end gap-0.5 pt-1.5", children: [
|
|
101
|
+
event.price?.formatted ? /* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-sm font-bold tabular-nums", children: [
|
|
102
|
+
event.price.currency ? /* @__PURE__ */ jsx(CurrencyIcon, { symbol: event.price.currency, size: 13, "aria-hidden": true }) : null,
|
|
103
|
+
formatDisplayPrice(event.price.formatted)
|
|
104
|
+
] }) : null,
|
|
105
|
+
/* @__PURE__ */ jsxs("span", { className: "flex items-center gap-1.5 text-xs text-muted-foreground", children: [
|
|
106
|
+
/* @__PURE__ */ jsx("time", { dateTime: event.timestamp, title: new Date(event.timestamp).toLocaleString(), children: timeAgo(event.timestamp) }),
|
|
107
|
+
event.txHash ? /* @__PURE__ */ jsx(
|
|
108
|
+
"a",
|
|
109
|
+
{
|
|
110
|
+
href: `${EXPLORER_URL}/tx/${event.txHash}`,
|
|
111
|
+
target: "_blank",
|
|
112
|
+
rel: "noopener noreferrer",
|
|
113
|
+
className: "rounded p-0.5 hover:bg-muted hover:text-foreground transition-colors",
|
|
114
|
+
"aria-label": "View transaction",
|
|
115
|
+
children: /* @__PURE__ */ jsx(ExternalLink, { className: "h-3 w-3", "aria-hidden": true })
|
|
116
|
+
}
|
|
117
|
+
) : null
|
|
118
|
+
] })
|
|
119
|
+
] })
|
|
120
|
+
] })
|
|
121
|
+
] });
|
|
122
|
+
}
|
|
123
|
+
function ProvenanceSkeleton() {
|
|
124
|
+
return /* @__PURE__ */ jsx("div", { className: "space-y-6", "aria-hidden": true, children: Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
|
|
125
|
+
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 shrink-0 rounded-full bg-muted animate-pulse" }),
|
|
126
|
+
/* @__PURE__ */ jsxs("div", { className: "flex-1 space-y-2 pt-1", children: [
|
|
127
|
+
/* @__PURE__ */ jsx("div", { className: "h-3.5 w-40 rounded bg-muted animate-pulse" }),
|
|
128
|
+
/* @__PURE__ */ jsx("div", { className: "h-3 w-24 rounded bg-muted animate-pulse" })
|
|
129
|
+
] })
|
|
130
|
+
] }, i)) });
|
|
131
|
+
}
|
|
132
|
+
function CollectionProvenanceTab({ contract }) {
|
|
133
|
+
const [page, setPage] = useState(1);
|
|
134
|
+
const [all, setAll] = useState([]);
|
|
135
|
+
const { activities, meta, isLoading } = useActivities({ contract, page, limit: PAGE_SIZE });
|
|
136
|
+
useEffect(() => {
|
|
137
|
+
if (activities.length === 0) return;
|
|
138
|
+
setAll((prev) => page === 1 ? activities : [...prev, ...activities]);
|
|
139
|
+
}, [activities, page]);
|
|
140
|
+
const groups = useMemo(() => groupByDay(all), [all]);
|
|
141
|
+
const showAsset = useMemo(
|
|
142
|
+
() => new Set(all.map((e) => e.nftTokenId ?? e.tokenId ?? "")).size > 1,
|
|
143
|
+
[all]
|
|
144
|
+
);
|
|
145
|
+
const hasMore = meta ? all.length < (meta.total ?? 0) : false;
|
|
146
|
+
if (isLoading && all.length === 0) return /* @__PURE__ */ jsx(ProvenanceSkeleton, {});
|
|
147
|
+
if (all.length === 0) {
|
|
148
|
+
return /* @__PURE__ */ jsxs("div", { className: "py-20 flex flex-col items-center gap-3 text-center", children: [
|
|
149
|
+
/* @__PURE__ */ jsx(Inbox, { className: "h-10 w-10 text-muted-foreground/40" }),
|
|
150
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-muted-foreground", children: "No history yet" }),
|
|
151
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground/70 max-w-xs", children: "Mints, transfers, listings and sales will appear here as they happen." })
|
|
152
|
+
] });
|
|
153
|
+
}
|
|
154
|
+
return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-2xl", children: [
|
|
155
|
+
groups.map((group) => /* @__PURE__ */ jsxs("section", { className: "mb-8 last:mb-0", children: [
|
|
156
|
+
/* @__PURE__ */ jsx("h3", { className: "mb-4 pl-12 text-xs font-medium text-muted-foreground", children: group.label }),
|
|
157
|
+
/* @__PURE__ */ jsx("ol", { className: "relative before:absolute before:left-4 before:top-4 before:bottom-4 before:w-px before:bg-border", children: group.events.map((event, i) => /* @__PURE__ */ jsx(
|
|
158
|
+
ProvenanceEvent,
|
|
159
|
+
{
|
|
160
|
+
event,
|
|
161
|
+
showAsset
|
|
162
|
+
},
|
|
163
|
+
`${event.txHash ?? event.orderHash}-${event.type}-${i}`
|
|
164
|
+
)) })
|
|
165
|
+
] }, group.label)),
|
|
166
|
+
/* @__PURE__ */ jsx(LoadMoreSentinel, { hasMore, isLoading, onLoadMore: () => setPage((p) => p + 1) })
|
|
167
|
+
] });
|
|
168
|
+
}
|
|
169
|
+
export {
|
|
170
|
+
CollectionProvenanceTab
|
|
171
|
+
};
|
|
172
|
+
//# sourceMappingURL=collection-provenance-tab.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/collection-provenance-tab.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, useEffect, useMemo } from \"react\";\nimport type { ApiActivity } from \"@medialane/sdk\";\nimport { assetHref, profileHref } from \"@medialane/sdk\";\nimport { ExternalLink, Inbox } from \"lucide-react\";\nimport Image from \"./image.js\";\nimport Link from \"./link.js\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { CurrencyIcon } from \"./currency-icon.js\";\nimport { LoadMoreSentinel } from \"./load-more-sentinel.js\";\nimport { useActivities } from \"../utils/use-activities.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\nimport { ACTIVITY_TYPE_CONFIG } from \"../data/activity.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport { cn } from \"../utils/cn.js\";\n\nconst PAGE_SIZE = 30;\n\nconst EVENT_TITLE: Record<string, string> = {\n mint: \"Minted\",\n listing: \"Listed for sale\",\n sale: \"Purchased\",\n offer: \"Offer made\",\n transfer: \"Transferred\",\n cancelled: \"Listing cancelled\",\n};\n\nfunction dayLabel(iso: string): string {\n const date = new Date(iso);\n const today = new Date();\n const yesterday = new Date();\n yesterday.setDate(today.getDate() - 1);\n if (date.toDateString() === today.toDateString()) return \"Today\";\n if (date.toDateString() === yesterday.toDateString()) return \"Yesterday\";\n return date.toLocaleDateString(undefined, { day: \"numeric\", month: \"long\", year: \"numeric\" });\n}\n\nfunction groupByDay(events: ApiActivity[]) {\n const groups: { label: string; events: ApiActivity[] }[] = [];\n for (const event of events) {\n const label = dayLabel(event.timestamp);\n const last = groups[groups.length - 1];\n if (last && last.label === label) last.events.push(event);\n else groups.push({ label, events: [event] });\n }\n return groups;\n}\n\nfunction ProvenanceEvent({ event, showAsset }: { event: ApiActivity; showAsset: boolean }) {\n const resolveImage = useImageUrl();\n const config = ACTIVITY_TYPE_CONFIG[event.type];\n const Icon = config?.icon ?? ExternalLink;\n const contract = event.nftContract ?? event.contractAddress ?? null;\n const tokenId = event.nftTokenId ?? event.tokenId ?? null;\n const actor =\n event.offerer ?? event.fulfiller ?? (event.type === \"mint\" ? event.to : event.from) ?? null;\n const amount = event.amount && Number(event.amount) > 1 ? event.amount : null;\n const name = event.token?.name ?? (tokenId ? `#${tokenId}` : null);\n const image = resolveImage(event.token?.image ?? null);\n\n return (\n <li className=\"relative pl-12 pb-6 last:pb-0\">\n <span\n className={cn(\n \"absolute left-0 top-0 flex h-8 w-8 items-center justify-center rounded-full ring-4 ring-background\",\n config?.bgClass ?? \"bg-muted\"\n )}\n aria-hidden\n >\n <Icon className={cn(\"h-4 w-4\", config?.colorClass ?? \"text-muted-foreground\")} />\n </span>\n\n <div className=\"flex items-start gap-3\">\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold leading-8 sm:leading-8\">\n {EVENT_TITLE[event.type] ?? event.type}\n {amount ? <span className=\"ml-1.5 text-xs font-medium text-muted-foreground\">×{amount}</span> : null}\n {actor ? (\n <span className=\"font-normal text-muted-foreground\">\n {\" by \"}\n <Link\n href={profileHref({ address: actor })}\n className=\"hover:text-primary transition-colors\"\n >\n <AddressDisplay address={actor} chars={4} showCopy={false} className=\"text-xs\" />\n </Link>\n </span>\n ) : null}\n </p>\n\n {showAsset && name ? (\n <Link\n href={contract && tokenId ? assetHref(event.chain ?? \"STARKNET\", contract, tokenId) : \"#\"}\n className=\"mt-1 inline-flex max-w-full items-center gap-2 rounded-lg bg-muted/40 py-1 pl-1 pr-3 hover:bg-muted transition-colors\"\n >\n <span className=\"relative h-8 w-8 shrink-0 overflow-hidden rounded-md bg-muted\">\n {image ? (\n <Image src={image} alt=\"\" width={32} height={32} className=\"h-full w-full object-cover\" unoptimized />\n ) : null}\n </span>\n <span className=\"truncate text-xs font-medium\">{name}</span>\n </Link>\n ) : null}\n </div>\n\n <div className=\"flex shrink-0 flex-col items-end gap-0.5 pt-1.5\">\n {event.price?.formatted ? (\n <span className=\"flex items-center gap-1.5 text-sm font-bold tabular-nums\">\n {event.price.currency ? <CurrencyIcon symbol={event.price.currency} size={13} aria-hidden /> : null}\n {formatDisplayPrice(event.price.formatted)}\n </span>\n ) : null}\n <span className=\"flex items-center gap-1.5 text-xs text-muted-foreground\">\n <time dateTime={event.timestamp} title={new Date(event.timestamp).toLocaleString()}>\n {timeAgo(event.timestamp)}\n </time>\n {event.txHash ? (\n <a\n href={`${EXPLORER_URL}/tx/${event.txHash}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"rounded p-0.5 hover:bg-muted hover:text-foreground transition-colors\"\n aria-label=\"View transaction\"\n >\n <ExternalLink className=\"h-3 w-3\" aria-hidden />\n </a>\n ) : null}\n </span>\n </div>\n </div>\n </li>\n );\n}\n\nfunction ProvenanceSkeleton() {\n return (\n <div className=\"space-y-6\" aria-hidden>\n {Array.from({ length: 6 }).map((_, i) => (\n <div key={i} className=\"flex items-start gap-4\">\n <div className=\"h-8 w-8 shrink-0 rounded-full bg-muted animate-pulse\" />\n <div className=\"flex-1 space-y-2 pt-1\">\n <div className=\"h-3.5 w-40 rounded bg-muted animate-pulse\" />\n <div className=\"h-3 w-24 rounded bg-muted animate-pulse\" />\n </div>\n </div>\n ))}\n </div>\n );\n}\n\nexport interface CollectionProvenanceTabProps {\n contract: string;\n}\n\nexport function CollectionProvenanceTab({ contract }: CollectionProvenanceTabProps) {\n const [page, setPage] = useState(1);\n const [all, setAll] = useState<ApiActivity[]>([]);\n const { activities, meta, isLoading } = useActivities({ contract, page, limit: PAGE_SIZE });\n\n useEffect(() => {\n if (activities.length === 0) return;\n setAll((prev) => (page === 1 ? activities : [...prev, ...activities]));\n }, [activities, page]);\n\n const groups = useMemo(() => groupByDay(all), [all]);\n const showAsset = useMemo(\n () => new Set(all.map((e) => e.nftTokenId ?? e.tokenId ?? \"\")).size > 1,\n [all]\n );\n const hasMore = meta ? all.length < (meta.total ?? 0) : false;\n\n if (isLoading && all.length === 0) return <ProvenanceSkeleton />;\n\n if (all.length === 0) {\n return (\n <div className=\"py-20 flex flex-col items-center gap-3 text-center\">\n <Inbox className=\"h-10 w-10 text-muted-foreground/40\" />\n <p className=\"text-sm font-medium text-muted-foreground\">No history yet</p>\n <p className=\"text-xs text-muted-foreground/70 max-w-xs\">\n Mints, transfers, listings and sales will appear here as they happen.\n </p>\n </div>\n );\n }\n\n return (\n <div className=\"mx-auto max-w-2xl\">\n {groups.map((group) => (\n <section key={group.label} className=\"mb-8 last:mb-0\">\n <h3 className=\"mb-4 pl-12 text-xs font-medium text-muted-foreground\">{group.label}</h3>\n <ol className=\"relative before:absolute before:left-4 before:top-4 before:bottom-4 before:w-px before:bg-border\">\n {group.events.map((event, i) => (\n <ProvenanceEvent\n key={`${event.txHash ?? event.orderHash}-${event.type}-${i}`}\n event={event}\n showAsset={showAsset}\n />\n ))}\n </ol>\n </section>\n ))}\n <LoadMoreSentinel hasMore={hasMore} isLoading={isLoading} onLoadMore={() => setPage((p) => p + 1)} />\n </div>\n );\n}\n"],"mappings":";AAwEQ,cAOc,YAPd;AAtER,SAAS,UAAU,WAAW,eAAe;AAE7C,SAAS,WAAW,mBAAmB;AACvC,SAAS,cAAc,aAAa;AACpC,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,wBAAwB;AACjC,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,4BAA4B;AACrC,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,eAAe;AACxB,SAAS,UAAU;AAEnB,MAAM,YAAY;AAElB,MAAM,cAAsC;AAAA,EAC1C,MAAM;AAAA,EACN,SAAS;AAAA,EACT,MAAM;AAAA,EACN,OAAO;AAAA,EACP,UAAU;AAAA,EACV,WAAW;AACb;AAEA,SAAS,SAAS,KAAqB;AACrC,QAAM,OAAO,IAAI,KAAK,GAAG;AACzB,QAAM,QAAQ,oBAAI,KAAK;AACvB,QAAM,YAAY,oBAAI,KAAK;AAC3B,YAAU,QAAQ,MAAM,QAAQ,IAAI,CAAC;AACrC,MAAI,KAAK,aAAa,MAAM,MAAM,aAAa,EAAG,QAAO;AACzD,MAAI,KAAK,aAAa,MAAM,UAAU,aAAa,EAAG,QAAO;AAC7D,SAAO,KAAK,mBAAmB,QAAW,EAAE,KAAK,WAAW,OAAO,QAAQ,MAAM,UAAU,CAAC;AAC9F;AAEA,SAAS,WAAW,QAAuB;AACzC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AA,0BAAC,SAAM,WAAU,sCAAqC;AAAA,MACtD,oBAAC,OAAE,WAAU,6CAA4C,4BAAc;AAAA,MACvE,oBAAC,OAAE,WAAU,6CAA4C,mFAEzD;AAAA,OACF;AAAA,EAEJ;AAEA,SACE,qBAAC,SAAI,WAAU,qBACZ;AAAA,WAAO,IAAI,CAAC,UACX,qBAAC,aAA0B,WAAU,kBACnC;AAAA,0BAAC,QAAG,WAAU,wDAAwD,gBAAM,OAAM;AAAA,MAClF,oBAAC,QAAG,WAAU,oGACX,gBAAM,OAAO,IAAI,CAAC,OAAO,MACxB;AAAA,QAAC;AAAA;AAAA,UAEC;AAAA,UACA;AAAA;AAAA,QAFK,GAAG,MAAM,UAAU,MAAM,SAAS,IAAI,MAAM,IAAI,IAAI,CAAC;AAAA,MAG5D,CACD,GACH;AAAA,SAVY,MAAM,KAWpB,CACD;AAAA,IACD,oBAAC,oBAAiB,SAAkB,WAAsB,YAAY,MAAM,QAAQ,CAAC,MAAM,IAAI,CAAC,GAAG;AAAA,KACrG;AAEJ;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.cjs';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.js';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -58,7 +58,7 @@ function CollectionPicker({ collections, loading, value, onChange, newCollection
|
|
|
58
58
|
if (loading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-[4.25rem] rounded-xl" });
|
|
59
59
|
if (collections.length === 0) {
|
|
60
60
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl border border-dashed border-border p-5 text-center space-y-3", children: [
|
|
61
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: "
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: "No collection found. It may take a minute to display recently created collections." }),
|
|
62
62
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
63
63
|
import_link.default,
|
|
64
64
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/launchpad/collection-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Boxes, Check, ChevronDown, Plus } from \"lucide-react\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Image from \"../image.js\";\nimport Link from \"../link.js\";\nimport { Input } from \"../input.js\";\nimport { Skeleton } from \"../skeleton.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\n\nexport interface CollectionPickerProps {\n collections: ApiCollection[];\n loading: boolean;\n value: string;\n onChange: (id: string) => void;\n newCollectionHref: string;\n}\n\nfunction label(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction works(col: ApiCollection) {\n return col.totalSupply != null ? `${col.totalSupply.toLocaleString()} work${col.totalSupply !== 1 ? \"s\" : \"\"}` : \"Empty\";\n}\n\nfunction Thumb({ image, size }: { image: string | null | undefined; size: \"sm\" | \"md\" }) {\n const url = useImageUrl()(image);\n return (\n <div className={cn(\"relative rounded-lg overflow-hidden bg-muted shrink-0\", size === \"md\" ? \"h-10 w-10\" : \"h-8 w-8\")}>\n {url ? (\n <Image src={url} alt=\"\" fill unoptimized className=\"object-cover\" />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nexport function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }: CollectionPickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n\n if (loading) return <Skeleton className=\"h-[4.25rem] rounded-xl\" />;\n\n if (collections.length === 0) {\n return (\n <div className=\"rounded-xl border border-dashed border-border p-5 text-center space-y-3\">\n <p className=\"text-sm text-muted-foreground\">
|
|
1
|
+
{"version":3,"sources":["../../../src/components/launchpad/collection-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Boxes, Check, ChevronDown, Plus } from \"lucide-react\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Image from \"../image.js\";\nimport Link from \"../link.js\";\nimport { Input } from \"../input.js\";\nimport { Skeleton } from \"../skeleton.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\n\nexport interface CollectionPickerProps {\n collections: ApiCollection[];\n loading: boolean;\n value: string;\n onChange: (id: string) => void;\n newCollectionHref: string;\n}\n\nfunction label(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction works(col: ApiCollection) {\n return col.totalSupply != null ? `${col.totalSupply.toLocaleString()} work${col.totalSupply !== 1 ? \"s\" : \"\"}` : \"Empty\";\n}\n\nfunction Thumb({ image, size }: { image: string | null | undefined; size: \"sm\" | \"md\" }) {\n const url = useImageUrl()(image);\n return (\n <div className={cn(\"relative rounded-lg overflow-hidden bg-muted shrink-0\", size === \"md\" ? \"h-10 w-10\" : \"h-8 w-8\")}>\n {url ? (\n <Image src={url} alt=\"\" fill unoptimized className=\"object-cover\" />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nexport function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }: CollectionPickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n\n if (loading) return <Skeleton className=\"h-[4.25rem] rounded-xl\" />;\n\n if (collections.length === 0) {\n return (\n <div className=\"rounded-xl border border-dashed border-border p-5 text-center space-y-3\">\n <p className=\"text-sm text-muted-foreground\">No collection found. It may take a minute to display recently created collections.</p>\n <Link\n href={newCollectionHref}\n className=\"inline-flex items-center gap-1.5 h-9 px-4 rounded-xl text-sm font-semibold text-white bg-brand-blue hover:brightness-110 transition-all\"\n >\n <Plus className=\"h-3.5 w-3.5\" />\n Create your first collection\n </Link>\n </div>\n );\n }\n\n const selected = collections.find((c) => c.collectionId === value) ?? null;\n const filtered = query.trim() ? collections.filter((c) => label(c).toLowerCase().includes(query.trim().toLowerCase())) : collections;\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n setOpen(next);\n if (!next) setQuery(\"\");\n }}\n >\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40\"\n >\n <Thumb image={selected?.image} size=\"md\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold truncate\">{selected ? label(selected) : \"Choose a collection\"}</p>\n <p className=\"text-xs text-muted-foreground\">{selected ? works(selected) : \"Where this work will live\"}</p>\n </div>\n <span className=\"flex items-center gap-1 text-xs font-medium text-muted-foreground shrink-0\">\n Change\n <ChevronDown className=\"h-3.5 w-3.5\" />\n </span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n {collections.length > 5 && (\n <div className=\"border-b border-border p-2\">\n <Input value={query} onChange={(e) => setQuery(e.target.value)} placeholder=\"Search collections…\" className=\"h-8\" />\n </div>\n )}\n <div className=\"max-h-64 overflow-y-auto p-1\">\n {filtered.length === 0 ? (\n <p className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No collection found.</p>\n ) : (\n filtered.map((col) => (\n <button\n key={col.collectionId!}\n type=\"button\"\n onClick={() => {\n onChange(col.collectionId!);\n setOpen(false);\n }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60\"\n >\n <Thumb image={col.image} size=\"sm\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium truncate\">{label(col)}</p>\n <p className=\"text-xs text-muted-foreground\">{works(col)}</p>\n </div>\n {value === col.collectionId && <Check className=\"h-4 w-4 text-brand-blue shrink-0\" />}\n </button>\n ))\n )}\n </div>\n <div className=\"border-t border-border p-1\">\n <Link\n href={newCollectionHref}\n className=\"flex items-center gap-2 rounded-lg px-2 py-2 text-sm font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground transition-colors\"\n >\n <Plus className=\"h-4 w-4\" />\n New collection\n </Link>\n </div>\n </PopoverContent>\n </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AAC,QACZ;AAAA,YAAC;AAAA;AAAA,cAEC,MAAK;AAAA,cACL,SAAS,MAAM;AACb,yBAAS,IAAI,YAAa;AAC1B,wBAAQ,KAAK;AAAA,cACf;AAAA,cACA,WAAU;AAAA,cAEV;AAAA,4DAAC,SAAM,OAAO,IAAI,OAAO,MAAK,MAAK;AAAA,gBACnC,6CAAC,SAAI,WAAU,kBACb;AAAA,8DAAC,OAAE,WAAU,gCAAgC,gBAAM,GAAG,GAAE;AAAA,kBACxD,4CAAC,OAAE,WAAU,iCAAiC,gBAAM,GAAG,GAAE;AAAA,mBAC3D;AAAA,gBACC,UAAU,IAAI,gBAAgB,4CAAC,6BAAM,WAAU,oCAAmC;AAAA;AAAA;AAAA,YAb9E,IAAI;AAAA,UAcX,CACD,GAEL;AAAA,UACA,4CAAC,SAAI,WAAU,8BACb;AAAA,YAAC,YAAAA;AAAA,YAAA;AAAA,cACC,MAAM;AAAA,cACN,WAAU;AAAA,cAEV;AAAA,4DAAC,4BAAK,WAAU,WAAU;AAAA,gBAAE;AAAA;AAAA;AAAA,UAE9B,GACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":["Image","Link"]}
|
|
@@ -25,7 +25,7 @@ function CollectionPicker({ collections, loading, value, onChange, newCollection
|
|
|
25
25
|
if (loading) return /* @__PURE__ */ jsx(Skeleton, { className: "h-[4.25rem] rounded-xl" });
|
|
26
26
|
if (collections.length === 0) {
|
|
27
27
|
return /* @__PURE__ */ jsxs("div", { className: "rounded-xl border border-dashed border-border p-5 text-center space-y-3", children: [
|
|
28
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "
|
|
28
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: "No collection found. It may take a minute to display recently created collections." }),
|
|
29
29
|
/* @__PURE__ */ jsxs(
|
|
30
30
|
Link,
|
|
31
31
|
{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/launchpad/collection-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Boxes, Check, ChevronDown, Plus } from \"lucide-react\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Image from \"../image.js\";\nimport Link from \"../link.js\";\nimport { Input } from \"../input.js\";\nimport { Skeleton } from \"../skeleton.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\n\nexport interface CollectionPickerProps {\n collections: ApiCollection[];\n loading: boolean;\n value: string;\n onChange: (id: string) => void;\n newCollectionHref: string;\n}\n\nfunction label(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction works(col: ApiCollection) {\n return col.totalSupply != null ? `${col.totalSupply.toLocaleString()} work${col.totalSupply !== 1 ? \"s\" : \"\"}` : \"Empty\";\n}\n\nfunction Thumb({ image, size }: { image: string | null | undefined; size: \"sm\" | \"md\" }) {\n const url = useImageUrl()(image);\n return (\n <div className={cn(\"relative rounded-lg overflow-hidden bg-muted shrink-0\", size === \"md\" ? \"h-10 w-10\" : \"h-8 w-8\")}>\n {url ? (\n <Image src={url} alt=\"\" fill unoptimized className=\"object-cover\" />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nexport function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }: CollectionPickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n\n if (loading) return <Skeleton className=\"h-[4.25rem] rounded-xl\" />;\n\n if (collections.length === 0) {\n return (\n <div className=\"rounded-xl border border-dashed border-border p-5 text-center space-y-3\">\n <p className=\"text-sm text-muted-foreground\">
|
|
1
|
+
{"version":3,"sources":["../../../src/components/launchpad/collection-picker.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Boxes, Check, ChevronDown, Plus } from \"lucide-react\";\nimport type { ApiCollection } from \"@medialane/sdk\";\nimport Image from \"../image.js\";\nimport Link from \"../link.js\";\nimport { Input } from \"../input.js\";\nimport { Skeleton } from \"../skeleton.js\";\nimport { Popover, PopoverContent, PopoverTrigger } from \"../popover.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\n\nexport interface CollectionPickerProps {\n collections: ApiCollection[];\n loading: boolean;\n value: string;\n onChange: (id: string) => void;\n newCollectionHref: string;\n}\n\nfunction label(col: ApiCollection) {\n return col.name || col.symbol || `Collection #${col.collectionId}`;\n}\n\nfunction works(col: ApiCollection) {\n return col.totalSupply != null ? `${col.totalSupply.toLocaleString()} work${col.totalSupply !== 1 ? \"s\" : \"\"}` : \"Empty\";\n}\n\nfunction Thumb({ image, size }: { image: string | null | undefined; size: \"sm\" | \"md\" }) {\n const url = useImageUrl()(image);\n return (\n <div className={cn(\"relative rounded-lg overflow-hidden bg-muted shrink-0\", size === \"md\" ? \"h-10 w-10\" : \"h-8 w-8\")}>\n {url ? (\n <Image src={url} alt=\"\" fill unoptimized className=\"object-cover\" />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center\">\n <Boxes className=\"h-4 w-4 text-muted-foreground/40\" />\n </div>\n )}\n </div>\n );\n}\n\nexport function CollectionPicker({ collections, loading, value, onChange, newCollectionHref }: CollectionPickerProps) {\n const [open, setOpen] = useState(false);\n const [query, setQuery] = useState(\"\");\n\n if (loading) return <Skeleton className=\"h-[4.25rem] rounded-xl\" />;\n\n if (collections.length === 0) {\n return (\n <div className=\"rounded-xl border border-dashed border-border p-5 text-center space-y-3\">\n <p className=\"text-sm text-muted-foreground\">No collection found. It may take a minute to display recently created collections.</p>\n <Link\n href={newCollectionHref}\n className=\"inline-flex items-center gap-1.5 h-9 px-4 rounded-xl text-sm font-semibold text-white bg-brand-blue hover:brightness-110 transition-all\"\n >\n <Plus className=\"h-3.5 w-3.5\" />\n Create your first collection\n </Link>\n </div>\n );\n }\n\n const selected = collections.find((c) => c.collectionId === value) ?? null;\n const filtered = query.trim() ? collections.filter((c) => label(c).toLowerCase().includes(query.trim().toLowerCase())) : collections;\n\n return (\n <Popover\n open={open}\n onOpenChange={(next) => {\n setOpen(next);\n if (!next) setQuery(\"\");\n }}\n >\n <PopoverTrigger asChild>\n <button\n type=\"button\"\n aria-expanded={open}\n className=\"flex w-full items-center gap-3 rounded-xl border border-border p-3 text-left transition-colors hover:bg-muted/40\"\n >\n <Thumb image={selected?.image} size=\"md\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold truncate\">{selected ? label(selected) : \"Choose a collection\"}</p>\n <p className=\"text-xs text-muted-foreground\">{selected ? works(selected) : \"Where this work will live\"}</p>\n </div>\n <span className=\"flex items-center gap-1 text-xs font-medium text-muted-foreground shrink-0\">\n Change\n <ChevronDown className=\"h-3.5 w-3.5\" />\n </span>\n </button>\n </PopoverTrigger>\n <PopoverContent className=\"w-[var(--radix-popover-trigger-width)] p-0\" align=\"start\">\n {collections.length > 5 && (\n <div className=\"border-b border-border p-2\">\n <Input value={query} onChange={(e) => setQuery(e.target.value)} placeholder=\"Search collections…\" className=\"h-8\" />\n </div>\n )}\n <div className=\"max-h-64 overflow-y-auto p-1\">\n {filtered.length === 0 ? (\n <p className=\"px-3 py-4 text-center text-sm text-muted-foreground\">No collection found.</p>\n ) : (\n filtered.map((col) => (\n <button\n key={col.collectionId!}\n type=\"button\"\n onClick={() => {\n onChange(col.collectionId!);\n setOpen(false);\n }}\n className=\"flex w-full items-center gap-2.5 rounded-lg px-2 py-2 text-left transition-colors hover:bg-muted/60\"\n >\n <Thumb image={col.image} size=\"sm\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-medium truncate\">{label(col)}</p>\n <p className=\"text-xs text-muted-foreground\">{works(col)}</p>\n </div>\n {value === col.collectionId && <Check className=\"h-4 w-4 text-brand-blue shrink-0\" />}\n </button>\n ))\n )}\n </div>\n <div className=\"border-t border-border p-1\">\n <Link\n href={newCollectionHref}\n className=\"flex items-center gap-2 rounded-lg px-2 py-2 text-sm font-medium text-muted-foreground hover:bg-muted/60 hover:text-foreground transition-colors\"\n >\n <Plus className=\"h-4 w-4\" />\n New collection\n </Link>\n </div>\n </PopoverContent>\n </Popover>\n );\n}\n"],"mappings":";AAkCQ,cAoBA,YApBA;AAhCR,SAAS,gBAAgB;AACzB,SAAS,OAAO,OAAO,aAAa,YAAY;AAEhD,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,SAAS,aAAa;AACtB,SAAS,gBAAgB;AACzB,SAAS,SAAS,gBAAgB,sBAAsB;AACxD,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAU5B,SAAS,MAAM,KAAoB;AACjC,SAAO,IAAI,QAAQ,IAAI,UAAU,eAAe,IAAI,YAAY;AAClE;AAEA,SAAS,MAAM,KAAoB;AACjC,SAAO,IAAI,eAAe,OAAO,GAAG,IAAI,YAAY,eAAe,CAAC,QAAQ,IAAI,gBAAgB,IAAI,MAAM,EAAE,KAAK;AACnH;AAEA,SAAS,MAAM,EAAE,OAAO,KAAK,GAA4D;AACvF,QAAM,MAAM,YAAY,EAAE,KAAK;AAC/B,SACE,oBAAC,SAAI,WAAW,GAAG,yDAAyD,SAAS,OAAO,cAAc,SAAS,GAChH,gBACC,oBAAC,SAAM,KAAK,KAAK,KAAI,IAAG,MAAI,MAAC,aAAW,MAAC,WAAU,gBAAe,IAElE,oBAAC,SAAI,WAAU,qDACb,8BAAC,SAAM,WAAU,oCAAmC,GACtD,GAEJ;AAEJ;AAEO,SAAS,iBAAiB,EAAE,aAAa,SAAS,OAAO,UAAU,kBAAkB,GAA0B;AACpH,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AACtC,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AAErC,MAAI,QAAS,QAAO,oBAAC,YAAS,WAAU,0BAAyB;AAEjE,MAAI,YAAY,WAAW,GA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,MAAM,SAAS,EAAE,OAAO,KAAK,GAAG,aAAY,4BAAsB,WAAU,OAAM,GACpH;AAAA,UAEF,oBAAC,SAAI,WAAU,gCACZ,mBAAS,WAAW,IACnB,oBAAC,OAAE,WAAU,uDAAsD,kCAAoB,IAEvF,SAAS,IAAI,CAAC,QACZ;AAAA,YAAC;AAAA;AAAA,cAEC,MAAK;AAAA,cACL,SAAS,MAAM;AACb,yBAAS,IAAI,YAAa;AAC1B,wBAAQ,KAAK;AAAA,cACf;AAAA,cACA,WAAU;AAAA,cAEV;AAAA,oCAAC,SAAM,OAAO,IAAI,OAAO,MAAK,MAAK;AAAA,gBACnC,qBAAC,SAAI,WAAU,kBACb;AAAA,sCAAC,OAAE,WAAU,gCAAgC,gBAAM,GAAG,GAAE;AAAA,kBACxD,oBAAC,OAAE,WAAU,iCAAiC,gBAAM,GAAG,GAAE;AAAA,mBAC3D;AAAA,gBACC,UAAU,IAAI,gBAAgB,oBAAC,SAAM,WAAU,oCAAmC;AAAA;AAAA;AAAA,YAb9E,IAAI;AAAA,UAcX,CACD,GAEL;AAAA,UACA,oBAAC,SAAI,WAAU,8BACb;AAAA,YAAC;AAAA;AAAA,cACC,MAAM;AAAA,cACN,WAAU;AAAA,cAEV;AAAA,oCAAC,QAAK,WAAU,WAAU;AAAA,gBAAE;AAAA;AAAA;AAAA,UAE9B,GACF;AAAA,WACF;AAAA;AAAA;AAAA,EACF;AAEJ;","names":[]}
|
|
@@ -16,7 +16,6 @@ declare const editionMintSchema: zod.ZodObject<{
|
|
|
16
16
|
royalty: zod.ZodNumber;
|
|
17
17
|
}, "strip", zod.ZodTypeAny, {
|
|
18
18
|
name: string;
|
|
19
|
-
value: string;
|
|
20
19
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
|
|
21
20
|
licenseType: string;
|
|
22
21
|
commercialUse: "Yes" | "No";
|
|
@@ -25,12 +24,12 @@ declare const editionMintSchema: zod.ZodObject<{
|
|
|
25
24
|
geographicScope: string;
|
|
26
25
|
aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
|
|
27
26
|
royalty: number;
|
|
27
|
+
value: string;
|
|
28
28
|
recipient: string;
|
|
29
29
|
description?: string | undefined;
|
|
30
30
|
external_url?: string | undefined;
|
|
31
31
|
}, {
|
|
32
32
|
name: string;
|
|
33
|
-
value: string;
|
|
34
33
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
|
|
35
34
|
licenseType: string;
|
|
36
35
|
commercialUse: "Yes" | "No";
|
|
@@ -39,6 +38,7 @@ declare const editionMintSchema: zod.ZodObject<{
|
|
|
39
38
|
geographicScope: string;
|
|
40
39
|
aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
|
|
41
40
|
royalty: number;
|
|
41
|
+
value: string;
|
|
42
42
|
recipient: string;
|
|
43
43
|
description?: string | undefined;
|
|
44
44
|
external_url?: string | undefined;
|
|
@@ -16,7 +16,6 @@ declare const editionMintSchema: zod.ZodObject<{
|
|
|
16
16
|
royalty: zod.ZodNumber;
|
|
17
17
|
}, "strip", zod.ZodTypeAny, {
|
|
18
18
|
name: string;
|
|
19
|
-
value: string;
|
|
20
19
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
|
|
21
20
|
licenseType: string;
|
|
22
21
|
commercialUse: "Yes" | "No";
|
|
@@ -25,12 +24,12 @@ declare const editionMintSchema: zod.ZodObject<{
|
|
|
25
24
|
geographicScope: string;
|
|
26
25
|
aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
|
|
27
26
|
royalty: number;
|
|
27
|
+
value: string;
|
|
28
28
|
recipient: string;
|
|
29
29
|
description?: string | undefined;
|
|
30
30
|
external_url?: string | undefined;
|
|
31
31
|
}, {
|
|
32
32
|
name: string;
|
|
33
|
-
value: string;
|
|
34
33
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
|
|
35
34
|
licenseType: string;
|
|
36
35
|
commercialUse: "Yes" | "No";
|
|
@@ -39,6 +38,7 @@ declare const editionMintSchema: zod.ZodObject<{
|
|
|
39
38
|
geographicScope: string;
|
|
40
39
|
aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
|
|
41
40
|
royalty: number;
|
|
41
|
+
value: string;
|
|
42
42
|
recipient: string;
|
|
43
43
|
description?: string | undefined;
|
|
44
44
|
external_url?: string | undefined;
|
package/dist/index.cjs
CHANGED
|
@@ -98,7 +98,6 @@ __export(index_exports, {
|
|
|
98
98
|
CollapsibleContent: () => import_collapsible.CollapsibleContent,
|
|
99
99
|
CollapsibleSection: () => import_collapsible_section.CollapsibleSection,
|
|
100
100
|
CollapsibleTrigger: () => import_collapsible.CollapsibleTrigger,
|
|
101
|
-
CollectionActivityTab: () => import_collection_activity_tab.CollectionActivityTab,
|
|
102
101
|
CollectionCard: () => import_collection_card.CollectionCard,
|
|
103
102
|
CollectionCardSkeleton: () => import_collection_card.CollectionCardSkeleton,
|
|
104
103
|
CollectionCreateForm: () => import_collection_create_form.CollectionCreateForm,
|
|
@@ -109,8 +108,8 @@ __export(index_exports, {
|
|
|
109
108
|
CollectionNameClaim: () => import_collection_name_claim.CollectionNameClaim,
|
|
110
109
|
CollectionPage: () => import_collection_page.CollectionPage,
|
|
111
110
|
CollectionPicker: () => import_collection_picker.CollectionPicker,
|
|
111
|
+
CollectionProvenanceTab: () => import_collection_provenance_tab.CollectionProvenanceTab,
|
|
112
112
|
CollectionSettings: () => import_collection_settings.CollectionSettings,
|
|
113
|
-
CollectionTraitsTab: () => import_collection_traits_tab.CollectionTraitsTab,
|
|
114
113
|
CollectionTypeChoices: () => import_new_collection_menu.CollectionTypeChoices,
|
|
115
114
|
CollectionsLoading: () => import_page_skeletons.CollectionsLoading,
|
|
116
115
|
CollectionsPage: () => import_collections_page.CollectionsPage,
|
|
@@ -878,8 +877,7 @@ var import_use_profiles = require("./utils/use-profiles.js");
|
|
|
878
877
|
var import_use_activities = require("./utils/use-activities.js");
|
|
879
878
|
var import_use_collections = require("./utils/use-collections.js");
|
|
880
879
|
var import_creator_chip = require("./components/creator-chip.js");
|
|
881
|
-
var
|
|
882
|
-
var import_collection_traits_tab = require("./components/collection-traits-tab.js");
|
|
880
|
+
var import_collection_provenance_tab = require("./components/collection-provenance-tab.js");
|
|
883
881
|
var import_portfolio_activity = require("./components/portfolio-activity.js");
|
|
884
882
|
var import_creator_score_inline = require("./components/creator-score-inline.js");
|
|
885
883
|
var import_use_medialane_client = require("./utils/use-medialane-client.js");
|
|
@@ -992,7 +990,6 @@ var import_asset_accents = require("./utils/asset-accents.js");
|
|
|
992
990
|
CollapsibleContent,
|
|
993
991
|
CollapsibleSection,
|
|
994
992
|
CollapsibleTrigger,
|
|
995
|
-
CollectionActivityTab,
|
|
996
993
|
CollectionCard,
|
|
997
994
|
CollectionCardSkeleton,
|
|
998
995
|
CollectionCreateForm,
|
|
@@ -1003,8 +1000,8 @@ var import_asset_accents = require("./utils/asset-accents.js");
|
|
|
1003
1000
|
CollectionNameClaim,
|
|
1004
1001
|
CollectionPage,
|
|
1005
1002
|
CollectionPicker,
|
|
1003
|
+
CollectionProvenanceTab,
|
|
1006
1004
|
CollectionSettings,
|
|
1007
|
-
CollectionTraitsTab,
|
|
1008
1005
|
CollectionTypeChoices,
|
|
1009
1006
|
CollectionsLoading,
|
|
1010
1007
|
CollectionsPage,
|