@medialane/ui 0.182.0 → 0.184.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/drop/create/artwork-section.cjs +115 -0
- package/dist/components/drop/create/artwork-section.cjs.map +1 -0
- package/dist/components/drop/create/artwork-section.d.cts +23 -0
- package/dist/components/drop/create/artwork-section.d.ts +23 -0
- package/dist/components/drop/create/artwork-section.js +79 -0
- package/dist/components/drop/create/artwork-section.js.map +1 -0
- package/dist/components/drop/create/details-section.cjs +110 -0
- package/dist/components/drop/create/details-section.cjs.map +1 -0
- package/dist/components/drop/create/details-section.d.cts +11 -0
- package/dist/components/drop/create/details-section.d.ts +11 -0
- package/dist/components/drop/create/details-section.js +86 -0
- package/dist/components/drop/create/details-section.js.map +1 -0
- package/dist/components/drop/create/drop-create.cjs +112 -0
- package/dist/components/drop/create/drop-create.cjs.map +1 -0
- package/dist/components/drop/create/drop-create.d.cts +22 -0
- package/dist/components/drop/create/drop-create.d.ts +22 -0
- package/dist/components/drop/create/drop-create.js +77 -0
- package/dist/components/drop/create/drop-create.js.map +1 -0
- package/dist/components/drop/create/exclusive-fields.cjs +45 -0
- package/dist/components/drop/create/exclusive-fields.cjs.map +1 -0
- package/dist/components/drop/create/exclusive-fields.d.cts +14 -0
- package/dist/components/drop/create/exclusive-fields.d.ts +14 -0
- package/dist/components/drop/create/exclusive-fields.js +21 -0
- package/dist/components/drop/create/exclusive-fields.js.map +1 -0
- package/dist/components/drop/create/launch-dialog.cjs +193 -0
- package/dist/components/drop/create/launch-dialog.cjs.map +1 -0
- package/dist/components/drop/create/launch-dialog.d.cts +21 -0
- package/dist/components/drop/create/launch-dialog.d.ts +21 -0
- package/dist/components/drop/create/launch-dialog.js +168 -0
- package/dist/components/drop/create/launch-dialog.js.map +1 -0
- package/dist/components/drop/create/list-section.cjs +67 -0
- package/dist/components/drop/create/list-section.cjs.map +1 -0
- package/dist/components/drop/create/list-section.d.cts +11 -0
- package/dist/components/drop/create/list-section.d.ts +11 -0
- package/dist/components/drop/create/list-section.js +43 -0
- package/dist/components/drop/create/list-section.js.map +1 -0
- package/dist/components/drop/create/sale-section.cjs +78 -0
- package/dist/components/drop/create/sale-section.cjs.map +1 -0
- package/dist/components/drop/create/sale-section.d.cts +13 -0
- package/dist/components/drop/create/sale-section.d.ts +13 -0
- package/dist/components/drop/create/sale-section.js +54 -0
- package/dist/components/drop/create/sale-section.js.map +1 -0
- package/dist/components/drop/drop-card.cjs +81 -0
- package/dist/components/drop/drop-card.cjs.map +1 -0
- package/dist/components/drop/drop-card.d.cts +18 -0
- package/dist/components/drop/drop-card.d.ts +18 -0
- package/dist/components/drop/drop-card.js +45 -0
- package/dist/components/drop/drop-card.js.map +1 -0
- package/dist/components/drop/drop-listing.cjs +79 -0
- package/dist/components/drop/drop-listing.cjs.map +1 -0
- package/dist/components/drop/drop-listing.d.cts +10 -0
- package/dist/components/drop/drop-listing.d.ts +10 -0
- package/dist/components/drop/drop-listing.js +45 -0
- package/dist/components/drop/drop-listing.js.map +1 -0
- package/dist/components/drop/drop-token-link.cjs +63 -0
- package/dist/components/drop/drop-token-link.cjs.map +1 -0
- package/dist/components/drop/drop-token-link.d.cts +9 -0
- package/dist/components/drop/drop-token-link.d.ts +9 -0
- package/dist/components/drop/drop-token-link.js +29 -0
- package/dist/components/drop/drop-token-link.js.map +1 -0
- package/dist/components/drop/my-drops.cjs +71 -0
- package/dist/components/drop/my-drops.cjs.map +1 -0
- package/dist/components/drop/my-drops.d.cts +12 -0
- package/dist/components/drop/my-drops.d.ts +12 -0
- package/dist/components/drop/my-drops.js +37 -0
- package/dist/components/drop/my-drops.js.map +1 -0
- package/dist/components/drop/page/drop-action-box.cjs +63 -0
- package/dist/components/drop/page/drop-action-box.cjs.map +1 -0
- package/dist/components/drop/page/drop-action-box.d.cts +16 -0
- package/dist/components/drop/page/drop-action-box.d.ts +16 -0
- package/dist/components/drop/page/drop-action-box.js +39 -0
- package/dist/components/drop/page/drop-action-box.js.map +1 -0
- package/dist/components/drop/page/drop-activity.cjs +42 -0
- package/dist/components/drop/page/drop-activity.cjs.map +1 -0
- package/dist/components/drop/page/drop-activity.d.cts +8 -0
- package/dist/components/drop/page/drop-activity.d.ts +8 -0
- package/dist/components/drop/page/drop-activity.js +18 -0
- package/dist/components/drop/page/drop-activity.js.map +1 -0
- package/dist/components/drop/page/drop-manage.cjs +161 -0
- package/dist/components/drop/page/drop-manage.cjs.map +1 -0
- package/dist/components/drop/page/drop-manage.d.cts +24 -0
- package/dist/components/drop/page/drop-manage.d.ts +24 -0
- package/dist/components/drop/page/drop-manage.js +137 -0
- package/dist/components/drop/page/drop-manage.js.map +1 -0
- package/dist/components/drop/page/drop-mint-dialog.cjs +97 -0
- package/dist/components/drop/page/drop-mint-dialog.cjs.map +1 -0
- package/dist/components/drop/page/drop-mint-dialog.d.cts +15 -0
- package/dist/components/drop/page/drop-mint-dialog.d.ts +15 -0
- package/dist/components/drop/page/drop-mint-dialog.js +73 -0
- package/dist/components/drop/page/drop-mint-dialog.js.map +1 -0
- package/dist/components/drop/page/drop-page.cjs +165 -0
- package/dist/components/drop/page/drop-page.cjs.map +1 -0
- package/dist/components/drop/page/drop-page.d.cts +16 -0
- package/dist/components/drop/page/drop-page.d.ts +16 -0
- package/dist/components/drop/page/drop-page.js +131 -0
- package/dist/components/drop/page/drop-page.js.map +1 -0
- package/dist/components/drop-status-display.cjs +7 -38
- package/dist/components/drop-status-display.cjs.map +1 -1
- package/dist/components/drop-status-display.d.cts +6 -7
- package/dist/components/drop-status-display.d.ts +6 -7
- package/dist/components/drop-status-display.js +7 -37
- package/dist/components/drop-status-display.js.map +1 -1
- package/dist/components/fast-mint/types.cjs.map +1 -1
- package/dist/components/fast-mint/types.d.cts +3 -1
- package/dist/components/fast-mint/types.d.ts +3 -1
- package/dist/components/image.d.cts +2 -0
- package/dist/components/image.d.ts +2 -0
- package/dist/index.cjs +46 -27
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +20 -11
- package/dist/index.d.ts +20 -11
- package/dist/index.js +31 -25
- package/dist/index.js.map +1 -1
- package/dist/utils/drop/actions.cjs +76 -0
- package/dist/utils/drop/actions.cjs.map +1 -0
- package/dist/utils/drop/actions.d.cts +46 -0
- package/dist/utils/drop/actions.d.ts +46 -0
- package/dist/utils/drop/actions.js +49 -0
- package/dist/utils/drop/actions.js.map +1 -0
- package/dist/utils/drop/allowlist.cjs +50 -0
- package/dist/utils/drop/allowlist.cjs.map +1 -0
- package/dist/utils/drop/allowlist.d.cts +10 -0
- package/dist/utils/drop/allowlist.d.ts +10 -0
- package/dist/utils/drop/allowlist.js +26 -0
- package/dist/utils/drop/allowlist.js.map +1 -0
- package/dist/utils/drop/chain.cjs +37 -0
- package/dist/utils/drop/chain.cjs.map +1 -0
- package/dist/utils/drop/chain.d.cts +5 -0
- package/dist/utils/drop/chain.d.ts +5 -0
- package/dist/utils/drop/chain.js +13 -0
- package/dist/utils/drop/chain.js.map +1 -0
- package/dist/utils/drop/claim-proof.cjs +48 -0
- package/dist/utils/drop/claim-proof.cjs.map +1 -0
- package/dist/utils/drop/claim-proof.d.cts +9 -0
- package/dist/utils/drop/claim-proof.d.ts +9 -0
- package/dist/utils/drop/claim-proof.js +24 -0
- package/dist/utils/drop/claim-proof.js.map +1 -0
- package/dist/utils/drop/draft.cjs +87 -0
- package/dist/utils/drop/draft.cjs.map +1 -0
- package/dist/utils/drop/draft.d.cts +32 -0
- package/dist/utils/drop/draft.d.ts +32 -0
- package/dist/utils/drop/draft.js +61 -0
- package/dist/utils/drop/draft.js.map +1 -0
- package/dist/utils/drop/metadata.cjs +70 -0
- package/dist/utils/drop/metadata.cjs.map +1 -0
- package/dist/utils/drop/metadata.d.cts +34 -0
- package/dist/utils/drop/metadata.d.ts +34 -0
- package/dist/utils/drop/metadata.js +43 -0
- package/dist/utils/drop/metadata.js.map +1 -0
- package/dist/utils/{drop-status.cjs → drop/preview.cjs} +14 -14
- package/dist/utils/drop/preview.cjs.map +1 -0
- package/dist/utils/drop/preview.d.cts +4 -0
- package/dist/utils/drop/preview.d.ts +4 -0
- package/dist/utils/drop/preview.js +13 -0
- package/dist/utils/drop/preview.js.map +1 -0
- package/dist/utils/drop/receipt.cjs +39 -0
- package/dist/utils/drop/receipt.cjs.map +1 -0
- package/dist/utils/drop/receipt.d.cts +6 -0
- package/dist/utils/drop/receipt.d.ts +6 -0
- package/dist/utils/drop/receipt.js +15 -0
- package/dist/utils/drop/receipt.js.map +1 -0
- package/dist/utils/drop/sale.cjs +108 -0
- package/dist/utils/drop/sale.cjs.map +1 -0
- package/dist/utils/drop/sale.d.cts +52 -0
- package/dist/utils/drop/sale.d.ts +52 -0
- package/dist/utils/drop/sale.js +78 -0
- package/dist/utils/drop/sale.js.map +1 -0
- package/dist/utils/drop/types.cjs +17 -0
- package/dist/utils/drop/types.cjs.map +1 -0
- package/dist/utils/drop/types.d.cts +20 -0
- package/dist/utils/drop/types.d.ts +20 -0
- package/dist/utils/drop/types.js +1 -0
- package/dist/utils/drop/types.js.map +1 -0
- package/dist/utils/drop/upload.cjs +48 -0
- package/dist/utils/drop/upload.cjs.map +1 -0
- package/dist/utils/drop/upload.d.cts +11 -0
- package/dist/utils/drop/upload.d.ts +11 -0
- package/dist/utils/drop/upload.js +24 -0
- package/dist/utils/drop/upload.js.map +1 -0
- package/dist/utils/drop/use-now.cjs +38 -0
- package/dist/utils/drop/use-now.cjs.map +1 -0
- package/dist/utils/drop/use-now.d.cts +4 -0
- package/dist/utils/drop/use-now.d.ts +4 -0
- package/dist/utils/drop/use-now.js +14 -0
- package/dist/utils/drop/use-now.js.map +1 -0
- package/dist/utils/drop/view.cjs +89 -0
- package/dist/utils/drop/view.cjs.map +1 -0
- package/dist/utils/drop/view.d.cts +34 -0
- package/dist/utils/drop/view.d.ts +34 -0
- package/dist/utils/drop/view.js +64 -0
- package/dist/utils/drop/view.js.map +1 -0
- package/dist/utils/launchpad-defaults.cjs +0 -22
- package/dist/utils/launchpad-defaults.cjs.map +1 -1
- package/dist/utils/launchpad-defaults.d.cts +1 -7
- package/dist/utils/launchpad-defaults.d.ts +1 -7
- package/dist/utils/launchpad-defaults.js +0 -21
- package/dist/utils/launchpad-defaults.js.map +1 -1
- package/dist/utils/use-drops.cjs +41 -45
- package/dist/utils/use-drops.cjs.map +1 -1
- package/dist/utils/use-drops.d.cts +31 -23
- package/dist/utils/use-drops.d.ts +31 -23
- package/dist/utils/use-drops.js +35 -40
- package/dist/utils/use-drops.js.map +1 -1
- package/dist/utils/wallet-failure.cjs +2 -2
- package/dist/utils/wallet-failure.cjs.map +1 -1
- package/dist/utils/wallet-failure.js +2 -2
- package/dist/utils/wallet-failure.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/account/account.test.cjs +0 -86
- package/dist/components/account/account.test.cjs.map +0 -1
- package/dist/components/account/account.test.d.cts +0 -2
- package/dist/components/account/account.test.d.ts +0 -2
- package/dist/components/account/account.test.js +0 -85
- package/dist/components/account/account.test.js.map +0 -1
- package/dist/components/drop-create-form.cjs +0 -341
- package/dist/components/drop-create-form.cjs.map +0 -1
- package/dist/components/drop-create-form.d.cts +0 -39
- package/dist/components/drop-create-form.d.ts +0 -39
- package/dist/components/drop-create-form.js +0 -322
- package/dist/components/drop-create-form.js.map +0 -1
- package/dist/components/drop-preview-card.cjs +0 -106
- package/dist/components/drop-preview-card.cjs.map +0 -1
- package/dist/components/drop-preview-card.d.cts +0 -17
- package/dist/components/drop-preview-card.d.ts +0 -17
- package/dist/components/drop-preview-card.js +0 -82
- package/dist/components/drop-preview-card.js.map +0 -1
- package/dist/components/drop-preview-card.test.cjs +0 -84
- package/dist/components/drop-preview-card.test.cjs.map +0 -1
- package/dist/components/drop-preview-card.test.d.cts +0 -3
- package/dist/components/drop-preview-card.test.d.ts +0 -3
- package/dist/components/drop-preview-card.test.js +0 -83
- package/dist/components/drop-preview-card.test.js.map +0 -1
- package/dist/components/drop-status-display.test.cjs +0 -29
- package/dist/components/drop-status-display.test.cjs.map +0 -1
- package/dist/components/drop-status-display.test.d.cts +0 -2
- package/dist/components/drop-status-display.test.d.ts +0 -2
- package/dist/components/drop-status-display.test.js +0 -28
- package/dist/components/drop-status-display.test.js.map +0 -1
- package/dist/components/exclusive-content-section.cjs +0 -88
- package/dist/components/exclusive-content-section.cjs.map +0 -1
- package/dist/components/exclusive-content-section.d.cts +0 -10
- package/dist/components/exclusive-content-section.d.ts +0 -10
- package/dist/components/exclusive-content-section.js +0 -64
- package/dist/components/exclusive-content-section.js.map +0 -1
- package/dist/data/drop-create-schema.cjs +0 -92
- package/dist/data/drop-create-schema.cjs.map +0 -1
- package/dist/data/drop-create-schema.d.cts +0 -131
- package/dist/data/drop-create-schema.d.ts +0 -131
- package/dist/data/drop-create-schema.js +0 -58
- package/dist/data/drop-create-schema.js.map +0 -1
- package/dist/utils/drop-status.cjs.map +0 -1
- package/dist/utils/drop-status.d.cts +0 -12
- package/dist/utils/drop-status.d.ts +0 -12
- package/dist/utils/drop-status.js +0 -13
- package/dist/utils/drop-status.js.map +0 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DropOnchain } from '@medialane/sdk/starknet';
|
|
3
|
+
import { ApiDrop, ApiDropMint } from '@medialane/sdk';
|
|
4
|
+
import { ExclusiveValue } from '../create/exclusive-fields.cjs';
|
|
5
|
+
|
|
6
|
+
interface DropManageProps {
|
|
7
|
+
contract: string;
|
|
8
|
+
indexed: ApiDrop | null;
|
|
9
|
+
onchain: DropOnchain;
|
|
10
|
+
mints: ApiDropMint[];
|
|
11
|
+
/** Runs a manage action as one transaction; resolves when confirmed. */
|
|
12
|
+
run: (params: {
|
|
13
|
+
action: "issue";
|
|
14
|
+
recipient: string;
|
|
15
|
+
quantity: string;
|
|
16
|
+
} | {
|
|
17
|
+
action: "set_allowlist_root";
|
|
18
|
+
root: string;
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
saveExclusive: (value: ExclusiveValue | null) => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
declare function DropManage({ contract, indexed, onchain, mints, run, saveExclusive }: DropManageProps): react_jsx_runtime.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { DropManage, type DropManageProps };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import { DropOnchain } from '@medialane/sdk/starknet';
|
|
3
|
+
import { ApiDrop, ApiDropMint } from '@medialane/sdk';
|
|
4
|
+
import { ExclusiveValue } from '../create/exclusive-fields.js';
|
|
5
|
+
|
|
6
|
+
interface DropManageProps {
|
|
7
|
+
contract: string;
|
|
8
|
+
indexed: ApiDrop | null;
|
|
9
|
+
onchain: DropOnchain;
|
|
10
|
+
mints: ApiDropMint[];
|
|
11
|
+
/** Runs a manage action as one transaction; resolves when confirmed. */
|
|
12
|
+
run: (params: {
|
|
13
|
+
action: "issue";
|
|
14
|
+
recipient: string;
|
|
15
|
+
quantity: string;
|
|
16
|
+
} | {
|
|
17
|
+
action: "set_allowlist_root";
|
|
18
|
+
root: string;
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
saveExclusive: (value: ExclusiveValue | null) => Promise<void>;
|
|
21
|
+
}
|
|
22
|
+
declare function DropManage({ contract, indexed, onchain, mints, run, saveExclusive }: DropManageProps): react_jsx_runtime.JSX.Element;
|
|
23
|
+
|
|
24
|
+
export { DropManage, type DropManageProps };
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { buildPopAllowlist, dropClaimLinks, popClaimLinksCsv } from "@medialane/sdk/starknet";
|
|
5
|
+
import { dropHref } from "@medialane/sdk";
|
|
6
|
+
import { ActionDialog } from "../../action-dialog.js";
|
|
7
|
+
import { Button } from "../../button.js";
|
|
8
|
+
import { Input } from "../../input.js";
|
|
9
|
+
import { Textarea } from "../../textarea.js";
|
|
10
|
+
import { ShareButton } from "../../share-button.js";
|
|
11
|
+
import { StatTile } from "../../stat-tile.js";
|
|
12
|
+
import { DropActivityList } from "./drop-activity.js";
|
|
13
|
+
import { ExclusiveFields } from "../create/exclusive-fields.js";
|
|
14
|
+
import { downloadCsv } from "../create/launch-dialog.js";
|
|
15
|
+
import { describeError } from "../../../utils/describe-error.js";
|
|
16
|
+
import { parseAllowlist } from "../../../utils/drop/allowlist.js";
|
|
17
|
+
import { priceLabel, supplyLabel } from "../../../utils/drop/sale.js";
|
|
18
|
+
function DropManage({ contract, indexed, onchain, mints, run, saveExclusive }) {
|
|
19
|
+
const [pending, setPending] = useState(null);
|
|
20
|
+
const [busy, setBusy] = useState(false);
|
|
21
|
+
const [message, setMessage] = useState(null);
|
|
22
|
+
const [listText, setListText] = useState("");
|
|
23
|
+
const [links, setLinks] = useState([]);
|
|
24
|
+
const [gift, setGift] = useState({ to: "", quantity: "1" });
|
|
25
|
+
const [exclusive, setExclusive] = useState({ title: "", url: "", type: "" });
|
|
26
|
+
const listed = BigInt(onchain.allowlistRoot) !== 0n;
|
|
27
|
+
const left = onchain.maxSupply === 0n ? null : onchain.maxSupply - onchain.totalMinted;
|
|
28
|
+
const shareUrl = typeof window === "undefined" ? dropHref(contract) : `${window.location.origin}${dropHref(contract)}`;
|
|
29
|
+
const confirm = async () => {
|
|
30
|
+
if (!pending) return;
|
|
31
|
+
setBusy(true);
|
|
32
|
+
try {
|
|
33
|
+
await pending.act();
|
|
34
|
+
setMessage(`${pending.title} \u2014 done.`);
|
|
35
|
+
} catch (err) {
|
|
36
|
+
setMessage(describeError(err, "That didn't go through. Please try again.").message);
|
|
37
|
+
} finally {
|
|
38
|
+
setBusy(false);
|
|
39
|
+
setPending(null);
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
const parsed = parseAllowlist(listText);
|
|
43
|
+
const list = parsed.addresses.length > 0 ? buildPopAllowlist(parsed.addresses) : null;
|
|
44
|
+
const sameList = list !== null && BigInt(list.root) === BigInt(onchain.allowlistRoot);
|
|
45
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-8", children: [
|
|
46
|
+
message && /* @__PURE__ */ jsx("p", { className: "rounded-lg bg-muted/50 px-3 py-2 text-sm", children: message }),
|
|
47
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-3", children: [
|
|
48
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Overview" }),
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { className: "grid grid-cols-2 gap-3 sm:grid-cols-3", children: [
|
|
50
|
+
/* @__PURE__ */ jsx(StatTile, { label: "Minted", value: supplyLabel(onchain.totalMinted.toString(), onchain.maxSupply.toString()) }),
|
|
51
|
+
/* @__PURE__ */ jsx(StatTile, { label: "Revenue", value: priceLabel(indexed?.revenue ?? "0", onchain.paymentToken) }),
|
|
52
|
+
/* @__PURE__ */ jsx(StatTile, { label: "Collectors", value: indexed?.collectors ?? 0 })
|
|
53
|
+
] }),
|
|
54
|
+
/* @__PURE__ */ jsx(DropActivityList, { mints })
|
|
55
|
+
] }),
|
|
56
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-3", children: [
|
|
57
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Who can mint" }),
|
|
58
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: listed ? "Only wallets on your list can mint." : "Everyone can mint." }),
|
|
59
|
+
/* @__PURE__ */ jsx(Textarea, { rows: 5, placeholder: "Paste wallet addresses, one per line", value: listText, onChange: (e) => {
|
|
60
|
+
setListText(e.target.value);
|
|
61
|
+
setLinks([]);
|
|
62
|
+
} }),
|
|
63
|
+
parsed.invalid.length > 0 && /* @__PURE__ */ jsxs("p", { className: "text-xs text-destructive", children: [
|
|
64
|
+
parsed.invalid.length,
|
|
65
|
+
" line(s) aren't wallet addresses: ",
|
|
66
|
+
parsed.invalid.slice(0, 3).join(", ")
|
|
67
|
+
] }),
|
|
68
|
+
/* @__PURE__ */ jsxs("div", { className: "flex flex-wrap gap-2", children: [
|
|
69
|
+
list && sameList && /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setLinks(dropClaimLinks(window.location.origin, contract, list)), children: "This is your current list \u2014 get its claim links" }),
|
|
70
|
+
list && !sameList && parsed.invalid.length === 0 && /* @__PURE__ */ jsx(Button, { onClick: () => setPending({
|
|
71
|
+
title: "List published",
|
|
72
|
+
body: `Only these ${parsed.addresses.length} wallets will be able to mint. Claim links for your previous list stop working for wallets not on this one.`,
|
|
73
|
+
act: async () => {
|
|
74
|
+
await run({ action: "set_allowlist_root", root: list.root });
|
|
75
|
+
setLinks(dropClaimLinks(window.location.origin, contract, list));
|
|
76
|
+
}
|
|
77
|
+
}), children: "Publish this list" }),
|
|
78
|
+
listed && /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setPending({
|
|
79
|
+
title: "Drop opened to everyone",
|
|
80
|
+
body: "Anyone will be able to mint, with or without a claim link.",
|
|
81
|
+
act: () => run({ action: "set_allowlist_root", root: "0x0" })
|
|
82
|
+
}), children: "Open to everyone" }),
|
|
83
|
+
links.length > 0 && /* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => downloadCsv(popClaimLinksCsv(links), "claim-links.csv"), children: "Download claim links" })
|
|
84
|
+
] })
|
|
85
|
+
] }),
|
|
86
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-3", children: [
|
|
87
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Gift" }),
|
|
88
|
+
/* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
89
|
+
"Mint free tokens to a wallet",
|
|
90
|
+
left !== null ? ` \xB7 ${left.toString()} left` : "",
|
|
91
|
+
". Gifts don't count toward that wallet's limit."
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
94
|
+
/* @__PURE__ */ jsx(Input, { placeholder: "Wallet address", value: gift.to, onChange: (e) => setGift({ ...gift, to: e.target.value.trim() }) }),
|
|
95
|
+
/* @__PURE__ */ jsx(Input, { className: "w-20", inputMode: "numeric", value: gift.quantity, onChange: (e) => setGift({ ...gift, quantity: e.target.value.trim() }) })
|
|
96
|
+
] }),
|
|
97
|
+
/* @__PURE__ */ jsx(
|
|
98
|
+
Button,
|
|
99
|
+
{
|
|
100
|
+
disabled: parseAllowlist(gift.to).addresses.length !== 1 || !/^[1-9]\d*$/.test(gift.quantity),
|
|
101
|
+
onClick: () => setPending({
|
|
102
|
+
title: "Gift sent",
|
|
103
|
+
body: `Mint ${gift.quantity} free token(s) to ${gift.to}.`,
|
|
104
|
+
act: () => run({ action: "issue", recipient: gift.to, quantity: gift.quantity })
|
|
105
|
+
}),
|
|
106
|
+
children: "Send gift"
|
|
107
|
+
}
|
|
108
|
+
)
|
|
109
|
+
] }),
|
|
110
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-3", children: [
|
|
111
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Share" }),
|
|
112
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
113
|
+
/* @__PURE__ */ jsx(Input, { readOnly: true, value: shareUrl }),
|
|
114
|
+
/* @__PURE__ */ jsx(ShareButton, { title: indexed?.name ?? "Drop", url: shareUrl, variant: "outline" })
|
|
115
|
+
] })
|
|
116
|
+
] }),
|
|
117
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-3", children: [
|
|
118
|
+
/* @__PURE__ */ jsx("h3", { className: "text-sm font-semibold", children: "Exclusive content" }),
|
|
119
|
+
/* @__PURE__ */ jsx(ExclusiveFields, { value: exclusive, onChange: setExclusive }),
|
|
120
|
+
/* @__PURE__ */ jsxs("div", { className: "flex gap-2", children: [
|
|
121
|
+
/* @__PURE__ */ jsx(Button, { disabled: !/^https:\/\//.test(exclusive.url), onClick: () => setPending({ title: "Exclusive content saved", body: "Holders will see this link.", act: () => saveExclusive(exclusive) }), children: "Save" }),
|
|
122
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", onClick: () => setPending({ title: "Exclusive content removed", body: "Holders will no longer see a link.", act: () => saveExclusive(null) }), children: "Remove" })
|
|
123
|
+
] })
|
|
124
|
+
] }),
|
|
125
|
+
/* @__PURE__ */ jsx(ActionDialog, { open: pending !== null, onClose: () => !busy && setPending(null), width: 460, children: /* @__PURE__ */ jsxs("div", { className: "space-y-4 p-6", children: [
|
|
126
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm", children: pending?.body }),
|
|
127
|
+
/* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-2", children: [
|
|
128
|
+
/* @__PURE__ */ jsx(Button, { variant: "outline", disabled: busy, onClick: () => setPending(null), children: "Cancel" }),
|
|
129
|
+
/* @__PURE__ */ jsx(Button, { disabled: busy, onClick: () => void confirm(), children: busy ? "Working\u2026" : "Confirm" })
|
|
130
|
+
] })
|
|
131
|
+
] }) })
|
|
132
|
+
] });
|
|
133
|
+
}
|
|
134
|
+
export {
|
|
135
|
+
DropManage
|
|
136
|
+
};
|
|
137
|
+
//# sourceMappingURL=drop-manage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-manage.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { buildPopAllowlist, dropClaimLinks, popClaimLinksCsv, type DropOnchain } from \"@medialane/sdk/starknet\";\nimport { dropHref, type ApiDrop, type ApiDropMint } from \"@medialane/sdk\";\nimport { ActionDialog } from \"../../action-dialog.js\";\nimport { Button } from \"../../button.js\";\nimport { Input } from \"../../input.js\";\nimport { Textarea } from \"../../textarea.js\";\nimport { ShareButton } from \"../../share-button.js\";\nimport { StatTile } from \"../../stat-tile.js\";\nimport { DropActivityList } from \"./drop-activity.js\";\nimport { ExclusiveFields, type ExclusiveValue } from \"../create/exclusive-fields.js\";\nimport { downloadCsv } from \"../create/launch-dialog.js\";\nimport { describeError } from \"../../../utils/describe-error.js\";\nimport { parseAllowlist } from \"../../../utils/drop/allowlist.js\";\nimport { priceLabel, supplyLabel } from \"../../../utils/drop/sale.js\";\n\nexport interface DropManageProps {\n contract: string;\n indexed: ApiDrop | null;\n onchain: DropOnchain;\n mints: ApiDropMint[];\n /** Runs a manage action as one transaction; resolves when confirmed. */\n run: (params: { action: \"issue\"; recipient: string; quantity: string } | { action: \"set_allowlist_root\"; root: string }) => Promise<void>;\n saveExclusive: (value: ExclusiveValue | null) => Promise<void>;\n}\n\ntype Pending = { title: string; body: string; act: () => Promise<void> } | null;\n\nexport function DropManage({ contract, indexed, onchain, mints, run, saveExclusive }: DropManageProps) {\n const [pending, setPending] = useState<Pending>(null);\n const [busy, setBusy] = useState(false);\n const [message, setMessage] = useState<string | null>(null);\n const [listText, setListText] = useState(\"\");\n const [links, setLinks] = useState<ReturnType<typeof dropClaimLinks>>([]);\n const [gift, setGift] = useState({ to: \"\", quantity: \"1\" });\n const [exclusive, setExclusive] = useState<ExclusiveValue>({ title: \"\", url: \"\", type: \"\" });\n const listed = BigInt(onchain.allowlistRoot) !== 0n;\n const left = onchain.maxSupply === 0n ? null : onchain.maxSupply - onchain.totalMinted;\n const shareUrl = typeof window === \"undefined\" ? dropHref(contract) : `${window.location.origin}${dropHref(contract)}`;\n\n const confirm = async () => {\n if (!pending) return;\n setBusy(true);\n try {\n await pending.act();\n setMessage(`${pending.title} — done.`);\n } catch (err) {\n setMessage(describeError(err, \"That didn't go through. Please try again.\").message);\n } finally {\n setBusy(false);\n setPending(null);\n }\n };\n\n const parsed = parseAllowlist(listText);\n const list = parsed.addresses.length > 0 ? buildPopAllowlist(parsed.addresses) : null;\n const sameList = list !== null && BigInt(list.root) === BigInt(onchain.allowlistRoot);\n\n return (\n <div className=\"space-y-8\">\n {message && <p className=\"rounded-lg bg-muted/50 px-3 py-2 text-sm\">{message}</p>}\n\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold\">Overview</h3>\n <div className=\"grid grid-cols-2 gap-3 sm:grid-cols-3\">\n <StatTile label=\"Minted\" value={supplyLabel(onchain.totalMinted.toString(), onchain.maxSupply.toString())} />\n <StatTile label=\"Revenue\" value={priceLabel(indexed?.revenue ?? \"0\", onchain.paymentToken)} />\n <StatTile label=\"Collectors\" value={indexed?.collectors ?? 0} />\n </div>\n <DropActivityList mints={mints} />\n </section>\n\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold\">Who can mint</h3>\n <p className=\"text-sm text-muted-foreground\">{listed ? \"Only wallets on your list can mint.\" : \"Everyone can mint.\"}</p>\n <Textarea rows={5} placeholder=\"Paste wallet addresses, one per line\" value={listText} onChange={(e) => { setListText(e.target.value); setLinks([]); }} />\n {parsed.invalid.length > 0 && <p className=\"text-xs text-destructive\">{parsed.invalid.length} line(s) aren't wallet addresses: {parsed.invalid.slice(0, 3).join(\", \")}</p>}\n <div className=\"flex flex-wrap gap-2\">\n {list && sameList && (\n <Button variant=\"outline\" onClick={() => setLinks(dropClaimLinks(window.location.origin, contract, list))}>This is your current list — get its claim links</Button>\n )}\n {list && !sameList && parsed.invalid.length === 0 && (\n <Button onClick={() => setPending({\n title: \"List published\",\n body: `Only these ${parsed.addresses.length} wallets will be able to mint. Claim links for your previous list stop working for wallets not on this one.`,\n act: async () => { await run({ action: \"set_allowlist_root\", root: list.root }); setLinks(dropClaimLinks(window.location.origin, contract, list)); },\n })}>Publish this list</Button>\n )}\n {listed && (\n <Button variant=\"outline\" onClick={() => setPending({\n title: \"Drop opened to everyone\",\n body: \"Anyone will be able to mint, with or without a claim link.\",\n act: () => run({ action: \"set_allowlist_root\", root: \"0x0\" }),\n })}>Open to everyone</Button>\n )}\n {links.length > 0 && <Button variant=\"outline\" onClick={() => downloadCsv(popClaimLinksCsv(links), \"claim-links.csv\")}>Download claim links</Button>}\n </div>\n </section>\n\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold\">Gift</h3>\n <p className=\"text-sm text-muted-foreground\">\n Mint free tokens to a wallet{left !== null ? ` · ${left.toString()} left` : \"\"}. Gifts don't count toward that wallet's limit.\n </p>\n <div className=\"flex gap-2\">\n <Input placeholder=\"Wallet address\" value={gift.to} onChange={(e) => setGift({ ...gift, to: e.target.value.trim() })} />\n <Input className=\"w-20\" inputMode=\"numeric\" value={gift.quantity} onChange={(e) => setGift({ ...gift, quantity: e.target.value.trim() })} />\n </div>\n <Button\n disabled={parseAllowlist(gift.to).addresses.length !== 1 || !/^[1-9]\\d*$/.test(gift.quantity)}\n onClick={() => setPending({\n title: \"Gift sent\",\n body: `Mint ${gift.quantity} free token(s) to ${gift.to}.`,\n act: () => run({ action: \"issue\", recipient: gift.to, quantity: gift.quantity }),\n })}\n >Send gift</Button>\n </section>\n\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold\">Share</h3>\n <div className=\"flex gap-2\">\n <Input readOnly value={shareUrl} />\n <ShareButton title={indexed?.name ?? \"Drop\"} url={shareUrl} variant=\"outline\" />\n </div>\n </section>\n\n <section className=\"space-y-3\">\n <h3 className=\"text-sm font-semibold\">Exclusive content</h3>\n <ExclusiveFields value={exclusive} onChange={setExclusive} />\n <div className=\"flex gap-2\">\n <Button disabled={!/^https:\\/\\//.test(exclusive.url)} onClick={() => setPending({ title: \"Exclusive content saved\", body: \"Holders will see this link.\", act: () => saveExclusive(exclusive) })}>Save</Button>\n <Button variant=\"outline\" onClick={() => setPending({ title: \"Exclusive content removed\", body: \"Holders will no longer see a link.\", act: () => saveExclusive(null) })}>Remove</Button>\n </div>\n </section>\n\n <ActionDialog open={pending !== null} onClose={() => !busy && setPending(null)} width={460}>\n <div className=\"space-y-4 p-6\">\n <p className=\"text-sm\">{pending?.body}</p>\n <div className=\"flex justify-end gap-2\">\n <Button variant=\"outline\" disabled={busy} onClick={() => setPending(null)}>Cancel</Button>\n <Button disabled={busy} onClick={() => void confirm()}>{busy ? \"Working…\" : \"Confirm\"}</Button>\n </div>\n </div>\n </ActionDialog>\n </div>\n );\n}\n"],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,MAAM,WAAW,EAAE,OAAO,6BAA6B,MAAM,sCAAsC,KAAK,MAAM,cAAc,IAAI,EAAE,CAAC,GAAG,oBAAM;AAAA,SACjL;AAAA,OACF;AAAA,IAEA,oBAAC,gBAAa,MAAM,YAAY,MAAM,SAAS,MAAM,CAAC,QAAQ,WAAW,IAAI,GAAG,OAAO,KACrF,+BAAC,SAAI,WAAU,iBACb;AAAA,0BAAC,OAAE,WAAU,WAAW,mBAAS,MAAK;AAAA,MACtC,qBAAC,SAAI,WAAU,0BACb;AAAA,4BAAC,UAAO,SAAQ,WAAU,UAAU,MAAM,SAAS,MAAM,WAAW,IAAI,GAAG,oBAAM;AAAA,QACjF,oBAAC,UAAO,UAAU,MAAM,SAAS,MAAM,KAAK,QAAQ,GAAI,iBAAO,kBAAa,WAAU;AAAA,SACxF;AAAA,OACF,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,97 @@
|
|
|
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 drop_mint_dialog_exports = {};
|
|
21
|
+
__export(drop_mint_dialog_exports, {
|
|
22
|
+
DropMintDialog: () => DropMintDialog
|
|
23
|
+
});
|
|
24
|
+
module.exports = __toCommonJS(drop_mint_dialog_exports);
|
|
25
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
26
|
+
var import_react = require("react");
|
|
27
|
+
var import_lucide_react = require("lucide-react");
|
|
28
|
+
var import_action_dialog = require("../../action-dialog.js");
|
|
29
|
+
var import_gradient_button = require("../../gradient-button.js");
|
|
30
|
+
var import_button = require("../../button.js");
|
|
31
|
+
var import_describe_error = require("../../../utils/describe-error.js");
|
|
32
|
+
function DropMintDialog({
|
|
33
|
+
open,
|
|
34
|
+
onClose,
|
|
35
|
+
name,
|
|
36
|
+
quantity,
|
|
37
|
+
totalText,
|
|
38
|
+
onMint,
|
|
39
|
+
portfolioHref
|
|
40
|
+
}) {
|
|
41
|
+
const [step, setStep] = (0, import_react.useState)({ kind: "confirm" });
|
|
42
|
+
const mint = async () => {
|
|
43
|
+
setStep({ kind: "minting" });
|
|
44
|
+
try {
|
|
45
|
+
setStep({ kind: "done", tokenIds: (await onMint()).tokenIds });
|
|
46
|
+
} catch (err) {
|
|
47
|
+
setStep({ kind: "error", message: (0, import_describe_error.describeError)(err, "The mint didn't go through. Please try again.").message });
|
|
48
|
+
}
|
|
49
|
+
};
|
|
50
|
+
const close = () => {
|
|
51
|
+
if (step.kind === "minting") return;
|
|
52
|
+
setStep({ kind: "confirm" });
|
|
53
|
+
onClose();
|
|
54
|
+
};
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_action_dialog.ActionDialog, { open, onClose: close, width: 460, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-5 p-6", children: [
|
|
56
|
+
step.kind === "confirm" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
57
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { className: "text-lg font-semibold", children: [
|
|
58
|
+
"Mint ",
|
|
59
|
+
quantity.toString(),
|
|
60
|
+
" from ",
|
|
61
|
+
name
|
|
62
|
+
] }),
|
|
63
|
+
totalText && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: totalText }),
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_gradient_button.GradientButton, { big: true, onClick: () => void mint(), children: "Confirm mint" })
|
|
65
|
+
] }),
|
|
66
|
+
step.kind === "minting" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { className: "flex items-center gap-2 text-lg font-semibold", children: [
|
|
67
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
68
|
+
"Minting\u2026"
|
|
69
|
+
] }),
|
|
70
|
+
step.kind === "done" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
71
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { className: "flex items-center gap-2 text-lg font-semibold", children: [
|
|
72
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.CheckCircle2, { className: "h-5 w-5 text-green-500" }),
|
|
73
|
+
"Minted"
|
|
74
|
+
] }),
|
|
75
|
+
step.tokenIds.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-sm text-muted-foreground", children: [
|
|
76
|
+
"Token",
|
|
77
|
+
step.tokenIds.length > 1 ? "s" : "",
|
|
78
|
+
" #",
|
|
79
|
+
step.tokenIds.join(", #")
|
|
80
|
+
] }),
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { asChild: true, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("a", { href: portfolioHref, children: "View in portfolio" }) })
|
|
82
|
+
] }),
|
|
83
|
+
step.kind === "error" && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("h2", { className: "flex items-center gap-2 text-lg font-semibold", children: [
|
|
85
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.XCircle, { className: "h-4 w-4 text-destructive" }),
|
|
86
|
+
"Not minted"
|
|
87
|
+
] }),
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: step.message }),
|
|
89
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { onClick: () => void mint(), children: "Try again" })
|
|
90
|
+
] })
|
|
91
|
+
] }) });
|
|
92
|
+
}
|
|
93
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
94
|
+
0 && (module.exports = {
|
|
95
|
+
DropMintDialog
|
|
96
|
+
});
|
|
97
|
+
//# sourceMappingURL=drop-mint-dialog.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-mint-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { ActionDialog } from \"../../action-dialog.js\";\nimport { GradientButton } from \"../../gradient-button.js\";\nimport { Button } from \"../../button.js\";\nimport { describeError } from \"../../../utils/describe-error.js\";\n\ntype Step = { kind: \"confirm\" } | { kind: \"minting\" } | { kind: \"done\"; tokenIds: string[] } | { kind: \"error\"; message: string };\n\nexport function DropMintDialog({\n open, onClose, name, quantity, totalText, onMint, portfolioHref,\n}: {\n open: boolean;\n onClose: () => void;\n name: string;\n quantity: bigint;\n totalText: string | null;\n onMint: () => Promise<{ tokenIds: string[] }>;\n portfolioHref: string;\n}) {\n const [step, setStep] = useState<Step>({ kind: \"confirm\" });\n const mint = async () => {\n setStep({ kind: \"minting\" });\n try {\n setStep({ kind: \"done\", tokenIds: (await onMint()).tokenIds });\n } catch (err) {\n setStep({ kind: \"error\", message: describeError(err, \"The mint didn't go through. Please try again.\").message });\n }\n };\n const close = () => {\n if (step.kind === \"minting\") return;\n setStep({ kind: \"confirm\" });\n onClose();\n };\n return (\n <ActionDialog open={open} onClose={close} width={460}>\n <div className=\"space-y-5 p-6\">\n {step.kind === \"confirm\" && (\n <>\n <h2 className=\"text-lg font-semibold\">Mint {quantity.toString()} from {name}</h2>\n {totalText && <p className=\"text-sm text-muted-foreground\">{totalText}</p>}\n <GradientButton big onClick={() => void mint()}>Confirm mint</GradientButton>\n </>\n )}\n {step.kind === \"minting\" && <h2 className=\"flex items-center gap-2 text-lg font-semibold\"><Loader2 className=\"h-4 w-4 animate-spin\" />Minting…</h2>}\n {step.kind === \"done\" && (\n <>\n <h2 className=\"flex items-center gap-2 text-lg font-semibold\"><CheckCircle2 className=\"h-5 w-5 text-green-500\" />Minted</h2>\n {step.tokenIds.length > 0 && <p className=\"text-sm text-muted-foreground\">Token{step.tokenIds.length > 1 ? \"s\" : \"\"} #{step.tokenIds.join(\", #\")}</p>}\n <Button asChild><a href={portfolioHref}>View in portfolio</a></Button>\n </>\n )}\n {step.kind === \"error\" && (\n <>\n <h2 className=\"flex items-center gap-2 text-lg font-semibold\"><XCircle className=\"h-4 w-4 text-destructive\" />Not minted</h2>\n <p className=\"text-sm text-muted-foreground\">{step.message}</p>\n <Button onClick={() => void mint()}>Try again</Button>\n </>\n )}\n </div>\n </ActionDialog>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwCU;AAtCV,mBAAyB;AACzB,0BAA+C;AAC/C,2BAA6B;AAC7B,6BAA+B;AAC/B,oBAAuB;AACvB,4BAA8B;AAIvB,SAAS,eAAe;AAAA,EAC7B;AAAA,EAAM;AAAA,EAAS;AAAA,EAAM;AAAA,EAAU;AAAA,EAAW;AAAA,EAAQ;AACpD,GAQG;AACD,QAAM,CAAC,M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AO,SAAO,MAAC,sDAAC,OAAE,MAAM,eAAe,+BAAiB,GAAI;AAAA,OAC/D;AAAA,IAED,KAAK,SAAS,WACb,4EACE;AAAA,mDAAC,QAAG,WAAU,iDAAgD;AAAA,oDAAC,+BAAQ,WAAU,4BAA2B;AAAA,QAAE;AAAA,SAAU;AAAA,MACxH,4CAAC,OAAE,WAAU,iCAAiC,eAAK,SAAQ;AAAA,MAC3D,4CAAC,wBAAO,SAAS,MAAM,KAAK,KAAK,GAAG,uBAAS;AAAA,OAC/C;AAAA,KAEJ,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare function DropMintDialog({ open, onClose, name, quantity, totalText, onMint, portfolioHref, }: {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
name: string;
|
|
7
|
+
quantity: bigint;
|
|
8
|
+
totalText: string | null;
|
|
9
|
+
onMint: () => Promise<{
|
|
10
|
+
tokenIds: string[];
|
|
11
|
+
}>;
|
|
12
|
+
portfolioHref: string;
|
|
13
|
+
}): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { DropMintDialog };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
declare function DropMintDialog({ open, onClose, name, quantity, totalText, onMint, portfolioHref, }: {
|
|
4
|
+
open: boolean;
|
|
5
|
+
onClose: () => void;
|
|
6
|
+
name: string;
|
|
7
|
+
quantity: bigint;
|
|
8
|
+
totalText: string | null;
|
|
9
|
+
onMint: () => Promise<{
|
|
10
|
+
tokenIds: string[];
|
|
11
|
+
}>;
|
|
12
|
+
portfolioHref: string;
|
|
13
|
+
}): react_jsx_runtime.JSX.Element;
|
|
14
|
+
|
|
15
|
+
export { DropMintDialog };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { CheckCircle2, Loader2, XCircle } from "lucide-react";
|
|
5
|
+
import { ActionDialog } from "../../action-dialog.js";
|
|
6
|
+
import { GradientButton } from "../../gradient-button.js";
|
|
7
|
+
import { Button } from "../../button.js";
|
|
8
|
+
import { describeError } from "../../../utils/describe-error.js";
|
|
9
|
+
function DropMintDialog({
|
|
10
|
+
open,
|
|
11
|
+
onClose,
|
|
12
|
+
name,
|
|
13
|
+
quantity,
|
|
14
|
+
totalText,
|
|
15
|
+
onMint,
|
|
16
|
+
portfolioHref
|
|
17
|
+
}) {
|
|
18
|
+
const [step, setStep] = useState({ kind: "confirm" });
|
|
19
|
+
const mint = async () => {
|
|
20
|
+
setStep({ kind: "minting" });
|
|
21
|
+
try {
|
|
22
|
+
setStep({ kind: "done", tokenIds: (await onMint()).tokenIds });
|
|
23
|
+
} catch (err) {
|
|
24
|
+
setStep({ kind: "error", message: describeError(err, "The mint didn't go through. Please try again.").message });
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
const close = () => {
|
|
28
|
+
if (step.kind === "minting") return;
|
|
29
|
+
setStep({ kind: "confirm" });
|
|
30
|
+
onClose();
|
|
31
|
+
};
|
|
32
|
+
return /* @__PURE__ */ jsx(ActionDialog, { open, onClose: close, width: 460, children: /* @__PURE__ */ jsxs("div", { className: "space-y-5 p-6", children: [
|
|
33
|
+
step.kind === "confirm" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
34
|
+
/* @__PURE__ */ jsxs("h2", { className: "text-lg font-semibold", children: [
|
|
35
|
+
"Mint ",
|
|
36
|
+
quantity.toString(),
|
|
37
|
+
" from ",
|
|
38
|
+
name
|
|
39
|
+
] }),
|
|
40
|
+
totalText && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: totalText }),
|
|
41
|
+
/* @__PURE__ */ jsx(GradientButton, { big: true, onClick: () => void mint(), children: "Confirm mint" })
|
|
42
|
+
] }),
|
|
43
|
+
step.kind === "minting" && /* @__PURE__ */ jsxs("h2", { className: "flex items-center gap-2 text-lg font-semibold", children: [
|
|
44
|
+
/* @__PURE__ */ jsx(Loader2, { className: "h-4 w-4 animate-spin" }),
|
|
45
|
+
"Minting\u2026"
|
|
46
|
+
] }),
|
|
47
|
+
step.kind === "done" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
/* @__PURE__ */ jsxs("h2", { className: "flex items-center gap-2 text-lg font-semibold", children: [
|
|
49
|
+
/* @__PURE__ */ jsx(CheckCircle2, { className: "h-5 w-5 text-green-500" }),
|
|
50
|
+
"Minted"
|
|
51
|
+
] }),
|
|
52
|
+
step.tokenIds.length > 0 && /* @__PURE__ */ jsxs("p", { className: "text-sm text-muted-foreground", children: [
|
|
53
|
+
"Token",
|
|
54
|
+
step.tokenIds.length > 1 ? "s" : "",
|
|
55
|
+
" #",
|
|
56
|
+
step.tokenIds.join(", #")
|
|
57
|
+
] }),
|
|
58
|
+
/* @__PURE__ */ jsx(Button, { asChild: true, children: /* @__PURE__ */ jsx("a", { href: portfolioHref, children: "View in portfolio" }) })
|
|
59
|
+
] }),
|
|
60
|
+
step.kind === "error" && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
61
|
+
/* @__PURE__ */ jsxs("h2", { className: "flex items-center gap-2 text-lg font-semibold", children: [
|
|
62
|
+
/* @__PURE__ */ jsx(XCircle, { className: "h-4 w-4 text-destructive" }),
|
|
63
|
+
"Not minted"
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground", children: step.message }),
|
|
66
|
+
/* @__PURE__ */ jsx(Button, { onClick: () => void mint(), children: "Try again" })
|
|
67
|
+
] })
|
|
68
|
+
] }) });
|
|
69
|
+
}
|
|
70
|
+
export {
|
|
71
|
+
DropMintDialog
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=drop-mint-dialog.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/drop/page/drop-mint-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport { CheckCircle2, Loader2, XCircle } from \"lucide-react\";\nimport { ActionDialog } from \"../../action-dialog.js\";\nimport { GradientButton } from \"../../gradient-button.js\";\nimport { Button } from \"../../button.js\";\nimport { describeError } from \"../../../utils/describe-error.js\";\n\ntype Step = { kind: \"confirm\" } | { kind: \"minting\" } | { kind: \"done\"; tokenIds: string[] } | { kind: \"error\"; message: string };\n\nexport function DropMintDialog({\n open, onClose, name, quantity, totalText, onMint, portfolioHref,\n}: {\n open: boolean;\n onClose: () => void;\n name: string;\n quantity: bigint;\n totalText: string | null;\n onMint: () => Promise<{ tokenIds: string[] }>;\n portfolioHref: string;\n}) {\n const [step, setStep] = useState<Step>({ kind: \"confirm\" });\n const mint = async () => {\n setStep({ kind: \"minting\" });\n try {\n setStep({ kind: \"done\", tokenIds: (await onMint()).tokenIds });\n } catch (err) {\n setStep({ kind: \"error\", message: describeError(err, \"The mint didn't go through. Please try again.\").message });\n }\n };\n const close = () => {\n if (step.kind === \"minting\") return;\n setStep({ kind: \"confirm\" });\n onClose();\n };\n return (\n <ActionDialog open={open} onClose={close} width={460}>\n <div className=\"space-y-5 p-6\">\n {step.kind === \"confirm\" && (\n <>\n <h2 className=\"text-lg font-semibold\">Mint {quantity.toString()} from {name}</h2>\n {totalText && <p className=\"text-sm text-muted-foreground\">{totalText}</p>}\n <GradientButton big onClick={() => void mint()}>Confirm mint</GradientButton>\n </>\n )}\n {step.kind === \"minting\" && <h2 className=\"flex items-center gap-2 text-lg font-semibold\"><Loader2 className=\"h-4 w-4 animate-spin\" />Minting…</h2>}\n {step.kind === \"done\" && (\n <>\n <h2 className=\"flex items-center gap-2 text-lg font-semibold\"><CheckCircle2 className=\"h-5 w-5 text-green-500\" />Minted</h2>\n {step.tokenIds.length > 0 && <p className=\"text-sm text-muted-foreground\">Token{step.tokenIds.length > 1 ? \"s\" : \"\"} #{step.tokenIds.join(\", #\")}</p>}\n <Button asChild><a href={portfolioHref}>View in portfolio</a></Button>\n </>\n )}\n {step.kind === \"error\" && (\n <>\n <h2 className=\"flex items-center gap-2 text-lg font-semibold\"><XCircle className=\"h-4 w-4 text-destructive\" />Not minted</h2>\n <p className=\"text-sm text-muted-foreground\">{step.message}</p>\n <Button onClick={() => void mint()}>Try again</Button>\n </>\n )}\n </div>\n </ActionDialog>\n );\n}\n"],"mappings":";AAwCU,mBAEgB,KADd,YADF;AAtCV,SAAS,gBAAgB;AACzB,SAAS,cAAc,SAAS,eAAe;AAC/C,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAIvB,SAAS,eAAe;AAAA,EAC7B;AAAA,EAAM;AAAA,EAAS;AAAA,EAAM;AAAA,EAAU;AAAA,EAAW;AAAA,EAAQ;AACpD,GAQG;AACD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAe,EAAE,MAAM,UAAU,CAAC;AAC1D,QAAM,OAAO,YAAY;AACvB,YAAQ,EAAE,MAAM,UAAU,CAAC;AAC3B,QAAI;AACF,cAAQ,EAAE,MAAM,QAAQ,WAAW,MAAM,OAAO,GAAG,SAAS,CAAC;AAAA,IAC/D,SAAS,KAAK;AACZ,cAAQ,EAAE,MAAM,SAAS,SAAS,cAAc,KAAK,+CAA+C,EAAE,QAAQ,CAAC;AAAA,IACjH;AAAA,EACF;AACA,QAAM,QAAQ,MAAM;AAClB,QAAI,KAAK,SAAS,UAAW;AAC7B,YAAQ,EAAE,MAAM,UAAU,CAAC;AAC3B,YAAQ;AAAA,EACV;AACA,SACE,oBAAC,gBAAa,MAAY,SAAS,OAAO,OAAO,KAC/C,+BAAC,SAAI,WAAU,iBACZ;AAAA,SAAK,SAAS,aACb,iCACE;AAAA,2BAAC,QAAG,WAAU,yBAAwB;AAAA;AAAA,QAAM,SAAS,SAAS;AAAA,QAAE;AAAA,QAAO;AAAA,SAAK;AAAA,MAC3E,aAAa,oBAAC,OAAE,WAAU,iCAAiC,qBAAU;AAAA,MACtE,oBAAC,kBAAe,KAAG,MAAC,SAAS,MAAM,KAAK,KAAK,GAAG,0BAAY;AAAA,OAC9D;AAAA,IAED,KAAK,SAAS,aAAa,qBAAC,QAAG,WAAU,iDAAgD;AAAA,0BAAC,WAAQ,WAAU,wBAAuB;AAAA,MAAE;AAAA,OAAQ;AAAA,IAC7I,KAAK,SAAS,UACb,iCACE;AAAA,2BAAC,QAAG,WAAU,iDAAgD;AAAA,4BAAC,gBAAa,WAAU,0BAAyB;AAAA,QAAE;AAAA,SAAM;AAAA,MACtH,KAAK,SAAS,SAAS,KAAK,qBAAC,OAAE,WAAU,iCAAgC;AAAA;AAAA,QAAM,KAAK,SAAS,SAAS,IAAI,MAAM;AAAA,QAAG;AAAA,QAAG,KAAK,SAAS,KAAK,KAAK;AAAA,SAAE;AAAA,MACjJ,oBAAC,UAAO,SAAO,MAAC,8BAAC,OAAE,MAAM,eAAe,+BAAiB,GAAI;AAAA,OAC/D;AAAA,IAED,KAAK,SAAS,WACb,iCACE;AAAA,2BAAC,QAAG,WAAU,iDAAgD;AAAA,4BAAC,WAAQ,WAAU,4BAA2B;AAAA,QAAE;AAAA,SAAU;AAAA,MACxH,oBAAC,OAAE,WAAU,iCAAiC,eAAK,SAAQ;AAAA,MAC3D,oBAAC,UAAO,SAAS,MAAM,KAAK,KAAK,GAAG,uBAAS;AAAA,OAC/C;AAAA,KAEJ,GACF;AAEJ;","names":[]}
|
|
@@ -0,0 +1,165 @@
|
|
|
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 drop_page_exports = {};
|
|
31
|
+
__export(drop_page_exports, {
|
|
32
|
+
DropPage: () => DropPage
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(drop_page_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_lucide_react = require("lucide-react");
|
|
38
|
+
var import_starknet = require("@medialane/sdk/starknet");
|
|
39
|
+
var import_image = __toESM(require("../../image.js"), 1);
|
|
40
|
+
var import_creator_chip = require("../../creator-chip.js");
|
|
41
|
+
var import_share_button = require("../../share-button.js");
|
|
42
|
+
var import_skeleton = require("../../skeleton.js");
|
|
43
|
+
var import_tabs = require("../../tabs.js");
|
|
44
|
+
var import_asset_license_summary = require("../../asset-license-summary.js");
|
|
45
|
+
var import_token_card = require("../../token-card.js");
|
|
46
|
+
var import_drop_action_box = require("./drop-action-box.js");
|
|
47
|
+
var import_drop_activity = require("./drop-activity.js");
|
|
48
|
+
var import_drop_manage = require("./drop-manage.js");
|
|
49
|
+
var import_drop_mint_dialog = require("./drop-mint-dialog.js");
|
|
50
|
+
var import_gradient_button = require("../../gradient-button.js");
|
|
51
|
+
var import_ipfs = require("../../../utils/ipfs.js");
|
|
52
|
+
var import_use_collections = require("../../../utils/use-collections.js");
|
|
53
|
+
var import_use_drops = require("../../../utils/use-drops.js");
|
|
54
|
+
var import_use_now = require("../../../utils/drop/use-now.js");
|
|
55
|
+
var import_view = require("../../../utils/drop/view.js");
|
|
56
|
+
var import_claim_proof = require("../../../utils/drop/claim-proof.js");
|
|
57
|
+
var import_actions = require("../../../utils/drop/actions.js");
|
|
58
|
+
function DropPage(props) {
|
|
59
|
+
const { contract, getClient, provider, walletAddress } = props;
|
|
60
|
+
const { drop: indexed, isLoading } = (0, import_use_drops.useDrop)(getClient, contract);
|
|
61
|
+
const chain = (0, import_use_drops.useDropChain)(provider, contract, walletAddress);
|
|
62
|
+
const { mints, mutate: refreshMints } = (0, import_use_drops.useDropMints)(getClient, contract);
|
|
63
|
+
const collectionFile = (0, import_use_drops.useDropFile)(getClient, indexed?.baseUri ?? null, "collection.json");
|
|
64
|
+
const firstToken = (0, import_use_drops.useDropFile)(getClient, indexed?.baseUri ?? null, "1");
|
|
65
|
+
const { tokens } = (0, import_use_collections.useCollectionTokens)(getClient, contract, 1, 24);
|
|
66
|
+
const now = (0, import_use_now.useNow)();
|
|
67
|
+
const [quantity, setQuantity] = (0, import_react.useState)(1n);
|
|
68
|
+
const [minting, setMinting] = (0, import_react.useState)(false);
|
|
69
|
+
const proof = (0, import_react.useMemo)(
|
|
70
|
+
() => typeof window === "undefined" ? null : (0, import_claim_proof.claimProofFor)(window.localStorage, contract, window.location.hash, "drop-proof"),
|
|
71
|
+
[contract]
|
|
72
|
+
);
|
|
73
|
+
if (isLoading && !chain.drop) {
|
|
74
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-8 lg:grid-cols-2", children: [
|
|
75
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "aspect-square rounded-2xl" }),
|
|
76
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-96 rounded-2xl" })
|
|
77
|
+
] });
|
|
78
|
+
}
|
|
79
|
+
if (!indexed && !chain.drop) {
|
|
80
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-3 py-24 text-center", children: [
|
|
81
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Package, { className: "mx-auto h-10 w-10 text-muted-foreground/30" }),
|
|
82
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground", children: "This drop wasn't found. A new drop can take a minute to appear." })
|
|
83
|
+
] });
|
|
84
|
+
}
|
|
85
|
+
const onchain = chain.drop;
|
|
86
|
+
const mint = (0, import_starknet.dropMintState)({ drop: onchain, wallet: walletAddress, claimed: chain.claimed, proof, balance: chain.balance, feeConfig: props.feeConfig, now });
|
|
87
|
+
const view = onchain ? (0, import_view.actionBoxView)({ drop: onchain, mint, quantity, feeConfig: props.feeConfig, now }) : null;
|
|
88
|
+
const isOrganizer = !!walletAddress && !!onchain && BigInt(walletAddress) === BigInt(onchain.organizer);
|
|
89
|
+
const isCollection = collectionFile?.drop_kind === "collection";
|
|
90
|
+
const art = firstToken?.image ?? indexed?.image ?? null;
|
|
91
|
+
const name = indexed?.name ?? "Drop";
|
|
92
|
+
const deps = async () => ({ client: getClient(), provider, signer: await props.getSigner() });
|
|
93
|
+
const onAction = () => {
|
|
94
|
+
if (!view) return;
|
|
95
|
+
if (view.button.action === "sign-in") props.onRequireWallet();
|
|
96
|
+
if (view.button.action === "mint") setMinting(true);
|
|
97
|
+
};
|
|
98
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-10 pb-28 lg:pb-0", children: [
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "grid gap-8 lg:grid-cols-2 lg:gap-10", children: [
|
|
100
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative aspect-square overflow-hidden rounded-2xl bg-muted", children: art && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: (0, import_ipfs.ipfsToHttp)(art), alt: name, fill: true, unoptimized: true, className: "object-cover" }) }),
|
|
101
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-5", children: [
|
|
102
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start justify-between gap-3", children: [
|
|
103
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1", children: [
|
|
104
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-3xl font-semibold", children: name }),
|
|
105
|
+
onchain && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_creator_chip.CreatorChip, { getClient, address: onchain.organizer })
|
|
106
|
+
] }),
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_share_button.ShareButton, { title: name, variant: "outline", size: "sm" })
|
|
108
|
+
] }),
|
|
109
|
+
view && onchain && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "hidden lg:block", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_action_box.DropActionBox, { view, minted: onchain.totalMinted, maxSupply: onchain.maxSupply, quantity, onQuantity: setQuantity, onAction }) })
|
|
110
|
+
] })
|
|
111
|
+
] }),
|
|
112
|
+
view && onchain && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "lg:hidden", children: [
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_action_box.DropActionBox, { view, minted: onchain.totalMinted, maxSupply: onchain.maxSupply, quantity, onQuantity: setQuantity, onAction }),
|
|
114
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "fixed inset-x-0 bottom-0 z-30 border-t border-border bg-background/95 p-3 backdrop-blur", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_gradient_button.GradientButton, { disabled: view.button.action === "none", onClick: onAction, children: view.button.label }) })
|
|
115
|
+
] }),
|
|
116
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tabs.Tabs, { defaultValue: props.initialTab === "manage" && isOrganizer ? "manage" : "about", children: [
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_tabs.TabsList, { children: [
|
|
118
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTrigger, { value: "about", children: "About" }),
|
|
119
|
+
isCollection && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTrigger, { value: "items", children: "Items" }),
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTrigger, { value: "activity", children: "Activity" }),
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTrigger, { value: "license", children: "License" }),
|
|
122
|
+
isOrganizer && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsTrigger, { value: "manage", children: "Manage" })
|
|
123
|
+
] }),
|
|
124
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsContent, { value: "about", className: "pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "whitespace-pre-line text-sm leading-relaxed text-muted-foreground", children: indexed?.description || "No description." }) }),
|
|
125
|
+
isCollection && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsContent, { value: "items", className: "pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "grid grid-cols-2 gap-4 sm:grid-cols-3 lg:grid-cols-4", children: tokens.map((t) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_token_card.TokenCard, { token: t }, t.tokenId)) }) }),
|
|
126
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsContent, { value: "activity", className: "pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_drop_activity.DropActivityList, { mints }) }),
|
|
127
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsContent, { value: "license", className: "pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_asset_license_summary.AssetLicenseSummary, { attributes: firstToken?.attributes ?? [] }) }),
|
|
128
|
+
isOrganizer && onchain && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_tabs.TabsContent, { value: "manage", className: "pt-6", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
129
|
+
import_drop_manage.DropManage,
|
|
130
|
+
{
|
|
131
|
+
contract,
|
|
132
|
+
indexed,
|
|
133
|
+
onchain,
|
|
134
|
+
mints,
|
|
135
|
+
run: async (params) => {
|
|
136
|
+
await (0, import_actions.manageDrop)(await deps(), { owner: walletAddress, collection: contract, ...params });
|
|
137
|
+
await Promise.all([chain.mutate(), refreshMints()]);
|
|
138
|
+
},
|
|
139
|
+
saveExclusive: (value) => (0, import_actions.saveExclusiveContent)(getClient(), contract, value)
|
|
140
|
+
}
|
|
141
|
+
) })
|
|
142
|
+
] }),
|
|
143
|
+
view && minting && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
144
|
+
import_drop_mint_dialog.DropMintDialog,
|
|
145
|
+
{
|
|
146
|
+
open: true,
|
|
147
|
+
onClose: () => setMinting(false),
|
|
148
|
+
name,
|
|
149
|
+
quantity: quantity > view.maxQuantity ? view.maxQuantity : quantity,
|
|
150
|
+
totalText: view.totalText,
|
|
151
|
+
portfolioHref: props.portfolioHref ?? "/portfolio",
|
|
152
|
+
onMint: async () => {
|
|
153
|
+
const res = await (0, import_actions.mintDrop)(await deps(), { claimer: walletAddress, collection: contract, quantity: quantity > view.maxQuantity ? view.maxQuantity : quantity, proof });
|
|
154
|
+
await Promise.all([chain.mutate(), refreshMints()]);
|
|
155
|
+
return res;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
)
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
162
|
+
0 && (module.exports = {
|
|
163
|
+
DropPage
|
|
164
|
+
});
|
|
165
|
+
//# sourceMappingURL=drop-page.cjs.map
|