@medialane/ui 0.382.0 → 0.384.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/account-section.cjs +3 -4
- package/dist/components/account/account-section.cjs.map +1 -1
- package/dist/components/account/account-section.d.cts +3 -3
- package/dist/components/account/account-section.d.ts +3 -3
- package/dist/components/account/account-section.js +3 -4
- package/dist/components/account/account-section.js.map +1 -1
- package/dist/components/account/guardian-recovery-section.cjs +2 -1
- package/dist/components/account/guardian-recovery-section.cjs.map +1 -1
- package/dist/components/account/guardian-recovery-section.js +2 -1
- package/dist/components/account/guardian-recovery-section.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/accounts-page.cjs +2 -1
- package/dist/components/accounts-page.cjs.map +1 -1
- package/dist/components/accounts-page.js +2 -1
- package/dist/components/accounts-page.js.map +1 -1
- package/dist/components/activities-feed.cjs +2 -1
- package/dist/components/activities-feed.cjs.map +1 -1
- package/dist/components/activities-feed.js +2 -1
- package/dist/components/activities-feed.js.map +1 -1
- package/dist/components/activity-timeline-row.cjs +2 -1
- package/dist/components/activity-timeline-row.cjs.map +1 -1
- package/dist/components/activity-timeline-row.js +2 -1
- package/dist/components/activity-timeline-row.js.map +1 -1
- package/dist/components/asset-overview-content.cjs +2 -1
- package/dist/components/asset-overview-content.cjs.map +1 -1
- package/dist/components/asset-overview-content.js +2 -1
- package/dist/components/asset-overview-content.js.map +1 -1
- package/dist/components/asset-picker.cjs +2 -1
- package/dist/components/asset-picker.cjs.map +1 -1
- package/dist/components/asset-picker.js +2 -1
- package/dist/components/asset-picker.js.map +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/claim-rail.cjs +5 -8
- package/dist/components/claim-rail.cjs.map +1 -1
- package/dist/components/claim-rail.d.cts +1 -4
- package/dist/components/claim-rail.d.ts +1 -4
- package/dist/components/claim-rail.js +5 -8
- package/dist/components/claim-rail.js.map +1 -1
- package/dist/components/collection-settings.cjs +2 -3
- package/dist/components/collection-settings.cjs.map +1 -1
- package/dist/components/collection-settings.js +2 -3
- package/dist/components/collection-settings.js.map +1 -1
- package/dist/components/collection-slug-claim.cjs +1 -7
- package/dist/components/collection-slug-claim.cjs.map +1 -1
- package/dist/components/collection-slug-claim.js +1 -7
- package/dist/components/collection-slug-claim.js.map +1 -1
- package/dist/components/comments-section.cjs +2 -1
- package/dist/components/comments-section.cjs.map +1 -1
- package/dist/components/comments-section.js +2 -1
- package/dist/components/comments-section.js.map +1 -1
- package/dist/components/discover-features.cjs +7 -6
- package/dist/components/discover-features.cjs.map +1 -1
- package/dist/components/discover-features.js +7 -6
- package/dist/components/discover-features.js.map +1 -1
- package/dist/components/empty-or-error.cjs +3 -2
- package/dist/components/empty-or-error.cjs.map +1 -1
- package/dist/components/empty-or-error.js +3 -2
- package/dist/components/empty-or-error.js.map +1 -1
- package/dist/components/gated-content.cjs +5 -4
- package/dist/components/gated-content.cjs.map +1 -1
- package/dist/components/gated-content.js +5 -4
- package/dist/components/gated-content.js.map +1 -1
- package/dist/components/icon-tile.cjs +49 -0
- package/dist/components/icon-tile.cjs.map +1 -0
- package/dist/components/icon-tile.d.cts +17 -0
- package/dist/components/icon-tile.d.ts +17 -0
- package/dist/components/icon-tile.js +25 -0
- package/dist/components/icon-tile.js.map +1 -0
- package/dist/components/ip-type-nav.cjs +3 -3
- package/dist/components/ip-type-nav.cjs.map +1 -1
- package/dist/components/ip-type-nav.js +3 -3
- package/dist/components/ip-type-nav.js.map +1 -1
- package/dist/components/ip-type-page.cjs +3 -2
- package/dist/components/ip-type-page.cjs.map +1 -1
- package/dist/components/ip-type-page.js +3 -2
- package/dist/components/ip-type-page.js.map +1 -1
- package/dist/components/journey-content.cjs +2 -1
- package/dist/components/journey-content.cjs.map +1 -1
- package/dist/components/journey-content.js +2 -1
- package/dist/components/journey-content.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +2 -2
- package/dist/components/launchpad/edition-mint-schema.d.ts +2 -2
- package/dist/components/launchpad-services.cjs +27 -22
- package/dist/components/launchpad-services.cjs.map +1 -1
- package/dist/components/launchpad-services.d.cts +2 -0
- package/dist/components/launchpad-services.d.ts +2 -0
- package/dist/components/launchpad-services.js +27 -22
- package/dist/components/launchpad-services.js.map +1 -1
- package/dist/components/launchpad-strip.cjs +6 -1
- package/dist/components/launchpad-strip.cjs.map +1 -1
- package/dist/components/launchpad-strip.js +6 -1
- package/dist/components/launchpad-strip.js.map +1 -1
- package/dist/components/license-request-page.cjs +2 -1
- package/dist/components/license-request-page.cjs.map +1 -1
- package/dist/components/license-request-page.js +2 -1
- package/dist/components/license-request-page.js.map +1 -1
- package/dist/components/marketplace-dialog-primitives.cjs +2 -1
- package/dist/components/marketplace-dialog-primitives.cjs.map +1 -1
- package/dist/components/marketplace-dialog-primitives.js +2 -1
- package/dist/components/marketplace-dialog-primitives.js.map +1 -1
- package/dist/components/media-wallet/media-wallet-home.cjs +3 -2
- package/dist/components/media-wallet/media-wallet-home.cjs.map +1 -1
- package/dist/components/media-wallet/media-wallet-home.js +3 -2
- package/dist/components/media-wallet/media-wallet-home.js.map +1 -1
- package/dist/components/media-wallet/wallet-activity-icon.cjs +5 -8
- package/dist/components/media-wallet/wallet-activity-icon.cjs.map +1 -1
- package/dist/components/media-wallet/wallet-activity-icon.js +5 -8
- package/dist/components/media-wallet/wallet-activity-icon.js.map +1 -1
- package/dist/components/mint-landing.cjs +7 -10
- package/dist/components/mint-landing.cjs.map +1 -1
- package/dist/components/mint-landing.js +7 -10
- package/dist/components/mint-landing.js.map +1 -1
- package/dist/components/nav-command-menu.cjs +2 -1
- package/dist/components/nav-command-menu.cjs.map +1 -1
- package/dist/components/nav-command-menu.js +2 -1
- package/dist/components/nav-command-menu.js.map +1 -1
- package/dist/components/remixes-tab.cjs +2 -1
- package/dist/components/remixes-tab.cjs.map +1 -1
- package/dist/components/remixes-tab.js +2 -1
- package/dist/components/remixes-tab.js.map +1 -1
- package/dist/components/rewards/badge-catalog.cjs +2 -1
- package/dist/components/rewards/badge-catalog.cjs.map +1 -1
- package/dist/components/rewards/badge-catalog.js +2 -1
- package/dist/components/rewards/badge-catalog.js.map +1 -1
- package/dist/components/rewards/leaderboard-panel.cjs +2 -1
- package/dist/components/rewards/leaderboard-panel.cjs.map +1 -1
- package/dist/components/rewards/leaderboard-panel.js +2 -1
- package/dist/components/rewards/leaderboard-panel.js.map +1 -1
- package/dist/components/rewards/rewards-dashboard.cjs +2 -4
- package/dist/components/rewards/rewards-dashboard.cjs.map +1 -1
- package/dist/components/rewards/rewards-dashboard.js +2 -4
- package/dist/components/rewards/rewards-dashboard.js.map +1 -1
- package/dist/components/rewards-section.cjs +2 -1
- package/dist/components/rewards-section.cjs.map +1 -1
- package/dist/components/rewards-section.js +2 -1
- package/dist/components/rewards-section.js.map +1 -1
- package/dist/components/route-error.cjs +2 -1
- package/dist/components/route-error.cjs.map +1 -1
- package/dist/components/route-error.js +2 -1
- package/dist/components/route-error.js.map +1 -1
- package/dist/components/service-collections-page.cjs +2 -1
- package/dist/components/service-collections-page.cjs.map +1 -1
- package/dist/components/service-collections-page.js +2 -1
- package/dist/components/service-collections-page.js.map +1 -1
- package/dist/components/settings-section.cjs +3 -4
- package/dist/components/settings-section.cjs.map +1 -1
- package/dist/components/settings-section.d.cts +1 -3
- package/dist/components/settings-section.d.ts +1 -3
- package/dist/components/settings-section.js +3 -4
- package/dist/components/settings-section.js.map +1 -1
- package/dist/components/sponsorship-offers-page.cjs +2 -1
- package/dist/components/sponsorship-offers-page.cjs.map +1 -1
- package/dist/components/sponsorship-offers-page.js +2 -1
- package/dist/components/sponsorship-offers-page.js.map +1 -1
- package/dist/components/tab-empty-state.cjs +2 -1
- package/dist/components/tab-empty-state.cjs.map +1 -1
- package/dist/components/tab-empty-state.js +2 -1
- package/dist/components/tab-empty-state.js.map +1 -1
- package/dist/components/transaction-dialog.cjs +2 -1
- package/dist/components/transaction-dialog.cjs.map +1 -1
- package/dist/components/transaction-dialog.js +2 -1
- package/dist/components/transaction-dialog.js.map +1 -1
- package/dist/index.cjs +3 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/medialane.css +20 -0
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/comments-section.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { ExternalLink, Flag, Loader2, MessageCircle, Send, Zap } from \"lucide-react\";\nimport { normalizeAddress, profileHref, STARKNET_NFTCOMMENTS_CONTRACT } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp, type ReportTarget } from \"./medialane-app.js\";\nimport { ReportDialog } from \"./report-dialog.js\";\nimport { RewardEarned } from \"./rewards/reward-earned.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { Textarea } from \"./textarea.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionSuccess } from \"./transaction-success.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport { successMessages } from \"../utils/success-messages.js\";\nimport { useComments } from \"../utils/use-comments.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { BRAND_COLOR } from \"../data/brand.js\";\n\nconst MAX_LEN = 1000;\nconst AVATAR_COLORS = ([\"blue\", \"purple\", \"rose\", \"orange\", \"maeve\"] as const).map((color) => BRAND_COLOR[color]);\n\nexport interface CommentsSectionProps {\n contract: string;\n tokenId: string;\n className?: string;\n}\n\nexport function CommentsSection({ contract, tokenId, className }: CommentsSectionProps) {\n const t = useT();\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const hasWallet = !!walletAddress;\n const { comments, isLoading, mutate } = useComments(contract, tokenId);\n const tx = useTransaction();\n\n const [text, setText] = useState(\"\");\n const [reportTarget, setReportTarget] = useState<ReportTarget | null>(null);\n\n const messagesRef = useRef<HTMLDivElement>(null);\n const bottomRef = useRef<HTMLDivElement>(null);\n const composeRef = useRef<HTMLTextAreaElement>(null);\n\n const byteLen = new TextEncoder().encode(text).length;\n const canSubmit = text.trim().length > 0 && byteLen <= MAX_LEN && !!STARKNET_NFTCOMMENTS_CONTRACT;\n const isProcessing = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const isOwn = (author: string) =>\n !!walletAddress && normalizeAddress(\"STARKNET\", author) === normalizeAddress(\"STARKNET\", walletAddress);\n\n const isNearBottom = () => {\n const el = messagesRef.current;\n if (!el) return true;\n return el.scrollHeight - el.scrollTop - el.clientHeight < 100;\n };\n\n useEffect(() => {\n if (isNearBottom()) {\n bottomRef.current?.scrollIntoView({ behavior: \"smooth\" });\n }\n\n }, [comments.length]);\n\n const handleTextInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setText(e.target.value);\n e.target.style.height = \"auto\";\n e.target.style.height = Math.min(e.target.scrollHeight, 96) + \"px\";\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey && canSubmit && !isProcessing) {\n e.preventDefault();\n post();\n }\n };\n\n const post = () => {\n const body = text.trim();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"comment\", { author: signer.address, nftContract: contract, tokenId, text: body }),\n );\n })\n .then((ok) => {\n if (!ok) return;\n setText(\"\");\n if (composeRef.current) composeRef.current.style.height = \"auto\";\n void mutate();\n });\n };\n\n const handleStartConversation = () => {\n if (hasWallet) composeRef.current?.focus();\n };\n\n return (\n <div className={cn(\"flex flex-col h-[480px] overflow-hidden\", className)}>\n\n <div ref={messagesRef} className=\"flex-1 overflow-y-auto px-4 py-4\">\n {isLoading ? (\n <div className=\"space-y-4\">\n {([\n { own: false, w: \"w-40\" },\n { own: true, w: \"w-56\" },\n { own: false, w: \"w-48\" },\n { own: true, w: \"w-32\" },\n ] as const).map((item, i) => (\n <div key={i} className={`flex ${item.own ? \"justify-end\" : \"justify-start\"} gap-2`}>\n {!item.own && <Skeleton className=\"h-8 w-8 rounded-full shrink-0\" />}\n <Skeleton\n className={`h-10 ${item.w} rounded-2xl ${item.own ? \"rounded-tr-sm\" : \"rounded-tl-sm\"}`}\n />\n </div>\n ))}\n </div>\n ) : comments.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center h-full gap-4 text-center px-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full\" style={{ background: \"hsl(var(--brand-blue) / 0.12)\" }}>\n <MessageCircle className=\"h-7 w-7\" style={{ color: \"hsl(var(--brand-blue))\" }} />\n </div>\n <div>\n <p className=\"text-sm font-semibold\">{t(\"Nothing here yet\")}</p>\n <p className=\"text-xs text-muted-foreground mt-1 leading-relaxed max-w-[220px]\">\n {t(\"Your comment will be minted onchain — attached to this NFT forever.\")}\n </p>\n </div>\n <Button\n size=\"sm\"\n onClick={handleStartConversation}\n className=\"rounded-full text-white px-5\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {t(\"Write the first comment\")}\n </Button>\n </div>\n ) : (\n <div className=\"space-y-5\">\n {comments.map((comment) => {\n const own = isOwn(comment.author);\n const avatarSeed = parseInt(comment.author.slice(2, 8), 16);\n const avatarBg = own\n ? \"hsl(var(--brand-blue))\"\n : AVATAR_COLORS[avatarSeed % AVATAR_COLORS.length];\n\n return (\n <div\n key={comment.id}\n className={`group flex gap-2.5 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}\n >\n\n <Link href={profileHref({ address: comment.author })} className=\"shrink-0 mt-0.5\">\n <div\n className=\"h-9 w-9 rounded-full flex items-center justify-center text-2xs font-bold text-white select-none ring-2 ring-background hover:ring-primary/40 transition-all\"\n style={{ background: avatarBg }}\n >\n {comment.author.slice(2, 5).toUpperCase()}\n </div>\n </Link>\n\n <div className={`flex flex-col max-w-[75%] gap-1 ${own ? \"items-end\" : \"items-start\"}`}>\n\n <div className={`flex items-center gap-2 px-1 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}>\n <Link\n href={profileHref({ address: comment.author })}\n className=\"text-xs font-semibold text-foreground hover:underline underline-offset-2\"\n >\n {own ? t(\"You\") : <AddressDisplay address={comment.author} chars={5} showCopy={false} />}\n </Link>\n <span className=\"text-2xs text-muted-foreground\" title={comment.postedAt}>\n {timeAgo(comment.postedAt)}\n </span>\n </div>\n\n <div className=\"relative\">\n {own ? (\n <div\n className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words rounded-2xl rounded-tr-sm text-white\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {comment.content}\n </div>\n ) : (\n <div className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words bg-muted rounded-2xl rounded-tl-sm\">\n {comment.content}\n </div>\n )}\n {!own && hasWallet && (\n <button\n className=\"absolute -top-1 -right-5 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground/40 hover:text-destructive/70\"\n title={t(\"Report comment\")}\n aria-label={t(\"Report comment\")}\n onClick={() => setReportTarget({ type: \"COMMENT\", commentId: comment.id })}\n >\n <Flag className=\"h-3 w-3\" />\n </button>\n )}\n </div>\n\n {comment.txHash && (\n <a\n href={`${EXPLORER_URL}/tx/${comment.txHash}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 px-1 text-2xs font-medium transition-colors\"\n style={{ color: \"hsl(var(--brand-blue) / 0.55)\" }}\n onMouseEnter={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue))\")}\n onMouseLeave={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue) / 0.55)\")}\n >\n <span>⛓</span>\n <span>{t(\"onchain proof\")}</span>\n <ExternalLink className=\"h-2.5 w-2.5\" />\n </a>\n )}\n </div>\n </div>\n );\n })}\n <div ref={bottomRef} />\n </div>\n )}\n </div>\n\n <div className=\"border-t border-border/60 shrink-0\">\n {!hasWallet ? (\n <div className=\"flex items-center justify-center px-4 h-16\">\n <button type=\"button\" onClick={app.onRequireWallet} className=\"text-sm text-primary hover:underline\">\n {app.connectLabel ?? t(\"Connect\")} {t(\"to comment\")}\n </button>\n </div>\n ) : (\n <div className=\"px-3 pt-2 pb-3 space-y-2\">\n\n <div className=\"flex items-center gap-1.5\">\n <Zap className=\"h-3 w-3\" style={{ color: \"hsl(var(--brand-blue))\" }} />\n <span className=\"text-2xs font-semibold\" style={{ color: \"hsl(var(--brand-blue))\" }}>\n {t(\"Mint your message onchain\")}\n </span>\n </div>\n\n <div\n className=\"rounded-xl border bg-background/60 transition-all focus-within:ring-2\"\n style={{\n borderColor: \"hsl(var(--border))\",\n }}\n onFocusCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--brand-blue) / 0.6)\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"0 0 0 3px hsl(var(--brand-blue) / 0.12)\";\n }}\n onBlurCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--border))\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"\";\n }}\n >\n <Textarea\n ref={composeRef}\n placeholder={t(\"Say something onchain… it's permanent.\")}\n value={text}\n onChange={handleTextInput}\n onKeyDown={handleKeyDown}\n rows={2}\n className=\"resize-none min-h-[52px] max-h-[120px] w-full border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 px-3 pt-2.5 pb-1 text-sm rounded-xl\"\n disabled={isProcessing}\n />\n <div className=\"flex items-center justify-between px-3 pb-2.5\">\n <span className=\"text-2xs text-muted-foreground/40 flex items-center gap-1\">\n {t(\"Enter ↵ to post\")}\n </span>\n <div className=\"flex items-center gap-2\">\n {byteLen > 800 && (\n <span className={`text-2xs ${byteLen > MAX_LEN ? \"text-destructive\" : \"text-muted-foreground\"}`}>\n {byteLen}/{MAX_LEN}\n </span>\n )}\n <button\n onClick={post}\n disabled={!canSubmit || isProcessing}\n className=\"flex items-center gap-1.5 h-7 px-3 text-xs font-semibold rounded-full text-white transition-all hover:opacity-90 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {isProcessing ? <Loader2 className=\"h-3 w-3 animate-spin\" /> : <Send className=\"h-3 w-3\" />}\n {t(\"Post onchain\")}\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {reportTarget && (\n <ReportDialog\n target={reportTarget}\n open={!!reportTarget}\n onOpenChange={(open) => { if (!open) setReportTarget(null); }}\n />\n )}\n\n <TransactionDialog tx={tx} title={t(\"Comment\")} workingLabel=\"Posting your comment…\" firstStepLabel=\"Prepare comment\">\n <TransactionSuccess\n name=\"Comment\"\n {...successMessages.commented(t)}\n txHash={tx.txHash}\n actions={[{ label: t(\"Done\"), onClick: tx.reset }]}\n >\n <RewardEarned actionType=\"comment\" />\n </TransactionSuccess>\n </TransactionDialog>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAkHc;AAhHd,mBAA4C;AAC5C,0BAAsE;AACtE,iBAA6E;AAC7E,6BAA+B;AAC/B,oBAAuB;AACvB,kBAAiB;AACjB,2BAAmD;AACnD,2BAA6B;AAC7B,2BAA6B;AAC7B,sBAAyB;AACzB,sBAAyB;AACzB,gCAAkC;AAClC,iCAAmC;AACnC,gBAAmB;AACnB,0BAA6B;AAC7B,8BAA+B;AAC/B,kBAAwB;AACxB,8BAAgC;AAChC,0BAA4B;AAC5B,6BAA+B;AAC/B,sBAAqB;AACrB,mBAA4B;AAE5B,MAAM,UAAU;AAChB,MAAM,gBAAiB,C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ACZ;AAAA,YACA,6CAAC,SAAI,WAAU,iDACb;AAAA,0DAAC,UAAK,WAAU,6DACb,YAAE,sBAAiB,GACtB;AAAA,cACA,6CAAC,SAAI,WAAU,2BACZ;AAAA,0BAAU,OACT,6CAAC,UAAK,WAAW,YAAY,UAAU,UAAU,qBAAqB,uBAAuB,IAC1F;AAAA;AAAA,kBAAQ;AAAA,kBAAE;AAAA,mBACb;AAAA,gBAEF;AAAA,kBAAC;AAAA;AAAA,oBACC,SAAS;AAAA,oBACT,UAAU,CAAC,aAAa;AAAA,oBACxB,WAAU;AAAA,oBACV,OAAO,EAAE,YAAY,yBAAyB;AAAA,oBAE7C;AAAA,qCAAe,4CAAC,+BAAQ,WAAU,wBAAuB,IAAK,4CAAC,4BAAK,WAAU,WAAU;AAAA,sBACxF,EAAE,cAAc;AAAA;AAAA;AAAA,gBACnB;AAAA,iBACF;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,OACF,GAEJ;AAAA,IAEC,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AAAE,cAAI,CAAC,KAAM,iBAAgB,IAAI;AAAA,QAAG;AAAA;AAAA,IAC9D;AAAA,IAGF,4CAAC,+CAAkB,IAAQ,OAAO,EAAE,SAAS,GAAG,cAAa,8BAAwB,gBAAe,mBAClG;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACJ,GAAG,wCAAgB,UAAU,CAAC;AAAA,QAC/B,QAAQ,GAAG;AAAA,QACX,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAAA,QAEjD,sDAAC,qCAAa,YAAW,WAAU;AAAA;AAAA,IACrC,GACF;AAAA,KACF;AAEJ;","names":["Link"]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/comments-section.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { ExternalLink, Flag, Loader2, MessageCircle, Send, Zap } from \"lucide-react\";\nimport { normalizeAddress, profileHref, STARKNET_NFTCOMMENTS_CONTRACT } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp, type ReportTarget } from \"./medialane-app.js\";\nimport { ReportDialog } from \"./report-dialog.js\";\nimport { RewardEarned } from \"./rewards/reward-earned.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { Textarea } from \"./textarea.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionSuccess } from \"./transaction-success.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport { successMessages } from \"../utils/success-messages.js\";\nimport { useComments } from \"../utils/use-comments.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { BRAND_COLOR } from \"../data/brand.js\";\nimport { IconTile } from \"./icon-tile.js\";\n\nconst MAX_LEN = 1000;\nconst AVATAR_COLORS = ([\"blue\", \"purple\", \"rose\", \"orange\", \"maeve\"] as const).map((color) => BRAND_COLOR[color]);\n\nexport interface CommentsSectionProps {\n contract: string;\n tokenId: string;\n className?: string;\n}\n\nexport function CommentsSection({ contract, tokenId, className }: CommentsSectionProps) {\n const t = useT();\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const hasWallet = !!walletAddress;\n const { comments, isLoading, mutate } = useComments(contract, tokenId);\n const tx = useTransaction();\n\n const [text, setText] = useState(\"\");\n const [reportTarget, setReportTarget] = useState<ReportTarget | null>(null);\n\n const messagesRef = useRef<HTMLDivElement>(null);\n const bottomRef = useRef<HTMLDivElement>(null);\n const composeRef = useRef<HTMLTextAreaElement>(null);\n\n const byteLen = new TextEncoder().encode(text).length;\n const canSubmit = text.trim().length > 0 && byteLen <= MAX_LEN && !!STARKNET_NFTCOMMENTS_CONTRACT;\n const isProcessing = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const isOwn = (author: string) =>\n !!walletAddress && normalizeAddress(\"STARKNET\", author) === normalizeAddress(\"STARKNET\", walletAddress);\n\n const isNearBottom = () => {\n const el = messagesRef.current;\n if (!el) return true;\n return el.scrollHeight - el.scrollTop - el.clientHeight < 100;\n };\n\n useEffect(() => {\n if (isNearBottom()) {\n bottomRef.current?.scrollIntoView({ behavior: \"smooth\" });\n }\n\n }, [comments.length]);\n\n const handleTextInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setText(e.target.value);\n e.target.style.height = \"auto\";\n e.target.style.height = Math.min(e.target.scrollHeight, 96) + \"px\";\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey && canSubmit && !isProcessing) {\n e.preventDefault();\n post();\n }\n };\n\n const post = () => {\n const body = text.trim();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"comment\", { author: signer.address, nftContract: contract, tokenId, text: body }),\n );\n })\n .then((ok) => {\n if (!ok) return;\n setText(\"\");\n if (composeRef.current) composeRef.current.style.height = \"auto\";\n void mutate();\n });\n };\n\n const handleStartConversation = () => {\n if (hasWallet) composeRef.current?.focus();\n };\n\n return (\n <div className={cn(\"flex flex-col h-[480px] overflow-hidden\", className)}>\n\n <div ref={messagesRef} className=\"flex-1 overflow-y-auto px-4 py-4\">\n {isLoading ? (\n <div className=\"space-y-4\">\n {([\n { own: false, w: \"w-40\" },\n { own: true, w: \"w-56\" },\n { own: false, w: \"w-48\" },\n { own: true, w: \"w-32\" },\n ] as const).map((item, i) => (\n <div key={i} className={`flex ${item.own ? \"justify-end\" : \"justify-start\"} gap-2`}>\n {!item.own && <Skeleton className=\"h-8 w-8 rounded-full shrink-0\" />}\n <Skeleton\n className={`h-10 ${item.w} rounded-2xl ${item.own ? \"rounded-tr-sm\" : \"rounded-tl-sm\"}`}\n />\n </div>\n ))}\n </div>\n ) : comments.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center h-full gap-4 text-center px-4\">\n <IconTile size=\"lg\">\n <MessageCircle />\n </IconTile>\n <div>\n <p className=\"text-sm font-semibold\">{t(\"Nothing here yet\")}</p>\n <p className=\"text-xs text-muted-foreground mt-1 leading-relaxed max-w-[220px]\">\n {t(\"Your comment will be minted onchain — attached to this NFT forever.\")}\n </p>\n </div>\n <Button\n size=\"sm\"\n onClick={handleStartConversation}\n className=\"rounded-full text-white px-5\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {t(\"Write the first comment\")}\n </Button>\n </div>\n ) : (\n <div className=\"space-y-5\">\n {comments.map((comment) => {\n const own = isOwn(comment.author);\n const avatarSeed = parseInt(comment.author.slice(2, 8), 16);\n const avatarBg = own\n ? \"hsl(var(--brand-blue))\"\n : AVATAR_COLORS[avatarSeed % AVATAR_COLORS.length];\n\n return (\n <div\n key={comment.id}\n className={`group flex gap-2.5 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}\n >\n\n <Link href={profileHref({ address: comment.author })} className=\"shrink-0 mt-0.5\">\n <div\n className=\"h-9 w-9 rounded-full flex items-center justify-center text-2xs font-bold text-white select-none ring-2 ring-background hover:ring-primary/40 transition-all\"\n style={{ background: avatarBg }}\n >\n {comment.author.slice(2, 5).toUpperCase()}\n </div>\n </Link>\n\n <div className={`flex flex-col max-w-[75%] gap-1 ${own ? \"items-end\" : \"items-start\"}`}>\n\n <div className={`flex items-center gap-2 px-1 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}>\n <Link\n href={profileHref({ address: comment.author })}\n className=\"text-xs font-semibold text-foreground hover:underline underline-offset-2\"\n >\n {own ? t(\"You\") : <AddressDisplay address={comment.author} chars={5} showCopy={false} />}\n </Link>\n <span className=\"text-2xs text-muted-foreground\" title={comment.postedAt}>\n {timeAgo(comment.postedAt)}\n </span>\n </div>\n\n <div className=\"relative\">\n {own ? (\n <div\n className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words rounded-2xl rounded-tr-sm text-white\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {comment.content}\n </div>\n ) : (\n <div className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words bg-muted rounded-2xl rounded-tl-sm\">\n {comment.content}\n </div>\n )}\n {!own && hasWallet && (\n <button\n className=\"absolute -top-1 -right-5 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground/40 hover:text-destructive/70\"\n title={t(\"Report comment\")}\n aria-label={t(\"Report comment\")}\n onClick={() => setReportTarget({ type: \"COMMENT\", commentId: comment.id })}\n >\n <Flag className=\"h-3 w-3\" />\n </button>\n )}\n </div>\n\n {comment.txHash && (\n <a\n href={`${EXPLORER_URL}/tx/${comment.txHash}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 px-1 text-2xs font-medium transition-colors\"\n style={{ color: \"hsl(var(--brand-blue) / 0.55)\" }}\n onMouseEnter={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue))\")}\n onMouseLeave={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue) / 0.55)\")}\n >\n <span>⛓</span>\n <span>{t(\"onchain proof\")}</span>\n <ExternalLink className=\"h-2.5 w-2.5\" />\n </a>\n )}\n </div>\n </div>\n );\n })}\n <div ref={bottomRef} />\n </div>\n )}\n </div>\n\n <div className=\"border-t border-border/60 shrink-0\">\n {!hasWallet ? (\n <div className=\"flex items-center justify-center px-4 h-16\">\n <button type=\"button\" onClick={app.onRequireWallet} className=\"text-sm text-primary hover:underline\">\n {app.connectLabel ?? t(\"Connect\")} {t(\"to comment\")}\n </button>\n </div>\n ) : (\n <div className=\"px-3 pt-2 pb-3 space-y-2\">\n\n <div className=\"flex items-center gap-1.5\">\n <Zap className=\"h-3 w-3\" style={{ color: \"hsl(var(--brand-blue))\" }} />\n <span className=\"text-2xs font-semibold\" style={{ color: \"hsl(var(--brand-blue))\" }}>\n {t(\"Mint your message onchain\")}\n </span>\n </div>\n\n <div\n className=\"rounded-xl border bg-background/60 transition-all focus-within:ring-2\"\n style={{\n borderColor: \"hsl(var(--border))\",\n }}\n onFocusCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--brand-blue) / 0.6)\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"0 0 0 3px hsl(var(--brand-blue) / 0.12)\";\n }}\n onBlurCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--border))\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"\";\n }}\n >\n <Textarea\n ref={composeRef}\n placeholder={t(\"Say something onchain… it's permanent.\")}\n value={text}\n onChange={handleTextInput}\n onKeyDown={handleKeyDown}\n rows={2}\n className=\"resize-none min-h-[52px] max-h-[120px] w-full border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 px-3 pt-2.5 pb-1 text-sm rounded-xl\"\n disabled={isProcessing}\n />\n <div className=\"flex items-center justify-between px-3 pb-2.5\">\n <span className=\"text-2xs text-muted-foreground/40 flex items-center gap-1\">\n {t(\"Enter ↵ to post\")}\n </span>\n <div className=\"flex items-center gap-2\">\n {byteLen > 800 && (\n <span className={`text-2xs ${byteLen > MAX_LEN ? \"text-destructive\" : \"text-muted-foreground\"}`}>\n {byteLen}/{MAX_LEN}\n </span>\n )}\n <button\n onClick={post}\n disabled={!canSubmit || isProcessing}\n className=\"flex items-center gap-1.5 h-7 px-3 text-xs font-semibold rounded-full text-white transition-all hover:opacity-90 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {isProcessing ? <Loader2 className=\"h-3 w-3 animate-spin\" /> : <Send className=\"h-3 w-3\" />}\n {t(\"Post onchain\")}\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {reportTarget && (\n <ReportDialog\n target={reportTarget}\n open={!!reportTarget}\n onOpenChange={(open) => { if (!open) setReportTarget(null); }}\n />\n )}\n\n <TransactionDialog tx={tx} title={t(\"Comment\")} workingLabel=\"Posting your comment…\" firstStepLabel=\"Prepare comment\">\n <TransactionSuccess\n name=\"Comment\"\n {...successMessages.commented(t)}\n txHash={tx.txHash}\n actions={[{ label: t(\"Done\"), onClick: tx.reset }]}\n >\n <RewardEarned actionType=\"comment\" />\n </TransactionSuccess>\n </TransactionDialog>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmHc;AAjHd,mBAA4C;AAC5C,0BAAsE;AACtE,iBAA6E;AAC7E,6BAA+B;AAC/B,oBAAuB;AACvB,kBAAiB;AACjB,2BAAmD;AACnD,2BAA6B;AAC7B,2BAA6B;AAC7B,sBAAyB;AACzB,sBAAyB;AACzB,gCAAkC;AAClC,iCAAmC;AACnC,gBAAmB;AACnB,0BAA6B;AAC7B,8BAA+B;AAC/B,kBAAwB;AACxB,8BAAgC;AAChC,0BAA4B;AAC5B,6BAA+B;AAC/B,sBAAqB;AACrB,mBAA4B;AAC5B,uBAAyB;AAEzB,MAAM,UAAU;AAChB,MAAM,gBAAiB,CAAC,QAAQ,UAAU,QAAQ,UAAU,OAAO,EAAY,IAAI,CAAC,UAAU,yBAAY,KAAK,CAAC;AAQzG,SAAS,gBAAgB,EAAE,UAAU,SAAS,UAAU,GAAyB;AACtF,QAAM,QAAI,sBAAK;AACf,QAAM,UAAM,sCAAgB;AAC5B,QAAM,gBAAgB,IAAI;AAC1B,QAAM,YAAY,CAAC,CAAC;AACpB,QAAM,EAAE,UAAU,WAAW,OAAO,QAAI,iCAAY,UAAU,OAAO;AACrE,QAAM,SAAK,uCAAe;AAE1B,QAAM,CAAC,MAAM,OAAO,QAAI,uBAAS,EAAE;AACnC,QAAM,CAAC,cAAc,eAAe,QAAI,uBAA8B,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Ac;AAAA;AAAA;AAAA,gBACnB;AAAA,iBACF;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,OACF,GAEJ;AAAA,IAEC,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AAAE,cAAI,CAAC,KAAM,iBAAgB,IAAI;AAAA,QAAG;AAAA;AAAA,IAC9D;AAAA,IAGF,4CAAC,+CAAkB,IAAQ,OAAO,EAAE,SAAS,GAAG,cAAa,8BAAwB,gBAAe,mBAClG;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACJ,GAAG,wCAAgB,UAAU,CAAC;AAAA,QAC/B,QAAQ,GAAG;AAAA,QACX,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAAA,QAEjD,sDAAC,qCAAa,YAAW,WAAU;AAAA;AAAA,IACrC,GACF;AAAA,KACF;AAEJ;","names":["Link"]}
|
|
@@ -22,6 +22,7 @@ import { useComments } from "../utils/use-comments.js";
|
|
|
22
22
|
import { useTransaction } from "../utils/use-transaction.js";
|
|
23
23
|
import { useT } from "../i18n/provider.js";
|
|
24
24
|
import { BRAND_COLOR } from "../data/brand.js";
|
|
25
|
+
import { IconTile } from "./icon-tile.js";
|
|
25
26
|
const MAX_LEN = 1e3;
|
|
26
27
|
const AVATAR_COLORS = ["blue", "purple", "rose", "orange", "maeve"].map((color) => BRAND_COLOR[color]);
|
|
27
28
|
function CommentsSection({ contract, tokenId, className }) {
|
|
@@ -93,7 +94,7 @@ function CommentsSection({ contract, tokenId, className }) {
|
|
|
93
94
|
}
|
|
94
95
|
)
|
|
95
96
|
] }, i)) }) : comments.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-center justify-center h-full gap-4 text-center px-4", children: [
|
|
96
|
-
/* @__PURE__ */ jsx(
|
|
97
|
+
/* @__PURE__ */ jsx(IconTile, { size: "lg", children: /* @__PURE__ */ jsx(MessageCircle, {}) }),
|
|
97
98
|
/* @__PURE__ */ jsxs("div", { children: [
|
|
98
99
|
/* @__PURE__ */ jsx("p", { className: "text-sm font-semibold", children: t("Nothing here yet") }),
|
|
99
100
|
/* @__PURE__ */ jsx("p", { className: "text-xs text-muted-foreground mt-1 leading-relaxed max-w-[220px]", children: t("Your comment will be minted onchain \u2014 attached to this NFT forever.") })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/comments-section.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { ExternalLink, Flag, Loader2, MessageCircle, Send, Zap } from \"lucide-react\";\nimport { normalizeAddress, profileHref, STARKNET_NFTCOMMENTS_CONTRACT } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp, type ReportTarget } from \"./medialane-app.js\";\nimport { ReportDialog } from \"./report-dialog.js\";\nimport { RewardEarned } from \"./rewards/reward-earned.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { Textarea } from \"./textarea.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionSuccess } from \"./transaction-success.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport { successMessages } from \"../utils/success-messages.js\";\nimport { useComments } from \"../utils/use-comments.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { BRAND_COLOR } from \"../data/brand.js\";\n\nconst MAX_LEN = 1000;\nconst AVATAR_COLORS = ([\"blue\", \"purple\", \"rose\", \"orange\", \"maeve\"] as const).map((color) => BRAND_COLOR[color]);\n\nexport interface CommentsSectionProps {\n contract: string;\n tokenId: string;\n className?: string;\n}\n\nexport function CommentsSection({ contract, tokenId, className }: CommentsSectionProps) {\n const t = useT();\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const hasWallet = !!walletAddress;\n const { comments, isLoading, mutate } = useComments(contract, tokenId);\n const tx = useTransaction();\n\n const [text, setText] = useState(\"\");\n const [reportTarget, setReportTarget] = useState<ReportTarget | null>(null);\n\n const messagesRef = useRef<HTMLDivElement>(null);\n const bottomRef = useRef<HTMLDivElement>(null);\n const composeRef = useRef<HTMLTextAreaElement>(null);\n\n const byteLen = new TextEncoder().encode(text).length;\n const canSubmit = text.trim().length > 0 && byteLen <= MAX_LEN && !!STARKNET_NFTCOMMENTS_CONTRACT;\n const isProcessing = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const isOwn = (author: string) =>\n !!walletAddress && normalizeAddress(\"STARKNET\", author) === normalizeAddress(\"STARKNET\", walletAddress);\n\n const isNearBottom = () => {\n const el = messagesRef.current;\n if (!el) return true;\n return el.scrollHeight - el.scrollTop - el.clientHeight < 100;\n };\n\n useEffect(() => {\n if (isNearBottom()) {\n bottomRef.current?.scrollIntoView({ behavior: \"smooth\" });\n }\n\n }, [comments.length]);\n\n const handleTextInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setText(e.target.value);\n e.target.style.height = \"auto\";\n e.target.style.height = Math.min(e.target.scrollHeight, 96) + \"px\";\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey && canSubmit && !isProcessing) {\n e.preventDefault();\n post();\n }\n };\n\n const post = () => {\n const body = text.trim();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"comment\", { author: signer.address, nftContract: contract, tokenId, text: body }),\n );\n })\n .then((ok) => {\n if (!ok) return;\n setText(\"\");\n if (composeRef.current) composeRef.current.style.height = \"auto\";\n void mutate();\n });\n };\n\n const handleStartConversation = () => {\n if (hasWallet) composeRef.current?.focus();\n };\n\n return (\n <div className={cn(\"flex flex-col h-[480px] overflow-hidden\", className)}>\n\n <div ref={messagesRef} className=\"flex-1 overflow-y-auto px-4 py-4\">\n {isLoading ? (\n <div className=\"space-y-4\">\n {([\n { own: false, w: \"w-40\" },\n { own: true, w: \"w-56\" },\n { own: false, w: \"w-48\" },\n { own: true, w: \"w-32\" },\n ] as const).map((item, i) => (\n <div key={i} className={`flex ${item.own ? \"justify-end\" : \"justify-start\"} gap-2`}>\n {!item.own && <Skeleton className=\"h-8 w-8 rounded-full shrink-0\" />}\n <Skeleton\n className={`h-10 ${item.w} rounded-2xl ${item.own ? \"rounded-tr-sm\" : \"rounded-tl-sm\"}`}\n />\n </div>\n ))}\n </div>\n ) : comments.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center h-full gap-4 text-center px-4\">\n <div className=\"flex h-16 w-16 items-center justify-center rounded-full\" style={{ background: \"hsl(var(--brand-blue) / 0.12)\" }}>\n <MessageCircle className=\"h-7 w-7\" style={{ color: \"hsl(var(--brand-blue))\" }} />\n </div>\n <div>\n <p className=\"text-sm font-semibold\">{t(\"Nothing here yet\")}</p>\n <p className=\"text-xs text-muted-foreground mt-1 leading-relaxed max-w-[220px]\">\n {t(\"Your comment will be minted onchain — attached to this NFT forever.\")}\n </p>\n </div>\n <Button\n size=\"sm\"\n onClick={handleStartConversation}\n className=\"rounded-full text-white px-5\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {t(\"Write the first comment\")}\n </Button>\n </div>\n ) : (\n <div className=\"space-y-5\">\n {comments.map((comment) => {\n const own = isOwn(comment.author);\n const avatarSeed = parseInt(comment.author.slice(2, 8), 16);\n const avatarBg = own\n ? \"hsl(var(--brand-blue))\"\n : AVATAR_COLORS[avatarSeed % AVATAR_COLORS.length];\n\n return (\n <div\n key={comment.id}\n className={`group flex gap-2.5 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}\n >\n\n <Link href={profileHref({ address: comment.author })} className=\"shrink-0 mt-0.5\">\n <div\n className=\"h-9 w-9 rounded-full flex items-center justify-center text-2xs font-bold text-white select-none ring-2 ring-background hover:ring-primary/40 transition-all\"\n style={{ background: avatarBg }}\n >\n {comment.author.slice(2, 5).toUpperCase()}\n </div>\n </Link>\n\n <div className={`flex flex-col max-w-[75%] gap-1 ${own ? \"items-end\" : \"items-start\"}`}>\n\n <div className={`flex items-center gap-2 px-1 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}>\n <Link\n href={profileHref({ address: comment.author })}\n className=\"text-xs font-semibold text-foreground hover:underline underline-offset-2\"\n >\n {own ? t(\"You\") : <AddressDisplay address={comment.author} chars={5} showCopy={false} />}\n </Link>\n <span className=\"text-2xs text-muted-foreground\" title={comment.postedAt}>\n {timeAgo(comment.postedAt)}\n </span>\n </div>\n\n <div className=\"relative\">\n {own ? (\n <div\n className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words rounded-2xl rounded-tr-sm text-white\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {comment.content}\n </div>\n ) : (\n <div className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words bg-muted rounded-2xl rounded-tl-sm\">\n {comment.content}\n </div>\n )}\n {!own && hasWallet && (\n <button\n className=\"absolute -top-1 -right-5 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground/40 hover:text-destructive/70\"\n title={t(\"Report comment\")}\n aria-label={t(\"Report comment\")}\n onClick={() => setReportTarget({ type: \"COMMENT\", commentId: comment.id })}\n >\n <Flag className=\"h-3 w-3\" />\n </button>\n )}\n </div>\n\n {comment.txHash && (\n <a\n href={`${EXPLORER_URL}/tx/${comment.txHash}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 px-1 text-2xs font-medium transition-colors\"\n style={{ color: \"hsl(var(--brand-blue) / 0.55)\" }}\n onMouseEnter={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue))\")}\n onMouseLeave={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue) / 0.55)\")}\n >\n <span>⛓</span>\n <span>{t(\"onchain proof\")}</span>\n <ExternalLink className=\"h-2.5 w-2.5\" />\n </a>\n )}\n </div>\n </div>\n );\n })}\n <div ref={bottomRef} />\n </div>\n )}\n </div>\n\n <div className=\"border-t border-border/60 shrink-0\">\n {!hasWallet ? (\n <div className=\"flex items-center justify-center px-4 h-16\">\n <button type=\"button\" onClick={app.onRequireWallet} className=\"text-sm text-primary hover:underline\">\n {app.connectLabel ?? t(\"Connect\")} {t(\"to comment\")}\n </button>\n </div>\n ) : (\n <div className=\"px-3 pt-2 pb-3 space-y-2\">\n\n <div className=\"flex items-center gap-1.5\">\n <Zap className=\"h-3 w-3\" style={{ color: \"hsl(var(--brand-blue))\" }} />\n <span className=\"text-2xs font-semibold\" style={{ color: \"hsl(var(--brand-blue))\" }}>\n {t(\"Mint your message onchain\")}\n </span>\n </div>\n\n <div\n className=\"rounded-xl border bg-background/60 transition-all focus-within:ring-2\"\n style={{\n borderColor: \"hsl(var(--border))\",\n }}\n onFocusCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--brand-blue) / 0.6)\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"0 0 0 3px hsl(var(--brand-blue) / 0.12)\";\n }}\n onBlurCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--border))\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"\";\n }}\n >\n <Textarea\n ref={composeRef}\n placeholder={t(\"Say something onchain… it's permanent.\")}\n value={text}\n onChange={handleTextInput}\n onKeyDown={handleKeyDown}\n rows={2}\n className=\"resize-none min-h-[52px] max-h-[120px] w-full border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 px-3 pt-2.5 pb-1 text-sm rounded-xl\"\n disabled={isProcessing}\n />\n <div className=\"flex items-center justify-between px-3 pb-2.5\">\n <span className=\"text-2xs text-muted-foreground/40 flex items-center gap-1\">\n {t(\"Enter ↵ to post\")}\n </span>\n <div className=\"flex items-center gap-2\">\n {byteLen > 800 && (\n <span className={`text-2xs ${byteLen > MAX_LEN ? \"text-destructive\" : \"text-muted-foreground\"}`}>\n {byteLen}/{MAX_LEN}\n </span>\n )}\n <button\n onClick={post}\n disabled={!canSubmit || isProcessing}\n className=\"flex items-center gap-1.5 h-7 px-3 text-xs font-semibold rounded-full text-white transition-all hover:opacity-90 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {isProcessing ? <Loader2 className=\"h-3 w-3 animate-spin\" /> : <Send className=\"h-3 w-3\" />}\n {t(\"Post onchain\")}\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {reportTarget && (\n <ReportDialog\n target={reportTarget}\n open={!!reportTarget}\n onOpenChange={(open) => { if (!open) setReportTarget(null); }}\n />\n )}\n\n <TransactionDialog tx={tx} title={t(\"Comment\")} workingLabel=\"Posting your comment…\" firstStepLabel=\"Prepare comment\">\n <TransactionSuccess\n name=\"Comment\"\n {...successMessages.commented(t)}\n txHash={tx.txHash}\n actions={[{ label: t(\"Done\"), onClick: tx.reset }]}\n >\n <RewardEarned actionType=\"comment\" />\n </TransactionSuccess>\n </TransactionDialog>\n </div>\n );\n}\n"],"mappings":";AAkHc,SACgB,KADhB;AAhHd,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,cAAc,MAAM,SAAS,eAAe,MAAM,WAAW;AACtE,SAAS,kBAAkB,aAAa,qCAAqC;AAC7E,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,OAAO,UAAU;AACjB,SAAS,uBAA0C;AACnD,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AACxB,SA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,"sources":["../../src/components/comments-section.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useRef, useState } from \"react\";\nimport { ExternalLink, Flag, Loader2, MessageCircle, Send, Zap } from \"lucide-react\";\nimport { normalizeAddress, profileHref, STARKNET_NFTCOMMENTS_CONTRACT } from \"@medialane/sdk\";\nimport { AddressDisplay } from \"./address-display.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { useMedialaneApp, type ReportTarget } from \"./medialane-app.js\";\nimport { ReportDialog } from \"./report-dialog.js\";\nimport { RewardEarned } from \"./rewards/reward-earned.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { Textarea } from \"./textarea.js\";\nimport { TransactionDialog } from \"./transaction-dialog.js\";\nimport { TransactionSuccess } from \"./transaction-success.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\nimport { runIntentCalls } from \"../utils/run-intent-calls.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport { successMessages } from \"../utils/success-messages.js\";\nimport { useComments } from \"../utils/use-comments.js\";\nimport { useTransaction } from \"../utils/use-transaction.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { BRAND_COLOR } from \"../data/brand.js\";\nimport { IconTile } from \"./icon-tile.js\";\n\nconst MAX_LEN = 1000;\nconst AVATAR_COLORS = ([\"blue\", \"purple\", \"rose\", \"orange\", \"maeve\"] as const).map((color) => BRAND_COLOR[color]);\n\nexport interface CommentsSectionProps {\n contract: string;\n tokenId: string;\n className?: string;\n}\n\nexport function CommentsSection({ contract, tokenId, className }: CommentsSectionProps) {\n const t = useT();\n const app = useMedialaneApp();\n const walletAddress = app.walletAddress;\n const hasWallet = !!walletAddress;\n const { comments, isLoading, mutate } = useComments(contract, tokenId);\n const tx = useTransaction();\n\n const [text, setText] = useState(\"\");\n const [reportTarget, setReportTarget] = useState<ReportTarget | null>(null);\n\n const messagesRef = useRef<HTMLDivElement>(null);\n const bottomRef = useRef<HTMLDivElement>(null);\n const composeRef = useRef<HTMLTextAreaElement>(null);\n\n const byteLen = new TextEncoder().encode(text).length;\n const canSubmit = text.trim().length > 0 && byteLen <= MAX_LEN && !!STARKNET_NFTCOMMENTS_CONTRACT;\n const isProcessing = tx.phase === \"preparing\" || tx.phase === \"submitting\" || tx.phase === \"confirming\";\n\n const isOwn = (author: string) =>\n !!walletAddress && normalizeAddress(\"STARKNET\", author) === normalizeAddress(\"STARKNET\", walletAddress);\n\n const isNearBottom = () => {\n const el = messagesRef.current;\n if (!el) return true;\n return el.scrollHeight - el.scrollTop - el.clientHeight < 100;\n };\n\n useEffect(() => {\n if (isNearBottom()) {\n bottomRef.current?.scrollIntoView({ behavior: \"smooth\" });\n }\n\n }, [comments.length]);\n\n const handleTextInput = (e: React.ChangeEvent<HTMLTextAreaElement>) => {\n setText(e.target.value);\n e.target.style.height = \"auto\";\n e.target.style.height = Math.min(e.target.scrollHeight, 96) + \"px\";\n };\n\n const handleKeyDown = (e: React.KeyboardEvent<HTMLTextAreaElement>) => {\n if (e.key === \"Enter\" && !e.shiftKey && canSubmit && !isProcessing) {\n e.preventDefault();\n post();\n }\n };\n\n const post = () => {\n const body = text.trim();\n void tx\n .run(async (signer) => {\n await runIntentCalls(signer, () =>\n app.getClient().api.intents.create(\"comment\", { author: signer.address, nftContract: contract, tokenId, text: body }),\n );\n })\n .then((ok) => {\n if (!ok) return;\n setText(\"\");\n if (composeRef.current) composeRef.current.style.height = \"auto\";\n void mutate();\n });\n };\n\n const handleStartConversation = () => {\n if (hasWallet) composeRef.current?.focus();\n };\n\n return (\n <div className={cn(\"flex flex-col h-[480px] overflow-hidden\", className)}>\n\n <div ref={messagesRef} className=\"flex-1 overflow-y-auto px-4 py-4\">\n {isLoading ? (\n <div className=\"space-y-4\">\n {([\n { own: false, w: \"w-40\" },\n { own: true, w: \"w-56\" },\n { own: false, w: \"w-48\" },\n { own: true, w: \"w-32\" },\n ] as const).map((item, i) => (\n <div key={i} className={`flex ${item.own ? \"justify-end\" : \"justify-start\"} gap-2`}>\n {!item.own && <Skeleton className=\"h-8 w-8 rounded-full shrink-0\" />}\n <Skeleton\n className={`h-10 ${item.w} rounded-2xl ${item.own ? \"rounded-tr-sm\" : \"rounded-tl-sm\"}`}\n />\n </div>\n ))}\n </div>\n ) : comments.length === 0 ? (\n <div className=\"flex flex-col items-center justify-center h-full gap-4 text-center px-4\">\n <IconTile size=\"lg\">\n <MessageCircle />\n </IconTile>\n <div>\n <p className=\"text-sm font-semibold\">{t(\"Nothing here yet\")}</p>\n <p className=\"text-xs text-muted-foreground mt-1 leading-relaxed max-w-[220px]\">\n {t(\"Your comment will be minted onchain — attached to this NFT forever.\")}\n </p>\n </div>\n <Button\n size=\"sm\"\n onClick={handleStartConversation}\n className=\"rounded-full text-white px-5\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {t(\"Write the first comment\")}\n </Button>\n </div>\n ) : (\n <div className=\"space-y-5\">\n {comments.map((comment) => {\n const own = isOwn(comment.author);\n const avatarSeed = parseInt(comment.author.slice(2, 8), 16);\n const avatarBg = own\n ? \"hsl(var(--brand-blue))\"\n : AVATAR_COLORS[avatarSeed % AVATAR_COLORS.length];\n\n return (\n <div\n key={comment.id}\n className={`group flex gap-2.5 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}\n >\n\n <Link href={profileHref({ address: comment.author })} className=\"shrink-0 mt-0.5\">\n <div\n className=\"h-9 w-9 rounded-full flex items-center justify-center text-2xs font-bold text-white select-none ring-2 ring-background hover:ring-primary/40 transition-all\"\n style={{ background: avatarBg }}\n >\n {comment.author.slice(2, 5).toUpperCase()}\n </div>\n </Link>\n\n <div className={`flex flex-col max-w-[75%] gap-1 ${own ? \"items-end\" : \"items-start\"}`}>\n\n <div className={`flex items-center gap-2 px-1 ${own ? \"flex-row-reverse\" : \"flex-row\"}`}>\n <Link\n href={profileHref({ address: comment.author })}\n className=\"text-xs font-semibold text-foreground hover:underline underline-offset-2\"\n >\n {own ? t(\"You\") : <AddressDisplay address={comment.author} chars={5} showCopy={false} />}\n </Link>\n <span className=\"text-2xs text-muted-foreground\" title={comment.postedAt}>\n {timeAgo(comment.postedAt)}\n </span>\n </div>\n\n <div className=\"relative\">\n {own ? (\n <div\n className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words rounded-2xl rounded-tr-sm text-white\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {comment.content}\n </div>\n ) : (\n <div className=\"px-3.5 py-2.5 text-sm leading-relaxed break-words bg-muted rounded-2xl rounded-tl-sm\">\n {comment.content}\n </div>\n )}\n {!own && hasWallet && (\n <button\n className=\"absolute -top-1 -right-5 opacity-0 group-hover:opacity-100 transition-opacity text-muted-foreground/40 hover:text-destructive/70\"\n title={t(\"Report comment\")}\n aria-label={t(\"Report comment\")}\n onClick={() => setReportTarget({ type: \"COMMENT\", commentId: comment.id })}\n >\n <Flag className=\"h-3 w-3\" />\n </button>\n )}\n </div>\n\n {comment.txHash && (\n <a\n href={`${EXPLORER_URL}/tx/${comment.txHash}`}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-1 px-1 text-2xs font-medium transition-colors\"\n style={{ color: \"hsl(var(--brand-blue) / 0.55)\" }}\n onMouseEnter={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue))\")}\n onMouseLeave={(e) => (e.currentTarget.style.color = \"hsl(var(--brand-blue) / 0.55)\")}\n >\n <span>⛓</span>\n <span>{t(\"onchain proof\")}</span>\n <ExternalLink className=\"h-2.5 w-2.5\" />\n </a>\n )}\n </div>\n </div>\n );\n })}\n <div ref={bottomRef} />\n </div>\n )}\n </div>\n\n <div className=\"border-t border-border/60 shrink-0\">\n {!hasWallet ? (\n <div className=\"flex items-center justify-center px-4 h-16\">\n <button type=\"button\" onClick={app.onRequireWallet} className=\"text-sm text-primary hover:underline\">\n {app.connectLabel ?? t(\"Connect\")} {t(\"to comment\")}\n </button>\n </div>\n ) : (\n <div className=\"px-3 pt-2 pb-3 space-y-2\">\n\n <div className=\"flex items-center gap-1.5\">\n <Zap className=\"h-3 w-3\" style={{ color: \"hsl(var(--brand-blue))\" }} />\n <span className=\"text-2xs font-semibold\" style={{ color: \"hsl(var(--brand-blue))\" }}>\n {t(\"Mint your message onchain\")}\n </span>\n </div>\n\n <div\n className=\"rounded-xl border bg-background/60 transition-all focus-within:ring-2\"\n style={{\n borderColor: \"hsl(var(--border))\",\n }}\n onFocusCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--brand-blue) / 0.6)\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"0 0 0 3px hsl(var(--brand-blue) / 0.12)\";\n }}\n onBlurCapture={(e) => {\n (e.currentTarget as HTMLDivElement).style.borderColor = \"hsl(var(--border))\";\n (e.currentTarget as HTMLDivElement).style.boxShadow = \"\";\n }}\n >\n <Textarea\n ref={composeRef}\n placeholder={t(\"Say something onchain… it's permanent.\")}\n value={text}\n onChange={handleTextInput}\n onKeyDown={handleKeyDown}\n rows={2}\n className=\"resize-none min-h-[52px] max-h-[120px] w-full border-0 bg-transparent focus-visible:ring-0 focus-visible:ring-offset-0 px-3 pt-2.5 pb-1 text-sm rounded-xl\"\n disabled={isProcessing}\n />\n <div className=\"flex items-center justify-between px-3 pb-2.5\">\n <span className=\"text-2xs text-muted-foreground/40 flex items-center gap-1\">\n {t(\"Enter ↵ to post\")}\n </span>\n <div className=\"flex items-center gap-2\">\n {byteLen > 800 && (\n <span className={`text-2xs ${byteLen > MAX_LEN ? \"text-destructive\" : \"text-muted-foreground\"}`}>\n {byteLen}/{MAX_LEN}\n </span>\n )}\n <button\n onClick={post}\n disabled={!canSubmit || isProcessing}\n className=\"flex items-center gap-1.5 h-7 px-3 text-xs font-semibold rounded-full text-white transition-all hover:opacity-90 active:scale-95 disabled:opacity-40 disabled:cursor-not-allowed\"\n style={{ background: \"hsl(var(--brand-blue))\" }}\n >\n {isProcessing ? <Loader2 className=\"h-3 w-3 animate-spin\" /> : <Send className=\"h-3 w-3\" />}\n {t(\"Post onchain\")}\n </button>\n </div>\n </div>\n </div>\n </div>\n )}\n </div>\n\n {reportTarget && (\n <ReportDialog\n target={reportTarget}\n open={!!reportTarget}\n onOpenChange={(open) => { if (!open) setReportTarget(null); }}\n />\n )}\n\n <TransactionDialog tx={tx} title={t(\"Comment\")} workingLabel=\"Posting your comment…\" firstStepLabel=\"Prepare comment\">\n <TransactionSuccess\n name=\"Comment\"\n {...successMessages.commented(t)}\n txHash={tx.txHash}\n actions={[{ label: t(\"Done\"), onClick: tx.reset }]}\n >\n <RewardEarned actionType=\"comment\" />\n </TransactionSuccess>\n </TransactionDialog>\n </div>\n );\n}\n"],"mappings":";AAmHc,SACgB,KADhB;AAjHd,SAAS,WAAW,QAAQ,gBAAgB;AAC5C,SAAS,cAAc,MAAM,SAAS,eAAe,MAAM,WAAW;AACtE,SAAS,kBAAkB,aAAa,qCAAqC;AAC7E,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB,OAAO,UAAU;AACjB,SAAS,uBAA0C;AACnD,SAAS,oBAAoB;AAC7B,SAAS,oBAAoB;AAC7B,SAAS,gBAAgB;AACzB,SAAS,gBAAgB;AACzB,SAAS,yBAAyB;AAClC,SAAS,0BAA0B;AACnC,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,sBAAsB;AAC/B,SAAS,eAAe;AACxB,SAAS,uBAAuB;AAChC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAC/B,SAAS,YAAY;AACrB,SAAS,mBAAmB;AAC5B,SAAS,gBAAgB;AAEzB,MAAM,UAAU;AAChB,MAAM,gBAAiB,CAAC,QAAQ,UAAU,QAAQ,UAAU,OAAO,EAAY,IAAI,CAAC,UAAU,YAAY,KAAK,CAAC;AAQzG,SAAS,gBAAgB,EAAE,UAAU,SAAS,UAAU,GAAyB;AACtF,QAAM,IAAI,KAAK;AACf,QAAM,MAAM,gBAAgB;AAC5B,QAAM,gBAAgB,IAAI;AAC1B,Q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AU;AAAA,oBACV,OAAO,EAAE,YAAY,yBAAyB;AAAA,oBAE7C;AAAA,qCAAe,oBAAC,WAAQ,WAAU,wBAAuB,IAAK,oBAAC,QAAK,WAAU,WAAU;AAAA,sBACxF,EAAE,cAAc;AAAA;AAAA;AAAA,gBACnB;AAAA,iBACF;AAAA,eACF;AAAA;AAAA;AAAA,MACF;AAAA,OACF,GAEJ;AAAA,IAEC,gBACC;AAAA,MAAC;AAAA;AAAA,QACC,QAAQ;AAAA,QACR,MAAM,CAAC,CAAC;AAAA,QACR,cAAc,CAAC,SAAS;AAAE,cAAI,CAAC,KAAM,iBAAgB,IAAI;AAAA,QAAG;AAAA;AAAA,IAC9D;AAAA,IAGF,oBAAC,qBAAkB,IAAQ,OAAO,EAAE,SAAS,GAAG,cAAa,8BAAwB,gBAAe,mBAClG;AAAA,MAAC;AAAA;AAAA,QACC,MAAK;AAAA,QACJ,GAAG,gBAAgB,UAAU,CAAC;AAAA,QAC/B,QAAQ,GAAG;AAAA,QACX,SAAS,CAAC,EAAE,OAAO,EAAE,MAAM,GAAG,SAAS,GAAG,MAAM,CAAC;AAAA,QAEjD,8BAAC,gBAAa,YAAW,WAAU;AAAA;AAAA,IACrC,GACF;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -28,12 +28,13 @@ var import_scroll_section = require("./scroll-section.js");
|
|
|
28
28
|
var import_cn = require("../utils/cn.js");
|
|
29
29
|
var import_provider = require("../i18n/provider.js");
|
|
30
30
|
var import_translate = require("../i18n/translate.js");
|
|
31
|
+
var import_icon_tile = require("./icon-tile.js");
|
|
31
32
|
const HUES = [
|
|
32
|
-
{
|
|
33
|
-
{
|
|
34
|
-
{
|
|
35
|
-
{
|
|
36
|
-
{
|
|
33
|
+
{ border: "border-brand-blue/30" },
|
|
34
|
+
{ border: "border-brand-maeve/30" },
|
|
35
|
+
{ border: "border-brand-orange/30" },
|
|
36
|
+
{ border: "border-brand-purple/30" },
|
|
37
|
+
{ border: "border-brand-rose/30" }
|
|
37
38
|
];
|
|
38
39
|
const FEATURES = [
|
|
39
40
|
{ icon: import_lucide_react.HandCoins, title: (0, import_translate.msg)("Creator-first economy"), description: (0, import_translate.msg)("99% to creators/owners + 1% fee goes to the Creator Fund Airdrop.") },
|
|
@@ -62,7 +63,7 @@ function DiscoverFeatures() {
|
|
|
62
63
|
hue.border
|
|
63
64
|
),
|
|
64
65
|
children: [
|
|
65
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
66
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_tile.IconTile, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {}) }),
|
|
66
67
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col gap-1.5", children: [
|
|
67
68
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "text-lg font-black leading-snug tracking-tight", children: t(title) }),
|
|
68
69
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm leading-relaxed text-muted-foreground", children: t(description) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/discover-features.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n BadgeCheck,\n Code,\n Database,\n DoorOpen,\n EyeOff,\n FileCog,\n Gem,\n Globe,\n HandCoins,\n Lock,\n Percent,\n ScanEye,\n Scale,\n ShieldCheck,\n type LucideIcon,\n} from \"lucide-react\";\nimport { ScrollSection } from \"./scroll-section.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { msg } from \"../i18n/translate.js\";\n\nconst HUES = [\n {
|
|
1
|
+
{"version":3,"sources":["../../src/components/discover-features.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n BadgeCheck,\n Code,\n Database,\n DoorOpen,\n EyeOff,\n FileCog,\n Gem,\n Globe,\n HandCoins,\n Lock,\n Percent,\n ScanEye,\n Scale,\n ShieldCheck,\n type LucideIcon,\n} from \"lucide-react\";\nimport { ScrollSection } from \"./scroll-section.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { msg } from \"../i18n/translate.js\";\nimport { IconTile } from \"./icon-tile.js\";\n\nconst HUES = [\n { border: \"border-brand-blue/30\" },\n { border: \"border-brand-maeve/30\" },\n { border: \"border-brand-orange/30\" },\n { border: \"border-brand-purple/30\" },\n { border: \"border-brand-rose/30\" },\n];\n\nconst FEATURES: ReadonlyArray<{ icon: LucideIcon; title: string; description: string }> = [\n { icon: HandCoins, title: msg(\"Creator-first economy\"), description: msg(\"99% to creators/owners + 1% fee goes to the Creator Fund Airdrop.\") },\n { icon: Globe, title: msg(\"Censorship resistance\"), description: msg(\"Assets and ownership live onchain on decentralized networks.\") },\n { icon: ShieldCheck, title: msg(\"Stark cryptography\"), description: msg(\"All transactions are secured onchain by mathematical proofs.\") },\n { icon: EyeOff, title: msg(\"Privacy by design\"), description: msg(\"Medialane is designed for user privacy and sovereignty.\") },\n { icon: ScanEye, title: msg(\"Zero knowledge\"), description: msg(\"Information can be proven valid without revealing the data behind it.\") },\n { icon: Percent, title: msg(\"Zero-fee protocols\"), description: msg(\"The smart contracts charge zero fees for interaction.\") },\n { icon: Lock, title: msg(\"Immutable contracts\"), description: msg(\"All smart contracts are fully open source and immutable.\") },\n { icon: DoorOpen, title: msg(\"Permissionless\"), description: msg(\"Anyone can create, trade and interact with onchain protocols.\") },\n { icon: Database, title: msg(\"Onchain as the source of truth\"), description: msg(\"Assets, ownership, markets and data are read directly onchain.\") },\n { icon: FileCog, title: msg(\"Programmable IP\"), description: msg(\"Licensing terms and rights are stored with the assets.\") },\n { icon: Gem, title: msg(\"Decentralized portfolio\"), description: msg(\"Assets are stored onchain with licensing and metadata on IPFS.\") },\n { icon: Scale, title: msg(\"Protection compliance\"), description: msg(\"Authorship and license are protected under international laws.\") },\n { icon: Code, title: msg(\"Open source and auditable\"), description: msg(\"The code is public to audit, review and collaborate on.\") },\n];\n\nexport function DiscoverFeatures() {\n const t = useT();\n return (\n <ScrollSection icon={<BadgeCheck />} title={t(\"Medialane features\")}>\n {FEATURES.map(({ icon: Icon, title, description }, i) => {\n const hue = HUES[i % HUES.length]!;\n return (\n <div\n key={title}\n className={cn(\n \"panel flex min-h-[168px] w-56 shrink-0 snap-start flex-col gap-4 p-6 sm:w-64\",\n hue.border,\n )}\n >\n <IconTile>\n <Icon />\n </IconTile>\n <div className=\"flex flex-col gap-1.5\">\n <h3 className=\"text-lg font-black leading-snug tracking-tight\">{t(title)}</h3>\n <p className=\"text-sm leading-relaxed text-muted-foreground\">{t(description)}</p>\n </div>\n </div>\n );\n })}\n </ScrollSection>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoDyB;AAlDzB,0BAgBO;AACP,4BAA8B;AAC9B,gBAAmB;AACnB,sBAAqB;AACrB,uBAAoB;AACpB,uBAAyB;AAEzB,MAAM,OAAO;AAAA,EACX,EAAE,QAAQ,uBAAuB;AAAA,EACjC,EAAE,QAAQ,wBAAwB;AAAA,EAClC,EAAE,QAAQ,yBAAyB;AAAA,EACnC,EAAE,QAAQ,yBAAyB;AAAA,EACnC,EAAE,QAAQ,uBAAuB;AACnC;AAEA,MAAM,WAAoF;AAAA,EACxF,EAAE,MAAM,+BAAW,WAAO,sBAAI,uBAAuB,GAAG,iBAAa,sBAAI,mEAAmE,EAAE;AAAA,EAC9I,EAAE,MAAM,2BAAO,WAAO,sBAAI,uBAAuB,GAAG,iBAAa,sBAAI,8DAA8D,EAAE;AAAA,EACrI,EAAE,MAAM,iCAAa,WAAO,sBAAI,oBAAoB,GAAG,iBAAa,sBAAI,8DAA8D,EAAE;AAAA,EACxI,EAAE,MAAM,4BAAQ,WAAO,sBAAI,mBAAmB,GAAG,iBAAa,sBAAI,yDAAyD,EAAE;AAAA,EAC7H,EAAE,MAAM,6BAAS,WAAO,sBAAI,gBAAgB,GAAG,iBAAa,sBAAI,u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E;AAAA,aAC/E;AAAA;AAAA;AAAA,MAZK;AAAA,IAaP;AAAA,EAEJ,CAAC,GACH;AAEJ;","names":[]}
|
|
@@ -20,12 +20,13 @@ import { ScrollSection } from "./scroll-section.js";
|
|
|
20
20
|
import { cn } from "../utils/cn.js";
|
|
21
21
|
import { useT } from "../i18n/provider.js";
|
|
22
22
|
import { msg } from "../i18n/translate.js";
|
|
23
|
+
import { IconTile } from "./icon-tile.js";
|
|
23
24
|
const HUES = [
|
|
24
|
-
{
|
|
25
|
-
{
|
|
26
|
-
{
|
|
27
|
-
{
|
|
28
|
-
{
|
|
25
|
+
{ border: "border-brand-blue/30" },
|
|
26
|
+
{ border: "border-brand-maeve/30" },
|
|
27
|
+
{ border: "border-brand-orange/30" },
|
|
28
|
+
{ border: "border-brand-purple/30" },
|
|
29
|
+
{ border: "border-brand-rose/30" }
|
|
29
30
|
];
|
|
30
31
|
const FEATURES = [
|
|
31
32
|
{ icon: HandCoins, title: msg("Creator-first economy"), description: msg("99% to creators/owners + 1% fee goes to the Creator Fund Airdrop.") },
|
|
@@ -54,7 +55,7 @@ function DiscoverFeatures() {
|
|
|
54
55
|
hue.border
|
|
55
56
|
),
|
|
56
57
|
children: [
|
|
57
|
-
/* @__PURE__ */ jsx(
|
|
58
|
+
/* @__PURE__ */ jsx(IconTile, { children: /* @__PURE__ */ jsx(Icon, {}) }),
|
|
58
59
|
/* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-1.5", children: [
|
|
59
60
|
/* @__PURE__ */ jsx("h3", { className: "text-lg font-black leading-snug tracking-tight", children: t(title) }),
|
|
60
61
|
/* @__PURE__ */ jsx("p", { className: "text-sm leading-relaxed text-muted-foreground", children: t(description) })
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/discover-features.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n BadgeCheck,\n Code,\n Database,\n DoorOpen,\n EyeOff,\n FileCog,\n Gem,\n Globe,\n HandCoins,\n Lock,\n Percent,\n ScanEye,\n Scale,\n ShieldCheck,\n type LucideIcon,\n} from \"lucide-react\";\nimport { ScrollSection } from \"./scroll-section.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { msg } from \"../i18n/translate.js\";\n\nconst HUES = [\n {
|
|
1
|
+
{"version":3,"sources":["../../src/components/discover-features.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n BadgeCheck,\n Code,\n Database,\n DoorOpen,\n EyeOff,\n FileCog,\n Gem,\n Globe,\n HandCoins,\n Lock,\n Percent,\n ScanEye,\n Scale,\n ShieldCheck,\n type LucideIcon,\n} from \"lucide-react\";\nimport { ScrollSection } from \"./scroll-section.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { msg } from \"../i18n/translate.js\";\nimport { IconTile } from \"./icon-tile.js\";\n\nconst HUES = [\n { border: \"border-brand-blue/30\" },\n { border: \"border-brand-maeve/30\" },\n { border: \"border-brand-orange/30\" },\n { border: \"border-brand-purple/30\" },\n { border: \"border-brand-rose/30\" },\n];\n\nconst FEATURES: ReadonlyArray<{ icon: LucideIcon; title: string; description: string }> = [\n { icon: HandCoins, title: msg(\"Creator-first economy\"), description: msg(\"99% to creators/owners + 1% fee goes to the Creator Fund Airdrop.\") },\n { icon: Globe, title: msg(\"Censorship resistance\"), description: msg(\"Assets and ownership live onchain on decentralized networks.\") },\n { icon: ShieldCheck, title: msg(\"Stark cryptography\"), description: msg(\"All transactions are secured onchain by mathematical proofs.\") },\n { icon: EyeOff, title: msg(\"Privacy by design\"), description: msg(\"Medialane is designed for user privacy and sovereignty.\") },\n { icon: ScanEye, title: msg(\"Zero knowledge\"), description: msg(\"Information can be proven valid without revealing the data behind it.\") },\n { icon: Percent, title: msg(\"Zero-fee protocols\"), description: msg(\"The smart contracts charge zero fees for interaction.\") },\n { icon: Lock, title: msg(\"Immutable contracts\"), description: msg(\"All smart contracts are fully open source and immutable.\") },\n { icon: DoorOpen, title: msg(\"Permissionless\"), description: msg(\"Anyone can create, trade and interact with onchain protocols.\") },\n { icon: Database, title: msg(\"Onchain as the source of truth\"), description: msg(\"Assets, ownership, markets and data are read directly onchain.\") },\n { icon: FileCog, title: msg(\"Programmable IP\"), description: msg(\"Licensing terms and rights are stored with the assets.\") },\n { icon: Gem, title: msg(\"Decentralized portfolio\"), description: msg(\"Assets are stored onchain with licensing and metadata on IPFS.\") },\n { icon: Scale, title: msg(\"Protection compliance\"), description: msg(\"Authorship and license are protected under international laws.\") },\n { icon: Code, title: msg(\"Open source and auditable\"), description: msg(\"The code is public to audit, review and collaborate on.\") },\n];\n\nexport function DiscoverFeatures() {\n const t = useT();\n return (\n <ScrollSection icon={<BadgeCheck />} title={t(\"Medialane features\")}>\n {FEATURES.map(({ icon: Icon, title, description }, i) => {\n const hue = HUES[i % HUES.length]!;\n return (\n <div\n key={title}\n className={cn(\n \"panel flex min-h-[168px] w-56 shrink-0 snap-start flex-col gap-4 p-6 sm:w-64\",\n hue.border,\n )}\n >\n <IconTile>\n <Icon />\n </IconTile>\n <div className=\"flex flex-col gap-1.5\">\n <h3 className=\"text-lg font-black leading-snug tracking-tight\">{t(title)}</h3>\n <p className=\"text-sm leading-relaxed text-muted-foreground\">{t(description)}</p>\n </div>\n </div>\n );\n })}\n </ScrollSection>\n );\n}\n"],"mappings":";AAoDyB,cAcb,YAda;AAlDzB;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,qBAAqB;AAC9B,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,WAAW;AACpB,SAAS,gBAAgB;AAEzB,MAAM,OAAO;AAAA,EACX,EAAE,QAAQ,uBAAuB;AAAA,EACjC,EAAE,QAAQ,wBAAwB;AAAA,EAClC,EAAE,QAAQ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AI,KAAK;AACf,SACE,oBAAC,iBAAc,MAAM,oBAAC,cAAW,GAAI,OAAO,EAAE,oBAAoB,GAC/D,mBAAS,IAAI,CAAC,EAAE,MAAM,MAAM,OAAO,YAAY,GAAG,MAAM;AACvD,UAAM,MAAM,KAAK,IAAI,KAAK,MAAM;AAChC,WACE;AAAA,MAAC;AAAA;AAAA,QAEC,WAAW;AAAA,UACT;AAAA,UACA,IAAI;AAAA,QACN;AAAA,QAEA;AAAA,8BAAC,YACC,8BAAC,QAAK,GACR;AAAA,UACA,qBAAC,SAAI,WAAU,yBACb;AAAA,gCAAC,QAAG,WAAU,kDAAkD,YAAE,KAAK,GAAE;AAAA,YACzE,oBAAC,OAAE,WAAU,iDAAiD,YAAE,WAAW,GAAE;AAAA,aAC/E;AAAA;AAAA;AAAA,MAZK;AAAA,IAaP;AAAA,EAEJ,CAAC,GACH;AAEJ;","names":[]}
|
|
@@ -39,6 +39,7 @@ var import_link = __toESM(require("./link.js"), 1);
|
|
|
39
39
|
var import_lucide_react = require("lucide-react");
|
|
40
40
|
var import_describe_error = require("../utils/describe-error.js");
|
|
41
41
|
var import_provider = require("../i18n/provider.js");
|
|
42
|
+
var import_icon_tile = require("./icon-tile.js");
|
|
42
43
|
function EmptyOrError({
|
|
43
44
|
isLoading,
|
|
44
45
|
error,
|
|
@@ -60,7 +61,7 @@ function EmptyOrError({
|
|
|
60
61
|
}
|
|
61
62
|
if (error) {
|
|
62
63
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "py-16 text-center space-y-4", children: [
|
|
63
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
64
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_tile.IconTile, { size: "lg", destructive: true, className: "mx-auto", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.AlertCircle, {}) }),
|
|
64
65
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground max-w-xs mx-auto", children: (0, import_describe_error.describeError)(error).message }),
|
|
65
66
|
onRetry && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_button.Button, { variant: "soft", size: "sm", onClick: onRetry, children: [
|
|
66
67
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.RefreshCw, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
@@ -70,7 +71,7 @@ function EmptyOrError({
|
|
|
70
71
|
}
|
|
71
72
|
if (isEmpty) {
|
|
72
73
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "py-16 text-center space-y-4", children: [
|
|
73
|
-
emptyIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
74
|
+
emptyIcon && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_tile.IconTile, { size: "lg", className: "mx-auto", children: emptyIcon }),
|
|
74
75
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "font-semibold text-lg", children: t(emptyTitle) }),
|
|
75
76
|
emptyDescription && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground max-w-xs mx-auto", children: t(emptyDescription) }),
|
|
76
77
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center justify-center gap-3", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/empty-or-error.tsx"],"sourcesContent":["\"use client\";\n\nimport { Skeleton } from \"./skeleton.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { RefreshCw, AlertCircle } from \"lucide-react\";\nimport { ReactNode } from \"react\";\nimport { describeError } from \"../utils/describe-error.js\";\nimport { useT } from \"../i18n/provider.js\";\n\ninterface EmptyOrErrorProps {\n isLoading: boolean;\n error?: unknown;\n isEmpty: boolean;\n onRetry?: () => void;\n emptyTitle: string;\n emptyDescription?: string;\n emptyCta?: { label: string; href: string };\n emptyActions?: ReactNode;\n emptyIcon?: ReactNode;\n skeletonCount?: number;\n\n skeletonNode?: ReactNode;\n children?: ReactNode;\n}\n\nexport function EmptyOrError({\n isLoading,\n error,\n isEmpty,\n onRetry,\n emptyTitle,\n emptyDescription,\n emptyCta,\n emptyActions,\n emptyIcon,\n skeletonCount = 4,\n skeletonNode,\n children,\n}: EmptyOrErrorProps) {\n const t = useT();\n if (isLoading) {\n if (skeletonNode) return <>{skeletonNode}</>;\n return (\n <div className=\"space-y-3\">\n {Array.from({ length: skeletonCount }).map((_, i) => (\n <Skeleton key={i} className=\"h-20 w-full rounded-xl\" />\n ))}\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n <
|
|
1
|
+
{"version":3,"sources":["../../src/components/empty-or-error.tsx"],"sourcesContent":["\"use client\";\n\nimport { Skeleton } from \"./skeleton.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { RefreshCw, AlertCircle } from \"lucide-react\";\nimport { ReactNode } from \"react\";\nimport { describeError } from \"../utils/describe-error.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { IconTile } from \"./icon-tile.js\";\n\ninterface EmptyOrErrorProps {\n isLoading: boolean;\n error?: unknown;\n isEmpty: boolean;\n onRetry?: () => void;\n emptyTitle: string;\n emptyDescription?: string;\n emptyCta?: { label: string; href: string };\n emptyActions?: ReactNode;\n emptyIcon?: ReactNode;\n skeletonCount?: number;\n\n skeletonNode?: ReactNode;\n children?: ReactNode;\n}\n\nexport function EmptyOrError({\n isLoading,\n error,\n isEmpty,\n onRetry,\n emptyTitle,\n emptyDescription,\n emptyCta,\n emptyActions,\n emptyIcon,\n skeletonCount = 4,\n skeletonNode,\n children,\n}: EmptyOrErrorProps) {\n const t = useT();\n if (isLoading) {\n if (skeletonNode) return <>{skeletonNode}</>;\n return (\n <div className=\"space-y-3\">\n {Array.from({ length: skeletonCount }).map((_, i) => (\n <Skeleton key={i} className=\"h-20 w-full rounded-xl\" />\n ))}\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n <IconTile size=\"lg\" destructive className=\"mx-auto\">\n <AlertCircle />\n </IconTile>\n <p className=\"text-sm text-muted-foreground max-w-xs mx-auto\">\n {describeError(error).message}\n </p>\n {onRetry && (\n <Button variant=\"soft\" size=\"sm\" onClick={onRetry}>\n <RefreshCw className=\"h-3.5 w-3.5 mr-1.5\" />\n {t(\"Try again\")}\n </Button>\n )}\n </div>\n );\n }\n\n if (isEmpty) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n {emptyIcon && (\n <IconTile size=\"lg\" className=\"mx-auto\">\n {emptyIcon}\n </IconTile>\n )}\n <p className=\"font-semibold text-lg\">{t(emptyTitle)}</p>\n {emptyDescription && (\n <p className=\"text-sm text-muted-foreground max-w-xs mx-auto\">{t(emptyDescription)}</p>\n )}\n <div className=\"flex items-center justify-center gap-3\">\n {onRetry && (\n <Button variant=\"soft\" size=\"sm\" onClick={onRetry}>\n <RefreshCw className=\"h-3.5 w-3.5 mr-1.5\" />\n {t(\"Refresh\")}\n </Button>\n )}\n {emptyCta && (\n <Button size=\"sm\" asChild>\n <Link href={emptyCta.href}>{t(emptyCta.label)}</Link>\n </Button>\n )}\n </div>\n {emptyActions}\n </div>\n );\n }\n\n return <>{children}</>;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA2C6B;AAzC7B,sBAAyB;AACzB,oBAAuB;AACvB,kBAAiB;AACjB,0BAAuC;AAEvC,4BAA8B;AAC9B,sBAAqB;AACrB,uBAAyB;AAkBlB,SAAS,aAAa;AAAA,EAC3B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,gBAAgB;AAAA,EAChB;AAAA,EACA;AACF,GAAsB;AACpB,QAAM,QAAI,sBAAK;AACf,MAAI,WAAW;AACb,QAAI,aAAc,QAAO,2E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from "lucide-react";
|
|
7
7
|
import { describeError } from "../utils/describe-error.js";
|
|
8
8
|
import { useT } from "../i18n/provider.js";
|
|
9
|
+
import { IconTile } from "./icon-tile.js";
|
|
9
10
|
function EmptyOrError({
|
|
10
11
|
isLoading,
|
|
11
12
|
error,
|
|
@@ -27,7 +28,7 @@ function EmptyOrError({
|
|
|
27
28
|
}
|
|
28
29
|
if (error) {
|
|
29
30
|
return /* @__PURE__ */ jsxs("div", { className: "py-16 text-center space-y-4", children: [
|
|
30
|
-
/* @__PURE__ */ jsx(
|
|
31
|
+
/* @__PURE__ */ jsx(IconTile, { size: "lg", destructive: true, className: "mx-auto", children: /* @__PURE__ */ jsx(AlertCircle, {}) }),
|
|
31
32
|
/* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-xs mx-auto", children: describeError(error).message }),
|
|
32
33
|
onRetry && /* @__PURE__ */ jsxs(Button, { variant: "soft", size: "sm", onClick: onRetry, children: [
|
|
33
34
|
/* @__PURE__ */ jsx(RefreshCw, { className: "h-3.5 w-3.5 mr-1.5" }),
|
|
@@ -37,7 +38,7 @@ function EmptyOrError({
|
|
|
37
38
|
}
|
|
38
39
|
if (isEmpty) {
|
|
39
40
|
return /* @__PURE__ */ jsxs("div", { className: "py-16 text-center space-y-4", children: [
|
|
40
|
-
emptyIcon && /* @__PURE__ */ jsx(
|
|
41
|
+
emptyIcon && /* @__PURE__ */ jsx(IconTile, { size: "lg", className: "mx-auto", children: emptyIcon }),
|
|
41
42
|
/* @__PURE__ */ jsx("p", { className: "font-semibold text-lg", children: t(emptyTitle) }),
|
|
42
43
|
emptyDescription && /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground max-w-xs mx-auto", children: t(emptyDescription) }),
|
|
43
44
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center justify-center gap-3", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/empty-or-error.tsx"],"sourcesContent":["\"use client\";\n\nimport { Skeleton } from \"./skeleton.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { RefreshCw, AlertCircle } from \"lucide-react\";\nimport { ReactNode } from \"react\";\nimport { describeError } from \"../utils/describe-error.js\";\nimport { useT } from \"../i18n/provider.js\";\n\ninterface EmptyOrErrorProps {\n isLoading: boolean;\n error?: unknown;\n isEmpty: boolean;\n onRetry?: () => void;\n emptyTitle: string;\n emptyDescription?: string;\n emptyCta?: { label: string; href: string };\n emptyActions?: ReactNode;\n emptyIcon?: ReactNode;\n skeletonCount?: number;\n\n skeletonNode?: ReactNode;\n children?: ReactNode;\n}\n\nexport function EmptyOrError({\n isLoading,\n error,\n isEmpty,\n onRetry,\n emptyTitle,\n emptyDescription,\n emptyCta,\n emptyActions,\n emptyIcon,\n skeletonCount = 4,\n skeletonNode,\n children,\n}: EmptyOrErrorProps) {\n const t = useT();\n if (isLoading) {\n if (skeletonNode) return <>{skeletonNode}</>;\n return (\n <div className=\"space-y-3\">\n {Array.from({ length: skeletonCount }).map((_, i) => (\n <Skeleton key={i} className=\"h-20 w-full rounded-xl\" />\n ))}\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n <
|
|
1
|
+
{"version":3,"sources":["../../src/components/empty-or-error.tsx"],"sourcesContent":["\"use client\";\n\nimport { Skeleton } from \"./skeleton.js\";\nimport { Button } from \"./button.js\";\nimport Link from \"./link.js\";\nimport { RefreshCw, AlertCircle } from \"lucide-react\";\nimport { ReactNode } from \"react\";\nimport { describeError } from \"../utils/describe-error.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { IconTile } from \"./icon-tile.js\";\n\ninterface EmptyOrErrorProps {\n isLoading: boolean;\n error?: unknown;\n isEmpty: boolean;\n onRetry?: () => void;\n emptyTitle: string;\n emptyDescription?: string;\n emptyCta?: { label: string; href: string };\n emptyActions?: ReactNode;\n emptyIcon?: ReactNode;\n skeletonCount?: number;\n\n skeletonNode?: ReactNode;\n children?: ReactNode;\n}\n\nexport function EmptyOrError({\n isLoading,\n error,\n isEmpty,\n onRetry,\n emptyTitle,\n emptyDescription,\n emptyCta,\n emptyActions,\n emptyIcon,\n skeletonCount = 4,\n skeletonNode,\n children,\n}: EmptyOrErrorProps) {\n const t = useT();\n if (isLoading) {\n if (skeletonNode) return <>{skeletonNode}</>;\n return (\n <div className=\"space-y-3\">\n {Array.from({ length: skeletonCount }).map((_, i) => (\n <Skeleton key={i} className=\"h-20 w-full rounded-xl\" />\n ))}\n </div>\n );\n }\n\n if (error) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n <IconTile size=\"lg\" destructive className=\"mx-auto\">\n <AlertCircle />\n </IconTile>\n <p className=\"text-sm text-muted-foreground max-w-xs mx-auto\">\n {describeError(error).message}\n </p>\n {onRetry && (\n <Button variant=\"soft\" size=\"sm\" onClick={onRetry}>\n <RefreshCw className=\"h-3.5 w-3.5 mr-1.5\" />\n {t(\"Try again\")}\n </Button>\n )}\n </div>\n );\n }\n\n if (isEmpty) {\n return (\n <div className=\"py-16 text-center space-y-4\">\n {emptyIcon && (\n <IconTile size=\"lg\" className=\"mx-auto\">\n {emptyIcon}\n </IconTile>\n )}\n <p className=\"font-semibold text-lg\">{t(emptyTitle)}</p>\n {emptyDescription && (\n <p className=\"text-sm text-muted-foreground max-w-xs mx-auto\">{t(emptyDescription)}</p>\n )}\n <div className=\"flex items-center justify-center gap-3\">\n {onRetry && (\n <Button variant=\"soft\" size=\"sm\" onClick={onRetry}>\n <RefreshCw className=\"h-3.5 w-3.5 mr-1.5\" />\n {t(\"Refresh\")}\n </Button>\n )}\n {emptyCta && (\n <Button size=\"sm\" asChild>\n <Link href={emptyCta.href}>{t(emptyCta.label)}</Link>\n </Button>\n )}\n </div>\n {emptyActions}\n </div>\n );\n }\n\n return <>{children}</>;\n}\n"],"mappings":";AA2C6B,wBAoBnB,YApBmB;AAzC7B,SAAS,gBAAgB;AACzB,SAAS,cAAc;AACvB,OAAO,UAAU;AACjB,SAAS,WAAW,m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AA,WACd;AAAA,QAED,YACC,oBAAC,UAAO,MAAK,MAAK,SAAO,MACvB,8BAAC,QAAK,MAAM,SAAS,MAAO,YAAE,SAAS,KAAK,GAAE,GAChD;AAAA,SAEJ;AAAA,MACC;AAAA,OACH;AAAA,EAEJ;AAEA,SAAO,gCAAG,UAAS;AACrB;","names":[]}
|
|
@@ -30,6 +30,7 @@ var import_medialane_app = require("./medialane-app.js");
|
|
|
30
30
|
var import_provider = require("../i18n/provider.js");
|
|
31
31
|
var import_panel = require("./panel.js");
|
|
32
32
|
var import_action_button = require("./action-button.js");
|
|
33
|
+
var import_icon_tile = require("./icon-tile.js");
|
|
33
34
|
const typeOf = (content) => content.type ? import_gated_content_types.GATED_CONTENT_TYPES[content.type] ?? import_gated_content_types.GATED_CONTENT_TYPE_FALLBACK : import_gated_content_types.GATED_CONTENT_TYPE_FALLBACK;
|
|
34
35
|
function GatedContentHero({
|
|
35
36
|
profile,
|
|
@@ -48,7 +49,7 @@ function GatedContentHero({
|
|
|
48
49
|
className: "panel w-full flex items-center gap-4 hover:bg-background/40 px-5 py-4 transition-colors text-left",
|
|
49
50
|
style: (0, import_panel.panelTint)("blue"),
|
|
50
51
|
children: [
|
|
51
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_tile.IconTile, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Icon, {}) }),
|
|
52
53
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
53
54
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-2xs font-bold text-brand-blue leading-none", children: t("\u2713 You're a holder \u2014 unlocked") }),
|
|
54
55
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-bold text-foreground leading-snug mt-1 truncate", children: state.content.title ?? title })
|
|
@@ -65,7 +66,7 @@ function GatedContentHero({
|
|
|
65
66
|
className: "w-full flex items-center gap-4 rounded-2xl hover:bg-background/40 px-5 py-4 transition-colors text-left group",
|
|
66
67
|
style: (0, import_panel.panelTint)("blue"),
|
|
67
68
|
children: [
|
|
68
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
69
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_tile.IconTile, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Lock, {}) }),
|
|
69
70
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex-1 min-w-0", children: [
|
|
70
71
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
71
72
|
"p",
|
|
@@ -84,7 +85,7 @@ function GatedContentHero({
|
|
|
84
85
|
}
|
|
85
86
|
function LockedNotice({ title, body, children }) {
|
|
86
87
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "py-16 flex flex-col items-center gap-5 text-center max-w-sm mx-auto", children: [
|
|
87
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
88
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_tile.IconTile, { size: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Lock, {}) }),
|
|
88
89
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { children: [
|
|
89
90
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-base font-semibold", children: title }),
|
|
90
91
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground mt-1", children: body })
|
|
@@ -117,7 +118,7 @@ function GatedContentPanel({ state, onBrowseListings }) {
|
|
|
117
118
|
const { icon: Icon, cta } = typeOf(state.content);
|
|
118
119
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "py-8 flex flex-col items-center gap-6 text-center max-w-md mx-auto", children: [
|
|
119
120
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "relative", children: [
|
|
120
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
121
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_icon_tile.IconTile, { size: "lg", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Unlock, {}) }),
|
|
121
122
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute -bottom-1 -right-1 h-6 w-6 rounded-full bg-brand-blue flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Sparkles, { className: "h-3 w-3 text-white" }) })
|
|
122
123
|
] }),
|
|
123
124
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/gated-content.tsx"],"sourcesContent":["\"use client\";\n\nimport { Loader2, Lock, ShoppingBag, Sparkles, Unlock } from \"lucide-react\";\nimport type { ApiCollectionProfile } from \"@medialane/sdk\";\nimport { GATED_CONTENT_TYPES, GATED_CONTENT_TYPE_FALLBACK } from \"../data/gated-content-types.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { panelTint } from \"./panel.js\";\nimport { ActionButton } from \"./action-button.js\";\n\nexport interface GatedContent {\n title: string | null;\n url: string;\n type: string | null;\n}\n\nexport type GatedContentState =\n | { status: \"signed_out\" }\n | { status: \"loading\" }\n | { status: \"not_holder\" }\n | { status: \"unlocked\"; content: GatedContent }\n | { status: \"error\" };\n\nconst typeOf = (content: GatedContent) => (content.type ? GATED_CONTENT_TYPES[content.type] ?? GATED_CONTENT_TYPE_FALLBACK : GATED_CONTENT_TYPE_FALLBACK);\n\nexport function GatedContentHero({\n profile,\n state,\n onViewExclusive,\n}: {\n profile: ApiCollectionProfile | null;\n state: GatedContentState;\n onViewExclusive: () => void;\n}) {\n const t = useT();\n if (!profile?.hasGatedContent) return null;\n const title = profile.gatedContentTitle ?? \"Exclusive content for holders\";\n\n if (state.status === \"unlocked\") {\n const { icon: Icon } = typeOf(state.content);\n return (\n <button\n onClick={onViewExclusive}\n className=\"panel w-full flex items-center gap-4 hover:bg-background/40 px-5 py-4 transition-colors text-left\"\n style={panelTint(\"blue\")}\n >\n <
|
|
1
|
+
{"version":3,"sources":["../../src/components/gated-content.tsx"],"sourcesContent":["\"use client\";\n\nimport { Loader2, Lock, ShoppingBag, Sparkles, Unlock } from \"lucide-react\";\nimport type { ApiCollectionProfile } from \"@medialane/sdk\";\nimport { GATED_CONTENT_TYPES, GATED_CONTENT_TYPE_FALLBACK } from \"../data/gated-content-types.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { panelTint } from \"./panel.js\";\nimport { ActionButton } from \"./action-button.js\";\nimport { IconTile } from \"./icon-tile.js\";\n\nexport interface GatedContent {\n title: string | null;\n url: string;\n type: string | null;\n}\n\nexport type GatedContentState =\n | { status: \"signed_out\" }\n | { status: \"loading\" }\n | { status: \"not_holder\" }\n | { status: \"unlocked\"; content: GatedContent }\n | { status: \"error\" };\n\nconst typeOf = (content: GatedContent) => (content.type ? GATED_CONTENT_TYPES[content.type] ?? GATED_CONTENT_TYPE_FALLBACK : GATED_CONTENT_TYPE_FALLBACK);\n\nexport function GatedContentHero({\n profile,\n state,\n onViewExclusive,\n}: {\n profile: ApiCollectionProfile | null;\n state: GatedContentState;\n onViewExclusive: () => void;\n}) {\n const t = useT();\n if (!profile?.hasGatedContent) return null;\n const title = profile.gatedContentTitle ?? \"Exclusive content for holders\";\n\n if (state.status === \"unlocked\") {\n const { icon: Icon } = typeOf(state.content);\n return (\n <button\n onClick={onViewExclusive}\n className=\"panel w-full flex items-center gap-4 hover:bg-background/40 px-5 py-4 transition-colors text-left\"\n style={panelTint(\"blue\")}\n >\n <IconTile>\n <Icon />\n </IconTile>\n <div className=\"flex-1 min-w-0\">\n <p className=\"text-2xs font-bold text-brand-blue leading-none\">{t(\"✓ You're a holder — unlocked\")}</p>\n <p className=\"text-sm font-bold text-foreground leading-snug mt-1 truncate\">{state.content.title ?? title}</p>\n </div>\n <Unlock className=\"h-4 w-4 text-brand-blue shrink-0\" />\n </button>\n );\n }\n\n return (\n <button\n onClick={onViewExclusive}\n className=\"w-full flex items-center gap-4 rounded-2xl hover:bg-background/40 px-5 py-4 transition-colors text-left group\"\n style={panelTint(\"blue\")}\n >\n <IconTile>\n <Lock />\n </IconTile>\n <div className=\"flex-1 min-w-0\">\n <p\n className=\"text-2xs font-bold leading-none mb-1 text-brand-blue\"\n >\n {t(\"Holder exclusive\")}\n </p>\n <p className=\"text-sm font-bold text-foreground leading-snug truncate\">{title}</p>\n <p className=\"text-xs text-muted-foreground mt-0.5\">{t(\"Own a token from this collection to unlock\")}</p>\n </div>\n <Sparkles className=\"h-4 w-4 text-muted-foreground/50 group-hover:text-primary transition-colors shrink-0\" />\n </button>\n );\n}\n\nfunction LockedNotice({ title, body, children }: { title: string; body: string; children?: React.ReactNode }) {\n return (\n <div className=\"py-16 flex flex-col items-center gap-5 text-center max-w-sm mx-auto\">\n <IconTile size=\"lg\">\n <Lock />\n </IconTile>\n <div>\n <p className=\"text-base font-semibold\">{title}</p>\n <p className=\"text-sm text-muted-foreground mt-1\">{body}</p>\n </div>\n {children}\n </div>\n );\n}\n\nconst PRIMARY = \"inline-flex items-center gap-2 bg-foreground text-background hover:opacity-90 font-semibold px-5 py-2.5 rounded-xl transition-all text-sm\";\n\nexport function GatedContentPanel({ state, onBrowseListings }: { state: GatedContentState; onBrowseListings: () => void }) {\n const t = useT();\n const { connectLabel = \"Sign in\", onRequireWallet } = useMedialaneApp();\n\n if (state.status === \"signed_out\") {\n return (\n <LockedNotice title={t(\"{label} to unlock\", { label: t(connectLabel) })} body={t(\"This collection has exclusive content for holders. Sign in so we can check your holdings.\")}>\n <button type=\"button\" onClick={onRequireWallet} className={PRIMARY}>{t(connectLabel)}</button>\n </LockedNotice>\n );\n }\n if (state.status === \"loading\") {\n return (\n <div className=\"py-16 flex flex-col items-center gap-3\">\n <Loader2 className=\"h-8 w-8 animate-spin text-muted-foreground/40\" />\n <p className=\"text-xs text-muted-foreground\">{t(\"Checking your holdings…\")}</p>\n </div>\n );\n }\n if (state.status === \"not_holder\") {\n return (\n <LockedNotice title={t(\"Holders only\")} body={t(\"Hold at least one token from this collection to open the exclusive content.\")}>\n <button type=\"button\" onClick={onBrowseListings} className={PRIMARY}>\n <ShoppingBag className=\"h-4 w-4\" />\n {t(\"Browse listings\")}\n </button>\n </LockedNotice>\n );\n }\n if (state.status === \"error\") {\n return <LockedNotice title={t(\"Couldn't check your holdings\")} body={t(\"Refresh the page to try again.\")} />;\n }\n\n const { icon: Icon, cta } = typeOf(state.content);\n return (\n <div className=\"py-8 flex flex-col items-center gap-6 text-center max-w-md mx-auto\">\n <div className=\"relative\">\n <IconTile size=\"lg\">\n <Unlock />\n </IconTile>\n <div className=\"absolute -bottom-1 -right-1 h-6 w-6 rounded-full bg-brand-blue flex items-center justify-center\">\n <Sparkles className=\"h-3 w-3 text-white\" />\n </div>\n </div>\n <div className=\"space-y-1.5\">\n <p className=\"text-2xs font-bold text-brand-blue\">{t(\"✓ Verified holder\")}</p>\n <h3 className=\"text-xl font-bold\">{state.content.title ?? t(\"Exclusive content\")}</h3>\n <p className=\"text-sm text-muted-foreground\">{t(\"Your access is verified. Enjoy your exclusive content.\")}</p>\n </div>\n <ActionButton solid asChild>\n <a href={state.content.url} target=\"_blank\" rel=\"noopener noreferrer\">\n <Icon className=\"h-5 w-5\" />\n {cta}\n </a>\n </ActionButton>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgDU;AA9CV,0BAA6D;AAE7D,iCAAiE;AACjE,2BAAgC;AAChC,sBAAqB;AACrB,mBAA0B;AAC1B,2BAA6B;AAC7B,uBAAyB;AAezB,MAA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