@medialane/ui 0.232.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/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/claim-route-shell.cjs +35 -0
- package/dist/components/claim-route-shell.cjs.map +1 -0
- package/dist/components/claim-route-shell.d.cts +7 -0
- package/dist/components/claim-route-shell.d.ts +7 -0
- package/dist/components/claim-route-shell.js +11 -0
- package/dist/components/claim-route-shell.js.map +1 -0
- package/dist/components/fast-mint/fast-mint.d.cts +2 -2
- package/dist/components/fast-mint/fast-mint.d.ts +2 -2
- package/dist/components/launchpad/collection-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/components/rewards/reward-earned.cjs +38 -34
- package/dist/components/rewards/reward-earned.cjs.map +1 -1
- package/dist/components/rewards/reward-earned.d.cts +2 -3
- package/dist/components/rewards/reward-earned.d.ts +2 -3
- package/dist/components/rewards/reward-earned.js +37 -33
- package/dist/components/rewards/reward-earned.js.map +1 -1
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/components/wallet-required.cjs +62 -0
- package/dist/components/wallet-required.cjs.map +1 -0
- package/dist/components/wallet-required.d.cts +13 -0
- package/dist/components/wallet-required.d.ts +13 -0
- package/dist/components/wallet-required.js +38 -0
- package/dist/components/wallet-required.js.map +1 -0
- package/dist/index.cjs +26 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -1
- package/dist/index.d.ts +7 -1
- package/dist/index.js +17 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/portfolio-cache.cjs +34 -0
- package/dist/utils/portfolio-cache.cjs.map +1 -0
- package/dist/utils/portfolio-cache.d.cts +3 -0
- package/dist/utils/portfolio-cache.d.ts +3 -0
- package/dist/utils/portfolio-cache.js +10 -0
- package/dist/utils/portfolio-cache.js.map +1 -0
- package/dist/utils/use-launchpad-image-upload.cjs +103 -0
- package/dist/utils/use-launchpad-image-upload.cjs.map +1 -0
- package/dist/utils/use-launchpad-image-upload.d.cts +21 -0
- package/dist/utils/use-launchpad-image-upload.d.ts +21 -0
- package/dist/utils/use-launchpad-image-upload.js +79 -0
- package/dist/utils/use-launchpad-image-upload.js.map +1 -0
- package/package.json +3 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import { VariantProps } from 'class-variance-authority';
|
|
5
5
|
|
|
6
6
|
declare const badgeVariants: (props?: ({
|
|
7
|
-
variant?: "
|
|
7
|
+
variant?: "default" | "destructive" | "outline" | "secondary" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface BadgeProps extends React.HTMLAttributes<HTMLDivElement>, VariantProps<typeof badgeVariants> {
|
|
10
10
|
}
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
|
+
size?: "icon" | "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -3,8 +3,8 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
7
|
-
size?: "
|
|
6
|
+
variant?: "ghost" | "link" | "default" | "destructive" | "outline" | "secondary" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
|
+
size?: "icon" | "default" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
10
10
|
asChild?: boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
+
var __export = (target, all) => {
|
|
8
|
+
for (var name in all)
|
|
9
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
20
|
+
var claim_route_shell_exports = {};
|
|
21
|
+
__export(claim_route_shell_exports, {
|
|
22
|
+
ClaimRouteShell: () => ClaimRouteShell
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(claim_route_shell_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_back_button = require("./back-button.js");
|
|
27
|
+
var import_service_form_shell = require("./service-form-shell.js");
|
|
28
|
+
function ClaimRouteShell(props) {
|
|
29
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_service_form_shell.ServiceFormShell, { ...props, backSlot: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_back_button.BackButton, {}) });
|
|
30
|
+
}
|
|
31
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
32
|
+
0 && (module.exports = {
|
|
33
|
+
ClaimRouteShell
|
|
34
|
+
});
|
|
35
|
+
//# sourceMappingURL=claim-route-shell.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/claim-route-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { BackButton } from \"./back-button.js\";\nimport { ServiceFormShell, type ServiceFormShellProps } from \"./service-form-shell.js\";\n\nexport function ClaimRouteShell(props: Omit<ServiceFormShellProps, \"backSlot\">) {\n return <ServiceFormShell {...props} backSlot={<BackButton />} />;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAMgD;AAJhD,yBAA2B;AAC3B,gCAA6D;AAEtD,SAAS,gBAAgB,OAAgD;AAC9E,SAAO,4CAAC,8CAAkB,GAAG,OAAO,UAAU,4CAAC,iCAAW,GAAI;AAChE;","names":[]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ServiceFormShellProps } from './service-form-shell.cjs';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
declare function ClaimRouteShell(props: Omit<ServiceFormShellProps, "backSlot">): react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { ClaimRouteShell };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { ServiceFormShellProps } from './service-form-shell.js';
|
|
3
|
+
import 'react';
|
|
4
|
+
|
|
5
|
+
declare function ClaimRouteShell(props: Omit<ServiceFormShellProps, "backSlot">): react_jsx_runtime.JSX.Element;
|
|
6
|
+
|
|
7
|
+
export { ClaimRouteShell };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { BackButton } from "./back-button.js";
|
|
4
|
+
import { ServiceFormShell } from "./service-form-shell.js";
|
|
5
|
+
function ClaimRouteShell(props) {
|
|
6
|
+
return /* @__PURE__ */ jsx(ServiceFormShell, { ...props, backSlot: /* @__PURE__ */ jsx(BackButton, {}) });
|
|
7
|
+
}
|
|
8
|
+
export {
|
|
9
|
+
ClaimRouteShell
|
|
10
|
+
};
|
|
11
|
+
//# sourceMappingURL=claim-route-shell.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/claim-route-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { BackButton } from \"./back-button.js\";\nimport { ServiceFormShell, type ServiceFormShellProps } from \"./service-form-shell.js\";\n\nexport function ClaimRouteShell(props: Omit<ServiceFormShellProps, \"backSlot\">) {\n return <ServiceFormShell {...props} backSlot={<BackButton />} />;\n}\n"],"mappings":";AAMgD;AAJhD,SAAS,kBAAkB;AAC3B,SAAS,wBAAoD;AAEtD,SAAS,gBAAgB,OAAgD;AAC9E,SAAO,oBAAC,oBAAkB,GAAG,OAAO,UAAU,oBAAC,cAAW,GAAI;AAChE;","names":[]}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.cjs';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
3
|
import { FastMintProps } from './types.js';
|
|
4
4
|
import 'starknet';
|
|
5
5
|
import '@medialane/sdk';
|
|
6
6
|
import '@medialane/sdk/starknet';
|
|
7
7
|
|
|
8
|
-
declare function FastMint(props: FastMintProps): string | number | bigint | boolean |
|
|
8
|
+
declare function FastMint(props: FastMintProps): string | number | bigint | boolean | Iterable<React.ReactNode> | Promise<string | number | bigint | boolean | React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | Iterable<React.ReactNode> | null | undefined> | react_jsx_runtime.JSX.Element | null | undefined;
|
|
9
9
|
|
|
10
10
|
export { FastMint };
|
|
@@ -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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,6CAA6C,kBAA7D,IAAkE,CAC3E;AAAA,WACH,GACF;AAAA;AAAA,IACF;AAAA,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 };
|