@medialane/ui 0.396.0 → 0.398.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/add-guardian-dialog.cjs +3 -2
- package/dist/components/account/add-guardian-dialog.cjs.map +1 -1
- package/dist/components/account/add-guardian-dialog.js +3 -2
- package/dist/components/account/add-guardian-dialog.js.map +1 -1
- package/dist/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/approve-mint-dialog.cjs +7 -7
- package/dist/components/approve-mint-dialog.cjs.map +1 -1
- package/dist/components/approve-mint-dialog.js +7 -7
- package/dist/components/approve-mint-dialog.js.map +1 -1
- package/dist/components/asset-picker.cjs +5 -5
- package/dist/components/asset-picker.cjs.map +1 -1
- package/dist/components/asset-picker.js +5 -5
- package/dist/components/asset-picker.js.map +1 -1
- package/dist/components/asset-search-picker.cjs +1 -1
- package/dist/components/asset-search-picker.cjs.map +1 -1
- package/dist/components/asset-search-picker.js +1 -1
- package/dist/components/asset-search-picker.js.map +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/coin-launch-preview.cjs +1 -1
- package/dist/components/coin-launch-preview.cjs.map +1 -1
- package/dist/components/coin-launch-preview.js +1 -1
- package/dist/components/coin-launch-preview.js.map +1 -1
- package/dist/components/create-aside.cjs +140 -0
- package/dist/components/create-aside.cjs.map +1 -0
- package/dist/components/create-aside.d.cts +101 -0
- package/dist/components/create-aside.d.ts +101 -0
- package/dist/components/create-aside.js +133 -0
- package/dist/components/create-aside.js.map +1 -0
- package/dist/components/create-sponsorship-aside.cjs +1 -1
- package/dist/components/create-sponsorship-aside.cjs.map +1 -1
- package/dist/components/create-sponsorship-aside.js +1 -1
- package/dist/components/create-sponsorship-aside.js.map +1 -1
- package/dist/components/drop/create/asset-editor.cjs +49 -34
- package/dist/components/drop/create/asset-editor.cjs.map +1 -1
- package/dist/components/drop/create/asset-editor.js +50 -35
- package/dist/components/drop/create/asset-editor.js.map +1 -1
- package/dist/components/drop/create/assets-panel.cjs +9 -9
- package/dist/components/drop/create/assets-panel.cjs.map +1 -1
- package/dist/components/drop/create/assets-panel.js +9 -9
- package/dist/components/drop/create/assets-panel.js.map +1 -1
- package/dist/components/drop/create/collection-panel.cjs +20 -8
- package/dist/components/drop/create/collection-panel.cjs.map +1 -1
- package/dist/components/drop/create/collection-panel.js +21 -9
- package/dist/components/drop/create/collection-panel.js.map +1 -1
- package/dist/components/drop/create/drop-create.cjs +2 -2
- package/dist/components/drop/create/drop-create.cjs.map +1 -1
- package/dist/components/drop/create/drop-create.js +2 -2
- package/dist/components/drop/create/drop-create.js.map +1 -1
- package/dist/components/drop/create/drop-fields.cjs +4 -5
- package/dist/components/drop/create/drop-fields.cjs.map +1 -1
- package/dist/components/drop/create/drop-fields.js +4 -5
- package/dist/components/drop/create/drop-fields.js.map +1 -1
- package/dist/components/drop/create/launch-dialog.cjs +1 -1
- package/dist/components/drop/create/launch-dialog.cjs.map +1 -1
- package/dist/components/drop/create/launch-dialog.js +1 -1
- package/dist/components/drop/create/launch-dialog.js.map +1 -1
- package/dist/components/drop/create/settings-panel.cjs +1 -1
- package/dist/components/drop/create/settings-panel.cjs.map +1 -1
- package/dist/components/drop/create/settings-panel.js +1 -1
- package/dist/components/drop/create/settings-panel.js.map +1 -1
- package/dist/components/external-link-field.cjs +1 -2
- package/dist/components/external-link-field.cjs.map +1 -1
- package/dist/components/external-link-field.js +2 -3
- package/dist/components/external-link-field.js.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.cjs +8 -43
- package/dist/components/fast-mint/asset-form-parts.cjs.map +1 -1
- package/dist/components/fast-mint/asset-form-parts.d.cts +7 -10
- package/dist/components/fast-mint/asset-form-parts.d.ts +7 -10
- package/dist/components/fast-mint/asset-form-parts.js +8 -42
- package/dist/components/fast-mint/asset-form-parts.js.map +1 -1
- package/dist/components/fast-mint/collection-section.cjs +8 -9
- package/dist/components/fast-mint/collection-section.cjs.map +1 -1
- package/dist/components/fast-mint/collection-section.d.cts +2 -2
- package/dist/components/fast-mint/collection-section.d.ts +2 -2
- package/dist/components/fast-mint/collection-section.js +8 -9
- package/dist/components/fast-mint/collection-section.js.map +1 -1
- package/dist/components/fast-mint/create-then-add.cjs +4 -5
- package/dist/components/fast-mint/create-then-add.cjs.map +1 -1
- package/dist/components/fast-mint/create-then-add.d.cts +2 -3
- package/dist/components/fast-mint/create-then-add.d.ts +2 -3
- package/dist/components/fast-mint/create-then-add.js +4 -5
- package/dist/components/fast-mint/create-then-add.js.map +1 -1
- package/dist/components/fast-mint/dropzone.cjs +9 -1
- package/dist/components/fast-mint/dropzone.cjs.map +1 -1
- package/dist/components/fast-mint/dropzone.js +9 -1
- package/dist/components/fast-mint/dropzone.js.map +1 -1
- package/dist/components/fast-mint/fast-mint.cjs +69 -58
- package/dist/components/fast-mint/fast-mint.cjs.map +1 -1
- package/dist/components/fast-mint/fast-mint.js +70 -59
- package/dist/components/fast-mint/fast-mint.js.map +1 -1
- package/dist/components/fast-mint/formats/nft.cjs +12 -12
- package/dist/components/fast-mint/formats/nft.cjs.map +1 -1
- package/dist/components/fast-mint/formats/nft.d.cts +2 -0
- package/dist/components/fast-mint/formats/nft.d.ts +2 -0
- package/dist/components/fast-mint/formats/nft.js +12 -12
- package/dist/components/fast-mint/formats/nft.js.map +1 -1
- package/dist/components/fast-mint/formats/pop.cjs +4 -4
- package/dist/components/fast-mint/formats/pop.cjs.map +1 -1
- package/dist/components/fast-mint/formats/pop.d.cts +2 -0
- package/dist/components/fast-mint/formats/pop.d.ts +2 -0
- package/dist/components/fast-mint/formats/pop.js +4 -4
- package/dist/components/fast-mint/formats/pop.js.map +1 -1
- package/dist/components/fast-mint/formats/registry.d.cts +2 -0
- package/dist/components/fast-mint/formats/registry.d.ts +2 -0
- package/dist/components/fast-mint/formats/tiers.cjs +25 -16
- package/dist/components/fast-mint/formats/tiers.cjs.map +1 -1
- package/dist/components/fast-mint/formats/tiers.d.cts +2 -0
- package/dist/components/fast-mint/formats/tiers.d.ts +2 -0
- package/dist/components/fast-mint/formats/tiers.js +25 -16
- package/dist/components/fast-mint/formats/tiers.js.map +1 -1
- package/dist/components/fast-mint/formats/types.cjs.map +1 -1
- package/dist/components/fast-mint/formats/types.d.cts +3 -1
- package/dist/components/fast-mint/formats/types.d.ts +3 -1
- package/dist/components/fast-mint/formats/types.js.map +1 -1
- package/dist/components/fast-mint/ip-type-section.cjs +2 -2
- package/dist/components/fast-mint/ip-type-section.cjs.map +1 -1
- package/dist/components/fast-mint/ip-type-section.js +2 -2
- package/dist/components/fast-mint/ip-type-section.js.map +1 -1
- package/dist/components/fast-mint/success-view.d.cts +2 -0
- package/dist/components/fast-mint/success-view.d.ts +2 -0
- package/dist/components/image-upload-field.cjs +139 -0
- package/dist/components/image-upload-field.cjs.map +1 -0
- package/dist/components/image-upload-field.d.cts +19 -0
- package/dist/components/image-upload-field.d.ts +19 -0
- package/dist/components/image-upload-field.js +105 -0
- package/dist/components/image-upload-field.js.map +1 -0
- package/dist/components/ip-type-fields.cjs +7 -6
- package/dist/components/ip-type-fields.cjs.map +1 -1
- package/dist/components/ip-type-fields.js +7 -6
- package/dist/components/ip-type-fields.js.map +1 -1
- package/dist/components/launchpad/coin-create.cjs +13 -56
- package/dist/components/launchpad/coin-create.cjs.map +1 -1
- package/dist/components/launchpad/coin-create.js +14 -57
- package/dist/components/launchpad/coin-create.js.map +1 -1
- package/dist/components/launchpad/collection-create-form.cjs +28 -87
- package/dist/components/launchpad/collection-create-form.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-form.js +28 -87
- package/dist/components/launchpad/collection-create-form.js.map +1 -1
- package/dist/components/launchpad/collection-create-presets.cjs +31 -37
- package/dist/components/launchpad/collection-create-presets.cjs.map +1 -1
- package/dist/components/launchpad/collection-create-presets.d.cts +0 -3
- package/dist/components/launchpad/collection-create-presets.d.ts +0 -3
- package/dist/components/launchpad/collection-create-presets.js +31 -37
- package/dist/components/launchpad/collection-create-presets.js.map +1 -1
- package/dist/components/launchpad/edition-mint-fields.cjs +21 -105
- package/dist/components/launchpad/edition-mint-fields.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint-fields.d.cts +5 -8
- package/dist/components/launchpad/edition-mint-fields.d.ts +5 -8
- package/dist/components/launchpad/edition-mint-fields.js +24 -98
- package/dist/components/launchpad/edition-mint-fields.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.cjs +5 -4
- package/dist/components/launchpad/edition-mint-schema.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +6 -6
- package/dist/components/launchpad/edition-mint-schema.d.ts +6 -6
- package/dist/components/launchpad/edition-mint-schema.js +5 -4
- package/dist/components/launchpad/edition-mint-schema.js.map +1 -1
- package/dist/components/launchpad/edition-mint.cjs +36 -52
- package/dist/components/launchpad/edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/edition-mint.js +36 -52
- package/dist/components/launchpad/edition-mint.js.map +1 -1
- package/dist/components/launchpad/pop-create-fields.cjs +46 -128
- package/dist/components/launchpad/pop-create-fields.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-fields.d.cts +5 -8
- package/dist/components/launchpad/pop-create-fields.d.ts +5 -8
- package/dist/components/launchpad/pop-create-fields.js +46 -120
- package/dist/components/launchpad/pop-create-fields.js.map +1 -1
- package/dist/components/launchpad/pop-create-schema.cjs +2 -2
- package/dist/components/launchpad/pop-create-schema.cjs.map +1 -1
- package/dist/components/launchpad/pop-create-schema.js +2 -2
- package/dist/components/launchpad/pop-create-schema.js.map +1 -1
- package/dist/components/launchpad/pop-create.cjs +24 -36
- package/dist/components/launchpad/pop-create.cjs.map +1 -1
- package/dist/components/launchpad/pop-create.js +24 -36
- package/dist/components/launchpad/pop-create.js.map +1 -1
- package/dist/components/launchpad/remix-mint.cjs +42 -73
- package/dist/components/launchpad/remix-mint.cjs.map +1 -1
- package/dist/components/launchpad/remix-mint.js +43 -74
- package/dist/components/launchpad/remix-mint.js.map +1 -1
- package/dist/components/launchpad/single-edition-mint.cjs +37 -95
- package/dist/components/launchpad/single-edition-mint.cjs.map +1 -1
- package/dist/components/launchpad/single-edition-mint.js +38 -96
- package/dist/components/launchpad/single-edition-mint.js.map +1 -1
- package/dist/components/launchpad/sponsorship-create.cjs +17 -16
- package/dist/components/launchpad/sponsorship-create.cjs.map +1 -1
- package/dist/components/launchpad/sponsorship-create.js +17 -16
- package/dist/components/launchpad/sponsorship-create.js.map +1 -1
- package/dist/components/launchpad/tier-mint-form.cjs +21 -75
- package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-form.js +22 -76
- package/dist/components/launchpad/tier-mint-form.js.map +1 -1
- package/dist/components/launchpad/tier-mint-presets.cjs +21 -21
- package/dist/components/launchpad/tier-mint-presets.cjs.map +1 -1
- package/dist/components/launchpad/tier-mint-presets.d.cts +2 -2
- package/dist/components/launchpad/tier-mint-presets.d.ts +2 -2
- package/dist/components/launchpad/tier-mint-presets.js +21 -21
- package/dist/components/launchpad/tier-mint-presets.js.map +1 -1
- package/dist/components/license-terms-builder.cjs +4 -4
- package/dist/components/license-terms-builder.cjs.map +1 -1
- package/dist/components/license-terms-builder.js +4 -4
- package/dist/components/license-terms-builder.js.map +1 -1
- package/dist/components/medialane-collection-card.cjs +1 -1
- package/dist/components/medialane-collection-card.cjs.map +1 -1
- package/dist/components/medialane-collection-card.js +1 -1
- package/dist/components/medialane-collection-card.js.map +1 -1
- package/dist/components/report-dialog.cjs +3 -3
- package/dist/components/report-dialog.cjs.map +1 -1
- package/dist/components/report-dialog.js +3 -3
- package/dist/components/report-dialog.js.map +1 -1
- package/dist/components/transaction-dialog.cjs +2 -2
- package/dist/components/transaction-dialog.cjs.map +1 -1
- package/dist/components/transaction-dialog.js +2 -2
- package/dist/components/transaction-dialog.js.map +1 -1
- package/dist/components/transfer-dialog.cjs +2 -1
- package/dist/components/transfer-dialog.cjs.map +1 -1
- package/dist/components/transfer-dialog.js +2 -1
- package/dist/components/transfer-dialog.js.map +1 -1
- package/dist/components/wallet/export-key-section.cjs +3 -2
- package/dist/components/wallet/export-key-section.cjs.map +1 -1
- package/dist/components/wallet/export-key-section.js +3 -2
- package/dist/components/wallet/export-key-section.js.map +1 -1
- package/dist/data/ip-templates.cjs +3 -3
- package/dist/data/ip-templates.cjs.map +1 -1
- package/dist/data/ip-templates.js +3 -3
- package/dist/data/ip-templates.js.map +1 -1
- package/dist/data/launchpad-services.cjs +21 -21
- package/dist/data/launchpad-services.cjs.map +1 -1
- package/dist/data/launchpad-services.js +21 -21
- package/dist/data/launchpad-services.js.map +1 -1
- package/dist/data/nav-commands.cjs +5 -5
- package/dist/data/nav-commands.cjs.map +1 -1
- package/dist/data/nav-commands.js +5 -5
- package/dist/data/nav-commands.js.map +1 -1
- package/dist/i18n/catalog/pt.cjs +278 -206
- package/dist/i18n/catalog/pt.cjs.map +1 -1
- package/dist/i18n/catalog/pt.js +278 -206
- package/dist/i18n/catalog/pt.js.map +1 -1
- package/dist/i18n/tools/scan.cjs +47 -2
- package/dist/i18n/tools/scan.cjs.map +1 -1
- package/dist/i18n/tools/scan.d.cts +6 -1
- package/dist/i18n/tools/scan.d.ts +6 -1
- package/dist/i18n/tools/scan.js +45 -1
- package/dist/i18n/tools/scan.js.map +1 -1
- package/dist/index.cjs +14 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -1
- package/dist/index.d.ts +4 -1
- package/dist/index.js +9 -2
- package/dist/index.js.map +1 -1
- package/dist/utils/drop/draft.cjs +3 -3
- package/dist/utils/drop/draft.cjs.map +1 -1
- package/dist/utils/drop/draft.js +3 -3
- package/dist/utils/drop/draft.js.map +1 -1
- package/dist/utils/ipfs-upload.cjs +13 -8
- package/dist/utils/ipfs-upload.cjs.map +1 -1
- package/dist/utils/ipfs-upload.d.cts +3 -4
- package/dist/utils/ipfs-upload.d.ts +3 -4
- package/dist/utils/ipfs-upload.js +13 -9
- package/dist/utils/ipfs-upload.js.map +1 -1
- package/dist/utils/launchpad-rules.cjs +4 -3
- package/dist/utils/launchpad-rules.cjs.map +1 -1
- package/dist/utils/launchpad-rules.d.cts +1 -1
- package/dist/utils/launchpad-rules.d.ts +1 -1
- package/dist/utils/launchpad-rules.js +4 -3
- package/dist/utils/launchpad-rules.js.map +1 -1
- package/dist/utils/order-form.cjs +3 -2
- package/dist/utils/order-form.cjs.map +1 -1
- package/dist/utils/order-form.js +3 -2
- package/dist/utils/order-form.js.map +1 -1
- package/dist/utils/upload-limits.cjs +10 -4
- package/dist/utils/upload-limits.cjs.map +1 -1
- package/dist/utils/upload-limits.d.cts +2 -1
- package/dist/utils/upload-limits.d.ts +2 -1
- package/dist/utils/upload-limits.js +11 -5
- package/dist/utils/upload-limits.js.map +1 -1
- package/dist/utils/use-file-upload.cjs +105 -0
- package/dist/utils/use-file-upload.cjs.map +1 -0
- package/dist/utils/use-file-upload.d.cts +27 -0
- package/dist/utils/use-file-upload.d.ts +27 -0
- package/dist/utils/use-file-upload.js +81 -0
- package/dist/utils/use-file-upload.js.map +1 -0
- package/dist/utils/use-image-upload.cjs +56 -0
- package/dist/utils/use-image-upload.cjs.map +1 -0
- package/dist/utils/use-image-upload.d.cts +20 -0
- package/dist/utils/use-image-upload.d.ts +20 -0
- package/dist/utils/use-image-upload.js +32 -0
- package/dist/utils/use-image-upload.js.map +1 -0
- package/package.json +1 -1
- package/dist/components/fast-mint/use-ipfs-upload.cjs +0 -64
- package/dist/components/fast-mint/use-ipfs-upload.cjs.map +0 -1
- package/dist/components/fast-mint/use-ipfs-upload.d.cts +0 -9
- package/dist/components/fast-mint/use-ipfs-upload.d.ts +0 -9
- package/dist/components/fast-mint/use-ipfs-upload.js +0 -40
- package/dist/components/fast-mint/use-ipfs-upload.js.map +0 -1
- package/dist/utils/use-launchpad-image-upload.cjs +0 -103
- package/dist/utils/use-launchpad-image-upload.cjs.map +0 -1
- package/dist/utils/use-launchpad-image-upload.d.cts +0 -21
- package/dist/utils/use-launchpad-image-upload.d.ts +0 -21
- package/dist/utils/use-launchpad-image-upload.js +0 -79
- package/dist/utils/use-launchpad-image-upload.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/launchpad/edition-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport { Sparkles } from \"lucide-react\";\nimport { PageState } from \"../page-state.js\";\nimport { assetHref, normalizeAddress, profileHref } from \"@medialane/sdk\";\nimport { mintedTokenIdFromReceipt } from \"@medialane/sdk/starknet\";\nimport Link from \"../link.js\";\nimport { Button } from \"../button.js\";\nimport { Form } from \"../form.js\";\nimport { ClaimRouteShell } from \"../claim-route-shell.js\";\nimport { TransactionSuccess } from \"../transaction-success.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 type { MetadataField } from \"../ip-type-fields.js\";\nimport { EditionMintFields } from \"./edition-mint-fields.js\";\nimport { editionMintSchema, type EditionMintValues } from \"./edition-mint-schema.js\";\nimport { runIntentCalls } from \"../../utils/run-intent-calls.js\";\nimport { pinAssetMetadata, uploadFileToIpfs } 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 { useT } from \"../../i18n/provider.js\";\n\nconst DEFAULTS: EditionMintValues = {\n value: \"1\",\n recipient: \"\",\n name: \"\",\n description: \"\",\n external_url: \"\",\n ipType: \"NFT\",\n licenseType: \"CC BY-SA\",\n commercialUse: \"Yes\",\n derivatives: \"Share-Alike\",\n attribution: \"Required\",\n geographicScope: \"Worldwide\",\n aiPolicy: \"Allowed\",\n royalty: 0,\n};\n\nexport function EditionMint({ contract: rawContract, aside }: { contract: string; aside?: ReactNode }) {\n const t = useT();\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const collectionAddress = normalizeAddress(\"STARKNET\", rawContract);\n const tx = useTransaction();\n const upload = useLaunchpadImageUpload({ successMessage: t(\"Image uploaded to IPFS\"), failureMessage: t(\"Image upload failed\") });\n const { imagePreview, imageUri, imageUploading, uploadError, uploadSuccess, fileInputRef, handleImageSelect, clearImage } = upload;\n const [ownerCheck, setOwnerCheck] = useState<\"loading\" | \"ok\" | \"denied\">(\"loading\");\n const [formError, setFormError] = useState<string | null>(null);\n const [metadataResetKey, setMetadataResetKey] = useState(0);\n const [autoExternalUrl, setAutoExternalUrl] = useState(\"\");\n const metadataFieldsRef = useRef<MetadataField[]>([]);\n\n const form = useForm<EditionMintValues>({ resolver: zodResolver(editionMintSchema), defaultValues: DEFAULTS });\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"recipient\")) form.setValue(\"recipient\", walletAddress);\n }, [walletAddress, form]);\n\n useEffect(() => {\n const suggested = `https://medialane.io/collections/${collectionAddress}`;\n const current = form.getValues(\"external_url\");\n if (!current || current === autoExternalUrl) {\n form.setValue(\"external_url\", suggested, { shouldDirty: false });\n setAutoExternalUrl(suggested);\n }\n }, [autoExternalUrl, collectionAddress, form]);\n\n useEffect(() => {\n if (!walletAddress) return;\n app\n .getClient()\n .api.collections.get(collectionAddress)\n .then((data) => {\n const owner = data.owner ? normalizeAddress(\"STARKNET\", data.owner) : null;\n setOwnerCheck(owner === normalizeAddress(\"STARKNET\", walletAddress) ? \"ok\" : \"denied\");\n })\n .catch(() => setOwnerCheck(\"denied\"));\n }, [app, walletAddress, collectionAddress]);\n\n const uploadDocument = async (file: File) => {\n await app.ensureSignedIn?.();\n return (await uploadFileToIpfs(app.getClient().api, file, \"document\")).uri;\n };\n\n const handleAgain = () => {\n tx.reset();\n metadataFieldsRef.current = [];\n setMetadataResetKey((key) => key + 1);\n setAutoExternalUrl(\"\");\n clearImage();\n form.reset({ ...DEFAULTS, recipient: walletAddress ?? \"\" });\n };\n\n const onSubmit = (values: EditionMintValues) => {\n if (!imageUri) {\n setFormError(\"Upload an image before minting.\");\n return;\n }\n if (!walletAddress) return;\n setFormError(null);\n void tx.run(async (signer) => {\n await app.ensureSignedIn?.();\n const api = app.getClient().api;\n const pinned = await pinAssetMetadata(api, {\n name: values.name,\n description: values.description ?? \"\",\n imageUri,\n externalUrl: values.external_url,\n ipType: values.ipType,\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n creator: walletAddress,\n templateTraits: metadataFieldsRef.current.filter((f) => f.traitType.trim() && f.value.trim()).map((f) => ({ traitType: f.traitType.trim(), value: f.value.trim() })),\n });\n await runIntentCalls(signer, () =>\n api.intents.create(\"mint\", {\n owner: walletAddress,\n recipient: values.recipient,\n collectionContract: collectionAddress,\n tokenUri: pinned.uri,\n value: values.value,\n royaltyBps: 0,\n }),\n );\n invalidatePortfolioCache(walletAddress);\n });\n };\n\n const mintedTokenId = tx.receipt ? mintedTokenIdFromReceipt(tx.receipt, collectionAddress) : null;\n\n return (\n <WalletRequired\n icon={Sparkles}\n iconClassName=\"text-brand-purple\"\n title={t(\"Secure your account to create\")}\n description={t(\"Secure your account to mint tokens into a multi-editions collection.\")}\n >\n {ownerCheck === \"denied\" ? (\n <PageState icon={Sparkles} title={t(\"Not the owner\")} description={t(\"Minting opens for the collection owner.\")}>\n <Button asChild variant=\"soft\">\n <Link href=\"/launchpad\">{t(\"Back to Launchpad\")}</Link>\n </Button>\n </PageState>\n ) : (\n <>\n <ClaimRouteShell\n icon={<Sparkles className=\"h-4 w-4 text-white\" />}\n title={t(\"Mint an edition\")}\n subtitle={t(\"Add a new piece to the collection.\")}\n headerAccessory={\n <div className=\"panel flex items-center gap-2 px-3 py-2 max-w-full\">\n <span className=\"tabular-nums text-xs text-foreground/80 truncate\">{t(\"Collection: {collectionAddress}\", { collectionAddress })}</span>\n </div>\n }\n aside={\n <>\n <MedialaneCollectionCard\n image={imagePreview}\n name={form.watch(\"name\")}\n collection=\"Edition\"\n serial={Number(form.watch(\"value\")) > 1 ? `${form.watch(\"value\")} editions` : undefined}\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 <EditionMintFields\n form={form}\n imagePreview={imagePreview}\n imageUri={imageUri}\n imageUploading={imageUploading}\n mintDisabled={imageUploading || tx.phase !== \"idle\"}\n fileInputRef={fileInputRef}\n onImageSelect={handleImageSelect}\n onClearImage={clearImage}\n metadataResetKey={metadataResetKey}\n onMetadataFieldsChange={(fields) => { metadataFieldsRef.current = fields; }}\n uploadDocument={uploadDocument}\n />\n {uploadError && <p className=\"text-xs text-destructive mt-1\">{uploadError}</p>}\n {uploadSuccess && <p className=\"text-xs text-brand-blue mt-1\">✓ {uploadSuccess}</p>}\n {formError && <p className=\"text-xs text-destructive mt-1\">{formError}</p>}\n </form>\n </Form>\n </ClaimRouteShell>\n\n <TransactionDialog tx={tx} title={t(\"Mint an edition\")} workingLabel={t(\"Minting your edition…\")} firstStepLabel={t(\"Upload metadata\")}>\n <TransactionSuccess\n name={form.getValues(\"name\") || \"Your token\"}\n image={imagePreview}\n title={t(\"Editions minted\")}\n description={t(\"Each copy is recorded onchain with the license terms in its metadata.\")}\n actions={[\n ...(mintedTokenId ? [{ href: assetHref(\"STARKNET\", collectionAddress, mintedTokenId), label: t(\"View asset\") }] : []),\n { href: \"/portfolio/assets\", label: t(\"View portfolio\") },\n { label: t(\"Mint another\"), onClick: handleAgain },\n ]}\n >\n <RewardEarned actionType=\"mint_asset\" />\n </TransactionSuccess>\n </TransactionDialog>\n </>\n )}\n </WalletRequired>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAwJY;AAtJZ,mBAA4D;AAC5D,6BAAwB;AACxB,iBAA4B;AAC5B,0BAAyB;AACzB,wBAA0B;AAC1B,iBAAyD;AACzD,sBAAyC;AACzC,kBAAiB;AACjB,oBAAuB;AACvB,kBAAqB;AACrB,+BAAgC;AAChC,iCAAmC;AACnC,uCAAwC;AACxC,gCAAkC;AAClC,6BAA+B;AAC/B,2BAAgC;AAChC,2BAA6B;AAE7B,iCAAkC;AAClC,iCAA0D;AAC1D,8BAA+B;AAC/B,yBAAmD;AACnD,6BAA+B;AAC/B,wCAAwC;AACxC,6BAAyC;AACzC,sBAAqB;AAErB,MAAM,WAA8B;AAAA,EAClC,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,eAAe;AAAA,EACf,aAAa;AAAA,EACb,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,SAAS;AACX;AAEO,SAAS,YAAY,EAAE,UAAU,aAAa,MAAM,GAA4C;AACrG,QAAM,QAAI,sBAAK;AACf,QAAM,UAAM,sCAAgB;AAC5B,QAAM,gBAAgB,IAAI;AAC1B,QAAM,wBAAoB,6BAAiB,YAAY,WAAW;AAClE,QAAM,SAAK,uCAAe;AAC1B,QAAM,aAAS,2DAAwB,EAAE,gBAAgB,EAAE,wBAAwB,GAAG,gBAAgB,EAAE,qBAAqB,EAAE,CAAC;AAChI,QAAM,EAAE,cAAc,UAAU,gBAAgB,aAAa,eAAe,cAAc,mBAAmB,WAAW,IAAI;AAC5H,QAAM,CAAC,YAAY,aAAa,QAAI,uBAAsC,SAAS;AACnF,QAAM,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AAA,kBACA;AAAA,kBACA;AAAA,kBACA;AAAA,kBACA,cAAc,kBAAkB,GAAG,UAAU;AAAA,kBAC7C;AAAA,kBACA,eAAe;AAAA,kBACf,cAAc;AAAA,kBACd;AAAA,kBACA,wBAAwB,CAAC,WAAW;AAAE,sCAAkB,UAAU;AAAA,kBAAQ;AAAA,kBAC1E;AAAA;AAAA,cACF;AAAA,cACC,eAAe,4CAAC,OAAE,WAAU,iCAAiC,uBAAY;AAAA,cACzE,iBAAiB,6CAAC,OAAE,WAAU,gCAA+B;AAAA;AAAA,gBAAG;AAAA,iBAAc;AAAA,cAC9E,aAAa,4CAAC,OAAE,WAAU,iCAAiC,qBAAU;AAAA,eACxE,GACF;AAAA;AAAA,QACF;AAAA,QAEA,4CAAC,+CAAkB,IAAQ,OAAO,EAAE,iBAAiB,GAAG,cAAc,EAAE,4BAAuB,GAAG,gBAAgB,EAAE,iBAAiB,GACnI;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,KAAK,UAAU,MAAM,KAAK;AAAA,YAChC,OAAO;AAAA,YACP,OAAO,EAAE,iBAAiB;AAAA,YAC1B,aAAa,EAAE,uEAAuE;AAAA,YACtF,SAAS;AAAA,cACP,GAAI,gBAAgB,CAAC,EAAE,UAAM,sBAAU,YAAY,mBAAmB,aAAa,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC;AAAA,cACnH,EAAE,MAAM,qBAAqB,OAAO,EAAE,gBAAgB,EAAE;AAAA,cACxD,EAAE,OAAO,EAAE,cAAc,GAAG,SAAS,YAAY;AAAA,YACnD;AAAA,YAEA,sDAAC,qCAAa,YAAW,cAAa;AAAA;AAAA,QACxC,GACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ;","names":["Link"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/launchpad/edition-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport { Sparkles } from \"lucide-react\";\nimport { PageState } from \"../page-state.js\";\nimport { assetHref, normalizeAddress, profileHref } from \"@medialane/sdk\";\nimport { mintedTokenIdFromReceipt } from \"@medialane/sdk/starknet\";\nimport Link from \"../link.js\";\nimport { Button } from \"../button.js\";\nimport { Form } from \"../form.js\";\nimport { ClaimRouteShell } from \"../claim-route-shell.js\";\nimport { TransactionSuccess } from \"../transaction-success.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 type { MetadataField } from \"../ip-type-fields.js\";\nimport { EditionMintFields } from \"./edition-mint-fields.js\";\nimport { editionMintSchema, type EditionMintValues } from \"./edition-mint-schema.js\";\nimport { runIntentCalls } from \"../../utils/run-intent-calls.js\";\nimport { pinAssetMetadata, uploadFileToIpfs } from \"../../utils/ipfs-upload.js\";\nimport { useTransaction } from \"../../utils/use-transaction.js\";\nimport { useImageUpload } from \"../../utils/use-image-upload.js\";\nimport { invalidatePortfolioCache } from \"../../utils/portfolio-cache.js\";\nimport { useT } from \"../../i18n/provider.js\";\nimport { msg } from \"../../i18n/translate.js\";\n\nconst DEFAULTS: EditionMintValues = {\n value: \"1\",\n recipient: \"\",\n name: \"\",\n description: \"\",\n external_url: \"\",\n ipType: \"NFT\",\n licenseType: \"CC BY-SA\",\n commercialUse: \"Yes\",\n derivatives: \"Share-Alike\",\n attribution: \"Required\",\n geographicScope: \"Worldwide\",\n aiPolicy: \"Allowed\",\n royalty: 0,\n};\n\nexport function EditionMint({ contract: rawContract, aside }: { contract: string; aside?: ReactNode }) {\n const t = useT();\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const collectionAddress = normalizeAddress(\"STARKNET\", rawContract);\n const tx = useTransaction();\n const upload = useImageUpload();\n const [ownerCheck, setOwnerCheck] = useState<\"loading\" | \"ok\" | \"denied\">(\"loading\");\n const [collectionName, setCollectionName] = useState<string | null>(null);\n const [metadataResetKey, setMetadataResetKey] = useState(0);\n const [autoExternalUrl, setAutoExternalUrl] = useState(\"\");\n const metadataFieldsRef = useRef<MetadataField[]>([]);\n\n const form = useForm<EditionMintValues>({ resolver: zodResolver(editionMintSchema), defaultValues: DEFAULTS });\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"recipient\")) form.setValue(\"recipient\", walletAddress);\n }, [walletAddress, form]);\n\n useEffect(() => {\n const suggested = `https://medialane.io/collections/${collectionAddress}`;\n const current = form.getValues(\"external_url\");\n if (!current || current === autoExternalUrl) {\n form.setValue(\"external_url\", suggested, { shouldDirty: false });\n setAutoExternalUrl(suggested);\n }\n }, [autoExternalUrl, collectionAddress, form]);\n\n useEffect(() => {\n if (!walletAddress) return;\n app\n .getClient()\n .api.collections.get(collectionAddress)\n .then((data) => {\n const owner = data.owner ? normalizeAddress(\"STARKNET\", data.owner) : null;\n setCollectionName(data.name ?? null);\n setOwnerCheck(owner === normalizeAddress(\"STARKNET\", walletAddress) ? \"ok\" : \"denied\");\n })\n .catch(() => setOwnerCheck(\"denied\"));\n }, [app, walletAddress, collectionAddress]);\n\n const uploadDocument = async (file: File) => {\n await app.ensureSignedIn?.();\n return (await uploadFileToIpfs(app.getClient().api, file, \"document\")).uri;\n };\n\n const handleAgain = () => {\n tx.reset();\n metadataFieldsRef.current = [];\n setMetadataResetKey((key) => key + 1);\n setAutoExternalUrl(\"\");\n upload.clear();\n form.reset({ ...DEFAULTS, recipient: walletAddress ?? \"\" });\n };\n\n const onSubmit = (values: EditionMintValues) => {\n if (!upload.confirm(msg(\"Upload an image before publishing.\"))) return;\n if (!walletAddress) return;\n void tx.run(async (signer) => {\n await app.ensureSignedIn?.();\n const api = app.getClient().api;\n const pinned = await pinAssetMetadata(api, {\n name: values.name,\n description: values.description ?? \"\",\n imageUri: upload.uri,\n externalUrl: values.external_url,\n ipType: values.ipType,\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n creator: walletAddress,\n templateTraits: metadataFieldsRef.current.filter((f) => f.traitType.trim() && f.value.trim()).map((f) => ({ traitType: f.traitType.trim(), value: f.value.trim() })),\n });\n await runIntentCalls(signer, () =>\n api.intents.create(\"mint\", {\n owner: walletAddress,\n recipient: values.recipient,\n collectionContract: collectionAddress,\n tokenUri: pinned.uri,\n value: values.value,\n royaltyBps: 0,\n }),\n );\n invalidatePortfolioCache(walletAddress);\n });\n };\n\n const mintedTokenId = tx.receipt ? mintedTokenIdFromReceipt(tx.receipt, collectionAddress) : null;\n\n return (\n <WalletRequired\n icon={Sparkles}\n iconClassName=\"text-brand-purple\"\n title={t(\"Secure your account to publish\")}\n description={t(\"Secure your account to publish editions.\")}\n >\n {ownerCheck === \"denied\" ? (\n <PageState icon={Sparkles} title={t(\"Owner only\")} description={t(\"Publishing is open to the collection owner.\")}>\n <Button asChild variant=\"soft\">\n <Link href=\"/launchpad\">{t(\"Back to Launchpad\")}</Link>\n </Button>\n </PageState>\n ) : (\n <>\n <ClaimRouteShell\n icon={<Sparkles className=\"h-4 w-4 text-white\" />}\n title={t(\"Publish an edition\")}\n subtitle={t(\"Add a new piece to the collection.\")}\n headerAccessory={\n collectionName ? (\n <div data-testid=\"collection-name\" className=\"panel flex items-center gap-2 px-3 py-2 max-w-full\">\n <span className=\"text-xs text-foreground/80 truncate\">{collectionName}</span>\n </div>\n ) : undefined\n }\n aside={\n <>\n <MedialaneCollectionCard\n image={upload.preview}\n name={form.watch(\"name\")}\n collection={t(\"Edition\")}\n serial={Number(form.watch(\"value\")) > 1 ? t(\"{count} editions\", { count: form.watch(\"value\") }) : undefined}\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 <EditionMintFields\n form={form}\n upload={upload}\n mintDisabled={upload.uploading || tx.phase !== \"idle\"}\n metadataResetKey={metadataResetKey}\n onMetadataFieldsChange={(fields) => { metadataFieldsRef.current = fields; }}\n uploadDocument={uploadDocument}\n />\n </form>\n </Form>\n </ClaimRouteShell>\n\n <TransactionDialog tx={tx} title={t(\"Publish an edition\")} workingLabel={t(\"Publishing your edition…\")} firstStepLabel={t(\"Saving details\")}>\n <TransactionSuccess\n name={form.getValues(\"name\") || t(\"Your work\")}\n image={upload.preview}\n title={t(\"Edition published\")}\n description={t(\"Each copy is saved permanently with its license terms.\")}\n actions={[\n ...(mintedTokenId ? [{ href: assetHref(\"STARKNET\", collectionAddress, mintedTokenId), label: t(\"View work\") }] : []),\n { href: \"/portfolio/assets\", label: t(\"View portfolio\") },\n { label: t(\"Publish another\"), onClick: handleAgain },\n ]}\n >\n <RewardEarned actionType=\"mint_asset\" />\n </TransactionSuccess>\n </TransactionDialog>\n </>\n )}\n </WalletRequired>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAqJY;AAnJZ,mBAA4D;AAC5D,6BAAwB;AACxB,iBAA4B;AAC5B,0BAAyB;AACzB,wBAA0B;AAC1B,iBAAyD;AACzD,sBAAyC;AACzC,kBAAiB;AACjB,oBAAuB;AACvB,kBAAqB;AACrB,+BAAgC;AAChC,iCAAmC;AACnC,uCAAwC;AACxC,gCAAkC;AAClC,6BAA+B;AAC/B,2BAAgC;AAChC,2BAA6B;AAE7B,iCAAkC;AAClC,iCAA0D;AAC1D,8BAA+B;AAC/B,yBAAmD;AACnD,6BAA+B;AAC/B,8BAA+B;AAC/B,6BAAyC;AACzC,sBAAqB;AACrB,uBAAoB;AAEpB,MAAM,WAA8B;AAAA,EAClC,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E;AAAA,cACxD,EAAE,OAAO,EAAE,iBAAiB,GAAG,SAAS,YAAY;AAAA,YACtD;AAAA,YAEA,sDAAC,qCAAa,YAAW,cAAa;AAAA;AAAA,QACxC,GACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ;","names":["Link"]}
|
|
@@ -22,9 +22,10 @@ import { editionMintSchema } from "./edition-mint-schema.js";
|
|
|
22
22
|
import { runIntentCalls } from "../../utils/run-intent-calls.js";
|
|
23
23
|
import { pinAssetMetadata, uploadFileToIpfs } from "../../utils/ipfs-upload.js";
|
|
24
24
|
import { useTransaction } from "../../utils/use-transaction.js";
|
|
25
|
-
import {
|
|
25
|
+
import { useImageUpload } from "../../utils/use-image-upload.js";
|
|
26
26
|
import { invalidatePortfolioCache } from "../../utils/portfolio-cache.js";
|
|
27
27
|
import { useT } from "../../i18n/provider.js";
|
|
28
|
+
import { msg } from "../../i18n/translate.js";
|
|
28
29
|
const DEFAULTS = {
|
|
29
30
|
value: "1",
|
|
30
31
|
recipient: "",
|
|
@@ -46,10 +47,9 @@ function EditionMint({ contract: rawContract, aside }) {
|
|
|
46
47
|
const walletAddress = app.walletAddress;
|
|
47
48
|
const collectionAddress = normalizeAddress("STARKNET", rawContract);
|
|
48
49
|
const tx = useTransaction();
|
|
49
|
-
const upload =
|
|
50
|
-
const { imagePreview, imageUri, imageUploading, uploadError, uploadSuccess, fileInputRef, handleImageSelect, clearImage } = upload;
|
|
50
|
+
const upload = useImageUpload();
|
|
51
51
|
const [ownerCheck, setOwnerCheck] = useState("loading");
|
|
52
|
-
const [
|
|
52
|
+
const [collectionName, setCollectionName] = useState(null);
|
|
53
53
|
const [metadataResetKey, setMetadataResetKey] = useState(0);
|
|
54
54
|
const [autoExternalUrl, setAutoExternalUrl] = useState("");
|
|
55
55
|
const metadataFieldsRef = useRef([]);
|
|
@@ -69,6 +69,7 @@ function EditionMint({ contract: rawContract, aside }) {
|
|
|
69
69
|
if (!walletAddress) return;
|
|
70
70
|
app.getClient().api.collections.get(collectionAddress).then((data) => {
|
|
71
71
|
const owner = data.owner ? normalizeAddress("STARKNET", data.owner) : null;
|
|
72
|
+
setCollectionName(data.name ?? null);
|
|
72
73
|
setOwnerCheck(owner === normalizeAddress("STARKNET", walletAddress) ? "ok" : "denied");
|
|
73
74
|
}).catch(() => setOwnerCheck("denied"));
|
|
74
75
|
}, [app, walletAddress, collectionAddress]);
|
|
@@ -81,23 +82,19 @@ function EditionMint({ contract: rawContract, aside }) {
|
|
|
81
82
|
metadataFieldsRef.current = [];
|
|
82
83
|
setMetadataResetKey((key) => key + 1);
|
|
83
84
|
setAutoExternalUrl("");
|
|
84
|
-
|
|
85
|
+
upload.clear();
|
|
85
86
|
form.reset({ ...DEFAULTS, recipient: walletAddress ?? "" });
|
|
86
87
|
};
|
|
87
88
|
const onSubmit = (values) => {
|
|
88
|
-
if (!
|
|
89
|
-
setFormError("Upload an image before minting.");
|
|
90
|
-
return;
|
|
91
|
-
}
|
|
89
|
+
if (!upload.confirm(msg("Upload an image before publishing."))) return;
|
|
92
90
|
if (!walletAddress) return;
|
|
93
|
-
setFormError(null);
|
|
94
91
|
void tx.run(async (signer) => {
|
|
95
92
|
await app.ensureSignedIn?.();
|
|
96
93
|
const api = app.getClient().api;
|
|
97
94
|
const pinned = await pinAssetMetadata(api, {
|
|
98
95
|
name: values.name,
|
|
99
96
|
description: values.description ?? "",
|
|
100
|
-
imageUri,
|
|
97
|
+
imageUri: upload.uri,
|
|
101
98
|
externalUrl: values.external_url,
|
|
102
99
|
ipType: values.ipType,
|
|
103
100
|
licenseType: values.licenseType,
|
|
@@ -130,69 +127,56 @@ function EditionMint({ contract: rawContract, aside }) {
|
|
|
130
127
|
{
|
|
131
128
|
icon: Sparkles,
|
|
132
129
|
iconClassName: "text-brand-purple",
|
|
133
|
-
title: t("Secure your account to
|
|
134
|
-
description: t("Secure your account to
|
|
135
|
-
children: ownerCheck === "denied" ? /* @__PURE__ */ jsx(PageState, { icon: Sparkles, title: t("
|
|
130
|
+
title: t("Secure your account to publish"),
|
|
131
|
+
description: t("Secure your account to publish editions."),
|
|
132
|
+
children: ownerCheck === "denied" ? /* @__PURE__ */ jsx(PageState, { icon: Sparkles, title: t("Owner only"), description: t("Publishing is open to the collection owner."), children: /* @__PURE__ */ jsx(Button, { asChild: true, variant: "soft", children: /* @__PURE__ */ jsx(Link, { href: "/launchpad", children: t("Back to Launchpad") }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
136
133
|
/* @__PURE__ */ jsx(
|
|
137
134
|
ClaimRouteShell,
|
|
138
135
|
{
|
|
139
136
|
icon: /* @__PURE__ */ jsx(Sparkles, { className: "h-4 w-4 text-white" }),
|
|
140
|
-
title: t("
|
|
137
|
+
title: t("Publish an edition"),
|
|
141
138
|
subtitle: t("Add a new piece to the collection."),
|
|
142
|
-
headerAccessory: /* @__PURE__ */ jsx("div", { className: "panel flex items-center gap-2 px-3 py-2 max-w-full", children: /* @__PURE__ */ jsx("span", { className: "
|
|
139
|
+
headerAccessory: collectionName ? /* @__PURE__ */ jsx("div", { "data-testid": "collection-name", className: "panel flex items-center gap-2 px-3 py-2 max-w-full", children: /* @__PURE__ */ jsx("span", { className: "text-xs text-foreground/80 truncate", children: collectionName }) }) : void 0,
|
|
143
140
|
aside: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
144
141
|
/* @__PURE__ */ jsx(
|
|
145
142
|
MedialaneCollectionCard,
|
|
146
143
|
{
|
|
147
|
-
image:
|
|
144
|
+
image: upload.preview,
|
|
148
145
|
name: form.watch("name"),
|
|
149
|
-
collection: "Edition",
|
|
150
|
-
serial: Number(form.watch("value")) > 1 ?
|
|
146
|
+
collection: t("Edition"),
|
|
147
|
+
serial: Number(form.watch("value")) > 1 ? t("{count} editions", { count: form.watch("value") }) : void 0,
|
|
151
148
|
creator: walletAddress ? `${walletAddress.slice(0, 6)}\u2026${walletAddress.slice(-4)}` : void 0,
|
|
152
149
|
creatorHref: walletAddress ? profileHref({ address: walletAddress }) : void 0
|
|
153
150
|
}
|
|
154
151
|
),
|
|
155
152
|
aside
|
|
156
153
|
] }),
|
|
157
|
-
children: /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
onMetadataFieldsChange: (fields) => {
|
|
171
|
-
metadataFieldsRef.current = fields;
|
|
172
|
-
},
|
|
173
|
-
uploadDocument
|
|
174
|
-
}
|
|
175
|
-
),
|
|
176
|
-
uploadError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive mt-1", children: uploadError }),
|
|
177
|
-
uploadSuccess && /* @__PURE__ */ jsxs("p", { className: "text-xs text-brand-blue mt-1", children: [
|
|
178
|
-
"\u2713 ",
|
|
179
|
-
uploadSuccess
|
|
180
|
-
] }),
|
|
181
|
-
formError && /* @__PURE__ */ jsx("p", { className: "text-xs text-destructive mt-1", children: formError })
|
|
182
|
-
] }) })
|
|
154
|
+
children: /* @__PURE__ */ jsx(Form, { ...form, children: /* @__PURE__ */ jsx("form", { onSubmit: form.handleSubmit(onSubmit), className: "space-y-5", children: /* @__PURE__ */ jsx(
|
|
155
|
+
EditionMintFields,
|
|
156
|
+
{
|
|
157
|
+
form,
|
|
158
|
+
upload,
|
|
159
|
+
mintDisabled: upload.uploading || tx.phase !== "idle",
|
|
160
|
+
metadataResetKey,
|
|
161
|
+
onMetadataFieldsChange: (fields) => {
|
|
162
|
+
metadataFieldsRef.current = fields;
|
|
163
|
+
},
|
|
164
|
+
uploadDocument
|
|
165
|
+
}
|
|
166
|
+
) }) })
|
|
183
167
|
}
|
|
184
168
|
),
|
|
185
|
-
/* @__PURE__ */ jsx(TransactionDialog, { tx, title: t("
|
|
169
|
+
/* @__PURE__ */ jsx(TransactionDialog, { tx, title: t("Publish an edition"), workingLabel: t("Publishing your edition\u2026"), firstStepLabel: t("Saving details"), children: /* @__PURE__ */ jsx(
|
|
186
170
|
TransactionSuccess,
|
|
187
171
|
{
|
|
188
|
-
name: form.getValues("name") || "Your
|
|
189
|
-
image:
|
|
190
|
-
title: t("
|
|
191
|
-
description: t("Each copy is
|
|
172
|
+
name: form.getValues("name") || t("Your work"),
|
|
173
|
+
image: upload.preview,
|
|
174
|
+
title: t("Edition published"),
|
|
175
|
+
description: t("Each copy is saved permanently with its license terms."),
|
|
192
176
|
actions: [
|
|
193
|
-
...mintedTokenId ? [{ href: assetHref("STARKNET", collectionAddress, mintedTokenId), label: t("View
|
|
177
|
+
...mintedTokenId ? [{ href: assetHref("STARKNET", collectionAddress, mintedTokenId), label: t("View work") }] : [],
|
|
194
178
|
{ href: "/portfolio/assets", label: t("View portfolio") },
|
|
195
|
-
{ label: t("
|
|
179
|
+
{ label: t("Publish another"), onClick: handleAgain }
|
|
196
180
|
],
|
|
197
181
|
children: /* @__PURE__ */ jsx(RewardEarned, { actionType: "mint_asset" })
|
|
198
182
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/launchpad/edition-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport { Sparkles } from \"lucide-react\";\nimport { PageState } from \"../page-state.js\";\nimport { assetHref, normalizeAddress, profileHref } from \"@medialane/sdk\";\nimport { mintedTokenIdFromReceipt } from \"@medialane/sdk/starknet\";\nimport Link from \"../link.js\";\nimport { Button } from \"../button.js\";\nimport { Form } from \"../form.js\";\nimport { ClaimRouteShell } from \"../claim-route-shell.js\";\nimport { TransactionSuccess } from \"../transaction-success.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 type { MetadataField } from \"../ip-type-fields.js\";\nimport { EditionMintFields } from \"./edition-mint-fields.js\";\nimport { editionMintSchema, type EditionMintValues } from \"./edition-mint-schema.js\";\nimport { runIntentCalls } from \"../../utils/run-intent-calls.js\";\nimport { pinAssetMetadata, uploadFileToIpfs } 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 { useT } from \"../../i18n/provider.js\";\n\nconst DEFAULTS: EditionMintValues = {\n value: \"1\",\n recipient: \"\",\n name: \"\",\n description: \"\",\n external_url: \"\",\n ipType: \"NFT\",\n licenseType: \"CC BY-SA\",\n commercialUse: \"Yes\",\n derivatives: \"Share-Alike\",\n attribution: \"Required\",\n geographicScope: \"Worldwide\",\n aiPolicy: \"Allowed\",\n royalty: 0,\n};\n\nexport function EditionMint({ contract: rawContract, aside }: { contract: string; aside?: ReactNode }) {\n const t = useT();\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const collectionAddress = normalizeAddress(\"STARKNET\", rawContract);\n const tx = useTransaction();\n const upload = useLaunchpadImageUpload({ successMessage: t(\"Image uploaded to IPFS\"), failureMessage: t(\"Image upload failed\") });\n const { imagePreview, imageUri, imageUploading, uploadError, uploadSuccess, fileInputRef, handleImageSelect, clearImage } = upload;\n const [ownerCheck, setOwnerCheck] = useState<\"loading\" | \"ok\" | \"denied\">(\"loading\");\n const [formError, setFormError] = useState<string | null>(null);\n const [metadataResetKey, setMetadataResetKey] = useState(0);\n const [autoExternalUrl, setAutoExternalUrl] = useState(\"\");\n const metadataFieldsRef = useRef<MetadataField[]>([]);\n\n const form = useForm<EditionMintValues>({ resolver: zodResolver(editionMintSchema), defaultValues: DEFAULTS });\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"recipient\")) form.setValue(\"recipient\", walletAddress);\n }, [walletAddress, form]);\n\n useEffect(() => {\n const suggested = `https://medialane.io/collections/${collectionAddress}`;\n const current = form.getValues(\"external_url\");\n if (!current || current === autoExternalUrl) {\n form.setValue(\"external_url\", suggested, { shouldDirty: false });\n setAutoExternalUrl(suggested);\n }\n }, [autoExternalUrl, collectionAddress, form]);\n\n useEffect(() => {\n if (!walletAddress) return;\n app\n .getClient()\n .api.collections.get(collectionAddress)\n .then((data) => {\n const owner = data.owner ? normalizeAddress(\"STARKNET\", data.owner) : null;\n setOwnerCheck(owner === normalizeAddress(\"STARKNET\", walletAddress) ? \"ok\" : \"denied\");\n })\n .catch(() => setOwnerCheck(\"denied\"));\n }, [app, walletAddress, collectionAddress]);\n\n const uploadDocument = async (file: File) => {\n await app.ensureSignedIn?.();\n return (await uploadFileToIpfs(app.getClient().api, file, \"document\")).uri;\n };\n\n const handleAgain = () => {\n tx.reset();\n metadataFieldsRef.current = [];\n setMetadataResetKey((key) => key + 1);\n setAutoExternalUrl(\"\");\n clearImage();\n form.reset({ ...DEFAULTS, recipient: walletAddress ?? \"\" });\n };\n\n const onSubmit = (values: EditionMintValues) => {\n if (!imageUri) {\n setFormError(\"Upload an image before minting.\");\n return;\n }\n if (!walletAddress) return;\n setFormError(null);\n void tx.run(async (signer) => {\n await app.ensureSignedIn?.();\n const api = app.getClient().api;\n const pinned = await pinAssetMetadata(api, {\n name: values.name,\n description: values.description ?? \"\",\n imageUri,\n externalUrl: values.external_url,\n ipType: values.ipType,\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n creator: walletAddress,\n templateTraits: metadataFieldsRef.current.filter((f) => f.traitType.trim() && f.value.trim()).map((f) => ({ traitType: f.traitType.trim(), value: f.value.trim() })),\n });\n await runIntentCalls(signer, () =>\n api.intents.create(\"mint\", {\n owner: walletAddress,\n recipient: values.recipient,\n collectionContract: collectionAddress,\n tokenUri: pinned.uri,\n value: values.value,\n royaltyBps: 0,\n }),\n );\n invalidatePortfolioCache(walletAddress);\n });\n };\n\n const mintedTokenId = tx.receipt ? mintedTokenIdFromReceipt(tx.receipt, collectionAddress) : null;\n\n return (\n <WalletRequired\n icon={Sparkles}\n iconClassName=\"text-brand-purple\"\n title={t(\"Secure your account to create\")}\n description={t(\"Secure your account to mint tokens into a multi-editions collection.\")}\n >\n {ownerCheck === \"denied\" ? (\n <PageState icon={Sparkles} title={t(\"Not the owner\")} description={t(\"Minting opens for the collection owner.\")}>\n <Button asChild variant=\"soft\">\n <Link href=\"/launchpad\">{t(\"Back to Launchpad\")}</Link>\n </Button>\n </PageState>\n ) : (\n <>\n <ClaimRouteShell\n icon={<Sparkles className=\"h-4 w-4 text-white\" />}\n title={t(\"Mint an edition\")}\n subtitle={t(\"Add a new piece to the collection.\")}\n headerAccessory={\n <div className=\"panel flex items-center gap-2 px-3 py-2 max-w-full\">\n <span className=\"tabular-nums text-xs text-foreground/80 truncate\">{t(\"Collection: {collectionAddress}\", { collectionAddress })}</span>\n </div>\n }\n aside={\n <>\n <MedialaneCollectionCard\n image={imagePreview}\n name={form.watch(\"name\")}\n collection=\"Edition\"\n serial={Number(form.watch(\"value\")) > 1 ? `${form.watch(\"value\")} editions` : undefined}\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 <EditionMintFields\n form={form}\n imagePreview={imagePreview}\n imageUri={imageUri}\n imageUploading={imageUploading}\n mintDisabled={imageUploading || tx.phase !== \"idle\"}\n fileInputRef={fileInputRef}\n onImageSelect={handleImageSelect}\n onClearImage={clearImage}\n metadataResetKey={metadataResetKey}\n onMetadataFieldsChange={(fields) => { metadataFieldsRef.current = fields; }}\n uploadDocument={uploadDocument}\n />\n {uploadError && <p className=\"text-xs text-destructive mt-1\">{uploadError}</p>}\n {uploadSuccess && <p className=\"text-xs text-brand-blue mt-1\">✓ {uploadSuccess}</p>}\n {formError && <p className=\"text-xs text-destructive mt-1\">{formError}</p>}\n </form>\n </Form>\n </ClaimRouteShell>\n\n <TransactionDialog tx={tx} title={t(\"Mint an edition\")} workingLabel={t(\"Minting your edition…\")} firstStepLabel={t(\"Upload metadata\")}>\n <TransactionSuccess\n name={form.getValues(\"name\") || \"Your token\"}\n image={imagePreview}\n title={t(\"Editions minted\")}\n description={t(\"Each copy is recorded onchain with the license terms in its metadata.\")}\n actions={[\n ...(mintedTokenId ? [{ href: assetHref(\"STARKNET\", collectionAddress, mintedTokenId), label: t(\"View asset\") }] : []),\n { href: \"/portfolio/assets\", label: t(\"View portfolio\") },\n { label: t(\"Mint another\"), onClick: handleAgain },\n ]}\n >\n <RewardEarned actionType=\"mint_asset\" />\n </TransactionSuccess>\n </TransactionDialog>\n </>\n )}\n </WalletRequired>\n );\n}\n"],"mappings":";AAwJY,SAeE,UAfF,KAeE,YAfF;AAtJZ,SAAS,WAAW,QAAQ,gBAAgC;AAC5D,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,WAAW,kBAAkB,mBAAmB;AACzD,SAAS,gCAAgC;AACzC,OAAO,UAAU;AACjB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAClC,SAAS,yBAAiD;AAC1D,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB,wBAAwB;AACnD,SAAS,sBAAsB;AAC/B,SAAS,+BAA+B;AACxC,SAAS,gCAAgC;AAC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;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,KAAK,UAAU,MAAM,KAAK;AAAA,YAChC,OAAO;AAAA,YACP,OAAO,EAAE,iBAAiB;AAAA,YAC1B,aAAa,EAAE,uEAAuE;AAAA,YACtF,SAAS;AAAA,cACP,GAAI,gBAAgB,CAAC,EAAE,MAAM,UAAU,YAAY,mBAAmB,aAAa,GAAG,OAAO,EAAE,YAAY,EAAE,CAAC,IAAI,CAAC;AAAA,cACnH,EAAE,MAAM,qBAAqB,OAAO,EAAE,gBAAgB,EAAE;AAAA,cACxD,EAAE,OAAO,EAAE,cAAc,GAAG,SAAS,YAAY;AAAA,YACnD;AAAA,YAEA,8BAAC,gBAAa,YAAW,cAAa;AAAA;AAAA,QACxC,GACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/launchpad/edition-mint.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState, type ReactNode } from \"react\";\nimport { useForm } from \"react-hook-form\";\nimport { zodResolver } from \"@hookform/resolvers/zod\";\nimport { Sparkles } from \"lucide-react\";\nimport { PageState } from \"../page-state.js\";\nimport { assetHref, normalizeAddress, profileHref } from \"@medialane/sdk\";\nimport { mintedTokenIdFromReceipt } from \"@medialane/sdk/starknet\";\nimport Link from \"../link.js\";\nimport { Button } from \"../button.js\";\nimport { Form } from \"../form.js\";\nimport { ClaimRouteShell } from \"../claim-route-shell.js\";\nimport { TransactionSuccess } from \"../transaction-success.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 type { MetadataField } from \"../ip-type-fields.js\";\nimport { EditionMintFields } from \"./edition-mint-fields.js\";\nimport { editionMintSchema, type EditionMintValues } from \"./edition-mint-schema.js\";\nimport { runIntentCalls } from \"../../utils/run-intent-calls.js\";\nimport { pinAssetMetadata, uploadFileToIpfs } from \"../../utils/ipfs-upload.js\";\nimport { useTransaction } from \"../../utils/use-transaction.js\";\nimport { useImageUpload } from \"../../utils/use-image-upload.js\";\nimport { invalidatePortfolioCache } from \"../../utils/portfolio-cache.js\";\nimport { useT } from \"../../i18n/provider.js\";\nimport { msg } from \"../../i18n/translate.js\";\n\nconst DEFAULTS: EditionMintValues = {\n value: \"1\",\n recipient: \"\",\n name: \"\",\n description: \"\",\n external_url: \"\",\n ipType: \"NFT\",\n licenseType: \"CC BY-SA\",\n commercialUse: \"Yes\",\n derivatives: \"Share-Alike\",\n attribution: \"Required\",\n geographicScope: \"Worldwide\",\n aiPolicy: \"Allowed\",\n royalty: 0,\n};\n\nexport function EditionMint({ contract: rawContract, aside }: { contract: string; aside?: ReactNode }) {\n const t = useT();\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const collectionAddress = normalizeAddress(\"STARKNET\", rawContract);\n const tx = useTransaction();\n const upload = useImageUpload();\n const [ownerCheck, setOwnerCheck] = useState<\"loading\" | \"ok\" | \"denied\">(\"loading\");\n const [collectionName, setCollectionName] = useState<string | null>(null);\n const [metadataResetKey, setMetadataResetKey] = useState(0);\n const [autoExternalUrl, setAutoExternalUrl] = useState(\"\");\n const metadataFieldsRef = useRef<MetadataField[]>([]);\n\n const form = useForm<EditionMintValues>({ resolver: zodResolver(editionMintSchema), defaultValues: DEFAULTS });\n\n useEffect(() => {\n if (walletAddress && !form.getValues(\"recipient\")) form.setValue(\"recipient\", walletAddress);\n }, [walletAddress, form]);\n\n useEffect(() => {\n const suggested = `https://medialane.io/collections/${collectionAddress}`;\n const current = form.getValues(\"external_url\");\n if (!current || current === autoExternalUrl) {\n form.setValue(\"external_url\", suggested, { shouldDirty: false });\n setAutoExternalUrl(suggested);\n }\n }, [autoExternalUrl, collectionAddress, form]);\n\n useEffect(() => {\n if (!walletAddress) return;\n app\n .getClient()\n .api.collections.get(collectionAddress)\n .then((data) => {\n const owner = data.owner ? normalizeAddress(\"STARKNET\", data.owner) : null;\n setCollectionName(data.name ?? null);\n setOwnerCheck(owner === normalizeAddress(\"STARKNET\", walletAddress) ? \"ok\" : \"denied\");\n })\n .catch(() => setOwnerCheck(\"denied\"));\n }, [app, walletAddress, collectionAddress]);\n\n const uploadDocument = async (file: File) => {\n await app.ensureSignedIn?.();\n return (await uploadFileToIpfs(app.getClient().api, file, \"document\")).uri;\n };\n\n const handleAgain = () => {\n tx.reset();\n metadataFieldsRef.current = [];\n setMetadataResetKey((key) => key + 1);\n setAutoExternalUrl(\"\");\n upload.clear();\n form.reset({ ...DEFAULTS, recipient: walletAddress ?? \"\" });\n };\n\n const onSubmit = (values: EditionMintValues) => {\n if (!upload.confirm(msg(\"Upload an image before publishing.\"))) return;\n if (!walletAddress) return;\n void tx.run(async (signer) => {\n await app.ensureSignedIn?.();\n const api = app.getClient().api;\n const pinned = await pinAssetMetadata(api, {\n name: values.name,\n description: values.description ?? \"\",\n imageUri: upload.uri,\n externalUrl: values.external_url,\n ipType: values.ipType,\n licenseType: values.licenseType,\n commercialUse: values.commercialUse,\n derivatives: values.derivatives,\n attribution: values.attribution,\n geographicScope: values.geographicScope,\n aiPolicy: values.aiPolicy,\n royalty: String(values.royalty),\n creator: walletAddress,\n templateTraits: metadataFieldsRef.current.filter((f) => f.traitType.trim() && f.value.trim()).map((f) => ({ traitType: f.traitType.trim(), value: f.value.trim() })),\n });\n await runIntentCalls(signer, () =>\n api.intents.create(\"mint\", {\n owner: walletAddress,\n recipient: values.recipient,\n collectionContract: collectionAddress,\n tokenUri: pinned.uri,\n value: values.value,\n royaltyBps: 0,\n }),\n );\n invalidatePortfolioCache(walletAddress);\n });\n };\n\n const mintedTokenId = tx.receipt ? mintedTokenIdFromReceipt(tx.receipt, collectionAddress) : null;\n\n return (\n <WalletRequired\n icon={Sparkles}\n iconClassName=\"text-brand-purple\"\n title={t(\"Secure your account to publish\")}\n description={t(\"Secure your account to publish editions.\")}\n >\n {ownerCheck === \"denied\" ? (\n <PageState icon={Sparkles} title={t(\"Owner only\")} description={t(\"Publishing is open to the collection owner.\")}>\n <Button asChild variant=\"soft\">\n <Link href=\"/launchpad\">{t(\"Back to Launchpad\")}</Link>\n </Button>\n </PageState>\n ) : (\n <>\n <ClaimRouteShell\n icon={<Sparkles className=\"h-4 w-4 text-white\" />}\n title={t(\"Publish an edition\")}\n subtitle={t(\"Add a new piece to the collection.\")}\n headerAccessory={\n collectionName ? (\n <div data-testid=\"collection-name\" className=\"panel flex items-center gap-2 px-3 py-2 max-w-full\">\n <span className=\"text-xs text-foreground/80 truncate\">{collectionName}</span>\n </div>\n ) : undefined\n }\n aside={\n <>\n <MedialaneCollectionCard\n image={upload.preview}\n name={form.watch(\"name\")}\n collection={t(\"Edition\")}\n serial={Number(form.watch(\"value\")) > 1 ? t(\"{count} editions\", { count: form.watch(\"value\") }) : undefined}\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 <EditionMintFields\n form={form}\n upload={upload}\n mintDisabled={upload.uploading || tx.phase !== \"idle\"}\n metadataResetKey={metadataResetKey}\n onMetadataFieldsChange={(fields) => { metadataFieldsRef.current = fields; }}\n uploadDocument={uploadDocument}\n />\n </form>\n </Form>\n </ClaimRouteShell>\n\n <TransactionDialog tx={tx} title={t(\"Publish an edition\")} workingLabel={t(\"Publishing your edition…\")} firstStepLabel={t(\"Saving details\")}>\n <TransactionSuccess\n name={form.getValues(\"name\") || t(\"Your work\")}\n image={upload.preview}\n title={t(\"Edition published\")}\n description={t(\"Each copy is saved permanently with its license terms.\")}\n actions={[\n ...(mintedTokenId ? [{ href: assetHref(\"STARKNET\", collectionAddress, mintedTokenId), label: t(\"View work\") }] : []),\n { href: \"/portfolio/assets\", label: t(\"View portfolio\") },\n { label: t(\"Publish another\"), onClick: handleAgain },\n ]}\n >\n <RewardEarned actionType=\"mint_asset\" />\n </TransactionSuccess>\n </TransactionDialog>\n </>\n )}\n </WalletRequired>\n );\n}\n"],"mappings":";AAqJY,SAiBE,UAjBF,KAiBE,YAjBF;AAnJZ,SAAS,WAAW,QAAQ,gBAAgC;AAC5D,SAAS,eAAe;AACxB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AACzB,SAAS,iBAAiB;AAC1B,SAAS,WAAW,kBAAkB,mBAAmB;AACzD,SAAS,gCAAgC;AACzC,OAAO,UAAU;AACjB,SAAS,cAAc;AACvB,SAAS,YAAY;AACrB,SAAS,uBAAuB;AAChC,SAAS,0BAA0B;AACnC,SAAS,+BAA+B;AACxC,SAAS,yBAAyB;AAClC,SAAS,sBAAsB;AAC/B,SAAS,uBAAuB;AAChC,SAAS,oBAAoB;AAE7B,SAAS,yBAAyB;AAClC,SAAS,yBAAiD;AAC1D,SAAS,sBAAsB;AAC/B,SAAS,kBAAkB,wBAAwB;AACnD,SAAS,sBAAsB;AAC/B,SAAS,sBAAsB;AAC/B,SAAS,gCAAgC;AACzC,SAAS,YAAY;AACrB,SAAS,WAAW;AAEpB,MAAM,WAA8B;AAAA,EAClC,OAAO;AAAA,EACP,WAAW;AAAA,EACX,MAAM;AAAA,EACN,aAAa;AAAA,EACb,cAAc;AAAA,EACd,QAAQ;AAAA,EACR,aAAa;AAAA,EACb,eAAe;AAAA,EACf,aAAa;AAAA,EACb,aAAa;AAAA,EACb,iBAAiB;AAAA,EACjB,UAAU;AAAA,EACV,SAAS;AACX;AAEO,SAAS,YAAY,EAAE,UAAU,aAAa,MAAM,GAA4C;AACrG,QAAM,IAAI,KAAK;AACf,QAAM,MAAM,gBAAgB;AAC5B,QAAM,gBAAgB,IAAI;AAC1B,QAAM,oBAAoB,iBAAiB,YAAY,WAAW;AAClE,QAAM,KAAK,eAAe;AAC1B,QAAM,SAAS,eA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AAG,MACR,8BAAC,UAAK,UAAU,KAAK,aAAa,QAAQ,GAAG,WAAU,aACrD;AAAA,cAAC;AAAA;AAAA,gBACC;AAAA,gBACA;AAAA,gBACA,cAAc,OAAO,aAAa,GAAG,UAAU;AAAA,gBAC/C;AAAA,gBACA,wBAAwB,CAAC,WAAW;AAAE,oCAAkB,UAAU;AAAA,gBAAQ;AAAA,gBAC1E;AAAA;AAAA,YACF,GACF,GACF;AAAA;AAAA,QACF;AAAA,QAEA,oBAAC,qBAAkB,IAAQ,OAAO,EAAE,oBAAoB,GAAG,cAAc,EAAE,+BAA0B,GAAG,gBAAgB,EAAE,gBAAgB,GACxI;AAAA,UAAC;AAAA;AAAA,YACC,MAAM,KAAK,UAAU,MAAM,KAAK,EAAE,WAAW;AAAA,YAC7C,OAAO,OAAO;AAAA,YACd,OAAO,EAAE,mBAAmB;AAAA,YAC5B,aAAa,EAAE,wDAAwD;AAAA,YACvE,SAAS;AAAA,cACP,GAAI,gBAAgB,CAAC,EAAE,MAAM,UAAU,YAAY,mBAAmB,aAAa,GAAG,OAAO,EAAE,WAAW,EAAE,CAAC,IAAI,CAAC;AAAA,cAClH,EAAE,MAAM,qBAAqB,OAAO,EAAE,gBAAgB,EAAE;AAAA,cACxD,EAAE,OAAO,EAAE,iBAAiB,GAAG,SAAS,YAAY;AAAA,YACtD;AAAA,YAEA,8BAAC,gBAAa,YAAW,cAAa;AAAA;AAAA,QACxC,GACF;AAAA,SACF;AAAA;AAAA,EAEJ;AAEJ;","names":[]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
8
|
for (var name in all)
|
|
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
}
|
|
19
17
|
return to;
|
|
20
18
|
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var pop_create_fields_exports = {};
|
|
31
21
|
__export(pop_create_fields_exports, {
|
|
@@ -34,9 +24,8 @@ __export(pop_create_fields_exports, {
|
|
|
34
24
|
});
|
|
35
25
|
module.exports = __toCommonJS(pop_create_fields_exports);
|
|
36
26
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
37
|
-
var import_image = __toESM(require("../image.js"), 1);
|
|
38
27
|
var import_lucide_react = require("lucide-react");
|
|
39
|
-
var
|
|
28
|
+
var import_image_upload_field = require("../image-upload-field.js");
|
|
40
29
|
var import_button = require("../button.js");
|
|
41
30
|
var import_input = require("../input.js");
|
|
42
31
|
var import_textarea = require("../textarea.js");
|
|
@@ -60,15 +49,10 @@ function PopCreateFields({
|
|
|
60
49
|
walletAddress,
|
|
61
50
|
eventType,
|
|
62
51
|
isPublic,
|
|
63
|
-
|
|
64
|
-
imageUri,
|
|
65
|
-
imageUploading,
|
|
52
|
+
upload,
|
|
66
53
|
isSubmitting,
|
|
67
|
-
fileInputRef,
|
|
68
54
|
onSetEventType,
|
|
69
|
-
onSetPublic
|
|
70
|
-
onImageSelect,
|
|
71
|
-
onClearImage
|
|
55
|
+
onSetPublic
|
|
72
56
|
}) {
|
|
73
57
|
const t = (0, import_provider.useT)();
|
|
74
58
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-5", children: [
|
|
@@ -96,86 +80,24 @@ function PopCreateFields({
|
|
|
96
80
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: t(EVENT_TYPES.find((event) => event.value === eventType)?.description ?? "") }),
|
|
97
81
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: t("Labels the certificate collection.") })
|
|
98
82
|
] }) }),
|
|
99
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.1, children: /* @__PURE__ */ (0, import_jsx_runtime.
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
role: "button",
|
|
110
|
-
tabIndex: 0,
|
|
111
|
-
onClick: () => !imageUploading && fileInputRef.current?.click(),
|
|
112
|
-
onKeyDown: (event) => {
|
|
113
|
-
if (event.key === "Enter" || event.key === " ") {
|
|
114
|
-
event.preventDefault();
|
|
115
|
-
if (!imageUploading) fileInputRef.current?.click();
|
|
116
|
-
}
|
|
117
|
-
},
|
|
118
|
-
className: "relative h-20 w-20 rounded-2xl border-2 border-dashed border-border bg-muted flex items-center justify-center overflow-hidden shrink-0 cursor-pointer hover:border-brand-blue/50 transition-colors",
|
|
119
|
-
children: [
|
|
120
|
-
imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: imagePreview, alt: t("Certificate"), fill: true, unoptimized: true, className: "object-cover" }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ImagePlus, { className: "h-6 w-6 text-muted-foreground" }),
|
|
121
|
-
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-4 w-4 animate-spin" }) }) : null
|
|
122
|
-
]
|
|
123
|
-
}
|
|
124
|
-
),
|
|
125
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
|
|
126
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
127
|
-
"input",
|
|
128
|
-
{
|
|
129
|
-
ref: fileInputRef,
|
|
130
|
-
type: "file",
|
|
131
|
-
accept: (0, import_upload_limits.acceptFor)("image"),
|
|
132
|
-
className: "hidden",
|
|
133
|
-
onChange: (event) => {
|
|
134
|
-
const file = event.target.files?.[0];
|
|
135
|
-
if (file) onImageSelect(file);
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
),
|
|
139
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
140
|
-
import_button.Button,
|
|
141
|
-
{
|
|
142
|
-
type: "button",
|
|
143
|
-
variant: "soft",
|
|
144
|
-
size: "sm",
|
|
145
|
-
disabled: imageUploading,
|
|
146
|
-
onClick: () => fileInputRef.current?.click(),
|
|
147
|
-
children: imageUploading ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
148
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-3.5 w-3.5 mr-1.5 animate-spin" }),
|
|
149
|
-
t("Uploading\u2026")
|
|
150
|
-
] }) : imagePreview ? t("Change") : t("Upload certificate art")
|
|
151
|
-
}
|
|
152
|
-
),
|
|
153
|
-
imagePreview ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
154
|
-
"button",
|
|
155
|
-
{
|
|
156
|
-
type: "button",
|
|
157
|
-
onClick: onClearImage,
|
|
158
|
-
className: "flex items-center gap-1 text-xs text-muted-foreground hover:text-destructive transition-colors",
|
|
159
|
-
children: [
|
|
160
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.X, { className: "h-3 w-3" }),
|
|
161
|
-
" ",
|
|
162
|
-
t("Remove")
|
|
163
|
-
]
|
|
164
|
-
}
|
|
165
|
-
) : null,
|
|
166
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: imageUri ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-brand-blue", children: t("\u2713 Uploaded") }) : t("Image files") })
|
|
167
|
-
] })
|
|
168
|
-
] })
|
|
169
|
-
] }) }),
|
|
83
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.1, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
84
|
+
import_image_upload_field.ImageUploadField,
|
|
85
|
+
{
|
|
86
|
+
upload,
|
|
87
|
+
label: t("Cover image"),
|
|
88
|
+
alt: t("Certificate"),
|
|
89
|
+
optional: true,
|
|
90
|
+
buttonLabel: t("Upload image")
|
|
91
|
+
}
|
|
92
|
+
) }),
|
|
170
93
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.12, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
171
94
|
import_form.FormField,
|
|
172
95
|
{
|
|
173
96
|
control: form.control,
|
|
174
97
|
name: "name",
|
|
175
98
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_form.FormItem, { children: [
|
|
176
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormLabel, { children: t("
|
|
99
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormLabel, { children: t("Name") }),
|
|
177
100
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { placeholder: t("Starknet Hackathon 2026"), ...field }) }),
|
|
178
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormDescription, { children: t("The event or program name participants will recognize immediately.") }),
|
|
179
101
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormMessage, {})
|
|
180
102
|
] })
|
|
181
103
|
}
|
|
@@ -186,7 +108,7 @@ function PopCreateFields({
|
|
|
186
108
|
control: form.control,
|
|
187
109
|
name: "symbol",
|
|
188
110
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_form.FormItem, { children: [
|
|
189
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormLabel, { children: t("
|
|
111
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormLabel, { children: t("Short code") }),
|
|
190
112
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
191
113
|
import_input.Input,
|
|
192
114
|
{
|
|
@@ -196,7 +118,7 @@ function PopCreateFields({
|
|
|
196
118
|
className: "max-w-[160px]"
|
|
197
119
|
}
|
|
198
120
|
) }),
|
|
199
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormDescription, { children: t("
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormDescription, { children: t("A short name shown in wallets.") }),
|
|
200
122
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormMessage, {})
|
|
201
123
|
] })
|
|
202
124
|
}
|
|
@@ -219,7 +141,7 @@ function PopCreateFields({
|
|
|
219
141
|
) }),
|
|
220
142
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.155, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_external_link_field.ExternalLinkField, { form, address: walletAddress }) }),
|
|
221
143
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.16, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
|
|
222
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium", children: t("
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium", children: t("Claims close") }),
|
|
223
145
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex gap-2 items-center", children: [
|
|
224
146
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
225
147
|
import_form.FormField,
|
|
@@ -240,40 +162,36 @@ function PopCreateFields({
|
|
|
240
162
|
render: ({ field }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormItem, { className: "w-28", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_form.FormControl, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_input.Input, { type: "time", ...field }) }) })
|
|
241
163
|
}
|
|
242
164
|
)
|
|
243
|
-
] })
|
|
244
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: t("Claims close at this time.") })
|
|
165
|
+
] })
|
|
245
166
|
] }) }),
|
|
246
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
247
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "
|
|
248
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
249
|
-
|
|
250
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: isPublic ? t("Listed publicly on the POP launchpad") : t("Only accessible via direct link") })
|
|
251
|
-
] }),
|
|
252
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
253
|
-
"button",
|
|
254
|
-
{
|
|
255
|
-
type: "button",
|
|
256
|
-
role: "switch",
|
|
257
|
-
"aria-checked": isPublic,
|
|
258
|
-
onClick: () => onSetPublic(!isPublic),
|
|
259
|
-
className: (0, import_cn.cn)(
|
|
260
|
-
"relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
261
|
-
isPublic ? "bg-brand-blue" : "bg-muted-foreground/30"
|
|
262
|
-
),
|
|
263
|
-
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
264
|
-
"span",
|
|
265
|
-
{
|
|
266
|
-
className: (0, import_cn.cn)(
|
|
267
|
-
"pointer-events-none block h-5 w-5 rounded-full bg-white shadow-sm transition-transform",
|
|
268
|
-
isPublic ? "translate-x-5" : "translate-x-0"
|
|
269
|
-
)
|
|
270
|
-
}
|
|
271
|
-
)
|
|
272
|
-
}
|
|
273
|
-
)
|
|
167
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.18, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "panel flex items-center justify-between p-4", children: [
|
|
168
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-0.5", children: [
|
|
169
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-medium", children: t("Event visibility") }),
|
|
170
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs text-muted-foreground", children: isPublic ? t("Listed publicly on the POP launchpad") : t("Only accessible via direct link") })
|
|
274
171
|
] }),
|
|
275
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
276
|
-
|
|
172
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
type: "button",
|
|
176
|
+
role: "switch",
|
|
177
|
+
"aria-checked": isPublic,
|
|
178
|
+
onClick: () => onSetPublic(!isPublic),
|
|
179
|
+
className: (0, import_cn.cn)(
|
|
180
|
+
"relative inline-flex h-6 w-11 shrink-0 rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring",
|
|
181
|
+
isPublic ? "bg-brand-blue" : "bg-muted-foreground/30"
|
|
182
|
+
),
|
|
183
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
184
|
+
"span",
|
|
185
|
+
{
|
|
186
|
+
className: (0, import_cn.cn)(
|
|
187
|
+
"pointer-events-none block h-5 w-5 rounded-full bg-white shadow-sm transition-transform",
|
|
188
|
+
isPublic ? "translate-x-5" : "translate-x-0"
|
|
189
|
+
)
|
|
190
|
+
}
|
|
191
|
+
)
|
|
192
|
+
}
|
|
193
|
+
)
|
|
194
|
+
] }) }),
|
|
277
195
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_motion_primitives.FadeIn, { delay: 0.2, children: [
|
|
278
196
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
279
197
|
import_button.Button,
|
|
@@ -281,7 +199,7 @@ function PopCreateFields({
|
|
|
281
199
|
type: "submit",
|
|
282
200
|
size: "lg",
|
|
283
201
|
className: "w-full rounded-xl mt-2",
|
|
284
|
-
disabled: isSubmitting ||
|
|
202
|
+
disabled: isSubmitting || upload.uploading,
|
|
285
203
|
children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
286
204
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Loader2, { className: "h-4 w-4 mr-2 animate-spin" }),
|
|
287
205
|
t("Creating event\u2026")
|