@medialane/ui 0.259.0 → 0.261.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/action-button.cjs +7 -2
- package/dist/components/action-button.cjs.map +1 -1
- package/dist/components/action-button.d.cts +2 -1
- package/dist/components/action-button.d.ts +2 -1
- package/dist/components/action-button.js +7 -2
- package/dist/components/action-button.js.map +1 -1
- package/dist/components/activities-feed.cjs +5 -1
- package/dist/components/activities-feed.cjs.map +1 -1
- package/dist/components/activities-feed.js +5 -1
- package/dist/components/activities-feed.js.map +1 -1
- package/dist/components/activity-feed-shell.cjs +3 -1
- package/dist/components/activity-feed-shell.cjs.map +1 -1
- package/dist/components/activity-feed-shell.js +3 -1
- package/dist/components/activity-feed-shell.js.map +1 -1
- package/dist/components/asset-access-cards.cjs +21 -33
- package/dist/components/asset-access-cards.cjs.map +1 -1
- package/dist/components/asset-access-cards.d.cts +3 -3
- package/dist/components/asset-access-cards.d.ts +3 -3
- package/dist/components/asset-access-cards.js +20 -32
- package/dist/components/asset-access-cards.js.map +1 -1
- package/dist/components/asset-marketplace-panel.cjs +44 -41
- package/dist/components/asset-marketplace-panel.cjs.map +1 -1
- package/dist/components/asset-marketplace-panel.js +45 -42
- package/dist/components/asset-marketplace-panel.js.map +1 -1
- package/dist/components/asset-overview-content.cjs +12 -1
- package/dist/components/asset-overview-content.cjs.map +1 -1
- package/dist/components/asset-overview-content.d.cts +3 -1
- package/dist/components/asset-overview-content.d.ts +3 -1
- package/dist/components/asset-overview-content.js +13 -2
- package/dist/components/asset-overview-content.js.map +1 -1
- package/dist/components/asset-page.cjs +8 -6
- package/dist/components/asset-page.cjs.map +1 -1
- package/dist/components/asset-page.js +8 -6
- package/dist/components/asset-page.js.map +1 -1
- package/dist/components/asset-top-sections.cjs +1 -9
- package/dist/components/asset-top-sections.cjs.map +1 -1
- package/dist/components/asset-top-sections.d.cts +1 -2
- package/dist/components/asset-top-sections.d.ts +1 -2
- package/dist/components/asset-top-sections.js +1 -9
- package/dist/components/asset-top-sections.js.map +1 -1
- package/dist/components/coins-explorer.cjs +5 -1
- package/dist/components/coins-explorer.cjs.map +1 -1
- package/dist/components/coins-explorer.js +6 -2
- package/dist/components/coins-explorer.js.map +1 -1
- package/dist/components/comments-section.cjs +2 -2
- package/dist/components/comments-section.cjs.map +1 -1
- package/dist/components/comments-section.js +2 -2
- package/dist/components/comments-section.js.map +1 -1
- package/dist/components/discover-community-section.cjs +5 -1
- package/dist/components/discover-community-section.cjs.map +1 -1
- package/dist/components/discover-community-section.js +5 -1
- package/dist/components/discover-community-section.js.map +1 -1
- package/dist/components/discover-feed-section.cjs +5 -1
- package/dist/components/discover-feed-section.cjs.map +1 -1
- package/dist/components/discover-feed-section.js +5 -1
- package/dist/components/discover-feed-section.js.map +1 -1
- package/dist/components/fast-mint/success-view.cjs +2 -2
- package/dist/components/fast-mint/success-view.cjs.map +1 -1
- package/dist/components/fast-mint/success-view.js +2 -2
- package/dist/components/fast-mint/success-view.js.map +1 -1
- package/dist/components/ip-type-page.cjs +3 -2
- package/dist/components/ip-type-page.cjs.map +1 -1
- package/dist/components/ip-type-page.js +3 -2
- package/dist/components/ip-type-page.js.map +1 -1
- package/dist/components/markdown-text.cjs +53 -0
- package/dist/components/markdown-text.cjs.map +1 -0
- package/dist/components/markdown-text.d.cts +7 -0
- package/dist/components/markdown-text.d.ts +7 -0
- package/dist/components/markdown-text.js +19 -0
- package/dist/components/markdown-text.js.map +1 -0
- package/dist/components/marketplace-dialog-primitives.cjs +1 -1
- package/dist/components/marketplace-dialog-primitives.cjs.map +1 -1
- package/dist/components/marketplace-dialog-primitives.js +1 -1
- package/dist/components/marketplace-dialog-primitives.js.map +1 -1
- package/dist/components/media-wallet/media-wallet-activity.cjs +5 -1
- package/dist/components/media-wallet/media-wallet-activity.cjs.map +1 -1
- package/dist/components/media-wallet/media-wallet-activity.js +5 -1
- package/dist/components/media-wallet/media-wallet-activity.js.map +1 -1
- package/dist/components/media-wallet/media-wallet-home.cjs +3 -2
- package/dist/components/media-wallet/media-wallet-home.cjs.map +1 -1
- package/dist/components/media-wallet/media-wallet-home.js +3 -2
- package/dist/components/media-wallet/media-wallet-home.js.map +1 -1
- package/dist/components/media-wallet/media-wallet-send.cjs +5 -2
- package/dist/components/media-wallet/media-wallet-send.cjs.map +1 -1
- package/dist/components/media-wallet/media-wallet-send.js +5 -2
- package/dist/components/media-wallet/media-wallet-send.js.map +1 -1
- package/dist/components/media-wallet/success-dialog.cjs +5 -11
- package/dist/components/media-wallet/success-dialog.cjs.map +1 -1
- package/dist/components/media-wallet/success-dialog.js +5 -11
- package/dist/components/media-wallet/success-dialog.js.map +1 -1
- package/dist/components/pop-claim-button.cjs +2 -2
- package/dist/components/pop-claim-button.cjs.map +1 -1
- package/dist/components/pop-claim-button.js +2 -2
- package/dist/components/pop-claim-button.js.map +1 -1
- package/dist/components/pop-manage-page.cjs +3 -2
- package/dist/components/pop-manage-page.cjs.map +1 -1
- package/dist/components/pop-manage-page.js +3 -2
- package/dist/components/pop-manage-page.js.map +1 -1
- package/dist/components/portfolio-sponsorships.cjs +14 -7
- package/dist/components/portfolio-sponsorships.cjs.map +1 -1
- package/dist/components/portfolio-sponsorships.js +14 -7
- package/dist/components/portfolio-sponsorships.js.map +1 -1
- package/dist/components/service-collections-page.cjs +2 -2
- package/dist/components/service-collections-page.cjs.map +1 -1
- package/dist/components/service-collections-page.d.cts +2 -2
- package/dist/components/service-collections-page.d.ts +2 -2
- package/dist/components/service-collections-page.js +2 -2
- package/dist/components/service-collections-page.js.map +1 -1
- package/dist/components/sponsorship-offer-page.cjs +4 -4
- package/dist/components/sponsorship-offer-page.cjs.map +1 -1
- package/dist/components/sponsorship-offer-page.js +4 -4
- package/dist/components/sponsorship-offer-page.js.map +1 -1
- package/dist/components/transaction-success.cjs +2 -5
- package/dist/components/transaction-success.cjs.map +1 -1
- package/dist/components/transaction-success.js +3 -6
- package/dist/components/transaction-success.js.map +1 -1
- package/dist/components/transfer-collection-ownership.cjs +2 -5
- package/dist/components/transfer-collection-ownership.cjs.map +1 -1
- package/dist/components/transfer-collection-ownership.js +2 -5
- package/dist/components/transfer-collection-ownership.js.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/empty-messages.cjs +62 -0
- package/dist/utils/empty-messages.cjs.map +1 -0
- package/dist/utils/empty-messages.d.cts +40 -0
- package/dist/utils/empty-messages.d.ts +40 -0
- package/dist/utils/empty-messages.js +38 -0
- package/dist/utils/empty-messages.js.map +1 -0
- package/dist/utils/success-messages.cjs +52 -0
- package/dist/utils/success-messages.cjs.map +1 -1
- package/dist/utils/success-messages.d.cts +27 -0
- package/dist/utils/success-messages.d.ts +27 -0
- package/dist/utils/success-messages.js +52 -0
- package/dist/utils/success-messages.js.map +1 -1
- package/package.json +3 -1
|
@@ -1,50 +1,38 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { Wallet } from "lucide-react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import { assetHref } from "@medialane/sdk";
|
|
4
|
+
import { Wallet } from "lucide-react";
|
|
5
5
|
import { useMedialaneApp } from "./medialane-app.js";
|
|
6
|
+
import { ActionButton } from "./action-button.js";
|
|
6
7
|
import { cn } from "../utils/cn.js";
|
|
7
|
-
|
|
8
|
-
function CardBody({ icon: Icon, iconClassName, title, description }) {
|
|
9
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10
|
-
/* @__PURE__ */ jsx("div", { className: cn("mt-0.5 flex h-9 w-9 shrink-0 items-center justify-center rounded-xl bg-gradient-to-br text-white", iconClassName), children: /* @__PURE__ */ jsx(Icon, { className: "h-[18px] w-[18px]" }) }),
|
|
11
|
-
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
12
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm font-bold leading-snug", children: title }),
|
|
13
|
-
description ? /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs leading-relaxed text-muted-foreground", children: description }) : null
|
|
14
|
-
] })
|
|
15
|
-
] });
|
|
16
|
-
}
|
|
17
|
-
function CompanionAppCard({ asset }) {
|
|
8
|
+
function CompanionAppButton({ asset }) {
|
|
18
9
|
const { companion } = useMedialaneApp();
|
|
19
10
|
if (!companion) return null;
|
|
11
|
+
const Icon = companion.icon;
|
|
20
12
|
return /* @__PURE__ */ jsx(
|
|
21
|
-
|
|
13
|
+
ActionButton,
|
|
22
14
|
{
|
|
15
|
+
action: "offer",
|
|
16
|
+
icon: /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" }),
|
|
23
17
|
href: `${companion.origin}${assetHref(asset.chain.toUpperCase(), asset.contractAddress, asset.tokenId)}`,
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
children: /* @__PURE__ */ jsx(CardBody, { icon: companion.icon, iconClassName: "from-brand-rose to-brand-orange", title: companion.title, description: companion.description })
|
|
18
|
+
title: companion.description,
|
|
19
|
+
className: "w-full",
|
|
20
|
+
children: companion.title
|
|
28
21
|
}
|
|
29
22
|
);
|
|
30
23
|
}
|
|
31
|
-
function
|
|
24
|
+
function AssetAccessButtons({ asset, stacked = false }) {
|
|
32
25
|
const { onRequireWallet, connectLabel = "Sign in", connectDescription, companion } = useMedialaneApp();
|
|
33
|
-
return /* @__PURE__ */ jsxs("div", { className:
|
|
34
|
-
/* @__PURE__ */
|
|
35
|
-
"
|
|
36
|
-
{
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
className: cn(CARD, "bg-gradient-to-br from-brand-blue/15 via-brand-purple/10 to-transparent hover:border-brand-purple/30"),
|
|
40
|
-
children: /* @__PURE__ */ jsx(CardBody, { icon: Wallet, iconClassName: "from-brand-blue to-brand-purple", title: connectLabel, description: connectDescription })
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ jsx(CompanionAppCard, { asset })
|
|
26
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
27
|
+
/* @__PURE__ */ jsxs("div", { className: cn("grid grid-cols-1 gap-2", companion && !stacked && "sm:grid-cols-2"), children: [
|
|
28
|
+
/* @__PURE__ */ jsx(ActionButton, { action: "buy", icon: /* @__PURE__ */ jsx(Wallet, { className: "h-4 w-4" }), onClick: onRequireWallet, className: "w-full", children: connectLabel }),
|
|
29
|
+
/* @__PURE__ */ jsx(CompanionAppButton, { asset })
|
|
30
|
+
] }),
|
|
31
|
+
connectDescription ? /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: connectDescription }) : null
|
|
44
32
|
] });
|
|
45
33
|
}
|
|
46
34
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
35
|
+
AssetAccessButtons,
|
|
36
|
+
CompanionAppButton
|
|
49
37
|
};
|
|
50
38
|
//# sourceMappingURL=asset-access-cards.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/asset-access-cards.tsx"],"sourcesContent":["\"use client\";\n\nimport type
|
|
1
|
+
{"version":3,"sources":["../../src/components/asset-access-cards.tsx"],"sourcesContent":["\"use client\";\n\nimport { assetHref, type Chain } from \"@medialane/sdk\";\nimport { Wallet } from \"lucide-react\";\nimport { useMedialaneApp, type AssetRef } from \"./medialane-app.js\";\nimport { ActionButton } from \"./action-button.js\";\nimport { cn } from \"../utils/cn.js\";\n\nexport function CompanionAppButton({ asset }: { asset: AssetRef }) {\n const { companion } = useMedialaneApp();\n if (!companion) return null;\n const Icon = companion.icon;\n return (\n <ActionButton\n action=\"offer\"\n icon={<Icon className=\"h-4 w-4\" />}\n href={`${companion.origin}${assetHref(asset.chain.toUpperCase() as Chain, asset.contractAddress, asset.tokenId)}`}\n title={companion.description}\n className=\"w-full\"\n >\n {companion.title}\n </ActionButton>\n );\n}\n\nexport function AssetAccessButtons({ asset, stacked = false }: { asset: AssetRef; stacked?: boolean }) {\n const { onRequireWallet, connectLabel = \"Sign in\", connectDescription, companion } = useMedialaneApp();\n return (\n <div className=\"space-y-2\">\n <div className={cn(\"grid grid-cols-1 gap-2\", companion && !stacked && \"sm:grid-cols-2\")}>\n <ActionButton action=\"buy\" icon={<Wallet className=\"h-4 w-4\" />} onClick={onRequireWallet} className=\"w-full\">\n {connectLabel}\n </ActionButton>\n <CompanionAppButton asset={asset} />\n </div>\n {connectDescription ? <p className=\"text-xs text-muted-foreground\">{connectDescription}</p> : null}\n </div>\n );\n}\n"],"mappings":";AAeY,cAcN,YAdM;AAbZ,SAAS,iBAA6B;AACtC,SAAS,cAAc;AACvB,SAAS,uBAAsC;AAC/C,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AAEZ,SAAS,mBAAmB,EAAE,MAAM,GAAwB;AACjE,QAAM,EAAE,UAAU,IAAI,gBAAgB;AACtC,MAAI,CAAC,UAAW,QAAO;AACvB,QAAM,OAAO,UAAU;AACvB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,QAAO;AAAA,MACP,MAAM,oBAAC,QAAK,WAAU,WAAU;AAAA,MAChC,MAAM,GAAG,UAAU,MAAM,GAAG,UAAU,MAAM,MAAM,YAAY,GAAY,MAAM,iBAAiB,MAAM,OAAO,CAAC;AAAA,MAC/G,OAAO,UAAU;AAAA,MACjB,WAAU;AAAA,MAET,oBAAU;AAAA;AAAA,EACb;AAEJ;AAEO,SAAS,mBAAmB,EAAE,OAAO,UAAU,MAAM,GAA2C;AACrG,QAAM,EAAE,iBAAiB,eAAe,WAAW,oBAAoB,UAAU,IAAI,gBAAgB;AACrG,SACE,qBAAC,SAAI,WAAU,aACb;AAAA,yBAAC,SAAI,WAAW,GAAG,0BAA0B,aAAa,CAAC,WAAW,gBAAgB,GACpF;AAAA,0BAAC,gBAAa,QAAO,OAAM,MAAM,oBAAC,UAAO,WAAU,WAAU,GAAI,SAAS,iBAAiB,WAAU,UAClG,wBACH;AAAA,MACA,oBAAC,sBAAmB,OAAc;AAAA,OACpC;AAAA,IACC,qBAAqB,oBAAC,OAAE,WAAU,iCAAiC,8BAAmB,IAAO;AAAA,KAChG;AAEJ;","names":[]}
|
|
@@ -34,21 +34,22 @@ var import_same_address = require("../utils/same-address.js");
|
|
|
34
34
|
var import_cn = require("../utils/cn.js");
|
|
35
35
|
var import_asset_access_cards = require("./asset-access-cards.js");
|
|
36
36
|
var import_medialane_app = require("./medialane-app.js");
|
|
37
|
-
var import_help_icon = require("./help-icon.js");
|
|
38
37
|
function ActionRow({ children }) {
|
|
39
38
|
const odd = import_react.Children.toArray(children).length % 2 === 1;
|
|
40
39
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: (0, import_cn.cn)("grid grid-cols-2 gap-2", odd && "[&>*:first-child]:col-span-2"), children });
|
|
41
40
|
}
|
|
42
|
-
function
|
|
43
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "
|
|
44
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("
|
|
45
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
"
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
41
|
+
function PriceBlock({ order, usdValue }) {
|
|
42
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1", children: [
|
|
43
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Buy for" }),
|
|
44
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
45
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_currency_icon.CurrencyAmount, { amount: (0, import_format.formatDisplayPrice)(order.price.formatted), symbol: order.price.currency ?? "", iconSize: 26, amountClassName: "text-3xl font-bold text-foreground tabular-nums" }),
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-lg font-semibold text-foreground", children: order.price.currency }),
|
|
47
|
+
usdValue ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-sm tabular-nums text-muted-foreground", children: usdValue }) : null
|
|
48
|
+
] }),
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
50
|
+
"Expires ",
|
|
51
|
+
(0, import_time.timeUntil)(order.endTime)
|
|
52
|
+
] })
|
|
52
53
|
] });
|
|
53
54
|
}
|
|
54
55
|
function AssetMarketplacePanel({
|
|
@@ -102,17 +103,16 @@ function AssetMarketplacePanel({
|
|
|
102
103
|
}
|
|
103
104
|
) : null;
|
|
104
105
|
const offerButton = /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { action: "offer", icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.HandCoins, { className: "h-4 w-4" }), onClick: onOpenOffer, children: "Make offer" });
|
|
105
|
-
const buyButton = liveCheapest && (!isOwner || canBuyMore) ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_action_button.ActionButton, { action: "buy", onClick: () => onOpenPurchase(liveCheapest), children: [
|
|
106
|
+
const buyButton = liveCheapest && (!isOwner || canBuyMore) ? isOwner ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_action_button.ActionButton, { action: "buy", onClick: () => onOpenPurchase(liveCheapest), children: [
|
|
106
107
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { children: "Buy" }),
|
|
107
108
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_currency_icon.CurrencyAmount, { amount: (0, import_format.formatDisplayPrice)(liveCheapest.price.formatted), symbol: liveCheapest.price.currency ?? "", iconSize: 14, amountClassName: "tabular-nums" }),
|
|
108
109
|
usdValue ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "font-normal text-muted-foreground tabular-nums", children: [
|
|
109
110
|
"\xB7 ",
|
|
110
111
|
usdValue
|
|
111
112
|
] }) : null
|
|
112
|
-
] }) : null;
|
|
113
|
-
const listedPrice = !isOwner &&
|
|
113
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { action: "buy", onClick: () => onOpenPurchase(liveCheapest), children: "Buy now" }) : null;
|
|
114
|
+
const listedPrice = !isOwner && liveCheapest ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(PriceBlock, { order: liveCheapest, usdValue }) : null;
|
|
114
115
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative space-y-4", children: [
|
|
115
|
-
listedPrice,
|
|
116
116
|
isOwner ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-3", children: [
|
|
117
117
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ActionRow, { children: [
|
|
118
118
|
liveMyListing ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
@@ -148,31 +148,34 @@ function AssetMarketplacePanel({
|
|
|
148
148
|
) : null
|
|
149
149
|
] }),
|
|
150
150
|
buyButton ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ActionRow, { children: buyButton }) : null
|
|
151
|
-
] }) :
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
151
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4", children: [
|
|
152
|
+
listedPrice,
|
|
153
|
+
isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(ActionRow, { children: [
|
|
154
|
+
buyButton,
|
|
155
|
+
offerButton,
|
|
156
|
+
remixButton,
|
|
157
|
+
showDealOption && onProposeDeal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
158
|
+
import_action_button.ActionButton,
|
|
159
|
+
{
|
|
160
|
+
action: "license",
|
|
161
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.HandCoins, { className: "h-4 w-4" }),
|
|
162
|
+
onClick: onProposeDeal,
|
|
163
|
+
helpContent: "Propose a license deal to the creator to use this work.",
|
|
164
|
+
children: "License"
|
|
165
|
+
}
|
|
166
|
+
) : null,
|
|
167
|
+
showSponsorOption && onOpenSponsorProposal ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
168
|
+
import_action_button.ActionButton,
|
|
169
|
+
{
|
|
170
|
+
tone: "blue",
|
|
171
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Handshake, { className: "h-4 w-4" }),
|
|
172
|
+
onClick: onOpenSponsorProposal,
|
|
173
|
+
helpContent: "Propose to sponsor this creator's work \u2014 pay them directly for a license, no escrow.",
|
|
174
|
+
children: "Sponsor"
|
|
175
|
+
}
|
|
176
|
+
) : null
|
|
177
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_asset_access_cards.AssetAccessButtons, { asset, stacked: compact })
|
|
178
|
+
] }),
|
|
176
179
|
myBid ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-xl bg-amber-500/8 px-4 py-3 flex items-center justify-between gap-3", children: [
|
|
177
180
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex items-center gap-2.5", children: [
|
|
178
181
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.HandCoins, { className: "h-4 w-4 text-amber-500 shrink-0" }),
|
|
@@ -236,7 +239,7 @@ function AssetMarketplacePanel({
|
|
|
236
239
|
)
|
|
237
240
|
] }, bid.orderHash)) })
|
|
238
241
|
] }) : null,
|
|
239
|
-
isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_asset_access_cards.
|
|
242
|
+
isSignedIn ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_asset_access_cards.CompanionAppButton, { asset }) : null
|
|
240
243
|
] }) });
|
|
241
244
|
}
|
|
242
245
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/asset-marketplace-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, type ReactNode } from \"react\";\nimport {\n ArrowRightLeft, CheckCircle, Clock, GitBranch, HandCoins, Handshake, Loader2,\n Tag, X,\n} from \"lucide-react\";\nimport { CurrencyIcon, CurrencyAmount } from \"./currency-icon.js\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { ActionButton } from \"./action-button.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { isExpired, timeUntil } from \"../utils/time.js\";\nimport { isSameAddress } from \"../utils/same-address.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { AssetAccessCards, CompanionAppCard } from \"./asset-access-cards.js\";\nimport { useMedialaneApp, type AssetRef } from \"./medialane-app.js\";\nimport { HelpIcon } from \"./help-icon.js\";\n\nexport interface ApiOrderLike {\n orderHash: string;\n offerer: string;\n endTime: string;\n price: { formatted: string | null; currency: string | null };\n}\n\nexport interface AssetMarketplacePanelProps<T extends ApiOrderLike = ApiOrderLike> {\n asset: AssetRef;\n compact?: boolean;\n cheapest?: T;\n isOwner: boolean;\n isProcessing: boolean;\n isERC1155: boolean;\n canListMoreEditions?: boolean;\n isMarketLoading?: boolean;\n myListing: T | null;\n activeBids: T[];\n remixEnabled?: boolean;\n showDealOption?: boolean;\n\n usdValue?: string | null;\n\n onCancelClick: (order: T) => void;\n onAcceptBid: (order: T) => void;\n onOpenListing: () => void;\n onOpenTransfer: () => void;\n onOpenPurchase: (order: T) => void;\n onOpenOffer: () => void;\n onOpenRemix?: () => void;\n onProposeDeal?: () => void;\n\n showSponsorOption?: boolean;\n onOpenSponsorProposal?: () => void;\n\n showSponsorSolicitOption?: boolean;\n onOpenSponsorSolicit?: () => void;\n\n\n}\n\nfunction ActionRow({ children }: { children: ReactNode }) {\n const odd = Children.toArray(children).length % 2 === 1;\n return <div className={cn(\"grid grid-cols-2 gap-2\", odd && \"[&>*:first-child]:col-span-2\")}>{children}</div>;\n}\n\nfunction PriceLine({ label, order, usdValue }: { label: string; order: ApiOrderLike; usdValue?: string | null }) {\n return (\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground\">\n <span>{label}</span>\n <CurrencyAmount amount={formatDisplayPrice(order.price.formatted)} symbol={order.price.currency ?? \"\"} iconSize={14} amountClassName=\"text-base font-bold text-foreground tabular-nums\" />\n <span className=\"font-semibold text-foreground\">{order.price.currency}</span>\n {usdValue ? <span className=\"tabular-nums\">· {usdValue}</span> : null}\n <HelpIcon content={`Expires ${timeUntil(order.endTime)}`} />\n </div>\n );\n}\n\nexport function AssetMarketplacePanel<T extends ApiOrderLike = ApiOrderLike>({\n asset,\n compact = false,\n cheapest,\n isOwner,\n isProcessing,\n isERC1155,\n canListMoreEditions,\n isMarketLoading = false,\n myListing,\n activeBids,\n remixEnabled = false,\n showDealOption = false,\n showSponsorOption = false,\n onOpenSponsorProposal,\n showSponsorSolicitOption = false,\n onOpenSponsorSolicit,\n usdValue,\n onCancelClick,\n onAcceptBid,\n onOpenListing,\n onOpenTransfer,\n onOpenPurchase,\n onOpenOffer,\n onOpenRemix,\n onProposeDeal,\n}: AssetMarketplacePanelProps<T>) {\n const { walletAddress } = useMedialaneApp();\n const isSignedIn = !!walletAddress;\n const liveBids = activeBids.filter((bid) => !isExpired(bid.endTime));\n const liveCheapest = cheapest && !isExpired(cheapest.endTime) ? cheapest : undefined;\n const liveMyListing = myListing && !isExpired(myListing.endTime) ? myListing : null;\n\n const myBid = !isOwner && walletAddress\n ? liveBids.find((bid) => isSameAddress(bid.offerer, walletAddress)) ?? null\n : null;\n\n const canBuyMore =\n isERC1155 && isOwner && !!liveCheapest && !!walletAddress &&\n !isSameAddress(liveCheapest.offerer, walletAddress);\n\n if (isMarketLoading && !liveCheapest) {\n return (\n <div className=\"space-y-4\">\n <div className=\"h-9 w-32 rounded-md bg-muted animate-pulse\" />\n <div className=\"h-12 w-full rounded-2xl bg-muted animate-pulse\" />\n </div>\n );\n }\n\n const remixButton = remixEnabled && onOpenRemix ? (\n <ActionButton\n action=\"remix\"\n icon={<GitBranch className=\"h-4 w-4\" />}\n onClick={onOpenRemix}\n helpContent=\"Create your own attributed derivative of this work.\"\n >\n Remix\n </ActionButton>\n ) : null;\n\n const offerButton = (\n <ActionButton action=\"offer\" icon={<HandCoins className=\"h-4 w-4\" />} onClick={onOpenOffer}>\n Make offer\n </ActionButton>\n );\n\n const buyButton = liveCheapest && (!isOwner || canBuyMore) ? (\n <ActionButton action=\"buy\" onClick={() => onOpenPurchase(liveCheapest)}>\n <span>Buy</span>\n <CurrencyAmount amount={formatDisplayPrice(liveCheapest.price.formatted)} symbol={liveCheapest.price.currency ?? \"\"} iconSize={14} amountClassName=\"tabular-nums\" />\n {usdValue ? <span className=\"font-normal text-muted-foreground tabular-nums\">· {usdValue}</span> : null}\n </ActionButton>\n ) : null;\n\n const listedPrice = !isOwner && !isSignedIn && liveCheapest ? (\n <PriceLine label=\"Price\" order={liveCheapest} usdValue={usdValue} />\n ) : null;\n\n return (\n <div className=\"relative\">\n\n <div className=\"relative space-y-4\">\n {listedPrice}\n\n {isOwner ? (\n <div className=\"space-y-3\">\n <ActionRow>\n {liveMyListing ? (\n <ActionButton\n icon={isProcessing ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <X className=\"h-4 w-4\" />}\n onClick={() => onCancelClick(liveMyListing)}\n disabled={isProcessing}\n tone=\"red\"\n helpContent={`Expires ${timeUntil(liveMyListing.endTime)}`}\n >\n <span>Cancel listing</span>\n <CurrencyAmount amount={formatDisplayPrice(liveMyListing.price.formatted)} symbol={liveMyListing.price.currency ?? \"\"} iconSize={14} amountClassName=\"tabular-nums\" />\n {liveMyListing.orderHash === liveCheapest?.orderHash && usdValue ? <span className=\"font-normal text-muted-foreground tabular-nums\">· {usdValue}</span> : null}\n </ActionButton>\n ) : null}\n {!liveMyListing || (isERC1155 && canListMoreEditions !== false) ? (\n <ActionButton tone=\"blue\" icon={<Tag className=\"h-4 w-4\" />} onClick={onOpenListing}>\n {liveMyListing ? \"List more\" : \"List for sale\"}\n </ActionButton>\n ) : null}\n <ActionButton tone=\"orange\" icon={<ArrowRightLeft className=\"h-4 w-4\" />} onClick={onOpenTransfer}>Transfer</ActionButton>\n {remixButton}\n {showSponsorSolicitOption && onOpenSponsorSolicit ? (\n <ActionButton\n tone=\"blue\"\n icon={<Handshake className=\"h-4 w-4\" />}\n onClick={onOpenSponsorSolicit}\n helpContent=\"Let sponsors bid on a license for this asset.\"\n >\n Open for sponsorship\n </ActionButton>\n ) : null}\n </ActionRow>\n {buyButton ? <ActionRow>{buyButton}</ActionRow> : null}\n </div>\n ) : isSignedIn ? (\n <div className=\"space-y-3\">\n <ActionRow>\n {buyButton}\n {offerButton}\n {remixButton}\n {showDealOption && onProposeDeal ? (\n <ActionButton\n action=\"license\"\n icon={<HandCoins className=\"h-4 w-4\" />}\n onClick={onProposeDeal}\n helpContent=\"Propose a license deal to the creator to use this work.\"\n >\n License\n </ActionButton>\n ) : null}\n {showSponsorOption && onOpenSponsorProposal ? (\n <ActionButton\n tone=\"blue\"\n icon={<Handshake className=\"h-4 w-4\" />}\n onClick={onOpenSponsorProposal}\n helpContent=\"Propose to sponsor this creator's work — pay them directly for a license, no escrow.\"\n >\n Sponsor\n </ActionButton>\n ) : null}\n </ActionRow>\n </div>\n ) : (\n <AssetAccessCards asset={asset} stacked={compact} />\n )}\n\n {myBid ? (\n <div className=\"rounded-xl bg-amber-500/8 px-4 py-3 flex items-center justify-between gap-3\">\n <div className=\"min-w-0 flex items-center gap-2.5\">\n <HandCoins className=\"h-4 w-4 text-amber-500 shrink-0\" />\n <div className=\"min-w-0\">\n <p className=\"text-xs font-semibold text-amber-500\">Your active offer</p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1.5 mt-0.5\">\n <span className=\"font-bold text-foreground inline-flex items-center gap-1\">\n {formatDisplayPrice(myBid.price.formatted)}\n <CurrencyIcon symbol={myBid.price.currency ?? \"\"} size={12} />\n </span>\n <span>·</span>\n <Clock className=\"h-3 w-3\" />\n {timeUntil(myBid.endTime)}\n </p>\n </div>\n </div>\n <button\n className=\"shrink-0 text-xs font-semibold text-red-400 hover:text-red-300 transition-colors flex items-center gap-1\"\n onClick={() => onCancelClick(myBid)}\n >\n <X className=\"h-3.5 w-3.5\" />\n Cancel\n </button>\n </div>\n ) : null}\n\n {isOwner && liveBids.length > 0 ? (\n <div className=\"space-y-2\">\n <p className=\"text-xs font-semibold text-muted-foreground\">\n Incoming offers ({liveBids.length})\n </p>\n <div className=\"divide-y divide-border/40\">\n {liveBids.map((bid) => (\n <div key={bid.orderHash} className=\"flex items-center justify-between gap-3 py-2.5\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-bold\">\n <span className=\"inline-flex items-center gap-1.5\">\n {formatDisplayPrice(bid.price.formatted)}\n <CurrencyIcon symbol={bid.price.currency ?? \"\"} size={14} />\n </span>\n </p>\n <div className=\"flex items-center gap-2 mt-0.5\">\n <AddressDisplay address={bid.offerer} chars={4} showCopy={false} className=\"text-xs text-muted-foreground\" />\n <span className=\"text-xs text-muted-foreground\">·</span>\n <div className=\"flex items-center gap-1 text-xs text-muted-foreground\">\n <Clock className=\"h-3 w-3\" />\n {timeUntil(bid.endTime)}\n </div>\n </div>\n </div>\n <button\n disabled={isProcessing}\n onClick={() => onAcceptBid(bid)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-semibold text-primary-foreground disabled:opacity-50\"\n >\n <CheckCircle className=\"h-3.5 w-3.5\" />\n Accept\n </button>\n </div>\n ))}\n </div>\n </div>\n ) : null}\n\n {isSignedIn ? <CompanionAppCard asset={asset} /> : null}\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6DS;AA3DT,mBAAyC;AACzC,0BAGO;AACP,2BAA6C;AAC7C,6BAA+B;AAC/B,2BAA6B;AAC7B,oBAAmC;AACnC,kBAAqC;AACrC,0BAA8B;AAC9B,gBAAmB;AACnB,gCAAmD;AACnD,2BAA+C;AAC/C,uBAAyB;AA2CzB,SAAS,UAAU,EAAE,SAAS,GAA4B;AACxD,QAAM,MAAM,sBAAS,QAAQ,QAAQ,EAAE,SAAS,MAAM;AACtD,SAAO,4CAAC,SAAI,eAAW,cAAG,0BAA0B,OAAO,8BAA8B,GAAI,UAAS;AACxG;AAEA,SAAS,UAAU,EAAE,OAAO,OAAO,SAAS,GAAqE;AAC/G,SACE,6CAAC,SAAI,WAAU,6EACb;AAAA,gDAAC,UAAM,iBAAM;AAAA,IACb,4CAAC,uCAAe,YAAQ,kCAAmB,MAAM,MAAM,SAAS,GAAG,QAAQ,MAAM,MAAM,YAAY,IAAI,UAAU,IAAI,iBAAgB,oDAAmD;AAAA,IACxL,4CAAC,UAAK,WAAU,iCAAiC,gBAAM,MAAM,UAAS;AAAA,IACrE,WAAW,6CAAC,UAAK,WAAU,gBAAe;AAAA;AAAA,MAAG;AAAA,OAAS,IAAU;AAAA,IACjE,4CAAC,6BAAS,SAAS,eAAW,uBAAU,MAAM,OAAO,CAAC,IAAI;AAAA,KAC5D;AAEJ;AAEO,SAAS,sBAA6D;AAAA,EAC3E;AAAA,EACA,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,kB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;AAAA,IAEH,aAAa,4CAAC,8CAAiB,OAAc,IAAK;AAAA,KACrD,GACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/asset-marketplace-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, type ReactNode } from \"react\";\nimport {\n ArrowRightLeft, CheckCircle, Clock, GitBranch, HandCoins, Handshake, Loader2,\n Tag, X,\n} from \"lucide-react\";\nimport { CurrencyIcon, CurrencyAmount } from \"./currency-icon.js\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { ActionButton } from \"./action-button.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { isExpired, timeUntil } from \"../utils/time.js\";\nimport { isSameAddress } from \"../utils/same-address.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { AssetAccessButtons, CompanionAppButton } from \"./asset-access-cards.js\";\nimport { useMedialaneApp, type AssetRef } from \"./medialane-app.js\";\n\nexport interface ApiOrderLike {\n orderHash: string;\n offerer: string;\n endTime: string;\n price: { formatted: string | null; currency: string | null };\n}\n\nexport interface AssetMarketplacePanelProps<T extends ApiOrderLike = ApiOrderLike> {\n asset: AssetRef;\n compact?: boolean;\n cheapest?: T;\n isOwner: boolean;\n isProcessing: boolean;\n isERC1155: boolean;\n canListMoreEditions?: boolean;\n isMarketLoading?: boolean;\n myListing: T | null;\n activeBids: T[];\n remixEnabled?: boolean;\n showDealOption?: boolean;\n\n usdValue?: string | null;\n\n onCancelClick: (order: T) => void;\n onAcceptBid: (order: T) => void;\n onOpenListing: () => void;\n onOpenTransfer: () => void;\n onOpenPurchase: (order: T) => void;\n onOpenOffer: () => void;\n onOpenRemix?: () => void;\n onProposeDeal?: () => void;\n\n showSponsorOption?: boolean;\n onOpenSponsorProposal?: () => void;\n\n showSponsorSolicitOption?: boolean;\n onOpenSponsorSolicit?: () => void;\n\n\n}\n\nfunction ActionRow({ children }: { children: ReactNode }) {\n const odd = Children.toArray(children).length % 2 === 1;\n return <div className={cn(\"grid grid-cols-2 gap-2\", odd && \"[&>*:first-child]:col-span-2\")}>{children}</div>;\n}\n\nfunction PriceBlock({ order, usdValue }: { order: ApiOrderLike; usdValue?: string | null }) {\n return (\n <div className=\"space-y-1\">\n <p className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">Buy for</p>\n <div className=\"flex flex-wrap items-baseline gap-x-2 gap-y-1\">\n <CurrencyAmount amount={formatDisplayPrice(order.price.formatted)} symbol={order.price.currency ?? \"\"} iconSize={26} amountClassName=\"text-3xl font-bold text-foreground tabular-nums\" />\n <span className=\"text-lg font-semibold text-foreground\">{order.price.currency}</span>\n {usdValue ? <span className=\"text-sm tabular-nums text-muted-foreground\">{usdValue}</span> : null}\n </div>\n <p className=\"text-xs text-muted-foreground\">Expires {timeUntil(order.endTime)}</p>\n </div>\n );\n}\n\nexport function AssetMarketplacePanel<T extends ApiOrderLike = ApiOrderLike>({\n asset,\n compact = false,\n cheapest,\n isOwner,\n isProcessing,\n isERC1155,\n canListMoreEditions,\n isMarketLoading = false,\n myListing,\n activeBids,\n remixEnabled = false,\n showDealOption = false,\n showSponsorOption = false,\n onOpenSponsorProposal,\n showSponsorSolicitOption = false,\n onOpenSponsorSolicit,\n usdValue,\n onCancelClick,\n onAcceptBid,\n onOpenListing,\n onOpenTransfer,\n onOpenPurchase,\n onOpenOffer,\n onOpenRemix,\n onProposeDeal,\n}: AssetMarketplacePanelProps<T>) {\n const { walletAddress } = useMedialaneApp();\n const isSignedIn = !!walletAddress;\n const liveBids = activeBids.filter((bid) => !isExpired(bid.endTime));\n const liveCheapest = cheapest && !isExpired(cheapest.endTime) ? cheapest : undefined;\n const liveMyListing = myListing && !isExpired(myListing.endTime) ? myListing : null;\n\n const myBid = !isOwner && walletAddress\n ? liveBids.find((bid) => isSameAddress(bid.offerer, walletAddress)) ?? null\n : null;\n\n const canBuyMore =\n isERC1155 && isOwner && !!liveCheapest && !!walletAddress &&\n !isSameAddress(liveCheapest.offerer, walletAddress);\n\n if (isMarketLoading && !liveCheapest) {\n return (\n <div className=\"space-y-4\">\n <div className=\"h-9 w-32 rounded-md bg-muted animate-pulse\" />\n <div className=\"h-12 w-full rounded-2xl bg-muted animate-pulse\" />\n </div>\n );\n }\n\n const remixButton = remixEnabled && onOpenRemix ? (\n <ActionButton\n action=\"remix\"\n icon={<GitBranch className=\"h-4 w-4\" />}\n onClick={onOpenRemix}\n helpContent=\"Create your own attributed derivative of this work.\"\n >\n Remix\n </ActionButton>\n ) : null;\n\n const offerButton = (\n <ActionButton action=\"offer\" icon={<HandCoins className=\"h-4 w-4\" />} onClick={onOpenOffer}>\n Make offer\n </ActionButton>\n );\n\n const buyButton = liveCheapest && (!isOwner || canBuyMore) ? (\n isOwner ? (\n <ActionButton action=\"buy\" onClick={() => onOpenPurchase(liveCheapest)}>\n <span>Buy</span>\n <CurrencyAmount amount={formatDisplayPrice(liveCheapest.price.formatted)} symbol={liveCheapest.price.currency ?? \"\"} iconSize={14} amountClassName=\"tabular-nums\" />\n {usdValue ? <span className=\"font-normal text-muted-foreground tabular-nums\">· {usdValue}</span> : null}\n </ActionButton>\n ) : (\n <ActionButton action=\"buy\" onClick={() => onOpenPurchase(liveCheapest)}>\n Buy now\n </ActionButton>\n )\n ) : null;\n\n const listedPrice = !isOwner && liveCheapest ? <PriceBlock order={liveCheapest} usdValue={usdValue} /> : null;\n\n return (\n <div className=\"relative\">\n\n <div className=\"relative space-y-4\">\n {isOwner ? (\n <div className=\"space-y-3\">\n <ActionRow>\n {liveMyListing ? (\n <ActionButton\n icon={isProcessing ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <X className=\"h-4 w-4\" />}\n onClick={() => onCancelClick(liveMyListing)}\n disabled={isProcessing}\n tone=\"red\"\n helpContent={`Expires ${timeUntil(liveMyListing.endTime)}`}\n >\n <span>Cancel listing</span>\n <CurrencyAmount amount={formatDisplayPrice(liveMyListing.price.formatted)} symbol={liveMyListing.price.currency ?? \"\"} iconSize={14} amountClassName=\"tabular-nums\" />\n {liveMyListing.orderHash === liveCheapest?.orderHash && usdValue ? <span className=\"font-normal text-muted-foreground tabular-nums\">· {usdValue}</span> : null}\n </ActionButton>\n ) : null}\n {!liveMyListing || (isERC1155 && canListMoreEditions !== false) ? (\n <ActionButton tone=\"blue\" icon={<Tag className=\"h-4 w-4\" />} onClick={onOpenListing}>\n {liveMyListing ? \"List more\" : \"List for sale\"}\n </ActionButton>\n ) : null}\n <ActionButton tone=\"orange\" icon={<ArrowRightLeft className=\"h-4 w-4\" />} onClick={onOpenTransfer}>Transfer</ActionButton>\n {remixButton}\n {showSponsorSolicitOption && onOpenSponsorSolicit ? (\n <ActionButton\n tone=\"blue\"\n icon={<Handshake className=\"h-4 w-4\" />}\n onClick={onOpenSponsorSolicit}\n helpContent=\"Let sponsors bid on a license for this asset.\"\n >\n Open for sponsorship\n </ActionButton>\n ) : null}\n </ActionRow>\n {buyButton ? <ActionRow>{buyButton}</ActionRow> : null}\n </div>\n ) : (\n <div className=\"space-y-4\">\n {listedPrice}\n {isSignedIn ? (\n <ActionRow>\n {buyButton}\n {offerButton}\n {remixButton}\n {showDealOption && onProposeDeal ? (\n <ActionButton\n action=\"license\"\n icon={<HandCoins className=\"h-4 w-4\" />}\n onClick={onProposeDeal}\n helpContent=\"Propose a license deal to the creator to use this work.\"\n >\n License\n </ActionButton>\n ) : null}\n {showSponsorOption && onOpenSponsorProposal ? (\n <ActionButton\n tone=\"blue\"\n icon={<Handshake className=\"h-4 w-4\" />}\n onClick={onOpenSponsorProposal}\n helpContent=\"Propose to sponsor this creator's work — pay them directly for a license, no escrow.\"\n >\n Sponsor\n </ActionButton>\n ) : null}\n </ActionRow>\n ) : (\n <AssetAccessButtons asset={asset} stacked={compact} />\n )}\n </div>\n )}\n\n {myBid ? (\n <div className=\"rounded-xl bg-amber-500/8 px-4 py-3 flex items-center justify-between gap-3\">\n <div className=\"min-w-0 flex items-center gap-2.5\">\n <HandCoins className=\"h-4 w-4 text-amber-500 shrink-0\" />\n <div className=\"min-w-0\">\n <p className=\"text-xs font-semibold text-amber-500\">Your active offer</p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1.5 mt-0.5\">\n <span className=\"font-bold text-foreground inline-flex items-center gap-1\">\n {formatDisplayPrice(myBid.price.formatted)}\n <CurrencyIcon symbol={myBid.price.currency ?? \"\"} size={12} />\n </span>\n <span>·</span>\n <Clock className=\"h-3 w-3\" />\n {timeUntil(myBid.endTime)}\n </p>\n </div>\n </div>\n <button\n className=\"shrink-0 text-xs font-semibold text-red-400 hover:text-red-300 transition-colors flex items-center gap-1\"\n onClick={() => onCancelClick(myBid)}\n >\n <X className=\"h-3.5 w-3.5\" />\n Cancel\n </button>\n </div>\n ) : null}\n\n {isOwner && liveBids.length > 0 ? (\n <div className=\"space-y-2\">\n <p className=\"text-xs font-semibold text-muted-foreground\">\n Incoming offers ({liveBids.length})\n </p>\n <div className=\"divide-y divide-border/40\">\n {liveBids.map((bid) => (\n <div key={bid.orderHash} className=\"flex items-center justify-between gap-3 py-2.5\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-bold\">\n <span className=\"inline-flex items-center gap-1.5\">\n {formatDisplayPrice(bid.price.formatted)}\n <CurrencyIcon symbol={bid.price.currency ?? \"\"} size={14} />\n </span>\n </p>\n <div className=\"flex items-center gap-2 mt-0.5\">\n <AddressDisplay address={bid.offerer} chars={4} showCopy={false} className=\"text-xs text-muted-foreground\" />\n <span className=\"text-xs text-muted-foreground\">·</span>\n <div className=\"flex items-center gap-1 text-xs text-muted-foreground\">\n <Clock className=\"h-3 w-3\" />\n {timeUntil(bid.endTime)}\n </div>\n </div>\n </div>\n <button\n disabled={isProcessing}\n onClick={() => onAcceptBid(bid)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-semibold text-primary-foreground disabled:opacity-50\"\n >\n <CheckCircle className=\"h-3.5 w-3.5\" />\n Accept\n </button>\n </div>\n ))}\n </div>\n </div>\n ) : null}\n\n {isSignedIn ? <CompanionAppButton asset={as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24 @@ import { formatDisplayPrice } from "../utils/format.js";
|
|
|
19
19
|
import { isExpired, timeUntil } from "../utils/time.js";
|
|
20
20
|
import { isSameAddress } from "../utils/same-address.js";
|
|
21
21
|
import { cn } from "../utils/cn.js";
|
|
22
|
-
import {
|
|
22
|
+
import { AssetAccessButtons, CompanionAppButton } from "./asset-access-cards.js";
|
|
23
23
|
import { useMedialaneApp } from "./medialane-app.js";
|
|
24
|
-
import { HelpIcon } from "./help-icon.js";
|
|
25
24
|
function ActionRow({ children }) {
|
|
26
25
|
const odd = Children.toArray(children).length % 2 === 1;
|
|
27
26
|
return /* @__PURE__ */ jsx("div", { className: cn("grid grid-cols-2 gap-2", odd && "[&>*:first-child]:col-span-2"), children });
|
|
28
27
|
}
|
|
29
|
-
function
|
|
30
|
-
return /* @__PURE__ */ jsxs("div", { className: "
|
|
31
|
-
/* @__PURE__ */ jsx("
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
"
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
28
|
+
function PriceBlock({ order, usdValue }) {
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-1", children: [
|
|
30
|
+
/* @__PURE__ */ jsx("p", { className: "text-xs font-medium uppercase tracking-wide text-muted-foreground", children: "Buy for" }),
|
|
31
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-baseline gap-x-2 gap-y-1", children: [
|
|
32
|
+
/* @__PURE__ */ jsx(CurrencyAmount, { amount: formatDisplayPrice(order.price.formatted), symbol: order.price.currency ?? "", iconSize: 26, amountClassName: "text-3xl font-bold text-foreground tabular-nums" }),
|
|
33
|
+
/* @__PURE__ */ jsx("span", { className: "text-lg font-semibold text-foreground", children: order.price.currency }),
|
|
34
|
+
usdValue ? /* @__PURE__ */ jsx("span", { className: "text-sm tabular-nums text-muted-foreground", children: usdValue }) : null
|
|
35
|
+
] }),
|
|
36
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
37
|
+
"Expires ",
|
|
38
|
+
timeUntil(order.endTime)
|
|
39
|
+
] })
|
|
39
40
|
] });
|
|
40
41
|
}
|
|
41
42
|
function AssetMarketplacePanel({
|
|
@@ -89,17 +90,16 @@ function AssetMarketplacePanel({
|
|
|
89
90
|
}
|
|
90
91
|
) : null;
|
|
91
92
|
const offerButton = /* @__PURE__ */ jsx(ActionButton, { action: "offer", icon: /* @__PURE__ */ jsx(HandCoins, { className: "h-4 w-4" }), onClick: onOpenOffer, children: "Make offer" });
|
|
92
|
-
const buyButton = liveCheapest && (!isOwner || canBuyMore) ? /* @__PURE__ */ jsxs(ActionButton, { action: "buy", onClick: () => onOpenPurchase(liveCheapest), children: [
|
|
93
|
+
const buyButton = liveCheapest && (!isOwner || canBuyMore) ? isOwner ? /* @__PURE__ */ jsxs(ActionButton, { action: "buy", onClick: () => onOpenPurchase(liveCheapest), children: [
|
|
93
94
|
/* @__PURE__ */ jsx("span", { children: "Buy" }),
|
|
94
95
|
/* @__PURE__ */ jsx(CurrencyAmount, { amount: formatDisplayPrice(liveCheapest.price.formatted), symbol: liveCheapest.price.currency ?? "", iconSize: 14, amountClassName: "tabular-nums" }),
|
|
95
96
|
usdValue ? /* @__PURE__ */ jsxs("span", { className: "font-normal text-muted-foreground tabular-nums", children: [
|
|
96
97
|
"\xB7 ",
|
|
97
98
|
usdValue
|
|
98
99
|
] }) : null
|
|
99
|
-
] }) : null;
|
|
100
|
-
const listedPrice = !isOwner &&
|
|
100
|
+
] }) : /* @__PURE__ */ jsx(ActionButton, { action: "buy", onClick: () => onOpenPurchase(liveCheapest), children: "Buy now" }) : null;
|
|
101
|
+
const listedPrice = !isOwner && liveCheapest ? /* @__PURE__ */ jsx(PriceBlock, { order: liveCheapest, usdValue }) : null;
|
|
101
102
|
return /* @__PURE__ */ jsx("div", { className: "relative", children: /* @__PURE__ */ jsxs("div", { className: "relative space-y-4", children: [
|
|
102
|
-
listedPrice,
|
|
103
103
|
isOwner ? /* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
104
104
|
/* @__PURE__ */ jsxs(ActionRow, { children: [
|
|
105
105
|
liveMyListing ? /* @__PURE__ */ jsxs(
|
|
@@ -135,31 +135,34 @@ function AssetMarketplacePanel({
|
|
|
135
135
|
) : null
|
|
136
136
|
] }),
|
|
137
137
|
buyButton ? /* @__PURE__ */ jsx(ActionRow, { children: buyButton }) : null
|
|
138
|
-
] }) :
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
138
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4", children: [
|
|
139
|
+
listedPrice,
|
|
140
|
+
isSignedIn ? /* @__PURE__ */ jsxs(ActionRow, { children: [
|
|
141
|
+
buyButton,
|
|
142
|
+
offerButton,
|
|
143
|
+
remixButton,
|
|
144
|
+
showDealOption && onProposeDeal ? /* @__PURE__ */ jsx(
|
|
145
|
+
ActionButton,
|
|
146
|
+
{
|
|
147
|
+
action: "license",
|
|
148
|
+
icon: /* @__PURE__ */ jsx(HandCoins, { className: "h-4 w-4" }),
|
|
149
|
+
onClick: onProposeDeal,
|
|
150
|
+
helpContent: "Propose a license deal to the creator to use this work.",
|
|
151
|
+
children: "License"
|
|
152
|
+
}
|
|
153
|
+
) : null,
|
|
154
|
+
showSponsorOption && onOpenSponsorProposal ? /* @__PURE__ */ jsx(
|
|
155
|
+
ActionButton,
|
|
156
|
+
{
|
|
157
|
+
tone: "blue",
|
|
158
|
+
icon: /* @__PURE__ */ jsx(Handshake, { className: "h-4 w-4" }),
|
|
159
|
+
onClick: onOpenSponsorProposal,
|
|
160
|
+
helpContent: "Propose to sponsor this creator's work \u2014 pay them directly for a license, no escrow.",
|
|
161
|
+
children: "Sponsor"
|
|
162
|
+
}
|
|
163
|
+
) : null
|
|
164
|
+
] }) : /* @__PURE__ */ jsx(AssetAccessButtons, { asset, stacked: compact })
|
|
165
|
+
] }),
|
|
163
166
|
myBid ? /* @__PURE__ */ jsxs("div", { className: "rounded-xl bg-amber-500/8 px-4 py-3 flex items-center justify-between gap-3", children: [
|
|
164
167
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex items-center gap-2.5", children: [
|
|
165
168
|
/* @__PURE__ */ jsx(HandCoins, { className: "h-4 w-4 text-amber-500 shrink-0" }),
|
|
@@ -223,7 +226,7 @@ function AssetMarketplacePanel({
|
|
|
223
226
|
)
|
|
224
227
|
] }, bid.orderHash)) })
|
|
225
228
|
] }) : null,
|
|
226
|
-
isSignedIn ? /* @__PURE__ */ jsx(
|
|
229
|
+
isSignedIn ? /* @__PURE__ */ jsx(CompanionAppButton, { asset }) : null
|
|
227
230
|
] }) });
|
|
228
231
|
}
|
|
229
232
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/asset-marketplace-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, type ReactNode } from \"react\";\nimport {\n ArrowRightLeft, CheckCircle, Clock, GitBranch, HandCoins, Handshake, Loader2,\n Tag, X,\n} from \"lucide-react\";\nimport { CurrencyIcon, CurrencyAmount } from \"./currency-icon.js\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { ActionButton } from \"./action-button.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { isExpired, timeUntil } from \"../utils/time.js\";\nimport { isSameAddress } from \"../utils/same-address.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { AssetAccessCards, CompanionAppCard } from \"./asset-access-cards.js\";\nimport { useMedialaneApp, type AssetRef } from \"./medialane-app.js\";\nimport { HelpIcon } from \"./help-icon.js\";\n\nexport interface ApiOrderLike {\n orderHash: string;\n offerer: string;\n endTime: string;\n price: { formatted: string | null; currency: string | null };\n}\n\nexport interface AssetMarketplacePanelProps<T extends ApiOrderLike = ApiOrderLike> {\n asset: AssetRef;\n compact?: boolean;\n cheapest?: T;\n isOwner: boolean;\n isProcessing: boolean;\n isERC1155: boolean;\n canListMoreEditions?: boolean;\n isMarketLoading?: boolean;\n myListing: T | null;\n activeBids: T[];\n remixEnabled?: boolean;\n showDealOption?: boolean;\n\n usdValue?: string | null;\n\n onCancelClick: (order: T) => void;\n onAcceptBid: (order: T) => void;\n onOpenListing: () => void;\n onOpenTransfer: () => void;\n onOpenPurchase: (order: T) => void;\n onOpenOffer: () => void;\n onOpenRemix?: () => void;\n onProposeDeal?: () => void;\n\n showSponsorOption?: boolean;\n onOpenSponsorProposal?: () => void;\n\n showSponsorSolicitOption?: boolean;\n onOpenSponsorSolicit?: () => void;\n\n\n}\n\nfunction ActionRow({ children }: { children: ReactNode }) {\n const odd = Children.toArray(children).length % 2 === 1;\n return <div className={cn(\"grid grid-cols-2 gap-2\", odd && \"[&>*:first-child]:col-span-2\")}>{children}</div>;\n}\n\nfunction PriceLine({ label, order, usdValue }: { label: string; order: ApiOrderLike; usdValue?: string | null }) {\n return (\n <div className=\"flex flex-wrap items-center gap-x-2 gap-y-1 text-sm text-muted-foreground\">\n <span>{label}</span>\n <CurrencyAmount amount={formatDisplayPrice(order.price.formatted)} symbol={order.price.currency ?? \"\"} iconSize={14} amountClassName=\"text-base font-bold text-foreground tabular-nums\" />\n <span className=\"font-semibold text-foreground\">{order.price.currency}</span>\n {usdValue ? <span className=\"tabular-nums\">· {usdValue}</span> : null}\n <HelpIcon content={`Expires ${timeUntil(order.endTime)}`} />\n </div>\n );\n}\n\nexport function AssetMarketplacePanel<T extends ApiOrderLike = ApiOrderLike>({\n asset,\n compact = false,\n cheapest,\n isOwner,\n isProcessing,\n isERC1155,\n canListMoreEditions,\n isMarketLoading = false,\n myListing,\n activeBids,\n remixEnabled = false,\n showDealOption = false,\n showSponsorOption = false,\n onOpenSponsorProposal,\n showSponsorSolicitOption = false,\n onOpenSponsorSolicit,\n usdValue,\n onCancelClick,\n onAcceptBid,\n onOpenListing,\n onOpenTransfer,\n onOpenPurchase,\n onOpenOffer,\n onOpenRemix,\n onProposeDeal,\n}: AssetMarketplacePanelProps<T>) {\n const { walletAddress } = useMedialaneApp();\n const isSignedIn = !!walletAddress;\n const liveBids = activeBids.filter((bid) => !isExpired(bid.endTime));\n const liveCheapest = cheapest && !isExpired(cheapest.endTime) ? cheapest : undefined;\n const liveMyListing = myListing && !isExpired(myListing.endTime) ? myListing : null;\n\n const myBid = !isOwner && walletAddress\n ? liveBids.find((bid) => isSameAddress(bid.offerer, walletAddress)) ?? null\n : null;\n\n const canBuyMore =\n isERC1155 && isOwner && !!liveCheapest && !!walletAddress &&\n !isSameAddress(liveCheapest.offerer, walletAddress);\n\n if (isMarketLoading && !liveCheapest) {\n return (\n <div className=\"space-y-4\">\n <div className=\"h-9 w-32 rounded-md bg-muted animate-pulse\" />\n <div className=\"h-12 w-full rounded-2xl bg-muted animate-pulse\" />\n </div>\n );\n }\n\n const remixButton = remixEnabled && onOpenRemix ? (\n <ActionButton\n action=\"remix\"\n icon={<GitBranch className=\"h-4 w-4\" />}\n onClick={onOpenRemix}\n helpContent=\"Create your own attributed derivative of this work.\"\n >\n Remix\n </ActionButton>\n ) : null;\n\n const offerButton = (\n <ActionButton action=\"offer\" icon={<HandCoins className=\"h-4 w-4\" />} onClick={onOpenOffer}>\n Make offer\n </ActionButton>\n );\n\n const buyButton = liveCheapest && (!isOwner || canBuyMore) ? (\n <ActionButton action=\"buy\" onClick={() => onOpenPurchase(liveCheapest)}>\n <span>Buy</span>\n <CurrencyAmount amount={formatDisplayPrice(liveCheapest.price.formatted)} symbol={liveCheapest.price.currency ?? \"\"} iconSize={14} amountClassName=\"tabular-nums\" />\n {usdValue ? <span className=\"font-normal text-muted-foreground tabular-nums\">· {usdValue}</span> : null}\n </ActionButton>\n ) : null;\n\n const listedPrice = !isOwner && !isSignedIn && liveCheapest ? (\n <PriceLine label=\"Price\" order={liveCheapest} usdValue={usdValue} />\n ) : null;\n\n return (\n <div className=\"relative\">\n\n <div className=\"relative space-y-4\">\n {listedPrice}\n\n {isOwner ? (\n <div className=\"space-y-3\">\n <ActionRow>\n {liveMyListing ? (\n <ActionButton\n icon={isProcessing ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <X className=\"h-4 w-4\" />}\n onClick={() => onCancelClick(liveMyListing)}\n disabled={isProcessing}\n tone=\"red\"\n helpContent={`Expires ${timeUntil(liveMyListing.endTime)}`}\n >\n <span>Cancel listing</span>\n <CurrencyAmount amount={formatDisplayPrice(liveMyListing.price.formatted)} symbol={liveMyListing.price.currency ?? \"\"} iconSize={14} amountClassName=\"tabular-nums\" />\n {liveMyListing.orderHash === liveCheapest?.orderHash && usdValue ? <span className=\"font-normal text-muted-foreground tabular-nums\">· {usdValue}</span> : null}\n </ActionButton>\n ) : null}\n {!liveMyListing || (isERC1155 && canListMoreEditions !== false) ? (\n <ActionButton tone=\"blue\" icon={<Tag className=\"h-4 w-4\" />} onClick={onOpenListing}>\n {liveMyListing ? \"List more\" : \"List for sale\"}\n </ActionButton>\n ) : null}\n <ActionButton tone=\"orange\" icon={<ArrowRightLeft className=\"h-4 w-4\" />} onClick={onOpenTransfer}>Transfer</ActionButton>\n {remixButton}\n {showSponsorSolicitOption && onOpenSponsorSolicit ? (\n <ActionButton\n tone=\"blue\"\n icon={<Handshake className=\"h-4 w-4\" />}\n onClick={onOpenSponsorSolicit}\n helpContent=\"Let sponsors bid on a license for this asset.\"\n >\n Open for sponsorship\n </ActionButton>\n ) : null}\n </ActionRow>\n {buyButton ? <ActionRow>{buyButton}</ActionRow> : null}\n </div>\n ) : isSignedIn ? (\n <div className=\"space-y-3\">\n <ActionRow>\n {buyButton}\n {offerButton}\n {remixButton}\n {showDealOption && onProposeDeal ? (\n <ActionButton\n action=\"license\"\n icon={<HandCoins className=\"h-4 w-4\" />}\n onClick={onProposeDeal}\n helpContent=\"Propose a license deal to the creator to use this work.\"\n >\n License\n </ActionButton>\n ) : null}\n {showSponsorOption && onOpenSponsorProposal ? (\n <ActionButton\n tone=\"blue\"\n icon={<Handshake className=\"h-4 w-4\" />}\n onClick={onOpenSponsorProposal}\n helpContent=\"Propose to sponsor this creator's work — pay them directly for a license, no escrow.\"\n >\n Sponsor\n </ActionButton>\n ) : null}\n </ActionRow>\n </div>\n ) : (\n <AssetAccessCards asset={asset} stacked={compact} />\n )}\n\n {myBid ? (\n <div className=\"rounded-xl bg-amber-500/8 px-4 py-3 flex items-center justify-between gap-3\">\n <div className=\"min-w-0 flex items-center gap-2.5\">\n <HandCoins className=\"h-4 w-4 text-amber-500 shrink-0\" />\n <div className=\"min-w-0\">\n <p className=\"text-xs font-semibold text-amber-500\">Your active offer</p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1.5 mt-0.5\">\n <span className=\"font-bold text-foreground inline-flex items-center gap-1\">\n {formatDisplayPrice(myBid.price.formatted)}\n <CurrencyIcon symbol={myBid.price.currency ?? \"\"} size={12} />\n </span>\n <span>·</span>\n <Clock className=\"h-3 w-3\" />\n {timeUntil(myBid.endTime)}\n </p>\n </div>\n </div>\n <button\n className=\"shrink-0 text-xs font-semibold text-red-400 hover:text-red-300 transition-colors flex items-center gap-1\"\n onClick={() => onCancelClick(myBid)}\n >\n <X className=\"h-3.5 w-3.5\" />\n Cancel\n </button>\n </div>\n ) : null}\n\n {isOwner && liveBids.length > 0 ? (\n <div className=\"space-y-2\">\n <p className=\"text-xs font-semibold text-muted-foreground\">\n Incoming offers ({liveBids.length})\n </p>\n <div className=\"divide-y divide-border/40\">\n {liveBids.map((bid) => (\n <div key={bid.orderHash} className=\"flex items-center justify-between gap-3 py-2.5\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-bold\">\n <span className=\"inline-flex items-center gap-1.5\">\n {formatDisplayPrice(bid.price.formatted)}\n <CurrencyIcon symbol={bid.price.currency ?? \"\"} size={14} />\n </span>\n </p>\n <div className=\"flex items-center gap-2 mt-0.5\">\n <AddressDisplay address={bid.offerer} chars={4} showCopy={false} className=\"text-xs text-muted-foreground\" />\n <span className=\"text-xs text-muted-foreground\">·</span>\n <div className=\"flex items-center gap-1 text-xs text-muted-foreground\">\n <Clock className=\"h-3 w-3\" />\n {timeUntil(bid.endTime)}\n </div>\n </div>\n </div>\n <button\n disabled={isProcessing}\n onClick={() => onAcceptBid(bid)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-semibold text-primary-foreground disabled:opacity-50\"\n >\n <CheckCircle className=\"h-3.5 w-3.5\" />\n Accept\n </button>\n </div>\n ))}\n </div>\n </div>\n ) : null}\n\n {isSignedIn ? <CompanionAppCard asset={asset} /> : null}\n </div>\n </div>\n );\n}\n"],"mappings":";AA6DS,cASS,YATT;AA3DT,SAAS,gBAAgC;AACzC;AAAA,EACE;AAAA,EAAgB;AAAA,EAAa;AAAA,EAAO;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACrE;AAAA,EAAK;AAAA,OACA;AACP,SAAS,cAAc,sBAAsB;AAC7C,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,WAAW,iBAAiB;AACrC,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AACnB,SAAS,kBAAkB,wBAAwB;AACnD,SAAS,uBAAsC;AAC/C,SAAS,gBAAgB;AA2CzB,SAAS,UAAU,EAAE,SAAS,GAA4B;AACxD,QAAM,MAAM,SAAS,QAAQ,QAAQ,EAAE,SAAS,MAAM;AACtD,SAAO,oBAAC,SAAI,WAAW,GAAG,0BAA0B,OAAO,8BAA8B,GAAI,UAAS;AACxG;AAEA,SAAS,UAAU,EAAE,OAAO,OAAO,SAAS,GAAqE;AAC/G,SACE,qBAAC,SAAI,WAAU,6EACb;AAAA,wBAAC,UA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,OAAO,GAAG,UAAU,OAAO,WAAU,iCAAgC;AAAA,YAC3G,oBAAC,UAAK,WAAU,iCAAgC,kBAAC;AAAA,YACjD,qBAAC,SAAI,WAAU,yDACb;AAAA,kCAAC,SAAM,WAAU,WAAU;AAAA,cAC1B,UAAU,IAAI,OAAO;AAAA,eACxB;AAAA,aACF;AAAA,WACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,SAAS,MAAM,YAAY,GAAG;AAAA,YAC9B,WAAU;AAAA,YAEV;AAAA,kCAAC,eAAY,WAAU,eAAc;AAAA,cAAE;AAAA;AAAA;AAAA,QAEzC;AAAA,WAxBQ,IAAI,SAyBd,CACD,GACH;AAAA,OACF,IACE;AAAA,IAEH,aAAa,oBAAC,oBAAiB,OAAc,IAAK;AAAA,KACrD,GACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/asset-marketplace-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { Children, type ReactNode } from \"react\";\nimport {\n ArrowRightLeft, CheckCircle, Clock, GitBranch, HandCoins, Handshake, Loader2,\n Tag, X,\n} from \"lucide-react\";\nimport { CurrencyIcon, CurrencyAmount } from \"./currency-icon.js\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { ActionButton } from \"./action-button.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { isExpired, timeUntil } from \"../utils/time.js\";\nimport { isSameAddress } from \"../utils/same-address.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { AssetAccessButtons, CompanionAppButton } from \"./asset-access-cards.js\";\nimport { useMedialaneApp, type AssetRef } from \"./medialane-app.js\";\n\nexport interface ApiOrderLike {\n orderHash: string;\n offerer: string;\n endTime: string;\n price: { formatted: string | null; currency: string | null };\n}\n\nexport interface AssetMarketplacePanelProps<T extends ApiOrderLike = ApiOrderLike> {\n asset: AssetRef;\n compact?: boolean;\n cheapest?: T;\n isOwner: boolean;\n isProcessing: boolean;\n isERC1155: boolean;\n canListMoreEditions?: boolean;\n isMarketLoading?: boolean;\n myListing: T | null;\n activeBids: T[];\n remixEnabled?: boolean;\n showDealOption?: boolean;\n\n usdValue?: string | null;\n\n onCancelClick: (order: T) => void;\n onAcceptBid: (order: T) => void;\n onOpenListing: () => void;\n onOpenTransfer: () => void;\n onOpenPurchase: (order: T) => void;\n onOpenOffer: () => void;\n onOpenRemix?: () => void;\n onProposeDeal?: () => void;\n\n showSponsorOption?: boolean;\n onOpenSponsorProposal?: () => void;\n\n showSponsorSolicitOption?: boolean;\n onOpenSponsorSolicit?: () => void;\n\n\n}\n\nfunction ActionRow({ children }: { children: ReactNode }) {\n const odd = Children.toArray(children).length % 2 === 1;\n return <div className={cn(\"grid grid-cols-2 gap-2\", odd && \"[&>*:first-child]:col-span-2\")}>{children}</div>;\n}\n\nfunction PriceBlock({ order, usdValue }: { order: ApiOrderLike; usdValue?: string | null }) {\n return (\n <div className=\"space-y-1\">\n <p className=\"text-xs font-medium uppercase tracking-wide text-muted-foreground\">Buy for</p>\n <div className=\"flex flex-wrap items-baseline gap-x-2 gap-y-1\">\n <CurrencyAmount amount={formatDisplayPrice(order.price.formatted)} symbol={order.price.currency ?? \"\"} iconSize={26} amountClassName=\"text-3xl font-bold text-foreground tabular-nums\" />\n <span className=\"text-lg font-semibold text-foreground\">{order.price.currency}</span>\n {usdValue ? <span className=\"text-sm tabular-nums text-muted-foreground\">{usdValue}</span> : null}\n </div>\n <p className=\"text-xs text-muted-foreground\">Expires {timeUntil(order.endTime)}</p>\n </div>\n );\n}\n\nexport function AssetMarketplacePanel<T extends ApiOrderLike = ApiOrderLike>({\n asset,\n compact = false,\n cheapest,\n isOwner,\n isProcessing,\n isERC1155,\n canListMoreEditions,\n isMarketLoading = false,\n myListing,\n activeBids,\n remixEnabled = false,\n showDealOption = false,\n showSponsorOption = false,\n onOpenSponsorProposal,\n showSponsorSolicitOption = false,\n onOpenSponsorSolicit,\n usdValue,\n onCancelClick,\n onAcceptBid,\n onOpenListing,\n onOpenTransfer,\n onOpenPurchase,\n onOpenOffer,\n onOpenRemix,\n onProposeDeal,\n}: AssetMarketplacePanelProps<T>) {\n const { walletAddress } = useMedialaneApp();\n const isSignedIn = !!walletAddress;\n const liveBids = activeBids.filter((bid) => !isExpired(bid.endTime));\n const liveCheapest = cheapest && !isExpired(cheapest.endTime) ? cheapest : undefined;\n const liveMyListing = myListing && !isExpired(myListing.endTime) ? myListing : null;\n\n const myBid = !isOwner && walletAddress\n ? liveBids.find((bid) => isSameAddress(bid.offerer, walletAddress)) ?? null\n : null;\n\n const canBuyMore =\n isERC1155 && isOwner && !!liveCheapest && !!walletAddress &&\n !isSameAddress(liveCheapest.offerer, walletAddress);\n\n if (isMarketLoading && !liveCheapest) {\n return (\n <div className=\"space-y-4\">\n <div className=\"h-9 w-32 rounded-md bg-muted animate-pulse\" />\n <div className=\"h-12 w-full rounded-2xl bg-muted animate-pulse\" />\n </div>\n );\n }\n\n const remixButton = remixEnabled && onOpenRemix ? (\n <ActionButton\n action=\"remix\"\n icon={<GitBranch className=\"h-4 w-4\" />}\n onClick={onOpenRemix}\n helpContent=\"Create your own attributed derivative of this work.\"\n >\n Remix\n </ActionButton>\n ) : null;\n\n const offerButton = (\n <ActionButton action=\"offer\" icon={<HandCoins className=\"h-4 w-4\" />} onClick={onOpenOffer}>\n Make offer\n </ActionButton>\n );\n\n const buyButton = liveCheapest && (!isOwner || canBuyMore) ? (\n isOwner ? (\n <ActionButton action=\"buy\" onClick={() => onOpenPurchase(liveCheapest)}>\n <span>Buy</span>\n <CurrencyAmount amount={formatDisplayPrice(liveCheapest.price.formatted)} symbol={liveCheapest.price.currency ?? \"\"} iconSize={14} amountClassName=\"tabular-nums\" />\n {usdValue ? <span className=\"font-normal text-muted-foreground tabular-nums\">· {usdValue}</span> : null}\n </ActionButton>\n ) : (\n <ActionButton action=\"buy\" onClick={() => onOpenPurchase(liveCheapest)}>\n Buy now\n </ActionButton>\n )\n ) : null;\n\n const listedPrice = !isOwner && liveCheapest ? <PriceBlock order={liveCheapest} usdValue={usdValue} /> : null;\n\n return (\n <div className=\"relative\">\n\n <div className=\"relative space-y-4\">\n {isOwner ? (\n <div className=\"space-y-3\">\n <ActionRow>\n {liveMyListing ? (\n <ActionButton\n icon={isProcessing ? <Loader2 className=\"h-4 w-4 animate-spin\" /> : <X className=\"h-4 w-4\" />}\n onClick={() => onCancelClick(liveMyListing)}\n disabled={isProcessing}\n tone=\"red\"\n helpContent={`Expires ${timeUntil(liveMyListing.endTime)}`}\n >\n <span>Cancel listing</span>\n <CurrencyAmount amount={formatDisplayPrice(liveMyListing.price.formatted)} symbol={liveMyListing.price.currency ?? \"\"} iconSize={14} amountClassName=\"tabular-nums\" />\n {liveMyListing.orderHash === liveCheapest?.orderHash && usdValue ? <span className=\"font-normal text-muted-foreground tabular-nums\">· {usdValue}</span> : null}\n </ActionButton>\n ) : null}\n {!liveMyListing || (isERC1155 && canListMoreEditions !== false) ? (\n <ActionButton tone=\"blue\" icon={<Tag className=\"h-4 w-4\" />} onClick={onOpenListing}>\n {liveMyListing ? \"List more\" : \"List for sale\"}\n </ActionButton>\n ) : null}\n <ActionButton tone=\"orange\" icon={<ArrowRightLeft className=\"h-4 w-4\" />} onClick={onOpenTransfer}>Transfer</ActionButton>\n {remixButton}\n {showSponsorSolicitOption && onOpenSponsorSolicit ? (\n <ActionButton\n tone=\"blue\"\n icon={<Handshake className=\"h-4 w-4\" />}\n onClick={onOpenSponsorSolicit}\n helpContent=\"Let sponsors bid on a license for this asset.\"\n >\n Open for sponsorship\n </ActionButton>\n ) : null}\n </ActionRow>\n {buyButton ? <ActionRow>{buyButton}</ActionRow> : null}\n </div>\n ) : (\n <div className=\"space-y-4\">\n {listedPrice}\n {isSignedIn ? (\n <ActionRow>\n {buyButton}\n {offerButton}\n {remixButton}\n {showDealOption && onProposeDeal ? (\n <ActionButton\n action=\"license\"\n icon={<HandCoins className=\"h-4 w-4\" />}\n onClick={onProposeDeal}\n helpContent=\"Propose a license deal to the creator to use this work.\"\n >\n License\n </ActionButton>\n ) : null}\n {showSponsorOption && onOpenSponsorProposal ? (\n <ActionButton\n tone=\"blue\"\n icon={<Handshake className=\"h-4 w-4\" />}\n onClick={onOpenSponsorProposal}\n helpContent=\"Propose to sponsor this creator's work — pay them directly for a license, no escrow.\"\n >\n Sponsor\n </ActionButton>\n ) : null}\n </ActionRow>\n ) : (\n <AssetAccessButtons asset={asset} stacked={compact} />\n )}\n </div>\n )}\n\n {myBid ? (\n <div className=\"rounded-xl bg-amber-500/8 px-4 py-3 flex items-center justify-between gap-3\">\n <div className=\"min-w-0 flex items-center gap-2.5\">\n <HandCoins className=\"h-4 w-4 text-amber-500 shrink-0\" />\n <div className=\"min-w-0\">\n <p className=\"text-xs font-semibold text-amber-500\">Your active offer</p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1.5 mt-0.5\">\n <span className=\"font-bold text-foreground inline-flex items-center gap-1\">\n {formatDisplayPrice(myBid.price.formatted)}\n <CurrencyIcon symbol={myBid.price.currency ?? \"\"} size={12} />\n </span>\n <span>·</span>\n <Clock className=\"h-3 w-3\" />\n {timeUntil(myBid.endTime)}\n </p>\n </div>\n </div>\n <button\n className=\"shrink-0 text-xs font-semibold text-red-400 hover:text-red-300 transition-colors flex items-center gap-1\"\n onClick={() => onCancelClick(myBid)}\n >\n <X className=\"h-3.5 w-3.5\" />\n Cancel\n </button>\n </div>\n ) : null}\n\n {isOwner && liveBids.length > 0 ? (\n <div className=\"space-y-2\">\n <p className=\"text-xs font-semibold text-muted-foreground\">\n Incoming offers ({liveBids.length})\n </p>\n <div className=\"divide-y divide-border/40\">\n {liveBids.map((bid) => (\n <div key={bid.orderHash} className=\"flex items-center justify-between gap-3 py-2.5\">\n <div className=\"min-w-0\">\n <p className=\"text-sm font-bold\">\n <span className=\"inline-flex items-center gap-1.5\">\n {formatDisplayPrice(bid.price.formatted)}\n <CurrencyIcon symbol={bid.price.currency ?? \"\"} size={14} />\n </span>\n </p>\n <div className=\"flex items-center gap-2 mt-0.5\">\n <AddressDisplay address={bid.offerer} chars={4} showCopy={false} className=\"text-xs text-muted-foreground\" />\n <span className=\"text-xs text-muted-foreground\">·</span>\n <div className=\"flex items-center gap-1 text-xs text-muted-foreground\">\n <Clock className=\"h-3 w-3\" />\n {timeUntil(bid.endTime)}\n </div>\n </div>\n </div>\n <button\n disabled={isProcessing}\n onClick={() => onAcceptBid(bid)}\n className=\"inline-flex items-center gap-1.5 rounded-lg bg-primary px-3 py-1.5 text-xs font-semibold text-primary-foreground disabled:opacity-50\"\n >\n <CheckCircle className=\"h-3.5 w-3.5\" />\n Accept\n </button>\n </div>\n ))}\n </div>\n </div>\n ) : null}\n\n {isSignedIn ? <CompanionAppButton asset={asset} /> : null}\n </div>\n </div>\n );\n}\n"],"mappings":";AA4DS,cAOH,YAPG;AA1DT,SAAS,gBAAgC;AACzC;AAAA,EACE;AAAA,EAAgB;AAAA,EAAa;AAAA,EAAO;AAAA,EAAW;AAAA,EAAW;AAAA,EAAW;AAAA,EACrE;AAAA,EAAK;AAAA,OACA;AACP,SAAS,cAAc,sBAAsB;AAC7C,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,WAAW,iBAAiB;AACrC,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AACnB,SAAS,oBAAoB,0BAA0B;AACvD,SAAS,uBAAsC;AA2C/C,SAAS,UAAU,EAAE,SAAS,GAA4B;AACxD,QAAM,MAAM,SAAS,QAAQ,QAAQ,EAAE,SAAS,MAAM;AACtD,SAAO,oBAAC,SAAI,WAAW,GAAG,0BAA0B,OAAO,8BAA8B,GAAI,UAAS;AACxG;AAEA,SAAS,WAAW,EAAE,OAAO,SAAS,GAAsD;AAC1F,SACE,qBAAC,SAAI,WAAU,aACb;AAAA,wBAAC,OAAE,WAAU,qEAAoE,qBAAO;AAAA,IACxF,qBAAC,SAAI,WAAU,iDACb;AAAA,0BAAC,kBAAe,QAAQ,mBAAmB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BAAe,SAAS,IAAI,SAAS,OAAO,GAAG,UAAU,OAAO,WAAU,iCAAgC;AAAA,YAC3G,oBAAC,UAAK,WAAU,iCAAgC,kBAAC;AAAA,YACjD,qBAAC,SAAI,WAAU,yDACb;AAAA,kCAAC,SAAM,WAAU,WAAU;AAAA,cAC1B,UAAU,IAAI,OAAO;AAAA,eACxB;AAAA,aACF;AAAA,WACF;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,UAAU;AAAA,YACV,SAAS,MAAM,YAAY,GAAG;AAAA,YAC9B,WAAU;AAAA,YAEV;AAAA,kCAAC,eAAY,WAAU,eAAc;AAAA,cAAE;AAAA;AAAA;AAAA,QAEzC;AAAA,WAxBQ,IAAI,SAyBd,CACD,GACH;AAAA,OACF,IACE;AAAA,IAEH,aAAa,oBAAC,sBAAmB,OAAc,IAAK;AAAA,KACvD,GACF;AAEJ;","names":[]}
|
|
@@ -26,6 +26,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
26
26
|
var import_lucide_react = require("lucide-react");
|
|
27
27
|
var import_ip_type_display = require("./ip-type-display.js");
|
|
28
28
|
var import_address_display = require("./address-display.js");
|
|
29
|
+
var import_markdown_text = require("./markdown-text.js");
|
|
29
30
|
var import_license_summary = require("../utils/license-summary.js");
|
|
30
31
|
const isAddressLike = (v) => typeof v === "string" && /^0x[0-9a-fA-F]{16,}$/.test(v.trim());
|
|
31
32
|
function Cell({
|
|
@@ -51,7 +52,9 @@ function Cell({
|
|
|
51
52
|
function AssetOverviewContent({
|
|
52
53
|
attributes,
|
|
53
54
|
hasTemplateData,
|
|
54
|
-
isDisplayAttr
|
|
55
|
+
isDisplayAttr,
|
|
56
|
+
content,
|
|
57
|
+
link
|
|
55
58
|
}) {
|
|
56
59
|
const attr = (trait) => attributes.find((attribute) => attribute.trait_type === trait)?.value;
|
|
57
60
|
const licenseType = attr("License");
|
|
@@ -73,6 +76,14 @@ function AssetOverviewContent({
|
|
|
73
76
|
{ icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Percent, { className: "h-4 w-4" }), label: "Royalty", value: royalty }
|
|
74
77
|
].filter((row) => !!row.value);
|
|
75
78
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mt-4 space-y-7", children: [
|
|
79
|
+
content ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "space-y-3", children: [
|
|
80
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-sm font-semibold text-muted-foreground", children: "Content" }),
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_markdown_text.MarkdownText, { text: content })
|
|
82
|
+
] }) : null,
|
|
83
|
+
link ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("a", { href: link, target: "_blank", rel: "noopener noreferrer", className: "inline-flex items-center gap-1.5 text-sm text-primary hover:underline", children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ExternalLink, { className: "h-3.5 w-3.5" }),
|
|
85
|
+
"Open link"
|
|
86
|
+
] }) : null,
|
|
76
87
|
hasTemplateData ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_ip_type_display.IPTypeDisplay, { attributes }) : null,
|
|
77
88
|
hasLicenseData ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "space-y-3", children: [
|
|
78
89
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-sm font-semibold text-muted-foreground", children: "Rights" }),
|