@medialane/ui 0.387.0 → 0.389.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/drop/create/drop-create.cjs +148 -63
- package/dist/components/drop/create/drop-create.cjs.map +1 -1
- package/dist/components/drop/create/drop-create.d.cts +9 -6
- package/dist/components/drop/create/drop-create.d.ts +9 -6
- package/dist/components/drop/create/drop-create.js +147 -53
- package/dist/components/drop/create/drop-create.js.map +1 -1
- package/dist/components/drop/create/drop-fields.cjs +264 -0
- package/dist/components/drop/create/drop-fields.cjs.map +1 -0
- package/dist/components/drop/create/drop-fields.d.cts +39 -0
- package/dist/components/drop/create/drop-fields.d.ts +39 -0
- package/dist/components/drop/create/drop-fields.js +223 -0
- package/dist/components/drop/create/drop-fields.js.map +1 -0
- package/dist/components/fast-mint/dropzone.cjs +17 -7
- package/dist/components/fast-mint/dropzone.cjs.map +1 -1
- package/dist/components/fast-mint/dropzone.d.cts +6 -1
- package/dist/components/fast-mint/dropzone.d.ts +6 -1
- package/dist/components/fast-mint/dropzone.js +17 -7
- package/dist/components/fast-mint/dropzone.js.map +1 -1
- package/dist/components/nav-command-menu.cjs +6 -6
- package/dist/components/nav-command-menu.cjs.map +1 -1
- package/dist/components/nav-command-menu.js +6 -6
- package/dist/components/nav-command-menu.js.map +1 -1
- package/dist/i18n/catalog/pt.cjs +15 -12
- package/dist/i18n/catalog/pt.cjs.map +1 -1
- package/dist/i18n/catalog/pt.js +15 -12
- package/dist/i18n/catalog/pt.js.map +1 -1
- package/dist/index.cjs +0 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/drop/create/artwork-section.cjs +0 -116
- package/dist/components/drop/create/artwork-section.cjs.map +0 -1
- package/dist/components/drop/create/artwork-section.d.cts +0 -25
- package/dist/components/drop/create/artwork-section.d.ts +0 -25
- package/dist/components/drop/create/artwork-section.js +0 -80
- package/dist/components/drop/create/artwork-section.js.map +0 -1
- package/dist/components/drop/create/details-section.cjs +0 -115
- package/dist/components/drop/create/details-section.cjs.map +0 -1
- package/dist/components/drop/create/details-section.d.cts +0 -13
- package/dist/components/drop/create/details-section.d.ts +0 -13
- package/dist/components/drop/create/details-section.js +0 -91
- package/dist/components/drop/create/details-section.js.map +0 -1
- package/dist/components/drop/create/list-section.cjs +0 -67
- package/dist/components/drop/create/list-section.cjs.map +0 -1
- package/dist/components/drop/create/list-section.d.cts +0 -13
- package/dist/components/drop/create/list-section.d.ts +0 -13
- package/dist/components/drop/create/list-section.js +0 -43
- package/dist/components/drop/create/list-section.js.map +0 -1
- package/dist/components/drop/create/sale-section.cjs +0 -80
- package/dist/components/drop/create/sale-section.cjs.map +0 -1
- package/dist/components/drop/create/sale-section.d.cts +0 -15
- package/dist/components/drop/create/sale-section.d.ts +0 -15
- package/dist/components/drop/create/sale-section.js +0 -56
- package/dist/components/drop/create/sale-section.js.map +0 -1
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
8
|
for (var name in all)
|
|
@@ -18,104 +16,191 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
}
|
|
19
17
|
return to;
|
|
20
18
|
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var drop_create_exports = {};
|
|
31
21
|
__export(drop_create_exports, {
|
|
32
|
-
|
|
33
|
-
|
|
22
|
+
DropCreate: () => DropCreate,
|
|
23
|
+
dropSymbol: () => dropSymbol,
|
|
24
|
+
withArtwork: () => withArtwork
|
|
34
25
|
});
|
|
35
26
|
module.exports = __toCommonJS(drop_create_exports);
|
|
36
27
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
28
|
var import_react = require("react");
|
|
38
29
|
var import_lucide_react = require("lucide-react");
|
|
39
|
-
var import_image = __toESM(require("../../image.js"), 1);
|
|
40
30
|
var import_action_button = require("../../action-button.js");
|
|
41
31
|
var import_collapsible_section = require("../../collapsible-section.js");
|
|
42
|
-
var
|
|
43
|
-
var
|
|
44
|
-
var
|
|
45
|
-
var
|
|
32
|
+
var import_claim_route_shell = require("../../claim-route-shell.js");
|
|
33
|
+
var import_dropzone = require("../../fast-mint/dropzone.js");
|
|
34
|
+
var import_medialane_collection_card = require("../../medialane-collection-card.js");
|
|
35
|
+
var import_drop_fields = require("./drop-fields.js");
|
|
46
36
|
var import_exclusive_fields = require("./exclusive-fields.js");
|
|
47
37
|
var import_launch_dialog = require("./launch-dialog.js");
|
|
48
|
-
var import_artwork_section2 = require("./artwork-section.js");
|
|
49
38
|
var import_draft = require("../../../utils/drop/draft.js");
|
|
50
|
-
var import_sale = require("../../../utils/drop/sale.js");
|
|
51
39
|
var import_preview = require("../../../utils/drop/preview.js");
|
|
40
|
+
var import_launchpad_defaults = require("../../../utils/launchpad-defaults.js");
|
|
41
|
+
var import_upload_limits = require("../../../utils/upload-limits.js");
|
|
42
|
+
var import_ip = require("../../../data/ip.js");
|
|
52
43
|
var import_medialane_app = require("../../medialane-app.js");
|
|
53
44
|
var import_use_drops = require("../../../utils/use-drops.js");
|
|
54
45
|
var import_provider = require("../../../i18n/provider.js");
|
|
46
|
+
var import_i18n = require("../../../i18n/index.js");
|
|
55
47
|
var import_use_format = require("../../../i18n/use-format.js");
|
|
48
|
+
const toItem = (file) => ({ id: crypto.randomUUID(), file, previewUrl: URL.createObjectURL(file), name: "", description: "" });
|
|
49
|
+
function withArtwork(draft, files) {
|
|
50
|
+
const current = draft.kind === "edition" ? draft.edition ? [toItem(draft.edition)] : [] : draft.items;
|
|
51
|
+
const items = [...current, ...files.map(toItem)];
|
|
52
|
+
if (items.length === 1) return { kind: "edition", edition: items[0].file, items: [] };
|
|
53
|
+
return { kind: "collection", edition: null, items };
|
|
54
|
+
}
|
|
55
|
+
function dropSymbol(name) {
|
|
56
|
+
return (0, import_launchpad_defaults.suggestLaunchpadSymbol)(name) || "DROP";
|
|
57
|
+
}
|
|
56
58
|
function DropCreate() {
|
|
57
59
|
const t = (0, import_provider.useT)();
|
|
60
|
+
const intl = (0, import_use_format.useFormat)();
|
|
58
61
|
const app = (0, import_medialane_app.useMedialaneApp)();
|
|
59
62
|
const feeBps = (0, import_use_drops.useDropFee)();
|
|
60
63
|
const [draft, setDraftState] = (0, import_react.useState)(import_draft.EMPTY_DRAFT);
|
|
61
64
|
const [tried, setTried] = (0, import_react.useState)(false);
|
|
62
65
|
const [launching, setLaunching] = (0, import_react.useState)(false);
|
|
66
|
+
const [timingOpen, setTimingOpen] = (0, import_react.useState)(false);
|
|
67
|
+
const [licenseOpen, setLicenseOpen] = (0, import_react.useState)(false);
|
|
68
|
+
const coverRef = (0, import_react.useRef)(null);
|
|
63
69
|
const setDraft = (patch) => setDraftState((d) => ({ ...d, ...patch }));
|
|
64
70
|
const errors = tried ? (0, import_draft.validateDropDraft)(draft, Math.floor(Date.now() / 1e3)) : {};
|
|
71
|
+
const hasArt = draft.kind === "edition" ? !!draft.edition : draft.items.length > 0;
|
|
72
|
+
const addFiles = (files) => setDraftState((d) => ({ ...d, ...withArtwork(d, files) }));
|
|
65
73
|
const launch = () => {
|
|
66
74
|
if (!app.walletAddress) return app.onRequireWallet();
|
|
67
75
|
setTried(true);
|
|
68
|
-
|
|
76
|
+
const invalid = (0, import_draft.validateDropDraft)(draft, Math.floor(Date.now() / 1e3));
|
|
77
|
+
if (invalid.start || invalid.end || invalid.perWallet) setTimingOpen(true);
|
|
78
|
+
if (Object.keys(invalid).length === 0) setLaunching(true);
|
|
69
79
|
};
|
|
70
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]", children: [
|
|
71
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-5 lg:order-1 order-2", children: [
|
|
72
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_artwork_section.ArtworkSection, { draft, setDraft, errors }),
|
|
73
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_details_section.DetailsSection, { draft, setDraft, errors }),
|
|
74
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_sale_section.SaleSection, { draft, setDraft, errors, feeBps }),
|
|
75
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_list_section.ListSection, { draft, setDraft, errors }),
|
|
76
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
77
|
-
import_collapsible_section.CollapsibleSection,
|
|
78
|
-
{
|
|
79
|
-
open: draft.gated.enabled,
|
|
80
|
-
onOpenChange: (enabled) => setDraft({ gated: { ...draft.gated, enabled } }),
|
|
81
|
-
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Lock, { className: "h-4 w-4 text-primary" }),
|
|
82
|
-
label: t("Exclusive content"),
|
|
83
|
-
hint: t("Optional \xB7 a private link only holders can open"),
|
|
84
|
-
children: [
|
|
85
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_exclusive_fields.ExclusiveFields, { value: draft.gated, onChange: (v) => setDraft({ gated: { ...draft.gated, ...v } }) }),
|
|
86
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_artwork_section2.FieldError, { message: errors.gated })
|
|
87
|
-
]
|
|
88
|
-
}
|
|
89
|
-
),
|
|
90
|
-
tried && Object.keys(errors).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium text-destructive", children: t("Check the highlighted fields.") }),
|
|
91
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { solid: true, big: true, onClick: launch, className: "w-full", children: app.walletAddress ? t("Review and launch") : app.connectLabel ?? t("Sign in to launch") }),
|
|
92
|
-
launching && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_launch_dialog.LaunchDialog, { open: true, onClose: () => setLaunching(false), draft })
|
|
93
|
-
] }),
|
|
94
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "order-1 lg:order-2", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "lg:sticky lg:top-24", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DraftSummary, { draft, feeBps }) }) })
|
|
95
|
-
] });
|
|
96
|
-
}
|
|
97
|
-
function DraftSummary({ draft, feeBps }) {
|
|
98
|
-
const intl = (0, import_use_format.useFormat)();
|
|
99
|
-
const t = (0, import_provider.useT)();
|
|
100
80
|
const art = draft.cover ?? (draft.kind === "edition" ? draft.edition : draft.items[0]?.file ?? null);
|
|
101
|
-
const preview = art ? (0, import_preview.previewUrl)(art) : null;
|
|
102
81
|
const supply = (0, import_draft.draftSupply)(draft);
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
82
|
+
const wallet = app.walletAddress;
|
|
83
|
+
const preview = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mx-auto w-full max-w-[260px] space-y-2 lg:max-w-none", children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
85
|
+
import_medialane_collection_card.MedialaneCollectionCard,
|
|
86
|
+
{
|
|
87
|
+
image: art ? (0, import_preview.previewUrl)(art) : null,
|
|
88
|
+
name: draft.name,
|
|
89
|
+
collection: Number.isFinite(supply) && supply > 0 ? (0, import_draft.supplyLabel)(t, draft.kind, supply, intl.number(supply)) : void 0,
|
|
90
|
+
creator: wallet ? `${wallet.slice(0, 6)}\u2026${wallet.slice(-4)}` : void 0
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
hasArt && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "text-center", children: [
|
|
94
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("button", { type: "button", onClick: () => coverRef.current?.click(), className: "text-xs font-semibold text-primary", children: t("Change cover") }),
|
|
95
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
96
|
+
"input",
|
|
97
|
+
{
|
|
98
|
+
ref: coverRef,
|
|
99
|
+
type: "file",
|
|
100
|
+
accept: (0, import_upload_limits.acceptFor)("image"),
|
|
101
|
+
className: "hidden",
|
|
102
|
+
onChange: (e) => {
|
|
103
|
+
const f = e.target.files?.[0];
|
|
104
|
+
if (f) setDraft({ cover: f });
|
|
105
|
+
e.target.value = "";
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
)
|
|
113
109
|
] })
|
|
114
110
|
] });
|
|
111
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
112
|
+
import_claim_route_shell.ClaimRouteShell,
|
|
113
|
+
{
|
|
114
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Package, { className: "h-4 w-4 text-white" }),
|
|
115
|
+
title: (0, import_i18n.msg)("Create a drop"),
|
|
116
|
+
subtitle: (0, import_i18n.msg)("One artwork as copies, or a set of unique pieces."),
|
|
117
|
+
aside: preview,
|
|
118
|
+
children: [
|
|
119
|
+
!hasArt ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
import_dropzone.Dropzone,
|
|
121
|
+
{
|
|
122
|
+
mediaKindLock: "image",
|
|
123
|
+
multiple: true,
|
|
124
|
+
title: t("Drop or upload your artwork"),
|
|
125
|
+
subtitle: t("One image becomes copies of one artwork. Several images become a set of unique pieces."),
|
|
126
|
+
hasWallet: !!wallet,
|
|
127
|
+
onRequireWallet: app.onRequireWallet,
|
|
128
|
+
connectLabel: app.connectLabel,
|
|
129
|
+
onFileSelected: (file) => addFiles([file]),
|
|
130
|
+
onFilesSelected: addFiles
|
|
131
|
+
}
|
|
132
|
+
) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-6", children: [
|
|
133
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
134
|
+
import_drop_fields.ArtworkFields,
|
|
135
|
+
{
|
|
136
|
+
draft,
|
|
137
|
+
setDraft,
|
|
138
|
+
errors,
|
|
139
|
+
onAddFiles: addFiles,
|
|
140
|
+
onRemoveEdition: () => setDraft({ edition: null, cover: null })
|
|
141
|
+
}
|
|
142
|
+
),
|
|
143
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
import_drop_fields.NameFields,
|
|
145
|
+
{
|
|
146
|
+
draft,
|
|
147
|
+
setDraft,
|
|
148
|
+
errors,
|
|
149
|
+
onNameChange: (name) => setDraft({ name, symbol: dropSymbol(name) })
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.PriceFields, { draft, setDraft, errors, feeBps }),
|
|
153
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.AccessFields, { draft, setDraft, errors }),
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-3", children: [
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
import_collapsible_section.CollapsibleSection,
|
|
157
|
+
{
|
|
158
|
+
open: timingOpen,
|
|
159
|
+
onOpenChange: setTimingOpen,
|
|
160
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.CalendarClock, { className: "h-4 w-4 text-primary" }),
|
|
161
|
+
label: t("Timing and limits"),
|
|
162
|
+
hint: (0, import_drop_fields.timingSummary)(draft.sale, t),
|
|
163
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.TimingFields, { draft, setDraft, errors })
|
|
164
|
+
}
|
|
165
|
+
),
|
|
166
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
167
|
+
import_collapsible_section.CollapsibleSection,
|
|
168
|
+
{
|
|
169
|
+
open: licenseOpen,
|
|
170
|
+
onOpenChange: setLicenseOpen,
|
|
171
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ShieldCheck, { className: "h-4 w-4 text-primary" }),
|
|
172
|
+
label: t("License terms"),
|
|
173
|
+
hint: t(import_ip.LICENSE_TYPES.find((l) => l.value === draft.license.licenseType)?.label ?? draft.license.licenseType),
|
|
174
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.LicenseFields, { draft, setDraft })
|
|
175
|
+
}
|
|
176
|
+
),
|
|
177
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
178
|
+
import_collapsible_section.CollapsibleSection,
|
|
179
|
+
{
|
|
180
|
+
open: draft.gated.enabled,
|
|
181
|
+
onOpenChange: (enabled) => setDraft({ gated: { ...draft.gated, enabled } }),
|
|
182
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Lock, { className: "h-4 w-4 text-primary" }),
|
|
183
|
+
label: t("Exclusive content"),
|
|
184
|
+
hint: t("Optional \xB7 a private link only holders can open"),
|
|
185
|
+
children: [
|
|
186
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_exclusive_fields.ExclusiveFields, { value: draft.gated, onChange: (v) => setDraft({ gated: { ...draft.gated, ...v } }) }),
|
|
187
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_fields.FieldError, { message: errors.gated })
|
|
188
|
+
]
|
|
189
|
+
}
|
|
190
|
+
)
|
|
191
|
+
] }),
|
|
192
|
+
tried && Object.keys(errors).length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium text-destructive", children: t("Check the highlighted fields.") }),
|
|
193
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_button.ActionButton, { solid: true, big: true, onClick: launch, className: "w-full", children: wallet ? t("Launch drop") : app.connectLabel ?? t("Sign in to launch") })
|
|
194
|
+
] }),
|
|
195
|
+
launching && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_launch_dialog.LaunchDialog, { open: true, onClose: () => setLaunching(false), draft })
|
|
196
|
+
]
|
|
197
|
+
}
|
|
198
|
+
);
|
|
115
199
|
}
|
|
116
200
|
// Annotate the CommonJS export names for ESM import in node:
|
|
117
201
|
0 && (module.exports = {
|
|
118
|
-
|
|
119
|
-
|
|
202
|
+
DropCreate,
|
|
203
|
+
dropSymbol,
|
|
204
|
+
withArtwork
|
|
120
205
|
});
|
|
121
206
|
//# sourceMappingURL=drop-create.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/drop/create/drop-create.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { Lock } from \"lucide-react\";\nimport Image from \"../../image.js\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { CollapsibleSection } from \"../../collapsible-section.js\";\nimport { ArtworkSection } from \"./artwork-section.js\";\nimport { DetailsSection } from \"./details-section.js\";\nimport { SaleSection } from \"./sale-section.js\";\nimport { ListSection } from \"./list-section.js\";\nimport { ExclusiveFields } from \"./exclusive-fields.js\";\nimport { LaunchDialog } from \"./launch-dialog.js\";\nimport { FieldError } from \"./artwork-section.js\";\nimport { EMPTY_DRAFT, draftSupply, validateDropDraft, type DropDraft, supplyLabel } from \"../../../utils/drop/draft.js\";\nimport { collectorPriceLine } from \"../../../utils/drop/sale.js\";\nimport { previewUrl } from \"../../../utils/drop/preview.js\";\nimport { useMedialaneApp } from \"../../medialane-app.js\";\nimport { useDropFee } from \"../../../utils/use-drops.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { useFormat } from \"../../../i18n/use-format.js\";\n\nexport function DropCreate() {\n const t = useT();\n const app = useMedialaneApp();\n const feeBps = useDropFee();\n const [draft, setDraftState] = useState<DropDraft>(EMPTY_DRAFT);\n const [tried, setTried] = useState(false);\n const [launching, setLaunching] = useState(false);\n const setDraft = (patch: Partial<DropDraft>) => setDraftState((d) => ({ ...d, ...patch }));\n const errors = tried ? validateDropDraft(draft, Math.floor(Date.now() / 1000)) : {};\n\n const launch = () => {\n if (!app.walletAddress) return app.onRequireWallet();\n setTried(true);\n if (Object.keys(validateDropDraft(draft, Math.floor(Date.now() / 1000))).length === 0) setLaunching(true);\n };\n\n return (\n <div className=\"grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]\">\n <div className=\"space-y-5 lg:order-1 order-2\">\n <ArtworkSection draft={draft} setDraft={setDraft} errors={errors} />\n <DetailsSection draft={draft} setDraft={setDraft} errors={errors} />\n <SaleSection draft={draft} setDraft={setDraft} errors={errors} feeBps={feeBps} />\n <ListSection draft={draft} setDraft={setDraft} errors={errors} />\n <CollapsibleSection\n open={draft.gated.enabled}\n onOpenChange={(enabled) => setDraft({ gated: { ...draft.gated, enabled } })}\n icon={<Lock className=\"h-4 w-4 text-primary\" />}\n label={t(\"Exclusive content\")}\n hint={t(\"Optional · a private link only holders can open\")}\n >\n <ExclusiveFields value={draft.gated} onChange={(v) => setDraft({ gated: { ...draft.gated, ...v } })} />\n <FieldError message={errors.gated} />\n </CollapsibleSection>\n {tried && Object.keys(errors).length > 0 && <p className=\"text-sm font-medium text-destructive\">{t(\"Check the highlighted fields.\")}</p>}\n <ActionButton solid big onClick={launch} className=\"w-full\">\n {app.walletAddress ? t(\"Review and launch\") : app.connectLabel ?? t(\"Sign in to launch\")}\n </ActionButton>\n {launching && <LaunchDialog open onClose={() => setLaunching(false)} draft={draft} />}\n </div>\n <div className=\"order-1 lg:order-2\">\n <div className=\"lg:sticky lg:top-24\"><DraftSummary draft={draft} feeBps={feeBps} /></div>\n </div>\n </div>\n );\n}\n\n/** The drop as collectors will see it, updated as the form changes. */\nexport function DraftSummary({ draft, feeBps }: { draft: DropDraft; feeBps: number | null }) {\n const intl = useFormat();\n const t = useT();\n const art = draft.cover ?? (draft.kind === \"edition\" ? draft.edition : draft.items[0]?.file ?? null);\n const preview = art ? previewUrl(art) : null;\n const supply = draftSupply(draft);\n return (\n <div className=\"panel overflow-hidden\">\n <div className=\"relative aspect-square bg-muted\">\n {preview && <Image src={preview} alt={draft.name || t(\"Drop\")} fill unoptimized className=\"object-cover\" />}\n </div>\n <div className=\"space-y-1 p-4\">\n <p className=\"truncate font-semibold\">{draft.name || t(\"Untitled drop\")}</p>\n <p className=\"text-xs text-muted-foreground\">\n {draft.sale.paid ? (feeBps === null ? \"…\" : collectorPriceLine(draft.sale, feeBps) ?? t(\"Set a price\")) : t(\"Free\")}\n </p>\n <p className=\"text-xs text-muted-foreground\">\n {Number.isFinite(supply) && supply > 0 ? supplyLabel(t, draft.kind, supply, intl.number(supply)) : t(\"Supply not set\")}\n {\" · \"}{draft.listOnly ? t(\"List only\") : t(\"Open to everyone\")}\n </p>\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;A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DAAC,SAAI,WAAU,mCACZ,qBAAW,4CAAC,aAAAC,SAAA,EAAM,KAAK,SAAS,KAAK,MAAM,QAAQ,EAAE,MAAM,GAAG,MAAI,MAAC,aAAW,MAAC,WAAU,gBAAe,GAC3G;AAAA,IACA,6CAAC,SAAI,WAAU,iBACb;AAAA,kDAAC,OAAE,WAAU,0BAA0B,gBAAM,QAAQ,EAAE,eAAe,GAAE;AAAA,MACxE,4CAAC,OAAE,WAAU,iCACV,gBAAM,KAAK,OAAQ,WAAW,OAAO,eAAM,gCAAmB,MAAM,MAAM,MAAM,KAAK,EAAE,aAAa,IAAK,EAAE,MAAM,GACpH;AAAA,MACA,6CAAC,OAAE,WAAU,iCACV;AAAA,eAAO,SAAS,MAAM,KAAK,SAAS,QAAI,0BAAY,GAAG,MAAM,MAAM,QAAQ,KAAK,OAAO,MAAM,CAAC,IAAI,EAAE,gBAAgB;AAAA,QACpH;AAAA,QAAO,MAAM,WAAW,EAAE,WAAW,IAAI,EAAE,kBAAkB;AAAA,SAChE;AAAA,OACF;AAAA,KACF;AAEJ;","names":["import_artwork_section","Image"]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/create/drop-create.tsx"],"sourcesContent":["\"use client\";\n\nimport { useRef, useState } from \"react\";\nimport { CalendarClock, Lock, Package, ShieldCheck } from \"lucide-react\";\nimport { ActionButton } from \"../../action-button.js\";\nimport { CollapsibleSection } from \"../../collapsible-section.js\";\nimport { ClaimRouteShell } from \"../../claim-route-shell.js\";\nimport { Dropzone } from \"../../fast-mint/dropzone.js\";\nimport { MedialaneCollectionCard } from \"../../medialane-collection-card.js\";\nimport type { DraftItem } from \"../../drop-item-list.js\";\nimport { AccessFields, ArtworkFields, FieldError, LicenseFields, NameFields, PriceFields, TimingFields, timingSummary } from \"./drop-fields.js\";\nimport { ExclusiveFields } from \"./exclusive-fields.js\";\nimport { LaunchDialog } from \"./launch-dialog.js\";\nimport { EMPTY_DRAFT, draftSupply, validateDropDraft, type DropDraft, supplyLabel } from \"../../../utils/drop/draft.js\";\nimport { previewUrl } from \"../../../utils/drop/preview.js\";\nimport { suggestLaunchpadSymbol } from \"../../../utils/launchpad-defaults.js\";\nimport { acceptFor } from \"../../../utils/upload-limits.js\";\nimport { LICENSE_TYPES } from \"../../../data/ip.js\";\nimport { useMedialaneApp } from \"../../medialane-app.js\";\nimport { useDropFee } from \"../../../utils/use-drops.js\";\nimport { useT } from \"../../../i18n/provider.js\";\nimport { msg } from \"../../../i18n/index.js\";\nimport { useFormat } from \"../../../i18n/use-format.js\";\n\nconst toItem = (file: File): DraftItem => ({ id: crypto.randomUUID(), file, previewUrl: URL.createObjectURL(file), name: \"\", description: \"\" });\n\n/** The draft with these images: one image is an edition, several are a collection. */\nexport function withArtwork(draft: DropDraft, files: File[]): Partial<DropDraft> {\n const current: DraftItem[] = draft.kind === \"edition\" ? (draft.edition ? [toItem(draft.edition)] : []) : draft.items;\n const items = [...current, ...files.map(toItem)];\n if (items.length === 1) return { kind: \"edition\", edition: items[0]!.file, items: [] };\n return { kind: \"collection\", edition: null, items };\n}\n\n/** The collection's symbol, made from the drop's name. */\nexport function dropSymbol(name: string): string {\n return suggestLaunchpadSymbol(name) || \"DROP\";\n}\n\n/**\n * Create a drop on one screen: the artwork first, then the name, price and who can mint, with\n * timing, license and exclusive content in panels that stay closed until needed.\n */\nexport function DropCreate() {\n const t = useT();\n const intl = useFormat();\n const app = useMedialaneApp();\n const feeBps = useDropFee();\n const [draft, setDraftState] = useState<DropDraft>(EMPTY_DRAFT);\n const [tried, setTried] = useState(false);\n const [launching, setLaunching] = useState(false);\n const [timingOpen, setTimingOpen] = useState(false);\n const [licenseOpen, setLicenseOpen] = useState(false);\n const coverRef = useRef<HTMLInputElement | null>(null);\n const setDraft = (patch: Partial<DropDraft>) => setDraftState((d) => ({ ...d, ...patch }));\n const errors = tried ? validateDropDraft(draft, Math.floor(Date.now() / 1000)) : {};\n const hasArt = draft.kind === \"edition\" ? !!draft.edition : draft.items.length > 0;\n\n const addFiles = (files: File[]) => setDraftState((d) => ({ ...d, ...withArtwork(d, files) }));\n\n const launch = () => {\n if (!app.walletAddress) return app.onRequireWallet();\n setTried(true);\n const invalid = validateDropDraft(draft, Math.floor(Date.now() / 1000));\n if (invalid.start || invalid.end || invalid.perWallet) setTimingOpen(true);\n if (Object.keys(invalid).length === 0) setLaunching(true);\n };\n\n const art = draft.cover ?? (draft.kind === \"edition\" ? draft.edition : draft.items[0]?.file ?? null);\n const supply = draftSupply(draft);\n const wallet = app.walletAddress;\n\n const preview = (\n <div className=\"mx-auto w-full max-w-[260px] space-y-2 lg:max-w-none\">\n <MedialaneCollectionCard\n image={art ? previewUrl(art) : null}\n name={draft.name}\n collection={Number.isFinite(supply) && supply > 0 ? supplyLabel(t, draft.kind, supply, intl.number(supply)) : undefined}\n creator={wallet ? `${wallet.slice(0, 6)}…${wallet.slice(-4)}` : undefined}\n />\n {hasArt && (\n <div className=\"text-center\">\n <button type=\"button\" onClick={() => coverRef.current?.click()} className=\"text-xs font-semibold text-primary\">\n {t(\"Change cover\")}\n </button>\n <input ref={coverRef} type=\"file\" accept={acceptFor(\"image\")} className=\"hidden\"\n onChange={(e) => { const f = e.target.files?.[0]; if (f) setDraft({ cover: f }); e.target.value = \"\"; }} />\n </div>\n )}\n </div>\n );\n\n return (\n <ClaimRouteShell\n icon={<Package className=\"h-4 w-4 text-white\" />}\n title={msg(\"Create a drop\")}\n subtitle={msg(\"One artwork as copies, or a set of unique pieces.\")}\n aside={preview}\n >\n {!hasArt ? (\n <Dropzone\n mediaKindLock=\"image\"\n multiple\n title={t(\"Drop or upload your artwork\")}\n subtitle={t(\"One image becomes copies of one artwork. Several images become a set of unique pieces.\")}\n hasWallet={!!wallet}\n onRequireWallet={app.onRequireWallet}\n connectLabel={app.connectLabel}\n onFileSelected={(file) => addFiles([file])}\n onFilesSelected={addFiles}\n />\n ) : (\n <div className=\"space-y-6\">\n <ArtworkFields draft={draft} setDraft={setDraft} errors={errors} onAddFiles={addFiles}\n onRemoveEdition={() => setDraft({ edition: null, cover: null })} />\n <NameFields draft={draft} setDraft={setDraft} errors={errors}\n onNameChange={(name) => setDraft({ name, symbol: dropSymbol(name) })} />\n <PriceFields draft={draft} setDraft={setDraft} errors={errors} feeBps={feeBps} />\n <AccessFields draft={draft} setDraft={setDraft} errors={errors} />\n\n <div className=\"space-y-3\">\n <CollapsibleSection open={timingOpen} onOpenChange={setTimingOpen}\n icon={<CalendarClock className=\"h-4 w-4 text-primary\" />}\n label={t(\"Timing and limits\")} hint={timingSummary(draft.sale, t)}>\n <TimingFields draft={draft} setDraft={setDraft} errors={errors} />\n </CollapsibleSection>\n <CollapsibleSection open={licenseOpen} onOpenChange={setLicenseOpen}\n icon={<ShieldCheck className=\"h-4 w-4 text-primary\" />}\n label={t(\"License terms\")} hint={t(LICENSE_TYPES.find((l) => l.value === draft.license.licenseType)?.label ?? draft.license.licenseType)}>\n <LicenseFields draft={draft} setDraft={setDraft} />\n </CollapsibleSection>\n <CollapsibleSection open={draft.gated.enabled}\n onOpenChange={(enabled) => setDraft({ gated: { ...draft.gated, enabled } })}\n icon={<Lock className=\"h-4 w-4 text-primary\" />}\n label={t(\"Exclusive content\")} hint={t(\"Optional · a private link only holders can open\")}>\n <ExclusiveFields value={draft.gated} onChange={(v) => setDraft({ gated: { ...draft.gated, ...v } })} />\n <FieldError message={errors.gated} />\n </CollapsibleSection>\n </div>\n\n {tried && Object.keys(errors).length > 0 && <p className=\"text-sm font-medium text-destructive\">{t(\"Check the highlighted fields.\")}</p>}\n <ActionButton solid big onClick={launch} className=\"w-full\">\n {wallet ? t(\"Launch drop\") : app.connectLabel ?? t(\"Sign in to launch\")}\n </ActionButton>\n </div>\n )}\n {launching && <LaunchDialog open onClose={() => setLaunching(false)} draft={draft} />}\n </ClaimRouteShell>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA0EM;AAxEN,mBAAiC;AACjC,0BAA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,aACF;AAAA,UAEC,SAAS,OAAO,KAAK,MAAM,EAAE,SAAS,KAAK,4CAAC,OAAE,WAAU,wCAAwC,YAAE,+BAA+B,GAAE;AAAA,UACpI,4CAAC,qCAAa,OAAK,MAAC,KAAG,MAAC,SAAS,QAAQ,WAAU,UAChD,mBAAS,EAAE,aAAa,IAAI,IAAI,gBAAgB,EAAE,mBAAmB,GACxE;AAAA,WACF;AAAA,QAED,aAAa,4CAAC,qCAAa,MAAI,MAAC,SAAS,MAAM,aAAa,KAAK,GAAG,OAAc;AAAA;AAAA;AAAA,EACrF;AAEJ;","names":[]}
|
|
@@ -7,11 +7,14 @@ import '../../../utils/drop/metadata.cjs';
|
|
|
7
7
|
import '@medialane/sdk';
|
|
8
8
|
import '../../../utils/drop/sale.cjs';
|
|
9
9
|
|
|
10
|
+
/** The draft with these images: one image is an edition, several are a collection. */
|
|
11
|
+
declare function withArtwork(draft: DropDraft, files: File[]): Partial<DropDraft>;
|
|
12
|
+
/** The collection's symbol, made from the drop's name. */
|
|
13
|
+
declare function dropSymbol(name: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Create a drop on one screen: the artwork first, then the name, price and who can mint, with
|
|
16
|
+
* timing, license and exclusive content in panels that stay closed until needed.
|
|
17
|
+
*/
|
|
10
18
|
declare function DropCreate(): react_jsx_runtime.JSX.Element;
|
|
11
|
-
/** The drop as collectors will see it, updated as the form changes. */
|
|
12
|
-
declare function DraftSummary({ draft, feeBps }: {
|
|
13
|
-
draft: DropDraft;
|
|
14
|
-
feeBps: number | null;
|
|
15
|
-
}): react_jsx_runtime.JSX.Element;
|
|
16
19
|
|
|
17
|
-
export {
|
|
20
|
+
export { DropCreate, dropSymbol, withArtwork };
|
|
@@ -7,11 +7,14 @@ import '../../../utils/drop/metadata.js';
|
|
|
7
7
|
import '@medialane/sdk';
|
|
8
8
|
import '../../../utils/drop/sale.js';
|
|
9
9
|
|
|
10
|
+
/** The draft with these images: one image is an edition, several are a collection. */
|
|
11
|
+
declare function withArtwork(draft: DropDraft, files: File[]): Partial<DropDraft>;
|
|
12
|
+
/** The collection's symbol, made from the drop's name. */
|
|
13
|
+
declare function dropSymbol(name: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Create a drop on one screen: the artwork first, then the name, price and who can mint, with
|
|
16
|
+
* timing, license and exclusive content in panels that stay closed until needed.
|
|
17
|
+
*/
|
|
10
18
|
declare function DropCreate(): react_jsx_runtime.JSX.Element;
|
|
11
|
-
/** The drop as collectors will see it, updated as the form changes. */
|
|
12
|
-
declare function DraftSummary({ draft, feeBps }: {
|
|
13
|
-
draft: DropDraft;
|
|
14
|
-
feeBps: number | null;
|
|
15
|
-
}): react_jsx_runtime.JSX.Element;
|
|
16
19
|
|
|
17
|
-
export {
|
|
20
|
+
export { DropCreate, dropSymbol, withArtwork };
|
|
@@ -1,86 +1,180 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState } from "react";
|
|
4
|
-
import { Lock } from "lucide-react";
|
|
5
|
-
import Image from "../../image.js";
|
|
3
|
+
import { useRef, useState } from "react";
|
|
4
|
+
import { CalendarClock, Lock, Package, ShieldCheck } from "lucide-react";
|
|
6
5
|
import { ActionButton } from "../../action-button.js";
|
|
7
6
|
import { CollapsibleSection } from "../../collapsible-section.js";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { ClaimRouteShell } from "../../claim-route-shell.js";
|
|
8
|
+
import { Dropzone } from "../../fast-mint/dropzone.js";
|
|
9
|
+
import { MedialaneCollectionCard } from "../../medialane-collection-card.js";
|
|
10
|
+
import { AccessFields, ArtworkFields, FieldError, LicenseFields, NameFields, PriceFields, TimingFields, timingSummary } from "./drop-fields.js";
|
|
12
11
|
import { ExclusiveFields } from "./exclusive-fields.js";
|
|
13
12
|
import { LaunchDialog } from "./launch-dialog.js";
|
|
14
|
-
import { FieldError } from "./artwork-section.js";
|
|
15
13
|
import { EMPTY_DRAFT, draftSupply, validateDropDraft, supplyLabel } from "../../../utils/drop/draft.js";
|
|
16
|
-
import { collectorPriceLine } from "../../../utils/drop/sale.js";
|
|
17
14
|
import { previewUrl } from "../../../utils/drop/preview.js";
|
|
15
|
+
import { suggestLaunchpadSymbol } from "../../../utils/launchpad-defaults.js";
|
|
16
|
+
import { acceptFor } from "../../../utils/upload-limits.js";
|
|
17
|
+
import { LICENSE_TYPES } from "../../../data/ip.js";
|
|
18
18
|
import { useMedialaneApp } from "../../medialane-app.js";
|
|
19
19
|
import { useDropFee } from "../../../utils/use-drops.js";
|
|
20
20
|
import { useT } from "../../../i18n/provider.js";
|
|
21
|
+
import { msg } from "../../../i18n/index.js";
|
|
21
22
|
import { useFormat } from "../../../i18n/use-format.js";
|
|
23
|
+
const toItem = (file) => ({ id: crypto.randomUUID(), file, previewUrl: URL.createObjectURL(file), name: "", description: "" });
|
|
24
|
+
function withArtwork(draft, files) {
|
|
25
|
+
const current = draft.kind === "edition" ? draft.edition ? [toItem(draft.edition)] : [] : draft.items;
|
|
26
|
+
const items = [...current, ...files.map(toItem)];
|
|
27
|
+
if (items.length === 1) return { kind: "edition", edition: items[0].file, items: [] };
|
|
28
|
+
return { kind: "collection", edition: null, items };
|
|
29
|
+
}
|
|
30
|
+
function dropSymbol(name) {
|
|
31
|
+
return suggestLaunchpadSymbol(name) || "DROP";
|
|
32
|
+
}
|
|
22
33
|
function DropCreate() {
|
|
23
34
|
const t = useT();
|
|
35
|
+
const intl = useFormat();
|
|
24
36
|
const app = useMedialaneApp();
|
|
25
37
|
const feeBps = useDropFee();
|
|
26
38
|
const [draft, setDraftState] = useState(EMPTY_DRAFT);
|
|
27
39
|
const [tried, setTried] = useState(false);
|
|
28
40
|
const [launching, setLaunching] = useState(false);
|
|
41
|
+
const [timingOpen, setTimingOpen] = useState(false);
|
|
42
|
+
const [licenseOpen, setLicenseOpen] = useState(false);
|
|
43
|
+
const coverRef = useRef(null);
|
|
29
44
|
const setDraft = (patch) => setDraftState((d) => ({ ...d, ...patch }));
|
|
30
45
|
const errors = tried ? validateDropDraft(draft, Math.floor(Date.now() / 1e3)) : {};
|
|
46
|
+
const hasArt = draft.kind === "edition" ? !!draft.edition : draft.items.length > 0;
|
|
47
|
+
const addFiles = (files) => setDraftState((d) => ({ ...d, ...withArtwork(d, files) }));
|
|
31
48
|
const launch = () => {
|
|
32
49
|
if (!app.walletAddress) return app.onRequireWallet();
|
|
33
50
|
setTried(true);
|
|
34
|
-
|
|
51
|
+
const invalid = validateDropDraft(draft, Math.floor(Date.now() / 1e3));
|
|
52
|
+
if (invalid.start || invalid.end || invalid.perWallet) setTimingOpen(true);
|
|
53
|
+
if (Object.keys(invalid).length === 0) setLaunching(true);
|
|
35
54
|
};
|
|
36
|
-
return /* @__PURE__ */ jsxs("div", { className: "grid gap-6 lg:grid-cols-[minmax(0,1fr)_320px]", children: [
|
|
37
|
-
/* @__PURE__ */ jsxs("div", { className: "space-y-5 lg:order-1 order-2", children: [
|
|
38
|
-
/* @__PURE__ */ jsx(ArtworkSection, { draft, setDraft, errors }),
|
|
39
|
-
/* @__PURE__ */ jsx(DetailsSection, { draft, setDraft, errors }),
|
|
40
|
-
/* @__PURE__ */ jsx(SaleSection, { draft, setDraft, errors, feeBps }),
|
|
41
|
-
/* @__PURE__ */ jsx(ListSection, { draft, setDraft, errors }),
|
|
42
|
-
/* @__PURE__ */ jsxs(
|
|
43
|
-
CollapsibleSection,
|
|
44
|
-
{
|
|
45
|
-
open: draft.gated.enabled,
|
|
46
|
-
onOpenChange: (enabled) => setDraft({ gated: { ...draft.gated, enabled } }),
|
|
47
|
-
icon: /* @__PURE__ */ jsx(Lock, { className: "h-4 w-4 text-primary" }),
|
|
48
|
-
label: t("Exclusive content"),
|
|
49
|
-
hint: t("Optional \xB7 a private link only holders can open"),
|
|
50
|
-
children: [
|
|
51
|
-
/* @__PURE__ */ jsx(ExclusiveFields, { value: draft.gated, onChange: (v) => setDraft({ gated: { ...draft.gated, ...v } }) }),
|
|
52
|
-
/* @__PURE__ */ jsx(FieldError, { message: errors.gated })
|
|
53
|
-
]
|
|
54
|
-
}
|
|
55
|
-
),
|
|
56
|
-
tried && Object.keys(errors).length > 0 && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: t("Check the highlighted fields.") }),
|
|
57
|
-
/* @__PURE__ */ jsx(ActionButton, { solid: true, big: true, onClick: launch, className: "w-full", children: app.walletAddress ? t("Review and launch") : app.connectLabel ?? t("Sign in to launch") }),
|
|
58
|
-
launching && /* @__PURE__ */ jsx(LaunchDialog, { open: true, onClose: () => setLaunching(false), draft })
|
|
59
|
-
] }),
|
|
60
|
-
/* @__PURE__ */ jsx("div", { className: "order-1 lg:order-2", children: /* @__PURE__ */ jsx("div", { className: "lg:sticky lg:top-24", children: /* @__PURE__ */ jsx(DraftSummary, { draft, feeBps }) }) })
|
|
61
|
-
] });
|
|
62
|
-
}
|
|
63
|
-
function DraftSummary({ draft, feeBps }) {
|
|
64
|
-
const intl = useFormat();
|
|
65
|
-
const t = useT();
|
|
66
55
|
const art = draft.cover ?? (draft.kind === "edition" ? draft.edition : draft.items[0]?.file ?? null);
|
|
67
|
-
const preview = art ? previewUrl(art) : null;
|
|
68
56
|
const supply = draftSupply(draft);
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
57
|
+
const wallet = app.walletAddress;
|
|
58
|
+
const preview = /* @__PURE__ */ jsxs("div", { className: "mx-auto w-full max-w-[260px] space-y-2 lg:max-w-none", children: [
|
|
59
|
+
/* @__PURE__ */ jsx(
|
|
60
|
+
MedialaneCollectionCard,
|
|
61
|
+
{
|
|
62
|
+
image: art ? previewUrl(art) : null,
|
|
63
|
+
name: draft.name,
|
|
64
|
+
collection: Number.isFinite(supply) && supply > 0 ? supplyLabel(t, draft.kind, supply, intl.number(supply)) : void 0,
|
|
65
|
+
creator: wallet ? `${wallet.slice(0, 6)}\u2026${wallet.slice(-4)}` : void 0
|
|
66
|
+
}
|
|
67
|
+
),
|
|
68
|
+
hasArt && /* @__PURE__ */ jsxs("div", { className: "text-center", children: [
|
|
69
|
+
/* @__PURE__ */ jsx("button", { type: "button", onClick: () => coverRef.current?.click(), className: "text-xs font-semibold text-primary", children: t("Change cover") }),
|
|
70
|
+
/* @__PURE__ */ jsx(
|
|
71
|
+
"input",
|
|
72
|
+
{
|
|
73
|
+
ref: coverRef,
|
|
74
|
+
type: "file",
|
|
75
|
+
accept: acceptFor("image"),
|
|
76
|
+
className: "hidden",
|
|
77
|
+
onChange: (e) => {
|
|
78
|
+
const f = e.target.files?.[0];
|
|
79
|
+
if (f) setDraft({ cover: f });
|
|
80
|
+
e.target.value = "";
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
)
|
|
79
84
|
] })
|
|
80
85
|
] });
|
|
86
|
+
return /* @__PURE__ */ jsxs(
|
|
87
|
+
ClaimRouteShell,
|
|
88
|
+
{
|
|
89
|
+
icon: /* @__PURE__ */ jsx(Package, { className: "h-4 w-4 text-white" }),
|
|
90
|
+
title: msg("Create a drop"),
|
|
91
|
+
subtitle: msg("One artwork as copies, or a set of unique pieces."),
|
|
92
|
+
aside: preview,
|
|
93
|
+
children: [
|
|
94
|
+
!hasArt ? /* @__PURE__ */ jsx(
|
|
95
|
+
Dropzone,
|
|
96
|
+
{
|
|
97
|
+
mediaKindLock: "image",
|
|
98
|
+
multiple: true,
|
|
99
|
+
title: t("Drop or upload your artwork"),
|
|
100
|
+
subtitle: t("One image becomes copies of one artwork. Several images become a set of unique pieces."),
|
|
101
|
+
hasWallet: !!wallet,
|
|
102
|
+
onRequireWallet: app.onRequireWallet,
|
|
103
|
+
connectLabel: app.connectLabel,
|
|
104
|
+
onFileSelected: (file) => addFiles([file]),
|
|
105
|
+
onFilesSelected: addFiles
|
|
106
|
+
}
|
|
107
|
+
) : /* @__PURE__ */ jsxs("div", { className: "space-y-6", children: [
|
|
108
|
+
/* @__PURE__ */ jsx(
|
|
109
|
+
ArtworkFields,
|
|
110
|
+
{
|
|
111
|
+
draft,
|
|
112
|
+
setDraft,
|
|
113
|
+
errors,
|
|
114
|
+
onAddFiles: addFiles,
|
|
115
|
+
onRemoveEdition: () => setDraft({ edition: null, cover: null })
|
|
116
|
+
}
|
|
117
|
+
),
|
|
118
|
+
/* @__PURE__ */ jsx(
|
|
119
|
+
NameFields,
|
|
120
|
+
{
|
|
121
|
+
draft,
|
|
122
|
+
setDraft,
|
|
123
|
+
errors,
|
|
124
|
+
onNameChange: (name) => setDraft({ name, symbol: dropSymbol(name) })
|
|
125
|
+
}
|
|
126
|
+
),
|
|
127
|
+
/* @__PURE__ */ jsx(PriceFields, { draft, setDraft, errors, feeBps }),
|
|
128
|
+
/* @__PURE__ */ jsx(AccessFields, { draft, setDraft, errors }),
|
|
129
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-3", children: [
|
|
130
|
+
/* @__PURE__ */ jsx(
|
|
131
|
+
CollapsibleSection,
|
|
132
|
+
{
|
|
133
|
+
open: timingOpen,
|
|
134
|
+
onOpenChange: setTimingOpen,
|
|
135
|
+
icon: /* @__PURE__ */ jsx(CalendarClock, { className: "h-4 w-4 text-primary" }),
|
|
136
|
+
label: t("Timing and limits"),
|
|
137
|
+
hint: timingSummary(draft.sale, t),
|
|
138
|
+
children: /* @__PURE__ */ jsx(TimingFields, { draft, setDraft, errors })
|
|
139
|
+
}
|
|
140
|
+
),
|
|
141
|
+
/* @__PURE__ */ jsx(
|
|
142
|
+
CollapsibleSection,
|
|
143
|
+
{
|
|
144
|
+
open: licenseOpen,
|
|
145
|
+
onOpenChange: setLicenseOpen,
|
|
146
|
+
icon: /* @__PURE__ */ jsx(ShieldCheck, { className: "h-4 w-4 text-primary" }),
|
|
147
|
+
label: t("License terms"),
|
|
148
|
+
hint: t(LICENSE_TYPES.find((l) => l.value === draft.license.licenseType)?.label ?? draft.license.licenseType),
|
|
149
|
+
children: /* @__PURE__ */ jsx(LicenseFields, { draft, setDraft })
|
|
150
|
+
}
|
|
151
|
+
),
|
|
152
|
+
/* @__PURE__ */ jsxs(
|
|
153
|
+
CollapsibleSection,
|
|
154
|
+
{
|
|
155
|
+
open: draft.gated.enabled,
|
|
156
|
+
onOpenChange: (enabled) => setDraft({ gated: { ...draft.gated, enabled } }),
|
|
157
|
+
icon: /* @__PURE__ */ jsx(Lock, { className: "h-4 w-4 text-primary" }),
|
|
158
|
+
label: t("Exclusive content"),
|
|
159
|
+
hint: t("Optional \xB7 a private link only holders can open"),
|
|
160
|
+
children: [
|
|
161
|
+
/* @__PURE__ */ jsx(ExclusiveFields, { value: draft.gated, onChange: (v) => setDraft({ gated: { ...draft.gated, ...v } }) }),
|
|
162
|
+
/* @__PURE__ */ jsx(FieldError, { message: errors.gated })
|
|
163
|
+
]
|
|
164
|
+
}
|
|
165
|
+
)
|
|
166
|
+
] }),
|
|
167
|
+
tried && Object.keys(errors).length > 0 && /* @__PURE__ */ jsx("p", { className: "text-sm font-medium text-destructive", children: t("Check the highlighted fields.") }),
|
|
168
|
+
/* @__PURE__ */ jsx(ActionButton, { solid: true, big: true, onClick: launch, className: "w-full", children: wallet ? t("Launch drop") : app.connectLabel ?? t("Sign in to launch") })
|
|
169
|
+
] }),
|
|
170
|
+
launching && /* @__PURE__ */ jsx(LaunchDialog, { open: true, onClose: () => setLaunching(false), draft })
|
|
171
|
+
]
|
|
172
|
+
}
|
|
173
|
+
);
|
|
81
174
|
}
|
|
82
175
|
export {
|
|
83
|
-
|
|
84
|
-
|
|
176
|
+
DropCreate,
|
|
177
|
+
dropSymbol,
|
|
178
|
+
withArtwork
|
|
85
179
|
};
|
|
86
180
|
//# sourceMappingURL=drop-create.js.map
|