@medialane/ui 0.233.0 → 0.234.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/launchpad/collection-create-form.cjs +302 -0
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -0
- package/dist/components/launchpad/collection-create-form.d.cts +11 -0
- package/dist/components/launchpad/collection-create-form.d.ts +11 -0
- package/dist/components/launchpad/collection-create-form.js +275 -0
- package/dist/components/launchpad/collection-create-form.js.map +1 -0
- package/dist/components/launchpad/collection-create-presets.cjs +147 -0
- package/dist/components/launchpad/collection-create-presets.cjs.map +1 -0
- package/dist/components/launchpad/collection-create-presets.d.cts +60 -0
- package/dist/components/launchpad/collection-create-presets.d.ts +60 -0
- package/dist/components/launchpad/collection-create-presets.js +120 -0
- package/dist/components/launchpad/collection-create-presets.js.map +1 -0
- package/dist/index.cjs +12 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/package.json +3 -1
|
@@ -0,0 +1,302 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
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
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var collection_create_form_exports = {};
|
|
31
|
+
__export(collection_create_form_exports, {
|
|
32
|
+
CollectionCreateForm: () => CollectionCreateForm
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(collection_create_form_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_react_hook_form = require("react-hook-form");
|
|
38
|
+
var import_zod = require("@hookform/resolvers/zod");
|
|
39
|
+
var z = __toESM(require("zod"), 1);
|
|
40
|
+
var import_lucide_react = require("lucide-react");
|
|
41
|
+
var import_sdk = require("@medialane/sdk");
|
|
42
|
+
var import_starknet = require("@medialane/sdk/starknet");
|
|
43
|
+
var import_image = __toESM(require("../image.js"), 1);
|
|
44
|
+
var import_button = require("../button.js");
|
|
45
|
+
var import_input = require("../input.js");
|
|
46
|
+
var import_textarea = require("../textarea.js");
|
|
47
|
+
var import_form = require("../form.js");
|
|
48
|
+
var import_claim_route_shell = require("../claim-route-shell.js");
|
|
49
|
+
var import_creation_success = require("../creation-success.js");
|
|
50
|
+
var import_external_link_field = require("../external-link-field.js");
|
|
51
|
+
var import_medialane_collection_card = require("../medialane-collection-card.js");
|
|
52
|
+
var import_transaction_dialog = require("../transaction-dialog.js");
|
|
53
|
+
var import_wallet_required = require("../wallet-required.js");
|
|
54
|
+
var import_medialane_app = require("../medialane-app.js");
|
|
55
|
+
var import_reward_earned = require("../rewards/reward-earned.js");
|
|
56
|
+
var import_run_intent_calls = require("../../utils/run-intent-calls.js");
|
|
57
|
+
var import_ipfs_upload = require("../../utils/ipfs-upload.js");
|
|
58
|
+
var import_use_transaction = require("../../utils/use-transaction.js");
|
|
59
|
+
var import_use_launchpad_image_upload = require("../../utils/use-launchpad-image-upload.js");
|
|
60
|
+
var import_portfolio_cache = require("../../utils/portfolio-cache.js");
|
|
61
|
+
var import_launchpad_defaults = require("../../utils/launchpad-defaults.js");
|
|
62
|
+
const schema = z.object({
|
|
63
|
+
name: z.string().min(1, "Name required").max(import_sdk.FIELD_LIMITS.name),
|
|
64
|
+
symbol: z.string().min(1, "Symbol required").max(import_sdk.FIELD_LIMITS.symbol, `Max ${import_sdk.FIELD_LIMITS.symbol} characters`).regex(/^[A-Z0-9]+$/, "Uppercase letters and numbers only"),
|
|
65
|
+
description: z.string().max(import_sdk.FIELD_LIMITS.description).optional(),
|
|
66
|
+
external_link: z.string().max(500).refine((v) => !v || v.startsWith("http://") || v.startsWith("https://"), {
|
|
67
|
+
message: "Must start with http:// or https://"
|
|
68
|
+
}).optional()
|
|
69
|
+
});
|
|
70
|
+
function CollectionCreateForm({ preset, aside }) {
|
|
71
|
+
const app = (0, import_medialane_app.useMedialaneApp)();
|
|
72
|
+
const walletAddress = app.walletAddress;
|
|
73
|
+
const tx = (0, import_use_transaction.useTransaction)();
|
|
74
|
+
const upload = (0, import_use_launchpad_image_upload.useLaunchpadImageUpload)({ successMessage: "Image uploaded" });
|
|
75
|
+
const { imageFile, imagePreview, imageUri, imageUploading, uploadError, fileInputRef, handleImageSelect, clearImage } = upload;
|
|
76
|
+
const [autoSymbol, setAutoSymbol] = (0, import_react.useState)("");
|
|
77
|
+
const [viewHref, setViewHref] = (0, import_react.useState)(null);
|
|
78
|
+
const Icon = preset.icon;
|
|
79
|
+
const form = (0, import_react_hook_form.useForm)({
|
|
80
|
+
resolver: (0, import_zod.zodResolver)(schema),
|
|
81
|
+
defaultValues: { name: "", symbol: "", description: "", external_link: "" }
|
|
82
|
+
});
|
|
83
|
+
const name = form.watch("name");
|
|
84
|
+
(0, import_react.useEffect)(() => {
|
|
85
|
+
if (!preset.suggestSymbol) return;
|
|
86
|
+
const suggested = (0, import_launchpad_defaults.suggestLaunchpadSymbol)(name);
|
|
87
|
+
if (!suggested) return;
|
|
88
|
+
const current = form.getValues("symbol");
|
|
89
|
+
if (!current || current === autoSymbol) {
|
|
90
|
+
form.setValue("symbol", suggested, { shouldDirty: false });
|
|
91
|
+
setAutoSymbol(suggested);
|
|
92
|
+
}
|
|
93
|
+
}, [autoSymbol, name, form, preset.suggestSymbol]);
|
|
94
|
+
const deployedAddress = tx.receipt && preset.service ? (0, import_starknet.deployedCollectionFromReceipt)(tx.receipt, preset.service) : null;
|
|
95
|
+
const createdId = tx.receipt && !preset.service ? (0, import_starknet.createdCollectionFromReceipt)(tx.receipt, (0, import_sdk.getCoordinates)("STARKNET").collection721)?.collectionId ?? null : null;
|
|
96
|
+
(0, import_react.useEffect)(() => {
|
|
97
|
+
if (tx.phase !== "success") return;
|
|
98
|
+
let alive = true;
|
|
99
|
+
const api = app.getClient().api;
|
|
100
|
+
if (deployedAddress) {
|
|
101
|
+
setViewHref((0, import_sdk.collectionHref)("STARKNET", deployedAddress));
|
|
102
|
+
if (preset.registerAfterDeploy) void api.collections.register(deployedAddress).catch(() => {
|
|
103
|
+
});
|
|
104
|
+
} else if (createdId && walletAddress) {
|
|
105
|
+
api.collections.list({ owner: walletAddress, limit: 50 }).then((res) => {
|
|
106
|
+
const created = (res.data ?? []).find((c) => c.collectionId === createdId);
|
|
107
|
+
if (alive && created) setViewHref((0, import_sdk.collectionHref)("STARKNET", created.contractAddress));
|
|
108
|
+
}).catch(() => {
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
return () => {
|
|
112
|
+
alive = false;
|
|
113
|
+
};
|
|
114
|
+
}, [tx.phase, deployedAddress, createdId, walletAddress, app, preset.registerAfterDeploy]);
|
|
115
|
+
const handleAgain = () => {
|
|
116
|
+
tx.reset();
|
|
117
|
+
setViewHref(null);
|
|
118
|
+
setAutoSymbol("");
|
|
119
|
+
form.reset();
|
|
120
|
+
clearImage();
|
|
121
|
+
};
|
|
122
|
+
const onSubmit = (values) => {
|
|
123
|
+
if (imageFile && !imageUri && !imageUploading) return;
|
|
124
|
+
if (!walletAddress) return;
|
|
125
|
+
void tx.run(async (signer) => {
|
|
126
|
+
await app.ensureSignedIn?.();
|
|
127
|
+
const api = app.getClient().api;
|
|
128
|
+
const baseUri = await (0, import_ipfs_upload.uploadJsonToIpfs)(
|
|
129
|
+
api,
|
|
130
|
+
(0, import_sdk.buildCollectionMetadata)({
|
|
131
|
+
name: values.name,
|
|
132
|
+
description: values.description,
|
|
133
|
+
image: imageUri,
|
|
134
|
+
externalLink: values.external_link,
|
|
135
|
+
owner: walletAddress
|
|
136
|
+
})
|
|
137
|
+
);
|
|
138
|
+
await (0, import_run_intent_calls.runIntentCalls)(
|
|
139
|
+
signer,
|
|
140
|
+
() => api.intents.create("create-collection", {
|
|
141
|
+
owner: walletAddress,
|
|
142
|
+
name: values.name,
|
|
143
|
+
symbol: values.symbol,
|
|
144
|
+
baseUri,
|
|
145
|
+
...preset.service ? { service: preset.service } : {}
|
|
146
|
+
})
|
|
147
|
+
);
|
|
148
|
+
(0, import_portfolio_cache.invalidatePortfolioCache)(walletAddress);
|
|
149
|
+
});
|
|
150
|
+
};
|
|
151
|
+
const { copy } = preset;
|
|
152
|
+
const busy = tx.phase !== "idle" || imageUploading;
|
|
153
|
+
const actions = preset.actions({ address: deployedAddress, collectionHref: viewHref });
|
|
154
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_wallet_required.WalletRequired, { icon: Icon, iconClassName: preset.iconClass, title: preset.signedOut.title, description: preset.signedOut.description, children: [
|
|
155
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_dialog.TransactionDialog, { tx, title: preset.dialog.title, workingLabel: preset.dialog.workingLabel, firstStepLabel: preset.dialog.firstStepLabel, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
156
|
+
import_creation_success.CreationSuccess,
|
|
157
|
+
{
|
|
158
|
+
name: name || preset.success.fallbackName,
|
|
159
|
+
image: imagePreview,
|
|
160
|
+
caption: preset.success.caption,
|
|
161
|
+
primary: actions.primary,
|
|
162
|
+
secondary: actions.secondary,
|
|
163
|
+
onAgain: handleAgain,
|
|
164
|
+
againLabel: preset.success.againLabel,
|
|
165
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_reward_earned.RewardEarned, { actionType: preset.success.reward })
|
|
166
|
+
}
|
|
167
|
+
) }),
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
169
|
+
import_claim_route_shell.ClaimRouteShell,
|
|
170
|
+
{
|
|
171
|
+
icon: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "h-4 w-4 text-white" }),
|
|
172
|
+
title: preset.shell.title,
|
|
173
|
+
subtitle: preset.shell.subtitle,
|
|
174
|
+
aside: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
175
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
176
|
+
import_medialane_collection_card.MedialaneCollectionCard,
|
|
177
|
+
{
|
|
178
|
+
image: imagePreview,
|
|
179
|
+
name,
|
|
180
|
+
collection: form.watch("symbol") || preset.cardFallbackSymbol,
|
|
181
|
+
creator: walletAddress ? `${walletAddress.slice(0, 6)}\u2026${walletAddress.slice(-4)}` : void 0,
|
|
182
|
+
creatorHref: walletAddress ? (0, import_sdk.profileHref)({ address: walletAddress }) : void 0
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
aside
|
|
186
|
+
] }),
|
|
187
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.Form, { ...form, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-5", children: [
|
|
188
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2", children: [
|
|
189
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium", children: copy.imageHeading }),
|
|
190
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start gap-4", children: [
|
|
191
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
192
|
+
"div",
|
|
193
|
+
{
|
|
194
|
+
className: "relative h-28 w-28 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors",
|
|
195
|
+
role: "button",
|
|
196
|
+
tabIndex: 0,
|
|
197
|
+
"aria-label": `Upload ${copy.imageHeading.toLowerCase()}`,
|
|
198
|
+
onClick: () => !imageUploading && fileInputRef.current?.click(),
|
|
199
|
+
onKeyDown: (e) => {
|
|
200
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
201
|
+
e.preventDefault();
|
|
202
|
+
if (!imageUploading) fileInputRef.current?.click();
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
children: [
|
|
206
|
+
imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: imagePreview, alt: copy.imageHeading, fill: true, unoptimized: true, className: "object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ImagePlus, { className: "h-8 w-8 text-muted-foreground" }),
|
|
207
|
+
imageUploading && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 bg-background/70 flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-5 w-5 animate-spin text-primary" }) })
|
|
208
|
+
]
|
|
209
|
+
}
|
|
210
|
+
),
|
|
211
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-2 flex-1", children: [
|
|
212
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
213
|
+
"input",
|
|
214
|
+
{
|
|
215
|
+
ref: fileInputRef,
|
|
216
|
+
type: "file",
|
|
217
|
+
accept: (0, import_sdk.acceptFor)("image"),
|
|
218
|
+
className: "hidden",
|
|
219
|
+
onChange: (e) => {
|
|
220
|
+
const f = e.target.files?.[0];
|
|
221
|
+
if (f) void handleImageSelect(f);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
),
|
|
225
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { type: "button", variant: "outline", size: "sm", disabled: imageUploading, onClick: () => fileInputRef.current?.click(), children: imageUploading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
226
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-3.5 w-3.5 mr-1.5 animate-spin" }),
|
|
227
|
+
"Uploading\u2026"
|
|
228
|
+
] }) : imageFile ? "Change image" : "Upload image" }),
|
|
229
|
+
imageFile && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
230
|
+
"button",
|
|
231
|
+
{
|
|
232
|
+
type: "button",
|
|
233
|
+
onClick: clearImage,
|
|
234
|
+
className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",
|
|
235
|
+
children: [
|
|
236
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "h-3 w-3" }),
|
|
237
|
+
" Remove"
|
|
238
|
+
]
|
|
239
|
+
}
|
|
240
|
+
),
|
|
241
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-xs text-muted-foreground", children: [
|
|
242
|
+
"JPG, PNG, GIF, SVG or WebP",
|
|
243
|
+
imageUri && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ml-2 text-emerald-500 font-medium", children: "\u2713 Uploaded" })
|
|
244
|
+
] }),
|
|
245
|
+
copy.imageHelp && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: copy.imageHelp }),
|
|
246
|
+
uploadError && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-destructive", children: uploadError })
|
|
247
|
+
] })
|
|
248
|
+
] })
|
|
249
|
+
] }),
|
|
250
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormField, { control: form.control, name: "name", render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_form.FormItem, { children: [
|
|
251
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormLabel, { children: copy.nameLabel }),
|
|
252
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { placeholder: copy.namePlaceholder, ...field }) }),
|
|
253
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormDescription, { children: copy.nameHint }),
|
|
254
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormMessage, {})
|
|
255
|
+
] }) }),
|
|
256
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormField, { control: form.control, name: "symbol", render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_form.FormItem, { children: [
|
|
257
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormLabel, { children: "Symbol *" }),
|
|
258
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
259
|
+
import_input.Input,
|
|
260
|
+
{
|
|
261
|
+
placeholder: copy.symbolPlaceholder,
|
|
262
|
+
maxLength: import_sdk.FIELD_LIMITS.symbol,
|
|
263
|
+
...field,
|
|
264
|
+
onChange: (e) => field.onChange(e.target.value.toUpperCase())
|
|
265
|
+
}
|
|
266
|
+
) }),
|
|
267
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormDescription, { children: copy.symbolHint }),
|
|
268
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormMessage, {})
|
|
269
|
+
] }) }),
|
|
270
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormField, { control: form.control, name: "description", render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_form.FormItem, { children: [
|
|
271
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_form.FormLabel, { children: [
|
|
272
|
+
"Description ",
|
|
273
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-muted-foreground font-normal", children: "(optional)" })
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_textarea.Textarea, { placeholder: copy.descriptionPlaceholder, rows: 3, ...field }) }),
|
|
276
|
+
copy.descriptionHint && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormDescription, { children: copy.descriptionHint }),
|
|
277
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormMessage, {})
|
|
278
|
+
] }) }),
|
|
279
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_external_link_field.ExternalLinkField, { form, address: walletAddress }),
|
|
280
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
281
|
+
"button",
|
|
282
|
+
{
|
|
283
|
+
type: "submit",
|
|
284
|
+
disabled: busy,
|
|
285
|
+
className: `w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] ${preset.buttonClass} ${busy ? "opacity-40 pointer-events-none" : ""}`,
|
|
286
|
+
children: [
|
|
287
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, { className: "h-4 w-4" }),
|
|
288
|
+
copy.submit
|
|
289
|
+
]
|
|
290
|
+
}
|
|
291
|
+
),
|
|
292
|
+
copy.footnotes.map((note) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-center text-muted-foreground", children: note }, note))
|
|
293
|
+
] }) })
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] });
|
|
297
|
+
}
|
|
298
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
299
|
+
0 && (module.exports = {
|
|
300
|
+
CollectionCreateForm
|
|
301
|
+
});
|
|
302
|
+
//# sourceMappingURL=collection-create-form.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/launchpad/collection-create-form.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState, type ReactNode } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport * as z from \"zod\";\nimport { ImagePlus, Loader2, X } from \"lucide-react\";\nimport {\n FIELD_LIMITS,\n acceptFor,\n buildCollectionMetadata,\n collectionHref,\n getCoordinates,\n profileHref,\n} from \"@medialane/sdk\";\nimport { createdCollectionFromReceipt, deployedCollectionFromReceipt } from \"@medialane/sdk/starknet\";\nimport Image from \"../image.js\";\nimport { Button } from \"../button.js\";\nimport { Input } from \"../input.js\";\nimport { Textarea } from \"../textarea.js\";\nimport { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from \"../form.js\";\nimport { ClaimRouteShell } from \"../claim-route-shell.js\";\nimport { CreationSuccess } from \"../creation-success.js\";\nimport { ExternalLinkField } from \"../external-link-field.js\";\nimport { MedialaneCollectionCard } from \"../medialane-collection-card.js\";\nimport { TransactionDialog } from \"../transaction-dialog.js\";\nimport { WalletRequired } from \"../wallet-required.js\";\nimport { useMedialaneApp } from \"../medialane-app.js\";\nimport { RewardEarned } from \"../rewards/reward-earned.js\";\nimport { runIntentCalls } from \"../../utils/run-intent-calls.js\";\nimport { uploadJsonToIpfs } from \"../../utils/ipfs-upload.js\";\nimport { useTransaction } from \"../../utils/use-transaction.js\";\nimport { useLaunchpadImageUpload } from \"../../utils/use-launchpad-image-upload.js\";\nimport { invalidatePortfolioCache } from \"../../utils/portfolio-cache.js\";\nimport { suggestLaunchpadSymbol } from \"../../utils/launchpad-defaults.js\";\nimport type { CollectionCreatePreset } from \"./collection-create-presets.js\";\n\nconst schema = z.object({\n name: z.string().min(1, \"Name required\").max(FIELD_LIMITS.name),\n symbol: z\n .string()\n .min(1, \"Symbol required\")\n .max(FIELD_LIMITS.symbol, `Max ${FIELD_LIMITS.symbol} characters`)\n .regex(/^[A-Z0-9]+$/, \"Uppercase letters and numbers only\"),\n description: z.string().max(FIELD_LIMITS.description).optional(),\n external_link: z\n .string()\n .max(500)\n .refine((v) => !v || v.startsWith(\"http://\") || v.startsWith(\"https://\"), {\n message: \"Must start with http:// or https://\",\n })\n .optional(),\n});\ntype FormValues = z.infer<typeof schema>;\n\nexport interface CollectionCreateFormProps {\n preset: CollectionCreatePreset;\n aside?: ReactNode;\n}\n\nexport function CollectionCreateForm({ preset, aside }: CollectionCreateFormProps) {\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const tx = useTransaction();\n const upload = useLaunchpadImageUpload({ successMessage: \"Image uploaded\" });\n const { imageFile, imagePreview, imageUri, imageUploading, uploadError, fileInputRef, handleImageSelect, clearImage } = upload;\n const [autoSymbol, setAutoSymbol] = useState(\"\");\n const [viewHref, setViewHref] = useState<string | null>(null);\n const Icon = preset.icon;\n\n const form = useForm<FormValues>({\n resolver: zodResolver(schema),\n defaultValues: { name: \"\", symbol: \"\", description: \"\", external_link: \"\" },\n });\n const name = form.watch(\"name\");\n\n useEffect(() => {\n if (!preset.suggestSymbol) return;\n const suggested = suggestLaunchpadSymbol(name);\n if (!suggested) return;\n const current = form.getValues(\"symbol\");\n if (!current || current === autoSymbol) {\n form.setValue(\"symbol\", suggested, { shouldDirty: false });\n setAutoSymbol(suggested);\n }\n }, [autoSymbol, name, form, preset.suggestSymbol]);\n\n const deployedAddress =\n tx.receipt && preset.service ? deployedCollectionFromReceipt(tx.receipt, preset.service) : null;\n const createdId =\n tx.receipt && !preset.service ? createdCollectionFromReceipt(tx.receipt, getCoordinates(\"STARKNET\").collection721)?.collectionId ?? null : null;\n\n useEffect(() => {\n if (tx.phase !== \"success\") return;\n let alive = true;\n const api = app.getClient().api;\n if (deployedAddress) {\n setViewHref(collectionHref(\"STARKNET\", deployedAddress));\n if (preset.registerAfterDeploy) void api.collections.register(deployedAddress).catch(() => {});\n } else if (createdId && walletAddress) {\n api.collections\n .list({ owner: walletAddress, limit: 50 })\n .then((res) => {\n const created = (res.data ?? []).find((c) => c.collectionId === createdId);\n if (alive && created) setViewHref(collectionHref(\"STARKNET\", created.contractAddress));\n })\n .catch(() => {});\n }\n return () => {\n alive = false;\n };\n }, [tx.phase, deployedAddress, createdId, walletAddress, app, preset.registerAfterDeploy]);\n\n const handleAgain = () => {\n tx.reset();\n setViewHref(null);\n setAutoSymbol(\"\");\n form.reset();\n clearImage();\n };\n\n const onSubmit = (values: FormValues) => {\n if (imageFile && !imageUri && !imageUploading) return;\n if (!walletAddress) return;\n void tx.run(async (signer) => {\n await app.ensureSignedIn?.();\n const api = app.getClient().api;\n const baseUri = await uploadJsonToIpfs(\n api,\n buildCollectionMetadata({\n name: values.name,\n description: values.description,\n image: imageUri,\n externalLink: values.external_link,\n owner: walletAddress,\n }),\n );\n await runIntentCalls(signer, () =>\n api.intents.create(\"create-collection\", {\n owner: walletAddress,\n name: values.name,\n symbol: values.symbol,\n baseUri,\n ...(preset.service ? { service: preset.service } : {}),\n }),\n );\n invalidatePortfolioCache(walletAddress);\n });\n };\n\n const { copy } = preset;\n const busy = tx.phase !== \"idle\" || imageUploading;\n const actions = preset.actions({ address: deployedAddress, collectionHref: viewHref });\n\n return (\n <WalletRequired icon={Icon} iconClassName={preset.iconClass} title={preset.signedOut.title} description={preset.signedOut.description}>\n <TransactionDialog tx={tx} title={preset.dialog.title} workingLabel={preset.dialog.workingLabel} firstStepLabel={preset.dialog.firstStepLabel}>\n <CreationSuccess\n name={name || preset.success.fallbackName}\n image={imagePreview}\n caption={preset.success.caption}\n primary={actions.primary}\n secondary={actions.secondary}\n onAgain={handleAgain}\n againLabel={preset.success.againLabel}\n >\n <RewardEarned actionType={preset.success.reward} />\n </CreationSuccess>\n </TransactionDialog>\n\n <ClaimRouteShell\n icon={<Icon className=\"h-4 w-4 text-white\" />}\n title={preset.shell.title}\n subtitle={preset.shell.subtitle}\n aside={\n <>\n <MedialaneCollectionCard\n image={imagePreview}\n name={name}\n collection={form.watch(\"symbol\") || preset.cardFallbackSymbol}\n creator={walletAddress ? `${walletAddress.slice(0, 6)}…${walletAddress.slice(-4)}` : undefined}\n creatorHref={walletAddress ? profileHref({ address: walletAddress }) : undefined}\n />\n {aside}\n </>\n }\n >\n <Form {...form}>\n <form onSubmit={form.handleSubmit(onSubmit)} className=\"space-y-5\">\n <div className=\"space-y-2\">\n <p className=\"text-sm font-medium\">{copy.imageHeading}</p>\n <div className=\"flex items-start gap-4\">\n <div\n className=\"relative h-28 w-28 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors\"\n role=\"button\"\n tabIndex={0}\n aria-label={`Upload ${copy.imageHeading.toLowerCase()}`}\n onClick={() => !imageUploading && fileInputRef.current?.click()}\n onKeyDown={(e) => {\n if (e.key === \"Enter\" || e.key === \" \") {\n e.preventDefault();\n if (!imageUploading) fileInputRef.current?.click();\n }\n }}\n >\n {imagePreview ? (\n <Image src={imagePreview} alt={copy.imageHeading} fill unoptimized className=\"object-cover\" />\n ) : (\n <ImagePlus className=\"h-8 w-8 text-muted-foreground\" />\n )}\n {imageUploading && (\n <div className=\"absolute inset-0 bg-background/70 flex items-center justify-center\">\n <Loader2 className=\"h-5 w-5 animate-spin text-primary\" />\n </div>\n )}\n </div>\n <div className=\"space-y-2 flex-1\">\n <input\n ref={fileInputRef}\n type=\"file\"\n accept={acceptFor(\"image\")}\n className=\"hidden\"\n onChange={(e) => {\n const f = e.target.files?.[0];\n if (f) void handleImageSelect(f);\n }}\n />\n <Button type=\"button\" variant=\"outline\" size=\"sm\" disabled={imageUploading} onClick={() => fileInputRef.current?.click()}>\n {imageUploading ? (\n <>\n <Loader2 className=\"h-3.5 w-3.5 mr-1.5 animate-spin\" />\n Uploading…\n </>\n ) : imageFile ? (\n \"Change image\"\n ) : (\n \"Upload image\"\n )}\n </Button>\n {imageFile && (\n <button\n type=\"button\"\n onClick={clearImage}\n className=\"flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors\"\n >\n <X className=\"h-3 w-3\" /> Remove\n </button>\n )}\n <p className=\"text-xs text-muted-foreground\">\n JPG, PNG, GIF, SVG or WebP\n {imageUri && <span className=\"ml-2 text-emerald-500 font-medium\">✓ Uploaded</span>}\n </p>\n {copy.imageHelp && <p className=\"text-xs text-muted-foreground\">{copy.imageHelp}</p>}\n {uploadError && <p className=\"text-xs text-destructive\">{uploadError}</p>}\n </div>\n </div>\n </div>\n\n <FormField control={form.control} name=\"name\" render={({ field }) => (\n <FormItem>\n <FormLabel>{copy.nameLabel}</FormLabel>\n <FormControl><Input placeholder={copy.namePlaceholder} {...field} /></FormControl>\n <FormDescription>{copy.nameHint}</FormDescription>\n <FormMessage />\n </FormItem>\n )} />\n\n <FormField control={form.control} name=\"symbol\" render={({ field }) => (\n <FormItem>\n <FormLabel>Symbol *</FormLabel>\n <FormControl>\n <Input\n placeholder={copy.symbolPlaceholder}\n maxLength={FIELD_LIMITS.symbol}\n {...field}\n onChange={(e) => field.onChange(e.target.value.toUpperCase())}\n />\n </FormControl>\n <FormDescription>{copy.symbolHint}</FormDescription>\n <FormMessage />\n </FormItem>\n )} />\n\n <FormField control={form.control} name=\"description\" render={({ field }) => (\n <FormItem>\n <FormLabel>Description <span className=\"text-muted-foreground font-normal\">(optional)</span></FormLabel>\n <FormControl><Textarea placeholder={copy.descriptionPlaceholder} rows={3} {...field} /></FormControl>\n {copy.descriptionHint && <FormDescription>{copy.descriptionHint}</FormDescription>}\n <FormMessage />\n </FormItem>\n )} />\n\n <ExternalLinkField form={form} address={walletAddress} />\n\n <button\n type=\"submit\"\n disabled={busy}\n className={`w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] ${preset.buttonClass} ${busy ? \"opacity-40 pointer-events-none\" : \"\"}`}\n >\n <Icon className=\"h-4 w-4\" />\n {copy.submit}\n </button>\n {copy.footnotes.map((note) => (\n <p key={note} className=\"text-xs text-center text-muted-foreground\">{note}</p>\n ))}\n </form>\n </Form>\n </ClaimRouteShell>\n </WalletRequired>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsKU;AApKV,mBAAoD;AACpD,6BAAwB;AACxB,iBAA4B;AAC5B,QAAmB;AACnB,0BAAsC;AACtC,iBAOO;AACP,sBAA4E;AAC5E,mBAAkB;AAClB,oBAAuB;AACvB,mBAAsB;AACtB,sBAAyB;AACzB,kBAAgG;AAChG,+BAAgC;AAChC,8BAAgC;AAChC,iCAAkC;AAClC,uCAAwC;AACxC,gCAAkC;AAClC,6BAA+B;AAC/B,2BAAgC;AAChC,2BAA6B;AAC7B,8BAA+B;AAC/B,yBAAiC;AACjC,6BAA+B;AAC/B,wCAAwC;AACxC,6BAAyC;AACzC,gCAAuC;AAGvC,MAAM,SAAS,EAAE,OAAO;AAAA,EACtB,MAAM,EAAE,OAAO,EAAE,IAAI,GAAG,e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A,KACF;AAEJ;","names":["Image"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { CollectionCreatePreset } from './collection-create-presets.cjs';
|
|
4
|
+
|
|
5
|
+
interface CollectionCreateFormProps {
|
|
6
|
+
preset: CollectionCreatePreset;
|
|
7
|
+
aside?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare function CollectionCreateForm({ preset, aside }: CollectionCreateFormProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { CollectionCreateForm, type CollectionCreateFormProps };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
import { CollectionCreatePreset } from './collection-create-presets.js';
|
|
4
|
+
|
|
5
|
+
interface CollectionCreateFormProps {
|
|
6
|
+
preset: CollectionCreatePreset;
|
|
7
|
+
aside?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
declare function CollectionCreateForm({ preset, aside }: CollectionCreateFormProps): react_jsx_runtime.JSX.Element;
|
|
10
|
+
|
|
11
|
+
export { CollectionCreateForm, type CollectionCreateFormProps };
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useEffect, useState } from "react";
|
|
4
|
+
import { useForm } from "react-hook-form";
|
|
5
|
+
import { zodResolver } from "@hookform/resolvers/zod";
|
|
6
|
+
import * as z from "zod";
|
|
7
|
+
import { ImagePlus, Loader2, X } from "lucide-react";
|
|
8
|
+
import {
|
|
9
|
+
FIELD_LIMITS,
|
|
10
|
+
acceptFor,
|
|
11
|
+
buildCollectionMetadata,
|
|
12
|
+
collectionHref,
|
|
13
|
+
getCoordinates,
|
|
14
|
+
profileHref
|
|
15
|
+
} from "@medialane/sdk";
|
|
16
|
+
import { createdCollectionFromReceipt, deployedCollectionFromReceipt } from "@medialane/sdk/starknet";
|
|
17
|
+
import Image from "../image.js";
|
|
18
|
+
import { Button } from "../button.js";
|
|
19
|
+
import { Input } from "../input.js";
|
|
20
|
+
import { Textarea } from "../textarea.js";
|
|
21
|
+
import { Form, FormControl, FormDescription, FormField, FormItem, FormLabel, FormMessage } from "../form.js";
|
|
22
|
+
import { ClaimRouteShell } from "../claim-route-shell.js";
|
|
23
|
+
import { CreationSuccess } from "../creation-success.js";
|
|
24
|
+
import { ExternalLinkField } from "../external-link-field.js";
|
|
25
|
+
import { MedialaneCollectionCard } from "../medialane-collection-card.js";
|
|
26
|
+
import { TransactionDialog } from "../transaction-dialog.js";
|
|
27
|
+
import { WalletRequired } from "../wallet-required.js";
|
|
28
|
+
import { useMedialaneApp } from "../medialane-app.js";
|
|
29
|
+
import { RewardEarned } from "../rewards/reward-earned.js";
|
|
30
|
+
import { runIntentCalls } from "../../utils/run-intent-calls.js";
|
|
31
|
+
import { uploadJsonToIpfs } from "../../utils/ipfs-upload.js";
|
|
32
|
+
import { useTransaction } from "../../utils/use-transaction.js";
|
|
33
|
+
import { useLaunchpadImageUpload } from "../../utils/use-launchpad-image-upload.js";
|
|
34
|
+
import { invalidatePortfolioCache } from "../../utils/portfolio-cache.js";
|
|
35
|
+
import { suggestLaunchpadSymbol } from "../../utils/launchpad-defaults.js";
|
|
36
|
+
const schema = z.object({
|
|
37
|
+
name: z.string().min(1, "Name required").max(FIELD_LIMITS.name),
|
|
38
|
+
symbol: z.string().min(1, "Symbol required").max(FIELD_LIMITS.symbol, `Max ${FIELD_LIMITS.symbol} characters`).regex(/^[A-Z0-9]+$/, "Uppercase letters and numbers only"),
|
|
39
|
+
description: z.string().max(FIELD_LIMITS.description).optional(),
|
|
40
|
+
external_link: z.string().max(500).refine((v) => !v || v.startsWith("http://") || v.startsWith("https://"), {
|
|
41
|
+
message: "Must start with http:// or https://"
|
|
42
|
+
}).optional()
|
|
43
|
+
});
|
|
44
|
+
function CollectionCreateForm({ preset, aside }) {
|
|
45
|
+
const app = useMedialaneApp();
|
|
46
|
+
const walletAddress = app.walletAddress;
|
|
47
|
+
const tx = useTransaction();
|
|
48
|
+
const upload = useLaunchpadImageUpload({ successMessage: "Image uploaded" });
|
|
49
|
+
const { imageFile, imagePreview, imageUri, imageUploading, uploadError, fileInputRef, handleImageSelect, clearImage } = upload;
|
|
50
|
+
const [autoSymbol, setAutoSymbol] = useState("");
|
|
51
|
+
const [viewHref, setViewHref] = useState(null);
|
|
52
|
+
const Icon = preset.icon;
|
|
53
|
+
const form = useForm({
|
|
54
|
+
resolver: zodResolver(schema),
|
|
55
|
+
defaultValues: { name: "", symbol: "", description: "", external_link: "" }
|
|
56
|
+
});
|
|
57
|
+
const name = form.watch("name");
|
|
58
|
+
useEffect(() => {
|
|
59
|
+
if (!preset.suggestSymbol) return;
|
|
60
|
+
const suggested = suggestLaunchpadSymbol(name);
|
|
61
|
+
if (!suggested) return;
|
|
62
|
+
const current = form.getValues("symbol");
|
|
63
|
+
if (!current || current === autoSymbol) {
|
|
64
|
+
form.setValue("symbol", suggested, { shouldDirty: false });
|
|
65
|
+
setAutoSymbol(suggested);
|
|
66
|
+
}
|
|
67
|
+
}, [autoSymbol, name, form, preset.suggestSymbol]);
|
|
68
|
+
const deployedAddress = tx.receipt && preset.service ? deployedCollectionFromReceipt(tx.receipt, preset.service) : null;
|
|
69
|
+
const createdId = tx.receipt && !preset.service ? createdCollectionFromReceipt(tx.receipt, getCoordinates("STARKNET").collection721)?.collectionId ?? null : null;
|
|
70
|
+
useEffect(() => {
|
|
71
|
+
if (tx.phase !== "success") return;
|
|
72
|
+
let alive = true;
|
|
73
|
+
const api = app.getClient().api;
|
|
74
|
+
if (deployedAddress) {
|
|
75
|
+
setViewHref(collectionHref("STARKNET", deployedAddress));
|
|
76
|
+
if (preset.registerAfterDeploy) void api.collections.register(deployedAddress).catch(() => {
|
|
77
|
+
});
|
|
78
|
+
} else if (createdId && walletAddress) {
|
|
79
|
+
api.collections.list({ owner: walletAddress, limit: 50 }).then((res) => {
|
|
80
|
+
const created = (res.data ?? []).find((c) => c.collectionId === createdId);
|
|
81
|
+
if (alive && created) setViewHref(collectionHref("STARKNET", created.contractAddress));
|
|
82
|
+
}).catch(() => {
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return () => {
|
|
86
|
+
alive = false;
|
|
87
|
+
};
|
|
88
|
+
}, [tx.phase, deployedAddress, createdId, walletAddress, app, preset.registerAfterDeploy]);
|
|
89
|
+
const handleAgain = () => {
|
|
90
|
+
tx.reset();
|
|
91
|
+
setViewHref(null);
|
|
92
|
+
setAutoSymbol("");
|
|
93
|
+
form.reset();
|
|
94
|
+
clearImage();
|
|
95
|
+
};
|
|
96
|
+
const onSubmit = (values) => {
|
|
97
|
+
if (imageFile && !imageUri && !imageUploading) return;
|
|
98
|
+
if (!walletAddress) return;
|
|
99
|
+
void tx.run(async (signer) => {
|
|
100
|
+
await app.ensureSignedIn?.();
|
|
101
|
+
const api = app.getClient().api;
|
|
102
|
+
const baseUri = await uploadJsonToIpfs(
|
|
103
|
+
api,
|
|
104
|
+
buildCollectionMetadata({
|
|
105
|
+
name: values.name,
|
|
106
|
+
description: values.description,
|
|
107
|
+
image: imageUri,
|
|
108
|
+
externalLink: values.external_link,
|
|
109
|
+
owner: walletAddress
|
|
110
|
+
})
|
|
111
|
+
);
|
|
112
|
+
await runIntentCalls(
|
|
113
|
+
signer,
|
|
114
|
+
() => api.intents.create("create-collection", {
|
|
115
|
+
owner: walletAddress,
|
|
116
|
+
name: values.name,
|
|
117
|
+
symbol: values.symbol,
|
|
118
|
+
baseUri,
|
|
119
|
+
...preset.service ? { service: preset.service } : {}
|
|
120
|
+
})
|
|
121
|
+
);
|
|
122
|
+
invalidatePortfolioCache(walletAddress);
|
|
123
|
+
});
|
|
124
|
+
};
|
|
125
|
+
const { copy } = preset;
|
|
126
|
+
const busy = tx.phase !== "idle" || imageUploading;
|
|
127
|
+
const actions = preset.actions({ address: deployedAddress, collectionHref: viewHref });
|
|
128
|
+
return /* @__PURE__ */ jsxs(WalletRequired, { icon: Icon, iconClassName: preset.iconClass, title: preset.signedOut.title, description: preset.signedOut.description, children: [
|
|
129
|
+
/* @__PURE__ */ jsx(TransactionDialog, { tx, title: preset.dialog.title, workingLabel: preset.dialog.workingLabel, firstStepLabel: preset.dialog.firstStepLabel, children: /* @__PURE__ */ jsx(
|
|
130
|
+
CreationSuccess,
|
|
131
|
+
{
|
|
132
|
+
name: name || preset.success.fallbackName,
|
|
133
|
+
image: imagePreview,
|
|
134
|
+
caption: preset.success.caption,
|
|
135
|
+
primary: actions.primary,
|
|
136
|
+
secondary: actions.secondary,
|
|
137
|
+
onAgain: handleAgain,
|
|
138
|
+
againLabel: preset.success.againLabel,
|
|
139
|
+
children: /* @__PURE__ */ jsx(RewardEarned, { actionType: preset.success.reward })
|
|
140
|
+
}
|
|
141
|
+
) }),
|
|
142
|
+
/* @__PURE__ */ jsx(
|
|
143
|
+
ClaimRouteShell,
|
|
144
|
+
{
|
|
145
|
+
icon: /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4 text-white" }),
|
|
146
|
+
title: preset.shell.title,
|
|
147
|
+
subtitle: preset.shell.subtitle,
|
|
148
|
+
aside: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
149
|
+
/* @__PURE__ */ jsx(
|
|
150
|
+
MedialaneCollectionCard,
|
|
151
|
+
{
|
|
152
|
+
image: imagePreview,
|
|
153
|
+
name,
|
|
154
|
+
collection: form.watch("symbol") || preset.cardFallbackSymbol,
|
|
155
|
+
creator: walletAddress ? `${walletAddress.slice(0, 6)}\u2026${walletAddress.slice(-4)}` : void 0,
|
|
156
|
+
creatorHref: walletAddress ? profileHref({ address: walletAddress }) : void 0
|
|
157
|
+
}
|
|
158
|
+
),
|
|
159
|
+
aside
|
|
160
|
+
] }),
|
|
161
|
+
children: /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsxs("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-5", children: [
|
|
162
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
163
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-medium", children: copy.imageHeading }),
|
|
164
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-start gap-4", children: [
|
|
165
|
+
/* @__PURE__ */ jsxs(
|
|
166
|
+
"div",
|
|
167
|
+
{
|
|
168
|
+
className: "relative h-28 w-28 rounded-xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-primary/50 transition-colors",
|
|
169
|
+
role: "button",
|
|
170
|
+
tabIndex: 0,
|
|
171
|
+
"aria-label": `Upload ${copy.imageHeading.toLowerCase()}`,
|
|
172
|
+
onClick: () => !imageUploading && fileInputRef.current?.click(),
|
|
173
|
+
onKeyDown: (e) => {
|
|
174
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
175
|
+
e.preventDefault();
|
|
176
|
+
if (!imageUploading) fileInputRef.current?.click();
|
|
177
|
+
}
|
|
178
|
+
},
|
|
179
|
+
children: [
|
|
180
|
+
imagePreview ? /* @__PURE__ */ jsx(Image, { src: imagePreview, alt: copy.imageHeading, fill: true, unoptimized: true, className: "object-cover" }) : /* @__PURE__ */ jsx(ImagePlus, { className: "h-8 w-8 text-muted-foreground" }),
|
|
181
|
+
imageUploading && /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-background/70 flex items-center justify-center", children: /* @__PURE__ */ jsx(Loader2, { className: "h-5 w-5 animate-spin text-primary" }) })
|
|
182
|
+
]
|
|
183
|
+
}
|
|
184
|
+
),
|
|
185
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-2 flex-1", children: [
|
|
186
|
+
/* @__PURE__ */ jsx(
|
|
187
|
+
"input",
|
|
188
|
+
{
|
|
189
|
+
ref: fileInputRef,
|
|
190
|
+
type: "file",
|
|
191
|
+
accept: acceptFor("image"),
|
|
192
|
+
className: "hidden",
|
|
193
|
+
onChange: (e) => {
|
|
194
|
+
const f = e.target.files?.[0];
|
|
195
|
+
if (f) void handleImageSelect(f);
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
),
|
|
199
|
+
/* @__PURE__ */ jsx(Button, { type: "button", variant: "outline", size: "sm", disabled: imageUploading, onClick: () => fileInputRef.current?.click(), children: imageUploading ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
200
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-3.5 w-3.5 mr-1.5 animate-spin" }),
|
|
201
|
+
"Uploading\u2026"
|
|
202
|
+
] }) : imageFile ? "Change image" : "Upload image" }),
|
|
203
|
+
imageFile && /* @__PURE__ */ jsxs(
|
|
204
|
+
"button",
|
|
205
|
+
{
|
|
206
|
+
type: "button",
|
|
207
|
+
onClick: clearImage,
|
|
208
|
+
className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",
|
|
209
|
+
children: [
|
|
210
|
+
/* @__PURE__ */ jsx(X, { className: "h-3 w-3" }),
|
|
211
|
+
" Remove"
|
|
212
|
+
]
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
/* @__PURE__ */ jsxs("p", { className: "text-xs text-muted-foreground", children: [
|
|
216
|
+
"JPG, PNG, GIF, SVG or WebP",
|
|
217
|
+
imageUri && /* @__PURE__ */ jsx("span", { className: "ml-2 text-emerald-500 font-medium", children: "\u2713 Uploaded" })
|
|
218
|
+
] }),
|
|
219
|
+
copy.imageHelp && /* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground", children: copy.imageHelp }),
|
|
220
|
+
uploadError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive", children: uploadError })
|
|
221
|
+
] })
|
|
222
|
+
] })
|
|
223
|
+
] }),
|
|
224
|
+
/* @__PURE__ */ jsx(FormField, { control: form.control, name: "name", render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
225
|
+
/* @__PURE__ */ jsx(FormLabel, { children: copy.nameLabel }),
|
|
226
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Input, { placeholder: copy.namePlaceholder, ...field }) }),
|
|
227
|
+
/* @__PURE__ */ jsx(FormDescription, { children: copy.nameHint }),
|
|
228
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
229
|
+
] }) }),
|
|
230
|
+
/* @__PURE__ */ jsx(FormField, { control: form.control, name: "symbol", render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
231
|
+
/* @__PURE__ */ jsx(FormLabel, { children: "Symbol *" }),
|
|
232
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(
|
|
233
|
+
Input,
|
|
234
|
+
{
|
|
235
|
+
placeholder: copy.symbolPlaceholder,
|
|
236
|
+
maxLength: FIELD_LIMITS.symbol,
|
|
237
|
+
...field,
|
|
238
|
+
onChange: (e) => field.onChange(e.target.value.toUpperCase())
|
|
239
|
+
}
|
|
240
|
+
) }),
|
|
241
|
+
/* @__PURE__ */ jsx(FormDescription, { children: copy.symbolHint }),
|
|
242
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
243
|
+
] }) }),
|
|
244
|
+
/* @__PURE__ */ jsx(FormField, { control: form.control, name: "description", render: ({ field }) => /* @__PURE__ */ jsxs(FormItem, { children: [
|
|
245
|
+
/* @__PURE__ */ jsxs(FormLabel, { children: [
|
|
246
|
+
"Description ",
|
|
247
|
+
/* @__PURE__ */ jsx("span", { className: "text-muted-foreground font-normal", children: "(optional)" })
|
|
248
|
+
] }),
|
|
249
|
+
/* @__PURE__ */ jsx(FormControl, { children: /* @__PURE__ */ jsx(Textarea, { placeholder: copy.descriptionPlaceholder, rows: 3, ...field }) }),
|
|
250
|
+
copy.descriptionHint && /* @__PURE__ */ jsx(FormDescription, { children: copy.descriptionHint }),
|
|
251
|
+
/* @__PURE__ */ jsx(FormMessage, {})
|
|
252
|
+
] }) }),
|
|
253
|
+
/* @__PURE__ */ jsx(ExternalLinkField, { form, address: walletAddress }),
|
|
254
|
+
/* @__PURE__ */ jsxs(
|
|
255
|
+
"button",
|
|
256
|
+
{
|
|
257
|
+
type: "submit",
|
|
258
|
+
disabled: busy,
|
|
259
|
+
className: `w-full h-12 text-base font-semibold text-white rounded-xl flex items-center justify-center gap-2 transition-all hover:brightness-110 active:scale-[0.98] ${preset.buttonClass} ${busy ? "opacity-40 pointer-events-none" : ""}`,
|
|
260
|
+
children: [
|
|
261
|
+
/* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" }),
|
|
262
|
+
copy.submit
|
|
263
|
+
]
|
|
264
|
+
}
|
|
265
|
+
),
|
|
266
|
+
copy.footnotes.map((note) => /* @__PURE__ */ jsx("p", { className: "text-xs text-center text-muted-foreground", children: note }, note))
|
|
267
|
+
] }) })
|
|
268
|
+
}
|
|
269
|
+
)
|
|
270
|
+
] });
|
|
271
|
+
}
|
|
272
|
+
export {
|
|
273
|
+
CollectionCreateForm
|
|
274
|
+
};
|
|
275
|
+
//# sourceMappingURL=collection-create-form.js.map
|