@medialane/ui 0.392.0 → 0.394.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/alert.d.cts +1 -1
- package/dist/components/alert.d.ts +1 -1
- 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/create-form-primitives.cjs +4 -2
- package/dist/components/create-form-primitives.cjs.map +1 -1
- package/dist/components/create-form-primitives.d.cts +2 -1
- package/dist/components/create-form-primitives.d.ts +2 -1
- package/dist/components/create-form-primitives.js +4 -2
- package/dist/components/create-form-primitives.js.map +1 -1
- package/dist/components/drop/create/asset-editor.cjs +40 -5
- package/dist/components/drop/create/asset-editor.cjs.map +1 -1
- package/dist/components/drop/create/asset-editor.d.cts +5 -1
- package/dist/components/drop/create/asset-editor.d.ts +5 -1
- package/dist/components/drop/create/asset-editor.js +41 -6
- package/dist/components/drop/create/asset-editor.js.map +1 -1
- package/dist/components/drop/create/assets-panel.cjs +27 -12
- package/dist/components/drop/create/assets-panel.cjs.map +1 -1
- package/dist/components/drop/create/assets-panel.d.cts +20 -3
- package/dist/components/drop/create/assets-panel.d.ts +20 -3
- package/dist/components/drop/create/assets-panel.js +26 -13
- package/dist/components/drop/create/assets-panel.js.map +1 -1
- package/dist/components/drop/create/collection-panel.cjs +4 -2
- package/dist/components/drop/create/collection-panel.cjs.map +1 -1
- package/dist/components/drop/create/collection-panel.d.cts +5 -1
- package/dist/components/drop/create/collection-panel.d.ts +5 -1
- package/dist/components/drop/create/collection-panel.js +4 -2
- package/dist/components/drop/create/collection-panel.js.map +1 -1
- package/dist/components/drop/create/drop-create.cjs +1 -1
- package/dist/components/drop/create/drop-create.cjs.map +1 -1
- package/dist/components/drop/create/drop-create.d.cts +5 -1
- package/dist/components/drop/create/drop-create.d.ts +5 -1
- package/dist/components/drop/create/drop-create.js +1 -1
- package/dist/components/drop/create/drop-create.js.map +1 -1
- package/dist/components/drop/create/drop-fields.cjs +10 -6
- package/dist/components/drop/create/drop-fields.cjs.map +1 -1
- package/dist/components/drop/create/drop-fields.d.cts +6 -2
- package/dist/components/drop/create/drop-fields.d.ts +6 -2
- package/dist/components/drop/create/drop-fields.js +10 -6
- package/dist/components/drop/create/drop-fields.js.map +1 -1
- package/dist/components/drop/create/drop-panel.cjs +1 -1
- package/dist/components/drop/create/drop-panel.cjs.map +1 -1
- package/dist/components/drop/create/drop-panel.d.cts +6 -2
- package/dist/components/drop/create/drop-panel.d.ts +6 -2
- package/dist/components/drop/create/drop-panel.js +1 -1
- package/dist/components/drop/create/drop-panel.js.map +1 -1
- package/dist/components/drop/create/launch-dialog.cjs +4 -4
- package/dist/components/drop/create/launch-dialog.cjs.map +1 -1
- package/dist/components/drop/create/launch-dialog.d.cts +5 -1
- package/dist/components/drop/create/launch-dialog.d.ts +5 -1
- package/dist/components/drop/create/launch-dialog.js +5 -5
- package/dist/components/drop/create/launch-dialog.js.map +1 -1
- package/dist/components/drop/create/settings-panel.cjs +8 -7
- package/dist/components/drop/create/settings-panel.cjs.map +1 -1
- package/dist/components/drop/create/settings-panel.d.cts +5 -1
- package/dist/components/drop/create/settings-panel.d.ts +5 -1
- package/dist/components/drop/create/settings-panel.js +9 -8
- package/dist/components/drop/create/settings-panel.js.map +1 -1
- package/dist/components/drop/drop-features.cjs +3 -3
- package/dist/components/drop/drop-features.cjs.map +1 -1
- package/dist/components/drop/drop-features.js +3 -3
- package/dist/components/drop/drop-features.js.map +1 -1
- package/dist/components/drop/drop-status.d.cts +1 -0
- package/dist/components/drop/drop-status.d.ts +1 -0
- package/dist/components/drop/page/drop-action-box.cjs +4 -4
- package/dist/components/drop/page/drop-action-box.cjs.map +1 -1
- package/dist/components/drop/page/drop-action-box.d.cts +1 -0
- package/dist/components/drop/page/drop-action-box.d.ts +1 -0
- package/dist/components/drop/page/drop-action-box.js +4 -4
- package/dist/components/drop/page/drop-action-box.js.map +1 -1
- package/dist/components/drop/page/drop-mint-dialog.cjs +1 -1
- package/dist/components/drop/page/drop-mint-dialog.cjs.map +1 -1
- package/dist/components/drop/page/drop-mint-dialog.d.cts +2 -1
- package/dist/components/drop/page/drop-mint-dialog.d.ts +2 -1
- package/dist/components/drop/page/drop-mint-dialog.js +1 -1
- package/dist/components/drop/page/drop-mint-dialog.js.map +1 -1
- package/dist/components/drop/page/drop-page.cjs +5 -9
- package/dist/components/drop/page/drop-page.cjs.map +1 -1
- package/dist/components/drop/page/drop-page.js +6 -10
- package/dist/components/drop/page/drop-page.js.map +1 -1
- package/dist/{draft-DaQIVRMX.d.ts → draft-D1Wfoe3V.d.ts} +20 -6
- package/dist/{draft-CuU1m9P3.d.cts → draft-Dlc0K4p0.d.cts} +20 -6
- package/dist/i18n/catalog/pt.cjs +39 -10
- package/dist/i18n/catalog/pt.cjs.map +1 -1
- package/dist/i18n/catalog/pt.js +39 -10
- package/dist/i18n/catalog/pt.js.map +1 -1
- package/dist/i18n/index.cjs.map +1 -1
- package/dist/i18n/index.d.cts +1 -1
- package/dist/i18n/index.d.ts +1 -1
- package/dist/i18n/index.js.map +1 -1
- package/dist/i18n/translate.cjs.map +1 -1
- package/dist/i18n/translate.d.cts +5 -1
- package/dist/i18n/translate.d.ts +5 -1
- package/dist/i18n/translate.js.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/utils/drop/draft-store.d.cts +5 -1
- package/dist/utils/drop/draft-store.d.ts +5 -1
- package/dist/utils/drop/draft.cjs +39 -15
- package/dist/utils/drop/draft.cjs.map +1 -1
- package/dist/utils/drop/draft.d.cts +5 -1
- package/dist/utils/drop/draft.d.ts +5 -1
- package/dist/utils/drop/draft.js +35 -15
- package/dist/utils/drop/draft.js.map +1 -1
- package/dist/utils/drop/metadata.cjs +11 -13
- package/dist/utils/drop/metadata.cjs.map +1 -1
- package/dist/utils/drop/metadata.d.cts +5 -1
- package/dist/utils/drop/metadata.d.ts +5 -1
- package/dist/utils/drop/metadata.js +11 -13
- package/dist/utils/drop/metadata.js.map +1 -1
- package/dist/utils/drop/sale.cjs +18 -9
- package/dist/utils/drop/sale.cjs.map +1 -1
- package/dist/utils/drop/sale.d.cts +5 -3
- package/dist/utils/drop/sale.d.ts +5 -3
- package/dist/utils/drop/sale.js +17 -9
- package/dist/utils/drop/sale.js.map +1 -1
- package/dist/utils/drop/view.cjs +15 -13
- package/dist/utils/drop/view.cjs.map +1 -1
- package/dist/utils/drop/view.d.cts +6 -4
- package/dist/utils/drop/view.d.ts +6 -4
- package/dist/utils/drop/view.js +15 -13
- package/dist/utils/drop/view.js.map +1 -1
- package/package.json +1 -1
|
@@ -36,7 +36,7 @@ function DropActionBox({ view, minted, maxSupply, quantity, onQuantity, onAction
|
|
|
36
36
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "panel space-y-5 p-5", children: [
|
|
37
37
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-between gap-3", children: [
|
|
38
38
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_status.DropStatusBadge, { phase: view.phase }),
|
|
39
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs text-muted-foreground", children: view.statusText })
|
|
39
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs text-muted-foreground", children: t(view.statusText.text, view.statusText.vars) })
|
|
40
40
|
] }),
|
|
41
41
|
view.countdown && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_countdown.DropCountdown, { targetTs: view.countdown.target, label: t(view.countdown.label) }),
|
|
42
42
|
maxSupply > 0n ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_status.DropSupplyProgress, { minted: Number(minted), max: Number(maxSupply) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: t("{value} minted", { value: intl.number(Number(minted)) }) }),
|
|
@@ -52,9 +52,9 @@ function DropActionBox({ view, minted, maxSupply, quantity, onQuantity, onAction
|
|
|
52
52
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", className: "rounded-xl p-2 bg-background/40", disabled: quantity >= view.maxQuantity, onClick: () => onQuantity(quantity + 1n), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Plus, { className: "h-3.5 w-3.5" }) })
|
|
53
53
|
] })
|
|
54
54
|
] }),
|
|
55
|
-
view.totalText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: view.totalText }),
|
|
56
|
-
|
|
57
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { solid: true, big: true, disabled: view.button.action === "none", onClick: onAction, className: "w-full", children: t(view.button.label) })
|
|
55
|
+
view.totalText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: t(view.totalText.text, view.totalText.vars) }),
|
|
56
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm", children: t(view.eligibility.text, view.eligibility.vars) }),
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { solid: true, big: true, disabled: view.button.action === "none", onClick: onAction, className: "w-full", children: t(view.button.label.text, view.button.label.vars) })
|
|
58
58
|
] });
|
|
59
59
|
}
|
|
60
60
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drop/page/drop-action-box.tsx"],"sourcesContent":["\"use client\";\n\nimport { Minus, Plus } from \"lucide-react\";\nimport { DropCountdown } from \"../../drop-countdown.js\";\nimport { DropStatusBadge, DropSupplyProgress } from \"../drop-status.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport type { ActionBoxView } from \"../../../utils/drop/view.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { useFormat } from \"../../../i18n/use-format.js\";\n\nexport interface DropActionBoxProps {\n view: ActionBoxView;\n minted: bigint;\n maxSupply: bigint;\n quantity: bigint;\n onQuantity: (q: bigint) => void;\n onAction: () => void;\n}\n\nexport function DropActionBox({ view, minted, maxSupply, quantity, onQuantity, onAction }: DropActionBoxProps) {\n const intl = useFormat();\n const t = useT();\n const canPick = view.button.action === \"mint\" && view.maxQuantity > 1n;\n return (\n <div className=\"panel space-y-5 p-5\">\n <div className=\"flex items-center justify-between gap-3\">\n <DropStatusBadge phase={view.phase} />\n <span className=\"text-xs text-muted-foreground\">{view.statusText}</span>\n </div>\n {view.countdown && <DropCountdown targetTs={view.countdown.target} label={t(view.countdown.label)} />}\n {maxSupply > 0n\n ? <DropSupplyProgress minted={Number(minted)} max={Number(maxSupply)} />\n : <p className=\"text-sm text-muted-foreground\">{t(\"{value} minted\", { value: intl.number(Number(minted)) })}</p>}\n <div className=\"flex items-end justify-between gap-3\">\n <div>\n <p className=\"text-xs text-muted-foreground\">{t(\"Price\")}</p>\n <p className=\"text-xl font-bold\">{view.priceText}</p>\n </div>\n {canPick && (\n <div className=\"flex items-center gap-2\" aria-label={t(\"Quantity\")}>\n <span className=\"sr-only\">{t(\"Quantity\")}</span>\n <button type=\"button\" className=\"rounded-xl p-2 bg-background/40\" disabled={quantity <= 1n} onClick={() => onQuantity(quantity - 1n)}><Minus className=\"h-3.5 w-3.5\" /></button>\n <span className=\"w-8 text-center font-semibold tabular-nums\">{quantity.toString()}</span>\n <button type=\"button\" className=\"rounded-xl p-2 bg-background/40\" disabled={quantity >= view.maxQuantity} onClick={() => onQuantity(quantity + 1n)}><Plus className=\"h-3.5 w-3.5\" /></button>\n </div>\n )}\n </div>\n {view.totalText && <p className=\"text-sm text-muted-foreground\">{view.totalText}</p>}\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-action-box.tsx"],"sourcesContent":["\"use client\";\n\nimport { Minus, Plus } from \"lucide-react\";\nimport { DropCountdown } from \"../../drop-countdown.js\";\nimport { DropStatusBadge, DropSupplyProgress } from \"../drop-status.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport type { ActionBoxView } from \"../../../utils/drop/view.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { useFormat } from \"../../../i18n/use-format.js\";\n\nexport interface DropActionBoxProps {\n view: ActionBoxView;\n minted: bigint;\n maxSupply: bigint;\n quantity: bigint;\n onQuantity: (q: bigint) => void;\n onAction: () => void;\n}\n\nexport function DropActionBox({ view, minted, maxSupply, quantity, onQuantity, onAction }: DropActionBoxProps) {\n const intl = useFormat();\n const t = useT();\n const canPick = view.button.action === \"mint\" && view.maxQuantity > 1n;\n return (\n <div className=\"panel space-y-5 p-5\">\n <div className=\"flex items-center justify-between gap-3\">\n <DropStatusBadge phase={view.phase} />\n <span className=\"text-xs text-muted-foreground\">{t(view.statusText.text, view.statusText.vars)}</span>\n </div>\n {view.countdown && <DropCountdown targetTs={view.countdown.target} label={t(view.countdown.label)} />}\n {maxSupply > 0n\n ? <DropSupplyProgress minted={Number(minted)} max={Number(maxSupply)} />\n : <p className=\"text-sm text-muted-foreground\">{t(\"{value} minted\", { value: intl.number(Number(minted)) })}</p>}\n <div className=\"flex items-end justify-between gap-3\">\n <div>\n <p className=\"text-xs text-muted-foreground\">{t(\"Price\")}</p>\n <p className=\"text-xl font-bold\">{view.priceText}</p>\n </div>\n {canPick && (\n <div className=\"flex items-center gap-2\" aria-label={t(\"Quantity\")}>\n <span className=\"sr-only\">{t(\"Quantity\")}</span>\n <button type=\"button\" className=\"rounded-xl p-2 bg-background/40\" disabled={quantity <= 1n} onClick={() => onQuantity(quantity - 1n)}><Minus className=\"h-3.5 w-3.5\" /></button>\n <span className=\"w-8 text-center font-semibold tabular-nums\">{quantity.toString()}</span>\n <button type=\"button\" className=\"rounded-xl p-2 bg-background/40\" disabled={quantity >= view.maxQuantity} onClick={() => onQuantity(quantity + 1n)}><Plus className=\"h-3.5 w-3.5\" /></button>\n </div>\n )}\n </div>\n {view.totalText && <p className=\"text-sm text-muted-foreground\">{t(view.totalText.text, view.totalText.vars)}</p>}\n <p className=\"text-sm\">{t(view.eligibility.text, view.eligibility.vars)}</p>\n <ActionButton solid big disabled={view.button.action === \"none\"} onClick={onAction} className=\"w-full\">\n {t(view.button.label.text, view.button.label.vars)}\n </ActionButton>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBM;AAvBN,0BAA4B;AAC5B,4BAA8B;AAC9B,yBAAoD;AACpD,2BAA6B;AAE7B,sBAAqB;AACrB,wBAA0B;AAWnB,SAAS,cAAc,EAAE,MAAM,QAAQ,WAAW,UAAU,YAAY,SAAS,GAAuB;AAC7G,QAAM,WAAO,6BAAU;AACvB,QAAM,QAAI,sBAAK;AACf,QAAM,UAAU,KAAK,OAAO,WAAW,UAAU,KAAK,cAAc;AACpE,SACE,6CAAC,SAAI,WAAU,uBACb;AAAA,iDAAC,SAAI,WAAU,2CACb;AAAA,kDAAC,sCAAgB,OAAO,KAAK,OAAO;AAAA,MACpC,4CAAC,UAAK,WAAU,iCAAiC,YAAE,KAAK,WAAW,MAAM,KAAK,WAAW,IAAI,GAAE;AAAA,OACjG;AAAA,IACC,KAAK,aAAa,4CAAC,uCAAc,UAAU,KAAK,UAAU,QAAQ,OAAO,EAAE,KAAK,UAAU,KAAK,GAAG;AAAA,IAClG,YAAY,KACT,4CAAC,yCAAmB,QAAQ,OAAO,MAAM,GAAG,KAAK,OAAO,SAAS,GAAG,IACpE,4CAAC,OAAE,WAAU,iCAAiC,YAAE,kBAAkB,EAAE,OAAO,KAAK,OAAO,OAAO,MAAM,CAAC,EAAE,CAAC,GAAE;AAAA,IAC9G,6CAAC,SAAI,WAAU,wCACb;AAAA,mDAAC,SACC;AAAA,oDAAC,OAAE,WAAU,iCAAiC,YAAE,OAAO,GAAE;AAAA,QACzD,4CAAC,OAAE,WAAU,qBAAqB,eAAK,WAAU;AAAA,SACnD;AAAA,MACC,WACC,6CAAC,SAAI,WAAU,2BAA0B,cAAY,EAAE,UAAU,GAC/D;AAAA,oDAAC,UAAK,WAAU,WAAW,YAAE,UAAU,GAAE;AAAA,QACzC,4CAAC,YAAO,MAAK,UAAS,WAAU,mCAAkC,UAAU,YAAY,IAAI,SAAS,MAAM,WAAW,WAAW,EAAE,GAAG,sDAAC,6BAAM,WAAU,eAAc,GAAE;AAAA,QACvK,4CAAC,UAAK,WAAU,8CAA8C,mBAAS,SAAS,GAAE;AAAA,QAClF,4CAAC,YAAO,MAAK,UAAS,WAAU,mCAAkC,UAAU,YAAY,KAAK,aAAa,SAAS,MAAM,WAAW,WAAW,EAAE,GAAG,sDAAC,4BAAK,WAAU,eAAc,GAAE;AAAA,SACtL;AAAA,OAEJ;AAAA,IACC,KAAK,aAAa,4CAAC,OAAE,WAAU,iCAAiC,YAAE,KAAK,UAAU,MAAM,KAAK,UAAU,IAAI,GAAE;AAAA,IAC7G,4CAAC,OAAE,WAAU,WAAW,YAAE,KAAK,YAAY,MAAM,KAAK,YAAY,IAAI,GAAE;AAAA,IACxE,4CAAC,qCAAa,OAAK,MAAC,KAAG,MAAC,UAAU,KAAK,OAAO,WAAW,QAAQ,SAAS,UAAU,WAAU,UAC3F,YAAE,KAAK,OAAO,MAAM,MAAM,KAAK,OAAO,MAAM,IAAI,GACnD;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -13,7 +13,7 @@ function DropActionBox({ view, minted, maxSupply, quantity, onQuantity, onAction
|
|
|
13
13
|
return /* @__PURE__ */ jsxs("div", { className: "panel space-y-5 p-5", children: [
|
|
14
14
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-3", children: [
|
|
15
15
|
/* @__PURE__ */ jsx(DropStatusBadge, { phase: view.phase }),
|
|
16
|
-
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: view.statusText })
|
|
16
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs text-muted-foreground", children: t(view.statusText.text, view.statusText.vars) })
|
|
17
17
|
] }),
|
|
18
18
|
view.countdown && /* @__PURE__ */ jsx(DropCountdown, { targetTs: view.countdown.target, label: t(view.countdown.label) }),
|
|
19
19
|
maxSupply > 0n ? /* @__PURE__ */ jsx(DropSupplyProgress, { minted: Number(minted), max: Number(maxSupply) }) : /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t("{value} minted", { value: intl.number(Number(minted)) }) }),
|
|
@@ -29,9 +29,9 @@ function DropActionBox({ view, minted, maxSupply, quantity, onQuantity, onAction
|
|
|
29
29
|
/* @__PURE__ */ jsx("button", { type: "button", className: "rounded-xl p-2 bg-background/40", disabled: quantity >= view.maxQuantity, onClick: () => onQuantity(quantity + 1n), children: /* @__PURE__ */ jsx(Plus, { className: "h-3.5 w-3.5" }) })
|
|
30
30
|
] })
|
|
31
31
|
] }),
|
|
32
|
-
view.totalText && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: view.totalText }),
|
|
33
|
-
|
|
34
|
-
/* @__PURE__ */ jsx(ActionButton, { solid: true, big: true, disabled: view.button.action === "none", onClick: onAction, className: "w-full", children: t(view.button.label) })
|
|
32
|
+
view.totalText && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t(view.totalText.text, view.totalText.vars) }),
|
|
33
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: t(view.eligibility.text, view.eligibility.vars) }),
|
|
34
|
+
/* @__PURE__ */ jsx(ActionButton, { solid: true, big: true, disabled: view.button.action === "none", onClick: onAction, className: "w-full", children: t(view.button.label.text, view.button.label.vars) })
|
|
35
35
|
] });
|
|
36
36
|
}
|
|
37
37
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drop/page/drop-action-box.tsx"],"sourcesContent":["\"use client\";\n\nimport { Minus, Plus } from \"lucide-react\";\nimport { DropCountdown } from \"../../drop-countdown.js\";\nimport { DropStatusBadge, DropSupplyProgress } from \"../drop-status.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport type { ActionBoxView } from \"../../../utils/drop/view.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { useFormat } from \"../../../i18n/use-format.js\";\n\nexport interface DropActionBoxProps {\n view: ActionBoxView;\n minted: bigint;\n maxSupply: bigint;\n quantity: bigint;\n onQuantity: (q: bigint) => void;\n onAction: () => void;\n}\n\nexport function DropActionBox({ view, minted, maxSupply, quantity, onQuantity, onAction }: DropActionBoxProps) {\n const intl = useFormat();\n const t = useT();\n const canPick = view.button.action === \"mint\" && view.maxQuantity > 1n;\n return (\n <div className=\"panel space-y-5 p-5\">\n <div className=\"flex items-center justify-between gap-3\">\n <DropStatusBadge phase={view.phase} />\n <span className=\"text-xs text-muted-foreground\">{view.statusText}</span>\n </div>\n {view.countdown && <DropCountdown targetTs={view.countdown.target} label={t(view.countdown.label)} />}\n {maxSupply > 0n\n ? <DropSupplyProgress minted={Number(minted)} max={Number(maxSupply)} />\n : <p className=\"text-sm text-muted-foreground\">{t(\"{value} minted\", { value: intl.number(Number(minted)) })}</p>}\n <div className=\"flex items-end justify-between gap-3\">\n <div>\n <p className=\"text-xs text-muted-foreground\">{t(\"Price\")}</p>\n <p className=\"text-xl font-bold\">{view.priceText}</p>\n </div>\n {canPick && (\n <div className=\"flex items-center gap-2\" aria-label={t(\"Quantity\")}>\n <span className=\"sr-only\">{t(\"Quantity\")}</span>\n <button type=\"button\" className=\"rounded-xl p-2 bg-background/40\" disabled={quantity <= 1n} onClick={() => onQuantity(quantity - 1n)}><Minus className=\"h-3.5 w-3.5\" /></button>\n <span className=\"w-8 text-center font-semibold tabular-nums\">{quantity.toString()}</span>\n <button type=\"button\" className=\"rounded-xl p-2 bg-background/40\" disabled={quantity >= view.maxQuantity} onClick={() => onQuantity(quantity + 1n)}><Plus className=\"h-3.5 w-3.5\" /></button>\n </div>\n )}\n </div>\n {view.totalText && <p className=\"text-sm text-muted-foreground\">{view.totalText}</p>}\n
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-action-box.tsx"],"sourcesContent":["\"use client\";\n\nimport { Minus, Plus } from \"lucide-react\";\nimport { DropCountdown } from \"../../drop-countdown.js\";\nimport { DropStatusBadge, DropSupplyProgress } from \"../drop-status.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport type { ActionBoxView } from \"../../../utils/drop/view.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { useFormat } from \"../../../i18n/use-format.js\";\n\nexport interface DropActionBoxProps {\n view: ActionBoxView;\n minted: bigint;\n maxSupply: bigint;\n quantity: bigint;\n onQuantity: (q: bigint) => void;\n onAction: () => void;\n}\n\nexport function DropActionBox({ view, minted, maxSupply, quantity, onQuantity, onAction }: DropActionBoxProps) {\n const intl = useFormat();\n const t = useT();\n const canPick = view.button.action === \"mint\" && view.maxQuantity > 1n;\n return (\n <div className=\"panel space-y-5 p-5\">\n <div className=\"flex items-center justify-between gap-3\">\n <DropStatusBadge phase={view.phase} />\n <span className=\"text-xs text-muted-foreground\">{t(view.statusText.text, view.statusText.vars)}</span>\n </div>\n {view.countdown && <DropCountdown targetTs={view.countdown.target} label={t(view.countdown.label)} />}\n {maxSupply > 0n\n ? <DropSupplyProgress minted={Number(minted)} max={Number(maxSupply)} />\n : <p className=\"text-sm text-muted-foreground\">{t(\"{value} minted\", { value: intl.number(Number(minted)) })}</p>}\n <div className=\"flex items-end justify-between gap-3\">\n <div>\n <p className=\"text-xs text-muted-foreground\">{t(\"Price\")}</p>\n <p className=\"text-xl font-bold\">{view.priceText}</p>\n </div>\n {canPick && (\n <div className=\"flex items-center gap-2\" aria-label={t(\"Quantity\")}>\n <span className=\"sr-only\">{t(\"Quantity\")}</span>\n <button type=\"button\" className=\"rounded-xl p-2 bg-background/40\" disabled={quantity <= 1n} onClick={() => onQuantity(quantity - 1n)}><Minus className=\"h-3.5 w-3.5\" /></button>\n <span className=\"w-8 text-center font-semibold tabular-nums\">{quantity.toString()}</span>\n <button type=\"button\" className=\"rounded-xl p-2 bg-background/40\" disabled={quantity >= view.maxQuantity} onClick={() => onQuantity(quantity + 1n)}><Plus className=\"h-3.5 w-3.5\" /></button>\n </div>\n )}\n </div>\n {view.totalText && <p className=\"text-sm text-muted-foreground\">{t(view.totalText.text, view.totalText.vars)}</p>}\n <p className=\"text-sm\">{t(view.eligibility.text, view.eligibility.vars)}</p>\n <ActionButton solid big disabled={view.button.action === \"none\"} onClick={onAction} className=\"w-full\">\n {t(view.button.label.text, view.button.label.vars)}\n </ActionButton>\n </div>\n );\n}\n"],"mappings":";AAyBM,SACE,KADF;AAvBN,SAAS,OAAO,YAAY;AAC5B,SAAS,qBAAqB;AAC9B,SAAS,iBAAiB,0BAA0B;AACpD,SAAS,oBAAoB;AAE7B,SAAS,YAAY;AACrB,SAAS,iBAAiB;AAWnB,SAAS,cAAc,EAAE,MAAM,QAAQ,WAAW,UAAU,YAAY,SAAS,GAAuB;AAC7G,QAAM,OAAO,UAAU;AACvB,QAAM,IAAI,KAAK;AACf,QAAM,UAAU,KAAK,OAAO,WAAW,UAAU,KAAK,cAAc;AACpE,SACE,qBAAC,SAAI,WAAU,uBACb;AAAA,yBAAC,SAAI,WAAU,2CACb;AAAA,0BAAC,mBAAgB,OAAO,KAAK,OAAO;AAAA,MACpC,oBAAC,UAAK,WAAU,iCAAiC,YAAE,KAAK,WAAW,MAAM,KAAK,WAAW,IAAI,GAAE;AAAA,OACjG;AAAA,IACC,KAAK,aAAa,oBAAC,iBAAc,UAAU,KAAK,UAAU,QAAQ,OAAO,EAAE,KAAK,UAAU,KAAK,GAAG;AAAA,IAClG,YAAY,KACT,oBAAC,sBAAmB,QAAQ,OAAO,MAAM,GAAG,KAAK,OAAO,SAAS,GAAG,IACpE,oBAAC,OAAE,WAAU,iCAAiC,YAAE,kBAAkB,EAAE,OAAO,KAAK,OAAO,OAAO,MAAM,CAAC,EAAE,CAAC,GAAE;AAAA,IAC9G,qBAAC,SAAI,WAAU,wCACb;AAAA,2BAAC,SACC;AAAA,4BAAC,OAAE,WAAU,iCAAiC,YAAE,OAAO,GAAE;AAAA,QACzD,oBAAC,OAAE,WAAU,qBAAqB,eAAK,WAAU;AAAA,SACnD;AAAA,MACC,WACC,qBAAC,SAAI,WAAU,2BAA0B,cAAY,EAAE,UAAU,GAC/D;AAAA,4BAAC,UAAK,WAAU,WAAW,YAAE,UAAU,GAAE;AAAA,QACzC,oBAAC,YAAO,MAAK,UAAS,WAAU,mCAAkC,UAAU,YAAY,IAAI,SAAS,MAAM,WAAW,WAAW,EAAE,GAAG,8BAAC,SAAM,WAAU,eAAc,GAAE;AAAA,QACvK,oBAAC,UAAK,WAAU,8CAA8C,mBAAS,SAAS,GAAE;AAAA,QAClF,oBAAC,YAAO,MAAK,UAAS,WAAU,mCAAkC,UAAU,YAAY,KAAK,aAAa,SAAS,MAAM,WAAW,WAAW,EAAE,GAAG,8BAAC,QAAK,WAAU,eAAc,GAAE;AAAA,SACtL;AAAA,OAEJ;AAAA,IACC,KAAK,aAAa,oBAAC,OAAE,WAAU,iCAAiC,YAAE,KAAK,UAAU,MAAM,KAAK,UAAU,IAAI,GAAE;AAAA,IAC7G,oBAAC,OAAE,WAAU,WAAW,YAAE,KAAK,YAAY,MAAM,KAAK,YAAY,IAAI,GAAE;AAAA,IACxE,oBAAC,gBAAa,OAAK,MAAC,KAAG,MAAC,UAAU,KAAK,OAAO,WAAW,QAAQ,SAAS,UAAU,WAAU,UAC3F,YAAE,KAAK,OAAO,MAAM,MAAM,KAAK,OAAO,MAAM,IAAI,GACnD;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -60,7 +60,7 @@ function DropMintDialog({
|
|
|
60
60
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogDescription, { className: "sr-only", children: t("Mint from this drop.") }),
|
|
61
61
|
step.kind === "confirm" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
62
62
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_dialog.DialogTitle, { className: "text-lg font-semibold", children: t("Mint {quantity} from {name}", { quantity: quantity.toString(), name }) }),
|
|
63
|
-
totalText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: totalText }),
|
|
63
|
+
totalText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: t(totalText.text, totalText.vars) }),
|
|
64
64
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { solid: true, big: true, onClick: () => void mint(), className: "w-full", children: t("Confirm mint") })
|
|
65
65
|
] }),
|
|
66
66
|
step.kind === "minting" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_dialog.DialogTitle, { className: "flex items-center gap-2 text-lg font-semibold", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drop/page/drop-mint-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../../dialog.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { Button } from \"../../button.js\";\nimport { describeError } from \"../../../utils/describe-error.js\";\nimport { useT } from \"../../../i18n/provider.js\";\n\ntype Step = { kind: \"confirm\" } | { kind: \"minting\" } | { kind: \"done\"; tokenIds: string[] } | { kind: \"error\"; message: string };\n\nexport function DropMintDialog({\n open, onClose, name, quantity, totalText, onMint, portfolioHref,\n}: {\n open: boolean;\n onClose: () => void;\n name: string;\n quantity: bigint;\n totalText:
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-mint-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../../dialog.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { Button } from \"../../button.js\";\nimport { describeError } from \"../../../utils/describe-error.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport type { Phrase } from \"../../../i18n/translate.js\";\n\ntype Step = { kind: \"confirm\" } | { kind: \"minting\" } | { kind: \"done\"; tokenIds: string[] } | { kind: \"error\"; message: string };\n\nexport function DropMintDialog({\n open, onClose, name, quantity, totalText, onMint, portfolioHref,\n}: {\n open: boolean;\n onClose: () => void;\n name: string;\n quantity: bigint;\n totalText: Phrase | null;\n onMint: () => Promise<{ tokenIds: string[] }>;\n portfolioHref: string;\n}) {\n const t = useT();\n const [step, setStep] = useState<Step>({ kind: \"confirm\" });\n const mint = async () => {\n setStep({ kind: \"minting\" });\n try {\n setStep({ kind: \"done\", tokenIds: (await onMint()).tokenIds });\n } catch (err) {\n setStep({ kind: \"error\", message: describeError(err).message });\n }\n };\n const close = () => {\n if (step.kind === \"minting\") return;\n setStep({ kind: \"confirm\" });\n onClose();\n };\n return (\n <Dialog open={open} onOpenChange={(next) => { if (!next) close(); }}>\n <DialogContent className=\"gap-5 sm:max-w-md\" hideClose={step.kind === \"minting\"}>\n <DialogDescription className=\"sr-only\">{t(\"Mint from this drop.\")}</DialogDescription>\n {step.kind === \"confirm\" && (\n <>\n <DialogTitle className=\"text-lg font-semibold\">{t(\"Mint {quantity} from {name}\", { quantity: quantity.toString(), name })}</DialogTitle>\n {totalText && <p className=\"text-sm text-muted-foreground\">{t(totalText.text, totalText.vars)}</p>}\n <ActionButton solid big onClick={() => void mint()} className=\"w-full\">{t(\"Confirm mint\")}</ActionButton>\n </>\n )}\n {step.kind === \"minting\" && <DialogTitle className=\"flex items-center gap-2 text-lg font-semibold\"><Loader2 className=\"h-4 w-4 animate-spin\" />{t(\"Minting…\")}</DialogTitle>}\n {step.kind === \"done\" && (\n <>\n <DialogTitle className=\"flex items-center gap-2 text-lg font-semibold\"><CheckCircle2 className=\"h-5 w-5 text-brand-blue\" />{t(\"Minted\")}</DialogTitle>\n <Button asChild><a href={portfolioHref}>{t(\"View in portfolio\")}</a></Button>\n </>\n )}\n {step.kind === \"error\" && (\n <>\n <DialogTitle className=\"flex items-center gap-2 text-lg font-semibold\"><XCircle className=\"h-4 w-4 text-destructive\" />{t(\"Not minted\")}</DialogTitle>\n <p className=\"text-sm text-muted-foreground\">{step.message}</p>\n <Button onClick={() => void mint()}>{t(\"Try again\")}</Button>\n </>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA0CQ;AAxCR,mBAAyB;AACzB,0BAA+C;AAC/C,oBAAsE;AACtE,2BAA6B;AAC7B,oBAAuB;AACvB,4BAA8B;AAC9B,sBAAqB;AAKd,SAAS,eAAe;AAAA,EAC7B;AAAA,EAAM;AAAA,EAAS;AAAA,EAAM;AAAA,EAAU;AAAA,EAAW;AAAA,EAAQ;AACpD,GAQG;AACD,QAAM,QAAI,sBAAK;AACf,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAe,EAAE,MAAM,UAAU,CAAC;AAC1D,QAAM,OAAO,YAAY;AACvB,YAAQ,EAAE,MAAM,UAAU,CAAC;AAC3B,QAAI;AACF,cAAQ,EAAE,MAAM,QAAQ,WAAW,MAAM,OAAO,GAAG,SAAS,CAAC;AAAA,IAC/D,SAAS,KAAK;AACZ,cAAQ,EAAE,MAAM,SAAS,aAAS,qCAAc,GAAG,EAAE,QAAQ,CAAC;AAAA,IAChE;AAAA,EACF;AACA,QAAM,QAAQ,MAAM;AAClB,QAAI,KAAK,SAAS,UAAW;AAC7B,YAAQ,EAAE,MAAM,UAAU,CAAC;AAC3B,YAAQ;AAAA,EACV;AACA,SACE,4CAAC,wBAAO,MAAY,cAAc,CAAC,SAAS;AAAE,QAAI,CAAC,KAAM,OAAM;AAAA,EAAG,GAChE,uDAAC,+BAAc,WAAU,qBAAoB,WAAW,KAAK,SAAS,WACpE;AAAA,gDAAC,mCAAkB,WAAU,WAAW,YAAE,sBAAsB,GAAE;AAAA,IACjE,KAAK,SAAS,aACb,4EACE;AAAA,kDAAC,6BAAY,WAAU,yBAAyB,YAAE,+BAA+B,EAAE,UAAU,SAAS,SAAS,GAAG,KAAK,CAAC,GAAE;AAAA,MACzH,aAAa,4CAAC,OAAE,WAAU,iCAAiC,YAAE,UAAU,MAAM,UAAU,IAAI,GAAE;AAAA,MAC9F,4CAAC,qCAAa,OAAK,MAAC,KAAG,MAAC,SAAS,MAAM,KAAK,KAAK,GAAG,WAAU,UAAU,YAAE,cAAc,GAAE;AAAA,OAC5F;AAAA,IAED,KAAK,SAAS,aAAa,6CAAC,6BAAY,WAAU,iDAAgD;AAAA,kDAAC,+BAAQ,WAAU,wBAAuB;AAAA,MAAG,EAAE,eAAU;AAAA,OAAE;AAAA,IAC7J,KAAK,SAAS,UACb,4EACE;AAAA,mDAAC,6BAAY,WAAU,iDAAgD;AAAA,oDAAC,oCAAa,WAAU,2BAA0B;AAAA,QAAG,EAAE,QAAQ;AAAA,SAAE;AAAA,MACxI,4CAAC,wBAAO,SAAO,MAAC,sDAAC,OAAE,MAAM,eAAgB,YAAE,mBAAmB,GAAE,GAAI;AAAA,OACtE;AAAA,IAED,KAAK,SAAS,WACb,4EACE;AAAA,mDAAC,6BAAY,WAAU,iDAAgD;AAAA,oDAAC,+BAAQ,WAAU,4BAA2B;AAAA,QAAG,EAAE,YAAY;AAAA,SAAE;AAAA,MACxI,4CAAC,OAAE,WAAU,iCAAiC,eAAK,SAAQ;AAAA,MAC3D,4CAAC,wBAAO,SAAS,MAAM,KAAK,KAAK,GAAI,YAAE,WAAW,GAAE;AAAA,OACtD;AAAA,KAEJ,GACF;AAEJ;","names":[]}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Phrase } from '../../../i18n/translate.cjs';
|
|
2
3
|
|
|
3
4
|
declare function DropMintDialog({ open, onClose, name, quantity, totalText, onMint, portfolioHref, }: {
|
|
4
5
|
open: boolean;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
name: string;
|
|
7
8
|
quantity: bigint;
|
|
8
|
-
totalText:
|
|
9
|
+
totalText: Phrase | null;
|
|
9
10
|
onMint: () => Promise<{
|
|
10
11
|
tokenIds: string[];
|
|
11
12
|
}>;
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { Phrase } from '../../../i18n/translate.js';
|
|
2
3
|
|
|
3
4
|
declare function DropMintDialog({ open, onClose, name, quantity, totalText, onMint, portfolioHref, }: {
|
|
4
5
|
open: boolean;
|
|
5
6
|
onClose: () => void;
|
|
6
7
|
name: string;
|
|
7
8
|
quantity: bigint;
|
|
8
|
-
totalText:
|
|
9
|
+
totalText: Phrase | null;
|
|
9
10
|
onMint: () => Promise<{
|
|
10
11
|
tokenIds: string[];
|
|
11
12
|
}>;
|
|
@@ -37,7 +37,7 @@ function DropMintDialog({
|
|
|
37
37
|
/* @__PURE__ */ jsx(DialogDescription, { className: "sr-only", children: t("Mint from this drop.") }),
|
|
38
38
|
step.kind === "confirm" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
39
39
|
/* @__PURE__ */ jsx(DialogTitle, { className: "text-lg font-semibold", children: t("Mint {quantity} from {name}", { quantity: quantity.toString(), name }) }),
|
|
40
|
-
totalText && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: totalText }),
|
|
40
|
+
totalText && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: t(totalText.text, totalText.vars) }),
|
|
41
41
|
/* @__PURE__ */ jsx(ActionButton, { solid: true, big: true, onClick: () => void mint(), className: "w-full", children: t("Confirm mint") })
|
|
42
42
|
] }),
|
|
43
43
|
step.kind === "minting" && /* @__PURE__ */ jsxs(DialogTitle, { className: "flex items-center gap-2 text-lg font-semibold", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drop/page/drop-mint-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../../dialog.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { Button } from \"../../button.js\";\nimport { describeError } from \"../../../utils/describe-error.js\";\nimport { useT } from \"../../../i18n/provider.js\";\n\ntype Step = { kind: \"confirm\" } | { kind: \"minting\" } | { kind: \"done\"; tokenIds: string[] } | { kind: \"error\"; message: string };\n\nexport function DropMintDialog({\n open, onClose, name, quantity, totalText, onMint, portfolioHref,\n}: {\n open: boolean;\n onClose: () => void;\n name: string;\n quantity: bigint;\n totalText:
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-mint-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { Dialog, DialogContent, DialogDescription, DialogTitle } from \"../../dialog.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { Button } from \"../../button.js\";\nimport { describeError } from \"../../../utils/describe-error.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport type { Phrase } from \"../../../i18n/translate.js\";\n\ntype Step = { kind: \"confirm\" } | { kind: \"minting\" } | { kind: \"done\"; tokenIds: string[] } | { kind: \"error\"; message: string };\n\nexport function DropMintDialog({\n open, onClose, name, quantity, totalText, onMint, portfolioHref,\n}: {\n open: boolean;\n onClose: () => void;\n name: string;\n quantity: bigint;\n totalText: Phrase | null;\n onMint: () => Promise<{ tokenIds: string[] }>;\n portfolioHref: string;\n}) {\n const t = useT();\n const [step, setStep] = useState<Step>({ kind: \"confirm\" });\n const mint = async () => {\n setStep({ kind: \"minting\" });\n try {\n setStep({ kind: \"done\", tokenIds: (await onMint()).tokenIds });\n } catch (err) {\n setStep({ kind: \"error\", message: describeError(err).message });\n }\n };\n const close = () => {\n if (step.kind === \"minting\") return;\n setStep({ kind: \"confirm\" });\n onClose();\n };\n return (\n <Dialog open={open} onOpenChange={(next) => { if (!next) close(); }}>\n <DialogContent className=\"gap-5 sm:max-w-md\" hideClose={step.kind === \"minting\"}>\n <DialogDescription className=\"sr-only\">{t(\"Mint from this drop.\")}</DialogDescription>\n {step.kind === \"confirm\" && (\n <>\n <DialogTitle className=\"text-lg font-semibold\">{t(\"Mint {quantity} from {name}\", { quantity: quantity.toString(), name })}</DialogTitle>\n {totalText && <p className=\"text-sm text-muted-foreground\">{t(totalText.text, totalText.vars)}</p>}\n <ActionButton solid big onClick={() => void mint()} className=\"w-full\">{t(\"Confirm mint\")}</ActionButton>\n </>\n )}\n {step.kind === \"minting\" && <DialogTitle className=\"flex items-center gap-2 text-lg font-semibold\"><Loader2 className=\"h-4 w-4 animate-spin\" />{t(\"Minting…\")}</DialogTitle>}\n {step.kind === \"done\" && (\n <>\n <DialogTitle className=\"flex items-center gap-2 text-lg font-semibold\"><CheckCircle2 className=\"h-5 w-5 text-brand-blue\" />{t(\"Minted\")}</DialogTitle>\n <Button asChild><a href={portfolioHref}>{t(\"View in portfolio\")}</a></Button>\n </>\n )}\n {step.kind === \"error\" && (\n <>\n <DialogTitle className=\"flex items-center gap-2 text-lg font-semibold\"><XCircle className=\"h-4 w-4 text-destructive\" />{t(\"Not minted\")}</DialogTitle>\n <p className=\"text-sm text-muted-foreground\">{step.message}</p>\n <Button onClick={() => void mint()}>{t(\"Try again\")}</Button>\n </>\n )}\n </DialogContent>\n </Dialog>\n );\n}\n"],"mappings":";AA0CQ,SAEE,UAFF,KAEE,YAFF;AAxCR,SAAS,gBAAgB;AACzB,SAAS,cAAc,SAAS,eAAe;AAC/C,SAAS,QAAQ,eAAe,mBAAmB,mBAAmB;AACtE,SAAS,oBAAoB;AAC7B,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AAKd,SAAS,eAAe;AAAA,EAC7B;AAAA,EAAM;AAAA,EAAS;AAAA,EAAM;AAAA,EAAU;A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DAAgD;AAAA,4BAAC,gBAAa,WAAU,2BAA0B;AAAA,QAAG,EAAE,QAAQ;AAAA,SAAE;AAAA,MACxI,oBAAC,UAAO,SAAO,MAAC,8BAAC,OAAE,MAAM,eAAgB,YAAE,mBAAmB,GAAE,GAAI;AAAA,OACtE;AAAA,IAED,KAAK,SAAS,WACb,iCACE;AAAA,2BAAC,eAAY,WAAU,iDAAgD;AAAA,4BAAC,WAAQ,WAAU,4BAA2B;AAAA,QAAG,EAAE,YAAY;AAAA,SAAE;AAAA,MACxI,oBAAC,OAAE,WAAU,iCAAiC,eAAK,SAAQ;AAAA,MAC3D,oBAAC,UAAO,SAAS,MAAM,KAAK,KAAK,GAAI,YAAE,WAAW,GAAE;AAAA,OACtD;AAAA,KAEJ,GACF;AAEJ;","names":[]}
|
|
@@ -47,7 +47,6 @@ var import_drop_action_box = require("./drop-action-box.js");
|
|
|
47
47
|
var import_drop_activity = require("./drop-activity.js");
|
|
48
48
|
var import_drop_manage = require("./drop-manage.js");
|
|
49
49
|
var import_drop_mint_dialog = require("./drop-mint-dialog.js");
|
|
50
|
-
var import_action_button = require("../../action-button.js");
|
|
51
50
|
var import_use_collections = require("../../../utils/use-collections.js");
|
|
52
51
|
var import_use_drops = require("../../../utils/use-drops.js");
|
|
53
52
|
var import_use_now = require("../../../utils/drop/use-now.js");
|
|
@@ -59,6 +58,7 @@ var import_use_image_url = require("../../../utils/use-image-url.js");
|
|
|
59
58
|
var import_provider = require("../../../i18n/provider.js");
|
|
60
59
|
function DropPage(props) {
|
|
61
60
|
const t = (0, import_provider.useT)();
|
|
61
|
+
const locale = (0, import_provider.useLocale)();
|
|
62
62
|
const resolveImage = (0, import_use_image_url.useImageUrl)();
|
|
63
63
|
const app = (0, import_medialane_app.useMedialaneApp)();
|
|
64
64
|
const { contract } = props;
|
|
@@ -93,9 +93,9 @@ function DropPage(props) {
|
|
|
93
93
|
const onchain = chain.drop;
|
|
94
94
|
const priced = feeBps === null ? null : onchain;
|
|
95
95
|
const mint = (0, import_starknet.dropMintState)({ drop: priced, wallet: walletAddress, claimed: chain.claimed, proof, balance: chain.balance, feeBps: feeBps ?? 0, now });
|
|
96
|
-
const view = priced ? (0, import_view.actionBoxView)({ drop: priced, mint, quantity, feeBps, now }) : null;
|
|
96
|
+
const view = priced ? (0, import_view.actionBoxView)({ drop: priced, mint, quantity, feeBps, now, locale }) : null;
|
|
97
97
|
const isOrganizer = !!walletAddress && !!onchain && BigInt(walletAddress) === BigInt(onchain.organizer);
|
|
98
|
-
const art = resolveImage(
|
|
98
|
+
const art = resolveImage(indexed?.image ?? collectionFile?.image ?? firstToken?.image);
|
|
99
99
|
const name = indexed?.name ?? "Drop";
|
|
100
100
|
const deps = async () => ({ client: getClient(), signer: await app.getSigner() });
|
|
101
101
|
const onAction = () => {
|
|
@@ -103,7 +103,7 @@ function DropPage(props) {
|
|
|
103
103
|
if (view.button.action === "sign-in") app.onRequireWallet();
|
|
104
104
|
if (view.button.action === "mint") setMinting(true);
|
|
105
105
|
};
|
|
106
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-10
|
|
106
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-10", children: [
|
|
107
107
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-8 lg:grid-cols-2 lg:gap-10", children: [
|
|
108
108
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative aspect-square overflow-hidden rounded-2xl bg-muted", children: art && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: art, alt: name, fill: true, unoptimized: true, className: "object-cover" }) }),
|
|
109
109
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-5", children: [
|
|
@@ -114,13 +114,9 @@ function DropPage(props) {
|
|
|
114
114
|
] }),
|
|
115
115
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_share_button.ShareButton, { title: name, variant: "soft", size: "sm" })
|
|
116
116
|
] }),
|
|
117
|
-
view && onchain && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
117
|
+
view && onchain && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_action_box.DropActionBox, { view, minted: onchain.totalMinted, maxSupply: onchain.maxSupply, quantity, onQuantity: setQuantity, onAction })
|
|
118
118
|
] })
|
|
119
119
|
] }),
|
|
120
|
-
view && onchain && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lg:hidden", children: [
|
|
121
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_action_box.DropActionBox, { view, minted: onchain.totalMinted, maxSupply: onchain.maxSupply, quantity, onQuantity: setQuantity, onAction }),
|
|
122
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/95 p-3 backdrop-blur", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { solid: true, disabled: view.button.action === "none", onClick: onAction, className: "w-full", children: t(view.button.label) }) })
|
|
123
|
-
] }),
|
|
124
120
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tabs.Tabs, { defaultValue: props.initialTab === "manage" && isOrganizer ? "manage" : "about", children: [
|
|
125
121
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tabs.TabsList, { children: [
|
|
126
122
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTrigger, { value: "about", children: t("About") }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drop/page/drop-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo, useState } from \"react\";\nimport { Package } from \"lucide-react\";\nimport { dropMintState } from \"@medialane/sdk/starknet\";\nimport Image from \"../../image.js\";\nimport { CreatorChip } from \"../../creator-chip.js\";\nimport { ShareButton } from \"../../share-button.js\";\nimport { Skeleton } from \"../../skeleton.js\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"../../tabs.js\";\nimport { AssetLicenseSummary } from \"../../asset-license-summary.js\";\nimport { TokenCard } from \"../../token-card.js\";\nimport { DropActionBox } from \"./drop-action-box.js\";\nimport { DropActivityList } from \"./drop-activity.js\";\nimport { DropManage } from \"./drop-manage.js\";\nimport { DropMintDialog } from \"./drop-mint-dialog.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { useCollectionTokens } from \"../../../utils/use-collections.js\";\nimport { useDrop, useDropChain, useDropFee, useDropFile, useDropMints } from \"../../../utils/use-drops.js\";\nimport { useNow } from \"../../../utils/drop/use-now.js\";\nimport { actionBoxView } from \"../../../utils/drop/view.js\";\nimport { claimProofFor } from \"../../../utils/drop/claim-proof.js\";\nimport { manageDrop, mintDrop, saveExclusiveContent } from \"../../../utils/drop/actions.js\";\nimport { useMedialaneApp } from \"../../medialane-app.js\";\nimport { useImageUrl } from \"../../../utils/use-image-url.js\";\nimport { useT } from \"../../../i18n/provider.js\";\n\ntype TokenFile = { image?: string; attributes?: { trait_type?: string; value?: string }[] };\n\nexport function DropPage(props: { contract: string; initialTab?: string; portfolioHref?: string }) {\n const t = useT();\n const resolveImage = useImageUrl();\n const app = useMedialaneApp();\n const { contract } = props;\n const { getClient, walletAddress } = app;\n const { drop: indexed, isLoading } = useDrop(contract);\n const chain = useDropChain(contract, walletAddress);\n const { mints, mutate: refreshMints } = useDropMints(contract);\n const feeBps = useDropFee();\n const collectionFile = useDropFile<{ drop_kind?: string }>(indexed?.baseUri ?? null, \"collection.json\");\n const isCollection = collectionFile?.drop_kind === \"collection\";\n const firstToken = useDropFile<TokenFile>(indexed?.baseUri ?? null, \"1\");\n const { tokens } = useCollectionTokens(isCollection ? contract : null, 1, 24);\n const now = useNow();\n const [quantity, setQuantity] = useState(1n);\n const [minting, setMinting] = useState(false);\n const proof = useMemo(\n () => (typeof window === \"undefined\" ? null : claimProofFor(window.localStorage, contract, window.location.hash, \"drop-proof\")),\n [contract],\n );\n\n if (isLoading && !chain.drop) {\n return <div className=\"grid gap-8 lg:grid-cols-2\"><Skeleton className=\"aspect-square rounded-2xl\" /><Skeleton className=\"h-96 rounded-2xl\" /></div>;\n }\n if (!indexed && !chain.drop) {\n return (\n <div className=\"space-y-3 py-24 text-center\">\n <Package className=\"mx-auto h-10 w-10 text-muted-foreground/30\" />\n <p className=\"text-sm text-muted-foreground\">{t(\"New drops appear within a minute.\")}</p>\n </div>\n );\n }\n\n const onchain = chain.drop;\n const priced = feeBps === null ? null : onchain;\n const mint = dropMintState({ drop: priced, wallet: walletAddress, claimed: chain.claimed, proof, balance: chain.balance, feeBps: feeBps ?? 0, now });\n const view = priced ? actionBoxView({ drop: priced, mint, quantity, feeBps: feeBps!, now }) : null;\n const isOrganizer = !!walletAddress && !!onchain && BigInt(walletAddress) === BigInt(onchain.organizer);\n const art = resolveImage(firstToken?.image ?? indexed?.image);\n const name = indexed?.name ?? \"Drop\";\n const deps = async () => ({ client: getClient(), signer: await app.getSigner() });\n\n const onAction = () => {\n if (!view) return;\n if (view.button.action === \"sign-in\") app.onRequireWallet();\n if (view.button.action === \"mint\") setMinting(true);\n };\n\n return (\n <div className=\"space-y-10 pb-28 lg:pb-0\">\n <div className=\"grid gap-8 lg:grid-cols-2 lg:gap-10\">\n <div className=\"relative aspect-square overflow-hidden rounded-2xl bg-muted\">\n {art && <Image src={art} alt={name} fill unoptimized className=\"object-cover\" />}\n </div>\n <div className=\"space-y-5\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"space-y-1\">\n <h1 className=\"text-3xl font-semibold\">{name}</h1>\n {onchain && <CreatorChip address={onchain.organizer} />}\n </div>\n <ShareButton title={name} variant=\"soft\" size=\"sm\" />\n </div>\n {view && onchain && (\n <div className=\"hidden lg:block\">\n <DropActionBox view={view} minted={onchain.totalMinted} maxSupply={onchain.maxSupply} quantity={quantity} onQuantity={setQuantity} onAction={onAction} />\n </div>\n )}\n </div>\n </div>\n\n {view && onchain && (\n <div className=\"lg:hidden\">\n <DropActionBox view={view} minted={onchain.totalMinted} maxSupply={onchain.maxSupply} quantity={quantity} onQuantity={setQuantity} onAction={onAction} />\n <div className=\"fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/95 p-3 backdrop-blur\">\n <ActionButton solid disabled={view.button.action === \"none\"} onClick={onAction} className=\"w-full\">{t(view.button.label)}</ActionButton>\n </div>\n </div>\n )}\n\n <Tabs defaultValue={props.initialTab === \"manage\" && isOrganizer ? \"manage\" : \"about\"}>\n <TabsList>\n <TabsTrigger value=\"about\">{t(\"About\")}</TabsTrigger>\n {isCollection && <TabsTrigger value=\"items\">{t(\"Items\")}</TabsTrigger>}\n <TabsTrigger value=\"activity\">{t(\"Activity\")}</TabsTrigger>\n <TabsTrigger value=\"license\">{t(\"License\")}</TabsTrigger>\n {isOrganizer && <TabsTrigger value=\"manage\">{t(\"Manage\")}</TabsTrigger>}\n </TabsList>\n <TabsContent value=\"about\" className=\"pt-6\">\n <p className=\"whitespace-pre-line text-sm leading-relaxed text-muted-foreground\">{indexed?.description || t(\"No description.\")}</p>\n </TabsContent>\n {isCollection && (\n <TabsContent value=\"items\" className=\"pt-6\">\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">{tokens.map((t) => <TokenCard key={t.tokenId} token={t} />)}</div>\n </TabsContent>\n )}\n <TabsContent value=\"activity\" className=\"pt-6\"><DropActivityList mints={mints} /></TabsContent>\n <TabsContent value=\"license\" className=\"pt-6\"><AssetLicenseSummary attributes={firstToken?.attributes ?? []} /></TabsContent>\n {isOrganizer && onchain && (\n <TabsContent value=\"manage\" className=\"pt-6\">\n <DropManage\n contract={contract}\n indexed={indexed}\n onchain={onchain}\n mints={mints}\n run={async (params) => {\n await manageDrop(await deps(), { owner: walletAddress!, collection: contract, ...params });\n await Promise.all([chain.mutate(), refreshMints()]);\n }}\n saveExclusive={(value) => saveExclusiveContent(getClient(), contract, value)}\n />\n </TabsContent>\n )}\n </Tabs>\n\n {view && minting && (\n <DropMintDialog\n open\n onClose={() => setMinting(false)}\n name={name}\n quantity={quantity > view.maxQuantity ? view.maxQuantity : quantity}\n totalText={view.totalText}\n portfolioHref={props.portfolioHref ?? \"/portfolio\"}\n onMint={async () => {\n const res = await mintDrop(await deps(), { claimer: walletAddress!, collection: contract, quantity: quantity > view.maxQuantity ? view.maxQuantity : quantity, proof });\n await Promise.all([chain.mutate(), refreshMints()]);\n return res;\n }}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDW;AAlDX,mBAAkC;AAClC,0BAAwB;AACxB,sBAA8B;AAC9B,mBAAkB;AAClB,0BAA4B;AAC5B,0BAA4B;AAC5B,sBAAyB;AACzB,kBAAyD;AACzD,mCAAoC;AACpC,wBAA0B;AAC1B,6BAA8B;AAC9B,2BAAiC;AACjC,yBAA2B;AAC3B,8BAA+B;AAC/B,2BAA6B;AAC7B,6BAAoC;AACpC,uBAA6E;AAC7E,qBAAuB;AACvB,kBAA8B;AAC9B,yBAA8B;AAC9B,qBAA2D;AAC3D,2BAAgC;AAChC,2BAA4B;AAC5B,sBAAqB;AAId,SAAS,SAAS,OAA0E;AACjG,QAAM,QAAI,sBAAK;AACf,QAAM,mBAAe,kCAAY;AACjC,QAAM,UAAM,sCAAgB;AAC5B,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,WAAW,cAAc,IAAI;AACrC,QAAM,EAAE,MAAM,SAAS,UAAU,QAAI,0BAAQ,QAAQ;AACrD,QAAM,YAAQ,+BAAa,UAAU,aAAa;AAClD,QAAM,EAAE,OAAO,QAAQ,aAAa,QAAI,+BAAa,QAAQ;AAC7D,QAAM,aAAS,6BAAW;AAC1B,QAAM,qBAAiB,8BAAoC,SAAS,WAAW,MAAM,iBAAiB;AACtG,QAAM,eAAe,gBAAgB,cAAc;AACnD,QAAM,iBAAa,8BAAuB,SAAS,WAAW,MAAM,GAAG;AACvE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A;AAAA,QACC,MAAI;AAAA,QACJ,SAAS,MAAM,WAAW,KAAK;AAAA,QAC/B;AAAA,QACA,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc;AAAA,QAC3D,WAAW,KAAK;AAAA,QAChB,eAAe,MAAM,iBAAiB;AAAA,QACtC,QAAQ,YAAY;AAClB,gBAAM,MAAM,UAAM,yBAAS,MAAM,KAAK,GAAG,EAAE,SAAS,eAAgB,YAAY,UAAU,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc,UAAU,MAAM,CAAC;AACtK,gBAAM,QAAQ,IAAI,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC;AAClD,iBAAO;AAAA,QACT;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":["Image","t"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo, useState } from \"react\";\nimport { Package } from \"lucide-react\";\nimport { dropMintState } from \"@medialane/sdk/starknet\";\nimport Image from \"../../image.js\";\nimport { CreatorChip } from \"../../creator-chip.js\";\nimport { ShareButton } from \"../../share-button.js\";\nimport { Skeleton } from \"../../skeleton.js\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"../../tabs.js\";\nimport { AssetLicenseSummary } from \"../../asset-license-summary.js\";\nimport { TokenCard } from \"../../token-card.js\";\nimport { DropActionBox } from \"./drop-action-box.js\";\nimport { DropActivityList } from \"./drop-activity.js\";\nimport { DropManage } from \"./drop-manage.js\";\nimport { DropMintDialog } from \"./drop-mint-dialog.js\";\nimport { useCollectionTokens } from \"../../../utils/use-collections.js\";\nimport { useDrop, useDropChain, useDropFee, useDropFile, useDropMints } from \"../../../utils/use-drops.js\";\nimport { useNow } from \"../../../utils/drop/use-now.js\";\nimport { actionBoxView } from \"../../../utils/drop/view.js\";\nimport { claimProofFor } from \"../../../utils/drop/claim-proof.js\";\nimport { manageDrop, mintDrop, saveExclusiveContent } from \"../../../utils/drop/actions.js\";\nimport { useMedialaneApp } from \"../../medialane-app.js\";\nimport { useImageUrl } from \"../../../utils/use-image-url.js\";\nimport { useLocale, useT } from \"../../../i18n/provider.js\";\n\ntype TokenFile = { image?: string; attributes?: { trait_type?: string; value?: string }[] };\n\nexport function DropPage(props: { contract: string; initialTab?: string; portfolioHref?: string }) {\n const t = useT();\n const locale = useLocale();\n const resolveImage = useImageUrl();\n const app = useMedialaneApp();\n const { contract } = props;\n const { getClient, walletAddress } = app;\n const { drop: indexed, isLoading } = useDrop(contract);\n const chain = useDropChain(contract, walletAddress);\n const { mints, mutate: refreshMints } = useDropMints(contract);\n const feeBps = useDropFee();\n const collectionFile = useDropFile<{ drop_kind?: string; image?: string | null }>(indexed?.baseUri ?? null, \"collection.json\");\n const isCollection = collectionFile?.drop_kind === \"collection\";\n const firstToken = useDropFile<TokenFile>(indexed?.baseUri ?? null, \"1\");\n const { tokens } = useCollectionTokens(isCollection ? contract : null, 1, 24);\n const now = useNow();\n const [quantity, setQuantity] = useState(1n);\n const [minting, setMinting] = useState(false);\n const proof = useMemo(\n () => (typeof window === \"undefined\" ? null : claimProofFor(window.localStorage, contract, window.location.hash, \"drop-proof\")),\n [contract],\n );\n\n if (isLoading && !chain.drop) {\n return <div className=\"grid gap-8 lg:grid-cols-2\"><Skeleton className=\"aspect-square rounded-2xl\" /><Skeleton className=\"h-96 rounded-2xl\" /></div>;\n }\n if (!indexed && !chain.drop) {\n return (\n <div className=\"space-y-3 py-24 text-center\">\n <Package className=\"mx-auto h-10 w-10 text-muted-foreground/30\" />\n <p className=\"text-sm text-muted-foreground\">{t(\"New drops appear within a minute.\")}</p>\n </div>\n );\n }\n\n const onchain = chain.drop;\n const priced = feeBps === null ? null : onchain;\n const mint = dropMintState({ drop: priced, wallet: walletAddress, claimed: chain.claimed, proof, balance: chain.balance, feeBps: feeBps ?? 0, now });\n const view = priced ? actionBoxView({ drop: priced, mint, quantity, feeBps: feeBps!, now, locale }) : null;\n const isOrganizer = !!walletAddress && !!onchain && BigInt(walletAddress) === BigInt(onchain.organizer);\n const art = resolveImage(indexed?.image ?? collectionFile?.image ?? firstToken?.image);\n const name = indexed?.name ?? \"Drop\";\n const deps = async () => ({ client: getClient(), signer: await app.getSigner() });\n\n const onAction = () => {\n if (!view) return;\n if (view.button.action === \"sign-in\") app.onRequireWallet();\n if (view.button.action === \"mint\") setMinting(true);\n };\n\n return (\n <div className=\"space-y-10\">\n <div className=\"grid gap-8 lg:grid-cols-2 lg:gap-10\">\n <div className=\"relative aspect-square overflow-hidden rounded-2xl bg-muted\">\n {art && <Image src={art} alt={name} fill unoptimized className=\"object-cover\" />}\n </div>\n <div className=\"space-y-5\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"space-y-1\">\n <h1 className=\"text-3xl font-semibold\">{name}</h1>\n {onchain && <CreatorChip address={onchain.organizer} />}\n </div>\n <ShareButton title={name} variant=\"soft\" size=\"sm\" />\n </div>\n {view && onchain && (\n <DropActionBox view={view} minted={onchain.totalMinted} maxSupply={onchain.maxSupply} quantity={quantity} onQuantity={setQuantity} onAction={onAction} />\n )}\n </div>\n </div>\n\n <Tabs defaultValue={props.initialTab === \"manage\" && isOrganizer ? \"manage\" : \"about\"}>\n <TabsList>\n <TabsTrigger value=\"about\">{t(\"About\")}</TabsTrigger>\n {isCollection && <TabsTrigger value=\"items\">{t(\"Items\")}</TabsTrigger>}\n <TabsTrigger value=\"activity\">{t(\"Activity\")}</TabsTrigger>\n <TabsTrigger value=\"license\">{t(\"License\")}</TabsTrigger>\n {isOrganizer && <TabsTrigger value=\"manage\">{t(\"Manage\")}</TabsTrigger>}\n </TabsList>\n <TabsContent value=\"about\" className=\"pt-6\">\n <p className=\"whitespace-pre-line text-sm leading-relaxed text-muted-foreground\">{indexed?.description || t(\"No description.\")}</p>\n </TabsContent>\n {isCollection && (\n <TabsContent value=\"items\" className=\"pt-6\">\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">{tokens.map((t) => <TokenCard key={t.tokenId} token={t} />)}</div>\n </TabsContent>\n )}\n <TabsContent value=\"activity\" className=\"pt-6\"><DropActivityList mints={mints} /></TabsContent>\n <TabsContent value=\"license\" className=\"pt-6\"><AssetLicenseSummary attributes={firstToken?.attributes ?? []} /></TabsContent>\n {isOrganizer && onchain && (\n <TabsContent value=\"manage\" className=\"pt-6\">\n <DropManage\n contract={contract}\n indexed={indexed}\n onchain={onchain}\n mints={mints}\n run={async (params) => {\n await manageDrop(await deps(), { owner: walletAddress!, collection: contract, ...params });\n await Promise.all([chain.mutate(), refreshMints()]);\n }}\n saveExclusive={(value) => saveExclusiveContent(getClient(), contract, value)}\n />\n </TabsContent>\n )}\n </Tabs>\n\n {view && minting && (\n <DropMintDialog\n open\n onClose={() => setMinting(false)}\n name={name}\n quantity={quantity > view.maxQuantity ? view.maxQuantity : quantity}\n totalText={view.totalText}\n portfolioHref={props.portfolioHref ?? \"/portfolio\"}\n onMint={async () => {\n const res = await mintDrop(await deps(), { claimer: walletAddress!, collection: contract, quantity: quantity > view.maxQuantity ? view.maxQuantity : quantity, proof });\n await Promise.all([chain.mutate(), refreshMints()]);\n return res;\n }}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDW;AAlDX,mBAAkC;AAClC,0BAAwB;AACxB,sBAA8B;AAC9B,mBAAkB;AAClB,0BAA4B;AAC5B,0BAA4B;AAC5B,sBAAyB;AACzB,kBAAyD;AACzD,mCAAoC;AACpC,wBAA0B;AAC1B,6BAA8B;AAC9B,2BAAiC;AACjC,yBAA2B;AAC3B,8BAA+B;AAC/B,6BAAoC;AACpC,uBAA6E;AAC7E,qBAAuB;AACvB,kBAA8B;AAC9B,yBAA8B;AAC9B,qBAA2D;AAC3D,2BAAgC;AAChC,2BAA4B;AAC5B,sBAAgC;AAIzB,SAAS,SAAS,OAA0E;AACjG,QAAM,QAAI,sBAAK;AACf,QAAM,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AA,UACA,eAAe,CAAC,cAAU,qCAAqB,UAAU,GAAG,UAAU,KAAK;AAAA;AAAA,MAC7E,GACF;AAAA,OAEJ;AAAA,IAEC,QAAQ,WACP;AAAA,MAAC;AAAA;AAAA,QACC,MAAI;AAAA,QACJ,SAAS,MAAM,WAAW,KAAK;AAAA,QAC/B;AAAA,QACA,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc;AAAA,QAC3D,WAAW,KAAK;AAAA,QAChB,eAAe,MAAM,iBAAiB;AAAA,QACtC,QAAQ,YAAY;AAClB,gBAAM,MAAM,UAAM,yBAAS,MAAM,KAAK,GAAG,EAAE,SAAS,eAAgB,YAAY,UAAU,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc,UAAU,MAAM,CAAC;AACtK,gBAAM,QAAQ,IAAI,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC;AAClD,iBAAO;AAAA,QACT;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":["Image","t"]}
|
|
@@ -14,7 +14,6 @@ import { DropActionBox } from "./drop-action-box.js";
|
|
|
14
14
|
import { DropActivityList } from "./drop-activity.js";
|
|
15
15
|
import { DropManage } from "./drop-manage.js";
|
|
16
16
|
import { DropMintDialog } from "./drop-mint-dialog.js";
|
|
17
|
-
import { ActionButton } from "../../action-button.js";
|
|
18
17
|
import { useCollectionTokens } from "../../../utils/use-collections.js";
|
|
19
18
|
import { useDrop, useDropChain, useDropFee, useDropFile, useDropMints } from "../../../utils/use-drops.js";
|
|
20
19
|
import { useNow } from "../../../utils/drop/use-now.js";
|
|
@@ -23,9 +22,10 @@ import { claimProofFor } from "../../../utils/drop/claim-proof.js";
|
|
|
23
22
|
import { manageDrop, mintDrop, saveExclusiveContent } from "../../../utils/drop/actions.js";
|
|
24
23
|
import { useMedialaneApp } from "../../medialane-app.js";
|
|
25
24
|
import { useImageUrl } from "../../../utils/use-image-url.js";
|
|
26
|
-
import { useT } from "../../../i18n/provider.js";
|
|
25
|
+
import { useLocale, useT } from "../../../i18n/provider.js";
|
|
27
26
|
function DropPage(props) {
|
|
28
27
|
const t = useT();
|
|
28
|
+
const locale = useLocale();
|
|
29
29
|
const resolveImage = useImageUrl();
|
|
30
30
|
const app = useMedialaneApp();
|
|
31
31
|
const { contract } = props;
|
|
@@ -60,9 +60,9 @@ function DropPage(props) {
|
|
|
60
60
|
const onchain = chain.drop;
|
|
61
61
|
const priced = feeBps === null ? null : onchain;
|
|
62
62
|
const mint = dropMintState({ drop: priced, wallet: walletAddress, claimed: chain.claimed, proof, balance: chain.balance, feeBps: feeBps ?? 0, now });
|
|
63
|
-
const view = priced ? actionBoxView({ drop: priced, mint, quantity, feeBps, now }) : null;
|
|
63
|
+
const view = priced ? actionBoxView({ drop: priced, mint, quantity, feeBps, now, locale }) : null;
|
|
64
64
|
const isOrganizer = !!walletAddress && !!onchain && BigInt(walletAddress) === BigInt(onchain.organizer);
|
|
65
|
-
const art = resolveImage(
|
|
65
|
+
const art = resolveImage(indexed?.image ?? collectionFile?.image ?? firstToken?.image);
|
|
66
66
|
const name = indexed?.name ?? "Drop";
|
|
67
67
|
const deps = async () => ({ client: getClient(), signer: await app.getSigner() });
|
|
68
68
|
const onAction = () => {
|
|
@@ -70,7 +70,7 @@ function DropPage(props) {
|
|
|
70
70
|
if (view.button.action === "sign-in") app.onRequireWallet();
|
|
71
71
|
if (view.button.action === "mint") setMinting(true);
|
|
72
72
|
};
|
|
73
|
-
return /* @__PURE__ */ jsxs("div", { className: "space-y-10
|
|
73
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-10", children: [
|
|
74
74
|
/* @__PURE__ */ jsxs("div", { className: "grid gap-8 lg:grid-cols-2 lg:gap-10", children: [
|
|
75
75
|
/* @__PURE__ */ jsx("div", { className: "relative aspect-square overflow-hidden rounded-2xl bg-muted", children: art && /* @__PURE__ */ jsx(Image, { src: art, alt: name, fill: true, unoptimized: true, className: "object-cover" }) }),
|
|
76
76
|
/* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
@@ -81,13 +81,9 @@ function DropPage(props) {
|
|
|
81
81
|
] }),
|
|
82
82
|
/* @__PURE__ */ jsx(ShareButton, { title: name, variant: "soft", size: "sm" })
|
|
83
83
|
] }),
|
|
84
|
-
view && onchain && /* @__PURE__ */ jsx(
|
|
84
|
+
view && onchain && /* @__PURE__ */ jsx(DropActionBox, { view, minted: onchain.totalMinted, maxSupply: onchain.maxSupply, quantity, onQuantity: setQuantity, onAction })
|
|
85
85
|
] })
|
|
86
86
|
] }),
|
|
87
|
-
view && onchain && /* @__PURE__ */ jsxs("div", { className: "lg:hidden", children: [
|
|
88
|
-
/* @__PURE__ */ jsx(DropActionBox, { view, minted: onchain.totalMinted, maxSupply: onchain.maxSupply, quantity, onQuantity: setQuantity, onAction }),
|
|
89
|
-
/* @__PURE__ */ jsx("div", { className: "fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/95 p-3 backdrop-blur", children: /* @__PURE__ */ jsx(ActionButton, { solid: true, disabled: view.button.action === "none", onClick: onAction, className: "w-full", children: t(view.button.label) }) })
|
|
90
|
-
] }),
|
|
91
87
|
/* @__PURE__ */ jsxs(Tabs, { defaultValue: props.initialTab === "manage" && isOrganizer ? "manage" : "about", children: [
|
|
92
88
|
/* @__PURE__ */ jsxs(TabsList, { children: [
|
|
93
89
|
/* @__PURE__ */ jsx(TabsTrigger, { value: "about", children: t("About") }),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drop/page/drop-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo, useState } from \"react\";\nimport { Package } from \"lucide-react\";\nimport { dropMintState } from \"@medialane/sdk/starknet\";\nimport Image from \"../../image.js\";\nimport { CreatorChip } from \"../../creator-chip.js\";\nimport { ShareButton } from \"../../share-button.js\";\nimport { Skeleton } from \"../../skeleton.js\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"../../tabs.js\";\nimport { AssetLicenseSummary } from \"../../asset-license-summary.js\";\nimport { TokenCard } from \"../../token-card.js\";\nimport { DropActionBox } from \"./drop-action-box.js\";\nimport { DropActivityList } from \"./drop-activity.js\";\nimport { DropManage } from \"./drop-manage.js\";\nimport { DropMintDialog } from \"./drop-mint-dialog.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { useCollectionTokens } from \"../../../utils/use-collections.js\";\nimport { useDrop, useDropChain, useDropFee, useDropFile, useDropMints } from \"../../../utils/use-drops.js\";\nimport { useNow } from \"../../../utils/drop/use-now.js\";\nimport { actionBoxView } from \"../../../utils/drop/view.js\";\nimport { claimProofFor } from \"../../../utils/drop/claim-proof.js\";\nimport { manageDrop, mintDrop, saveExclusiveContent } from \"../../../utils/drop/actions.js\";\nimport { useMedialaneApp } from \"../../medialane-app.js\";\nimport { useImageUrl } from \"../../../utils/use-image-url.js\";\nimport { useT } from \"../../../i18n/provider.js\";\n\ntype TokenFile = { image?: string; attributes?: { trait_type?: string; value?: string }[] };\n\nexport function DropPage(props: { contract: string; initialTab?: string; portfolioHref?: string }) {\n const t = useT();\n const resolveImage = useImageUrl();\n const app = useMedialaneApp();\n const { contract } = props;\n const { getClient, walletAddress } = app;\n const { drop: indexed, isLoading } = useDrop(contract);\n const chain = useDropChain(contract, walletAddress);\n const { mints, mutate: refreshMints } = useDropMints(contract);\n const feeBps = useDropFee();\n const collectionFile = useDropFile<{ drop_kind?: string }>(indexed?.baseUri ?? null, \"collection.json\");\n const isCollection = collectionFile?.drop_kind === \"collection\";\n const firstToken = useDropFile<TokenFile>(indexed?.baseUri ?? null, \"1\");\n const { tokens } = useCollectionTokens(isCollection ? contract : null, 1, 24);\n const now = useNow();\n const [quantity, setQuantity] = useState(1n);\n const [minting, setMinting] = useState(false);\n const proof = useMemo(\n () => (typeof window === \"undefined\" ? null : claimProofFor(window.localStorage, contract, window.location.hash, \"drop-proof\")),\n [contract],\n );\n\n if (isLoading && !chain.drop) {\n return <div className=\"grid gap-8 lg:grid-cols-2\"><Skeleton className=\"aspect-square rounded-2xl\" /><Skeleton className=\"h-96 rounded-2xl\" /></div>;\n }\n if (!indexed && !chain.drop) {\n return (\n <div className=\"space-y-3 py-24 text-center\">\n <Package className=\"mx-auto h-10 w-10 text-muted-foreground/30\" />\n <p className=\"text-sm text-muted-foreground\">{t(\"New drops appear within a minute.\")}</p>\n </div>\n );\n }\n\n const onchain = chain.drop;\n const priced = feeBps === null ? null : onchain;\n const mint = dropMintState({ drop: priced, wallet: walletAddress, claimed: chain.claimed, proof, balance: chain.balance, feeBps: feeBps ?? 0, now });\n const view = priced ? actionBoxView({ drop: priced, mint, quantity, feeBps: feeBps!, now }) : null;\n const isOrganizer = !!walletAddress && !!onchain && BigInt(walletAddress) === BigInt(onchain.organizer);\n const art = resolveImage(firstToken?.image ?? indexed?.image);\n const name = indexed?.name ?? \"Drop\";\n const deps = async () => ({ client: getClient(), signer: await app.getSigner() });\n\n const onAction = () => {\n if (!view) return;\n if (view.button.action === \"sign-in\") app.onRequireWallet();\n if (view.button.action === \"mint\") setMinting(true);\n };\n\n return (\n <div className=\"space-y-10 pb-28 lg:pb-0\">\n <div className=\"grid gap-8 lg:grid-cols-2 lg:gap-10\">\n <div className=\"relative aspect-square overflow-hidden rounded-2xl bg-muted\">\n {art && <Image src={art} alt={name} fill unoptimized className=\"object-cover\" />}\n </div>\n <div className=\"space-y-5\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"space-y-1\">\n <h1 className=\"text-3xl font-semibold\">{name}</h1>\n {onchain && <CreatorChip address={onchain.organizer} />}\n </div>\n <ShareButton title={name} variant=\"soft\" size=\"sm\" />\n </div>\n {view && onchain && (\n <div className=\"hidden lg:block\">\n <DropActionBox view={view} minted={onchain.totalMinted} maxSupply={onchain.maxSupply} quantity={quantity} onQuantity={setQuantity} onAction={onAction} />\n </div>\n )}\n </div>\n </div>\n\n {view && onchain && (\n <div className=\"lg:hidden\">\n <DropActionBox view={view} minted={onchain.totalMinted} maxSupply={onchain.maxSupply} quantity={quantity} onQuantity={setQuantity} onAction={onAction} />\n <div className=\"fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/95 p-3 backdrop-blur\">\n <ActionButton solid disabled={view.button.action === \"none\"} onClick={onAction} className=\"w-full\">{t(view.button.label)}</ActionButton>\n </div>\n </div>\n )}\n\n <Tabs defaultValue={props.initialTab === \"manage\" && isOrganizer ? \"manage\" : \"about\"}>\n <TabsList>\n <TabsTrigger value=\"about\">{t(\"About\")}</TabsTrigger>\n {isCollection && <TabsTrigger value=\"items\">{t(\"Items\")}</TabsTrigger>}\n <TabsTrigger value=\"activity\">{t(\"Activity\")}</TabsTrigger>\n <TabsTrigger value=\"license\">{t(\"License\")}</TabsTrigger>\n {isOrganizer && <TabsTrigger value=\"manage\">{t(\"Manage\")}</TabsTrigger>}\n </TabsList>\n <TabsContent value=\"about\" className=\"pt-6\">\n <p className=\"whitespace-pre-line text-sm leading-relaxed text-muted-foreground\">{indexed?.description || t(\"No description.\")}</p>\n </TabsContent>\n {isCollection && (\n <TabsContent value=\"items\" className=\"pt-6\">\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">{tokens.map((t) => <TokenCard key={t.tokenId} token={t} />)}</div>\n </TabsContent>\n )}\n <TabsContent value=\"activity\" className=\"pt-6\"><DropActivityList mints={mints} /></TabsContent>\n <TabsContent value=\"license\" className=\"pt-6\"><AssetLicenseSummary attributes={firstToken?.attributes ?? []} /></TabsContent>\n {isOrganizer && onchain && (\n <TabsContent value=\"manage\" className=\"pt-6\">\n <DropManage\n contract={contract}\n indexed={indexed}\n onchain={onchain}\n mints={mints}\n run={async (params) => {\n await manageDrop(await deps(), { owner: walletAddress!, collection: contract, ...params });\n await Promise.all([chain.mutate(), refreshMints()]);\n }}\n saveExclusive={(value) => saveExclusiveContent(getClient(), contract, value)}\n />\n </TabsContent>\n )}\n </Tabs>\n\n {view && minting && (\n <DropMintDialog\n open\n onClose={() => setMinting(false)}\n name={name}\n quantity={quantity > view.maxQuantity ? view.maxQuantity : quantity}\n totalText={view.totalText}\n portfolioHref={props.portfolioHref ?? \"/portfolio\"}\n onMint={async () => {\n const res = await mintDrop(await deps(), { claimer: walletAddress!, collection: contract, quantity: quantity > view.maxQuantity ? view.maxQuantity : quantity, proof });\n await Promise.all([chain.mutate(), refreshMints()]);\n return res;\n }}\n />\n )}\n </div>\n );\n}\n"],"mappings":";AAoDW,SAA2C,KAA3C;AAlDX,SAAS,SAAS,gBAAgB;AAClC,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,MAAM,aAAa,UAAU,mBAAmB;AACzD,SAAS,2BAA2B;AACpC,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,oBAAoB;AAC7B,SAAS,2BAA2B;AACpC,SAAS,SAAS,cAAc,YAAY,aAAa,oBAAoB;AAC7E,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,YAAY,UAAU,4BAA4B;AAC3D,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,YAAY;AAId,SAAS,SAAS,OAA0E;AACjG,QAAM,IAAI,KAAK;AACf,QAAM,eAAe,YAAY;AACjC,QAAM,MAAM,gBAAgB;AAC5B,QAAM,EAAE,SAAS,IAAI;AACrB,QAAM,EAAE,WAAW,cAAc,IAAI;AACrC,QAAM,EAAE,MAAM,SAAS,UAAU,IAAI,QAAQ,QAAQ;AACrD,QAAM,QAAQ,aAAa,UAAU,aAAa;AAClD,QAAM,EAAE,OAAO,QAAQ,aAAa,IAAI,aAAa,QAAQ;AAC7D,QAAM,SAAS,WAAW;AAC1B,QAAM,iBAAiB,YAAoC,SAAS,WAAW,MAAM,iBAAiB;AACtG,QAAM,eAAe,gBAAgB,cAA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AA,MAAC;AAAA;AAAA,QACC,MAAI;AAAA,QACJ,SAAS,MAAM,WAAW,KAAK;AAAA,QAC/B;AAAA,QACA,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc;AAAA,QAC3D,WAAW,KAAK;AAAA,QAChB,eAAe,MAAM,iBAAiB;AAAA,QACtC,QAAQ,YAAY;AAClB,gBAAM,MAAM,MAAM,SAAS,MAAM,KAAK,GAAG,EAAE,SAAS,eAAgB,YAAY,UAAU,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc,UAAU,MAAM,CAAC;AACtK,gBAAM,QAAQ,IAAI,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC;AAClD,iBAAO;AAAA,QACT;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":["t"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useMemo, useState } from \"react\";\nimport { Package } from \"lucide-react\";\nimport { dropMintState } from \"@medialane/sdk/starknet\";\nimport Image from \"../../image.js\";\nimport { CreatorChip } from \"../../creator-chip.js\";\nimport { ShareButton } from \"../../share-button.js\";\nimport { Skeleton } from \"../../skeleton.js\";\nimport { Tabs, TabsContent, TabsList, TabsTrigger } from \"../../tabs.js\";\nimport { AssetLicenseSummary } from \"../../asset-license-summary.js\";\nimport { TokenCard } from \"../../token-card.js\";\nimport { DropActionBox } from \"./drop-action-box.js\";\nimport { DropActivityList } from \"./drop-activity.js\";\nimport { DropManage } from \"./drop-manage.js\";\nimport { DropMintDialog } from \"./drop-mint-dialog.js\";\nimport { useCollectionTokens } from \"../../../utils/use-collections.js\";\nimport { useDrop, useDropChain, useDropFee, useDropFile, useDropMints } from \"../../../utils/use-drops.js\";\nimport { useNow } from \"../../../utils/drop/use-now.js\";\nimport { actionBoxView } from \"../../../utils/drop/view.js\";\nimport { claimProofFor } from \"../../../utils/drop/claim-proof.js\";\nimport { manageDrop, mintDrop, saveExclusiveContent } from \"../../../utils/drop/actions.js\";\nimport { useMedialaneApp } from \"../../medialane-app.js\";\nimport { useImageUrl } from \"../../../utils/use-image-url.js\";\nimport { useLocale, useT } from \"../../../i18n/provider.js\";\n\ntype TokenFile = { image?: string; attributes?: { trait_type?: string; value?: string }[] };\n\nexport function DropPage(props: { contract: string; initialTab?: string; portfolioHref?: string }) {\n const t = useT();\n const locale = useLocale();\n const resolveImage = useImageUrl();\n const app = useMedialaneApp();\n const { contract } = props;\n const { getClient, walletAddress } = app;\n const { drop: indexed, isLoading } = useDrop(contract);\n const chain = useDropChain(contract, walletAddress);\n const { mints, mutate: refreshMints } = useDropMints(contract);\n const feeBps = useDropFee();\n const collectionFile = useDropFile<{ drop_kind?: string; image?: string | null }>(indexed?.baseUri ?? null, \"collection.json\");\n const isCollection = collectionFile?.drop_kind === \"collection\";\n const firstToken = useDropFile<TokenFile>(indexed?.baseUri ?? null, \"1\");\n const { tokens } = useCollectionTokens(isCollection ? contract : null, 1, 24);\n const now = useNow();\n const [quantity, setQuantity] = useState(1n);\n const [minting, setMinting] = useState(false);\n const proof = useMemo(\n () => (typeof window === \"undefined\" ? null : claimProofFor(window.localStorage, contract, window.location.hash, \"drop-proof\")),\n [contract],\n );\n\n if (isLoading && !chain.drop) {\n return <div className=\"grid gap-8 lg:grid-cols-2\"><Skeleton className=\"aspect-square rounded-2xl\" /><Skeleton className=\"h-96 rounded-2xl\" /></div>;\n }\n if (!indexed && !chain.drop) {\n return (\n <div className=\"space-y-3 py-24 text-center\">\n <Package className=\"mx-auto h-10 w-10 text-muted-foreground/30\" />\n <p className=\"text-sm text-muted-foreground\">{t(\"New drops appear within a minute.\")}</p>\n </div>\n );\n }\n\n const onchain = chain.drop;\n const priced = feeBps === null ? null : onchain;\n const mint = dropMintState({ drop: priced, wallet: walletAddress, claimed: chain.claimed, proof, balance: chain.balance, feeBps: feeBps ?? 0, now });\n const view = priced ? actionBoxView({ drop: priced, mint, quantity, feeBps: feeBps!, now, locale }) : null;\n const isOrganizer = !!walletAddress && !!onchain && BigInt(walletAddress) === BigInt(onchain.organizer);\n const art = resolveImage(indexed?.image ?? collectionFile?.image ?? firstToken?.image);\n const name = indexed?.name ?? \"Drop\";\n const deps = async () => ({ client: getClient(), signer: await app.getSigner() });\n\n const onAction = () => {\n if (!view) return;\n if (view.button.action === \"sign-in\") app.onRequireWallet();\n if (view.button.action === \"mint\") setMinting(true);\n };\n\n return (\n <div className=\"space-y-10\">\n <div className=\"grid gap-8 lg:grid-cols-2 lg:gap-10\">\n <div className=\"relative aspect-square overflow-hidden rounded-2xl bg-muted\">\n {art && <Image src={art} alt={name} fill unoptimized className=\"object-cover\" />}\n </div>\n <div className=\"space-y-5\">\n <div className=\"flex items-start justify-between gap-3\">\n <div className=\"space-y-1\">\n <h1 className=\"text-3xl font-semibold\">{name}</h1>\n {onchain && <CreatorChip address={onchain.organizer} />}\n </div>\n <ShareButton title={name} variant=\"soft\" size=\"sm\" />\n </div>\n {view && onchain && (\n <DropActionBox view={view} minted={onchain.totalMinted} maxSupply={onchain.maxSupply} quantity={quantity} onQuantity={setQuantity} onAction={onAction} />\n )}\n </div>\n </div>\n\n <Tabs defaultValue={props.initialTab === \"manage\" && isOrganizer ? \"manage\" : \"about\"}>\n <TabsList>\n <TabsTrigger value=\"about\">{t(\"About\")}</TabsTrigger>\n {isCollection && <TabsTrigger value=\"items\">{t(\"Items\")}</TabsTrigger>}\n <TabsTrigger value=\"activity\">{t(\"Activity\")}</TabsTrigger>\n <TabsTrigger value=\"license\">{t(\"License\")}</TabsTrigger>\n {isOrganizer && <TabsTrigger value=\"manage\">{t(\"Manage\")}</TabsTrigger>}\n </TabsList>\n <TabsContent value=\"about\" className=\"pt-6\">\n <p className=\"whitespace-pre-line text-sm leading-relaxed text-muted-foreground\">{indexed?.description || t(\"No description.\")}</p>\n </TabsContent>\n {isCollection && (\n <TabsContent value=\"items\" className=\"pt-6\">\n <div className=\"grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4\">{tokens.map((t) => <TokenCard key={t.tokenId} token={t} />)}</div>\n </TabsContent>\n )}\n <TabsContent value=\"activity\" className=\"pt-6\"><DropActivityList mints={mints} /></TabsContent>\n <TabsContent value=\"license\" className=\"pt-6\"><AssetLicenseSummary attributes={firstToken?.attributes ?? []} /></TabsContent>\n {isOrganizer && onchain && (\n <TabsContent value=\"manage\" className=\"pt-6\">\n <DropManage\n contract={contract}\n indexed={indexed}\n onchain={onchain}\n mints={mints}\n run={async (params) => {\n await manageDrop(await deps(), { owner: walletAddress!, collection: contract, ...params });\n await Promise.all([chain.mutate(), refreshMints()]);\n }}\n saveExclusive={(value) => saveExclusiveContent(getClient(), contract, value)}\n />\n </TabsContent>\n )}\n </Tabs>\n\n {view && minting && (\n <DropMintDialog\n open\n onClose={() => setMinting(false)}\n name={name}\n quantity={quantity > view.maxQuantity ? view.maxQuantity : quantity}\n totalText={view.totalText}\n portfolioHref={props.portfolioHref ?? \"/portfolio\"}\n onMint={async () => {\n const res = await mintDrop(await deps(), { claimer: walletAddress!, collection: contract, quantity: quantity > view.maxQuantity ? view.maxQuantity : quantity, proof });\n await Promise.all([chain.mutate(), refreshMints()]);\n return res;\n }}\n />\n )}\n </div>\n );\n}\n"],"mappings":";AAoDW,SAA2C,KAA3C;AAlDX,SAAS,SAAS,gBAAgB;AAClC,SAAS,eAAe;AACxB,SAAS,qBAAqB;AAC9B,OAAO,WAAW;AAClB,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,MAAM,aAAa,UAAU,mBAAmB;AACzD,SAAS,2BAA2B;AACpC,SAAS,iBAAiB;AAC1B,SAAS,qBAAqB;AAC9B,SAAS,wBAAwB;AACjC,SAAS,kBAAkB;AAC3B,SAAS,sBAAsB;AAC/B,SAAS,2BAA2B;AACpC,SAAS,SAAS,cAAc,YAAY,aAAa,oBAAoB;AAC7E,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SA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G,OAAO,CAAC;AACzF,kBAAM,QAAQ,IAAI,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC;AAAA,UACpD;AAAA,UACA,eAAe,CAAC,UAAU,qBAAqB,UAAU,GAAG,UAAU,KAAK;AAAA;AAAA,MAC7E,GACF;AAAA,OAEJ;AAAA,IAEC,QAAQ,WACP;AAAA,MAAC;AAAA;AAAA,QACC,MAAI;AAAA,QACJ,SAAS,MAAM,WAAW,KAAK;AAAA,QAC/B;AAAA,QACA,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc;AAAA,QAC3D,WAAW,KAAK;AAAA,QAChB,eAAe,MAAM,iBAAiB;AAAA,QACtC,QAAQ,YAAY;AAClB,gBAAM,MAAM,MAAM,SAAS,MAAM,KAAK,GAAG,EAAE,SAAS,eAAgB,YAAY,UAAU,UAAU,WAAW,KAAK,cAAc,KAAK,cAAc,UAAU,MAAM,CAAC;AACtK,gBAAM,QAAQ,IAAI,CAAC,MAAM,OAAO,GAAG,aAAa,CAAC,CAAC;AAClD,iBAAO;AAAA,QACT;AAAA;AAAA,IACF;AAAA,KAEJ;AAEJ;","names":["t"]}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { BuildAssetMetadataInput } from '@medialane/sdk';
|
|
2
2
|
import { SaleDraft, SaleErrors } from './utils/drop/sale.js';
|
|
3
|
+
import { Phrase } from './i18n/translate.js';
|
|
4
|
+
import { MediaKind } from './components/fast-mint/types.js';
|
|
3
5
|
|
|
4
6
|
declare const MAX_DROP_SUPPLY = 2000;
|
|
5
7
|
declare const MAX_DROP_METADATA_BYTES: number;
|
|
@@ -16,6 +18,7 @@ interface DropMetadataInput {
|
|
|
16
18
|
name: string;
|
|
17
19
|
description: string;
|
|
18
20
|
imageUri: string;
|
|
21
|
+
animationUrl?: string | null;
|
|
19
22
|
copies: number;
|
|
20
23
|
traits: DraftTrait[];
|
|
21
24
|
}[];
|
|
@@ -36,6 +39,7 @@ interface DraftTrait {
|
|
|
36
39
|
interface DraftAsset {
|
|
37
40
|
id: string;
|
|
38
41
|
file: File;
|
|
42
|
+
feature: File | null;
|
|
39
43
|
name: string;
|
|
40
44
|
description: string;
|
|
41
45
|
copies: string;
|
|
@@ -63,23 +67,33 @@ interface DropDraft {
|
|
|
63
67
|
}
|
|
64
68
|
declare const EMPTY_DRAFT: DropDraft;
|
|
65
69
|
declare function newAsset(file: File): DraftAsset;
|
|
70
|
+
declare function assetKind(a: DraftAsset): MediaKind;
|
|
71
|
+
declare function assetImage(a: DraftAsset): File | null;
|
|
66
72
|
declare function dropSymbol(name: string): string;
|
|
73
|
+
declare function assetUploads(assets: DraftAsset[]): {
|
|
74
|
+
id: string;
|
|
75
|
+
file: File;
|
|
76
|
+
}[];
|
|
77
|
+
declare function assetMedia(a: DraftAsset, uriOf: (id: string) => string | null): {
|
|
78
|
+
imageUri: string;
|
|
79
|
+
animationUrl: string | null;
|
|
80
|
+
};
|
|
67
81
|
declare function draftTokens(d: DropDraft): number;
|
|
68
82
|
type DropPanel = "collection" | "assets" | "settings";
|
|
69
|
-
type AssetErrors = Partial<Record<"copies" | "traits",
|
|
83
|
+
type AssetErrors = Partial<Record<"copies" | "traits" | "feature", Phrase>>;
|
|
70
84
|
interface DropDraftErrors {
|
|
71
|
-
collection: Partial<Record<"name" | "externalUrl",
|
|
85
|
+
collection: Partial<Record<"name" | "externalUrl", Phrase>>;
|
|
72
86
|
assets: {
|
|
73
|
-
list?:
|
|
87
|
+
list?: Phrase;
|
|
74
88
|
byId: Record<string, AssetErrors>;
|
|
75
89
|
};
|
|
76
|
-
settings: SaleErrors & Partial<Record<"allowlist" | "gated",
|
|
90
|
+
settings: SaleErrors & Partial<Record<"allowlist" | "gated", Phrase>>;
|
|
77
91
|
}
|
|
78
92
|
declare function validateDropDraft(d: DropDraft, now: number): DropDraftErrors;
|
|
79
93
|
declare function firstMissing(e: DropDraftErrors): {
|
|
80
94
|
panel: DropPanel;
|
|
81
|
-
message:
|
|
95
|
+
message: Phrase;
|
|
82
96
|
} | null;
|
|
83
97
|
declare function hasErrors(e: DropDraftErrors): boolean;
|
|
84
98
|
|
|
85
|
-
export { type DraftAsset as D, EMPTY_DRAFT as E, MAX_DROP_METADATA_BYTES as M, type DropDraft as a, type DropDraftErrors as b, type DropKind as c, dropSymbol as d, type DropLicense as e, type DropMetadataFile as f, type DropMetadataInput as g, MAX_DROP_SUPPLY as h, buildDropMetadataFiles as i, type DraftTrait as j, type DropPanel as k,
|
|
99
|
+
export { type DraftAsset as D, EMPTY_DRAFT as E, MAX_DROP_METADATA_BYTES as M, type DropDraft as a, type DropDraftErrors as b, type DropKind as c, dropSymbol as d, type DropLicense as e, type DropMetadataFile as f, type DropMetadataInput as g, MAX_DROP_SUPPLY as h, buildDropMetadataFiles as i, type DraftTrait as j, type DropPanel as k, assetImage as l, metadataBytes as m, assetKind as n, assetMedia as o, assetUploads as p, draftTokens as q, firstMissing as r, hasErrors as s, tokenOrder as t, newAsset as u, validateDropDraft as v };
|