@medialane/ui 0.395.0 → 0.396.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.
Files changed (120) hide show
  1. package/README.md +4 -2
  2. package/dist/components/account/input-otp.d.cts +2 -2
  3. package/dist/components/account/input-otp.d.ts +2 -2
  4. package/dist/components/back-button.cjs +23 -7
  5. package/dist/components/back-button.cjs.map +1 -1
  6. package/dist/components/back-button.d.cts +6 -3
  7. package/dist/components/back-button.d.ts +6 -3
  8. package/dist/components/back-button.js +14 -8
  9. package/dist/components/back-button.js.map +1 -1
  10. package/dist/components/button.d.cts +1 -1
  11. package/dist/components/button.d.ts +1 -1
  12. package/dist/components/comments-section.cjs +1 -1
  13. package/dist/components/comments-section.cjs.map +1 -1
  14. package/dist/components/comments-section.js +1 -1
  15. package/dist/components/comments-section.js.map +1 -1
  16. package/dist/components/create-form-primitives.cjs +3 -2
  17. package/dist/components/create-form-primitives.cjs.map +1 -1
  18. package/dist/components/create-form-primitives.d.cts +2 -1
  19. package/dist/components/create-form-primitives.d.ts +2 -1
  20. package/dist/components/create-form-primitives.js +3 -2
  21. package/dist/components/create-form-primitives.js.map +1 -1
  22. package/dist/components/creator-page.cjs +15 -11
  23. package/dist/components/creator-page.cjs.map +1 -1
  24. package/dist/components/creator-page.js +16 -12
  25. package/dist/components/creator-page.js.map +1 -1
  26. package/dist/components/launchpad/coin-create.cjs +1 -1
  27. package/dist/components/launchpad/coin-create.cjs.map +1 -1
  28. package/dist/components/launchpad/coin-create.js +1 -1
  29. package/dist/components/launchpad/coin-create.js.map +1 -1
  30. package/dist/components/launchpad/edition-mint-schema.d.cts +2 -2
  31. package/dist/components/launchpad/edition-mint-schema.d.ts +2 -2
  32. package/dist/components/launchpad/edition-mint.cjs +3 -7
  33. package/dist/components/launchpad/edition-mint.cjs.map +1 -1
  34. package/dist/components/launchpad/edition-mint.js +3 -7
  35. package/dist/components/launchpad/edition-mint.js.map +1 -1
  36. package/dist/components/launchpad/pop-create.cjs +1 -1
  37. package/dist/components/launchpad/pop-create.cjs.map +1 -1
  38. package/dist/components/launchpad/pop-create.js +1 -1
  39. package/dist/components/launchpad/pop-create.js.map +1 -1
  40. package/dist/components/launchpad/remix-mint.cjs +5 -9
  41. package/dist/components/launchpad/remix-mint.cjs.map +1 -1
  42. package/dist/components/launchpad/remix-mint.js +6 -10
  43. package/dist/components/launchpad/remix-mint.js.map +1 -1
  44. package/dist/components/launchpad/single-edition-mint.cjs +1 -1
  45. package/dist/components/launchpad/single-edition-mint.cjs.map +1 -1
  46. package/dist/components/launchpad/single-edition-mint.js +1 -1
  47. package/dist/components/launchpad/single-edition-mint.js.map +1 -1
  48. package/dist/components/launchpad/sponsorship-create.cjs +2 -2
  49. package/dist/components/launchpad/sponsorship-create.cjs.map +1 -1
  50. package/dist/components/launchpad/sponsorship-create.js +2 -2
  51. package/dist/components/launchpad/sponsorship-create.js.map +1 -1
  52. package/dist/components/launchpad/tier-mint-form.cjs +3 -10
  53. package/dist/components/launchpad/tier-mint-form.cjs.map +1 -1
  54. package/dist/components/launchpad/tier-mint-form.js +3 -10
  55. package/dist/components/launchpad/tier-mint-form.js.map +1 -1
  56. package/dist/components/license-request-page.cjs +14 -18
  57. package/dist/components/license-request-page.cjs.map +1 -1
  58. package/dist/components/license-request-page.js +16 -20
  59. package/dist/components/license-request-page.js.map +1 -1
  60. package/dist/components/page-container.cjs +2 -1
  61. package/dist/components/page-container.cjs.map +1 -1
  62. package/dist/components/page-container.d.cts +1 -1
  63. package/dist/components/page-container.d.ts +1 -1
  64. package/dist/components/page-container.js +2 -1
  65. package/dist/components/page-container.js.map +1 -1
  66. package/dist/components/page-state.cjs +50 -0
  67. package/dist/components/page-state.cjs.map +1 -0
  68. package/dist/components/page-state.d.cts +18 -0
  69. package/dist/components/page-state.d.ts +18 -0
  70. package/dist/components/page-state.js +25 -0
  71. package/dist/components/page-state.js.map +1 -0
  72. package/dist/components/pop-claim-button.cjs +1 -1
  73. package/dist/components/pop-claim-button.cjs.map +1 -1
  74. package/dist/components/pop-claim-button.js +1 -1
  75. package/dist/components/pop-claim-button.js.map +1 -1
  76. package/dist/components/pop-manage-page.cjs +53 -72
  77. package/dist/components/pop-manage-page.cjs.map +1 -1
  78. package/dist/components/pop-manage-page.js +54 -73
  79. package/dist/components/pop-manage-page.js.map +1 -1
  80. package/dist/components/pop-my-events-page.cjs +5 -4
  81. package/dist/components/pop-my-events-page.cjs.map +1 -1
  82. package/dist/components/pop-my-events-page.js +5 -4
  83. package/dist/components/pop-my-events-page.js.map +1 -1
  84. package/dist/components/portfolio-shell.cjs +3 -12
  85. package/dist/components/portfolio-shell.cjs.map +1 -1
  86. package/dist/components/portfolio-shell.js +3 -12
  87. package/dist/components/portfolio-shell.js.map +1 -1
  88. package/dist/components/service-collections-page.cjs +2 -4
  89. package/dist/components/service-collections-page.cjs.map +1 -1
  90. package/dist/components/service-collections-page.d.cts +0 -2
  91. package/dist/components/service-collections-page.d.ts +0 -2
  92. package/dist/components/service-collections-page.js +2 -4
  93. package/dist/components/service-collections-page.js.map +1 -1
  94. package/dist/components/sponsorship-offer-page.cjs +4 -3
  95. package/dist/components/sponsorship-offer-page.cjs.map +1 -1
  96. package/dist/components/sponsorship-offer-page.js +4 -3
  97. package/dist/components/sponsorship-offer-page.js.map +1 -1
  98. package/dist/components/transaction-dialog.cjs +2 -2
  99. package/dist/components/transaction-dialog.cjs.map +1 -1
  100. package/dist/components/transaction-dialog.js +2 -2
  101. package/dist/components/transaction-dialog.js.map +1 -1
  102. package/dist/components/transfer-collection-ownership.cjs +1 -1
  103. package/dist/components/transfer-collection-ownership.cjs.map +1 -1
  104. package/dist/components/transfer-collection-ownership.js +1 -1
  105. package/dist/components/transfer-collection-ownership.js.map +1 -1
  106. package/dist/components/wallet-required.cjs +4 -14
  107. package/dist/components/wallet-required.cjs.map +1 -1
  108. package/dist/components/wallet-required.js +5 -15
  109. package/dist/components/wallet-required.js.map +1 -1
  110. package/dist/i18n/catalog/pt.cjs +22 -2
  111. package/dist/i18n/catalog/pt.cjs.map +1 -1
  112. package/dist/i18n/catalog/pt.js +22 -2
  113. package/dist/i18n/catalog/pt.js.map +1 -1
  114. package/dist/index.cjs +5 -0
  115. package/dist/index.cjs.map +1 -1
  116. package/dist/index.d.cts +2 -1
  117. package/dist/index.d.ts +2 -1
  118. package/dist/index.js +3 -0
  119. package/dist/index.js.map +1 -1
  120. package/package.json +1 -1
package/README.md CHANGED
@@ -161,14 +161,16 @@ import { PageContainer, PageHeader, PageHeaderSkeleton, StatPillRow } from "@med
161
161
  </PageContainer>
162
162
  ```
163
163
 
164
- Every page starts with `PageHeader`, inside `PageContainer`. Browse pages use the default full-width container; focused pages (forms, service pages) use `variant="narrow"`.
164
+ Every page starts with `PageHeader`, inside `PageContainer`. Browse pages use the default full-width container; service pages use `variant="narrow"` and forms use `variant="form"`. Full-page states (not found, sign in) use `PageState`.
165
165
 
166
166
  | Component | Description |
167
167
  |---|---|
168
- | `<PageContainer>` | Page width and padding; `variant` is `app` (default), `content` or `narrow` |
168
+ | `<PageContainer>` | Page width and padding; `variant` is `app` (default), `content`, `narrow` or `form` |
169
169
  | `<PageHeader title subtitle icon back action>` | The page title block; children render below it (stat pills, filters) |
170
170
  | `<PageHeaderSkeleton stats={2} />` | Loading placeholder for `PageHeader` |
171
171
  | `<SectionHeading title subtitle icon href action>` | The title of a section on a page |
172
+ | `<PageState icon title description>` | Centered full-page state; children render below (buttons, sign-in) |
173
+ | `<BackButton href label>` | Back link; without `href` it goes back in history |
172
174
 
173
175
  ---
174
176
 
@@ -1,7 +1,7 @@
1
1
  import * as input_otp from 'input-otp';
2
2
  import * as React from 'react';
3
3
 
4
- declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
4
+ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
5
5
  value?: string;
6
6
  onChange?: (newValue: string) => unknown;
7
7
  maxLength: number;
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
14
14
  } & {
15
15
  render: (props: input_otp.RenderProps) => React.ReactNode;
16
16
  children?: never;
17
- } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
17
+ } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
18
18
  value?: string;
19
19
  onChange?: (newValue: string) => unknown;
20
20
  maxLength: number;
@@ -1,7 +1,7 @@
1
1
  import * as input_otp from 'input-otp';
2
2
  import * as React from 'react';
3
3
 
4
- declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
4
+ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
5
5
  value?: string;
6
6
  onChange?: (newValue: string) => unknown;
7
7
  maxLength: number;
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
14
14
  } & {
15
15
  render: (props: input_otp.RenderProps) => React.ReactNode;
16
16
  children?: never;
17
- } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "value" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
17
+ } & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "value" | "onChange" | "maxLength" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
18
18
  value?: string;
19
19
  onChange?: (newValue: string) => unknown;
20
20
  maxLength: number;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  "use client";
3
+ var __create = Object.create;
3
4
  var __defProp = Object.defineProperty;
4
5
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
6
  var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
6
8
  var __hasOwnProp = Object.prototype.hasOwnProperty;
7
9
  var __export = (target, all) => {
8
10
  for (var name in all)
@@ -16,6 +18,14 @@ var __copyProps = (to, from, except, desc) => {
16
18
  }
17
19
  return to;
18
20
  };
21
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
22
+ // If the importer is in node compatibility mode or this is not an ESM
23
+ // file that has been converted to a CommonJS file using a Babel-
24
+ // compatible transform (i.e. "__esModule" has not been set), then set
25
+ // "default" to the CommonJS "module.exports" for node compatibility.
26
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
27
+ mod
28
+ ));
19
29
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
30
  var back_button_exports = {};
21
31
  __export(back_button_exports, {
@@ -24,21 +34,27 @@ __export(back_button_exports, {
24
34
  module.exports = __toCommonJS(back_button_exports);
25
35
  var import_jsx_runtime = require("react/jsx-runtime");
26
36
  var import_lucide_react = require("lucide-react");
37
+ var import_link = __toESM(require("./link.js"), 1);
27
38
  var import_router = require("./router.js");
28
39
  var import_provider = require("../i18n/provider.js");
29
- function BackButton({ fallbackHref = "/launchpad" }) {
40
+ const className = "inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors";
41
+ function BackButton({ href, label, fallbackHref = "/launchpad" }) {
30
42
  const t = (0, import_provider.useT)();
31
43
  const router = (0, import_router.useRouter)();
32
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
44
+ const content = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
45
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArrowLeft, { className: "h-3.5 w-3.5" }),
46
+ label ?? t("Back")
47
+ ] });
48
+ if (href) {
49
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href, className, children: content });
50
+ }
51
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
33
52
  "button",
34
53
  {
35
54
  type: "button",
36
55
  onClick: () => window.history.length > 1 ? router.back() : router.push(fallbackHref),
37
- className: "inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",
38
- children: [
39
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.ArrowLeft, { className: "h-3.5 w-3.5" }),
40
- t("Back")
41
- ]
56
+ className,
57
+ children: content
42
58
  }
43
59
  );
44
60
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/back-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { ArrowLeft } from \"lucide-react\";\nimport { useRouter } from \"./router.js\";\nimport { useT } from \"../i18n/provider.js\";\n\nexport function BackButton({ fallbackHref = \"/launchpad\" }: { fallbackHref?: string }) {\n const t = useT();\n const router = useRouter();\n return (\n <button\n type=\"button\"\n onClick={() => (window.history.length > 1 ? router.back() : router.push(fallbackHref))}\n className=\"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors\"\n >\n <ArrowLeft className=\"h-3.5 w-3.5\" />\n {t(\"Back\")}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAUI;AARJ,0BAA0B;AAC1B,oBAA0B;AAC1B,sBAAqB;AAEd,SAAS,WAAW,EAAE,eAAe,aAAa,GAA8B;AACrF,QAAM,QAAI,sBAAK;AACf,QAAM,aAAS,yBAAU;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAS,MAAO,OAAO,QAAQ,SAAS,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,YAAY;AAAA,MACpF,WAAU;AAAA,MAEV;AAAA,oDAAC,iCAAU,WAAU,eAAc;AAAA,QAClC,EAAE,MAAM;AAAA;AAAA;AAAA,EACX;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/back-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { ArrowLeft } from \"lucide-react\";\nimport Link from \"./link.js\";\nimport { useRouter } from \"./router.js\";\nimport { useT } from \"../i18n/provider.js\";\n\nconst className = \"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors\";\n\nexport interface BackButtonProps {\n href?: string;\n label?: string;\n fallbackHref?: string;\n}\n\nexport function BackButton({ href, label, fallbackHref = \"/launchpad\" }: BackButtonProps) {\n const t = useT();\n const router = useRouter();\n const content = (\n <>\n <ArrowLeft className=\"h-3.5 w-3.5\" />\n {label ?? t(\"Back\")}\n </>\n );\n if (href) {\n return (\n <Link href={href} className={className}>\n {content}\n </Link>\n );\n }\n return (\n <button\n type=\"button\"\n onClick={() => (window.history.length > 1 ? router.back() : router.push(fallbackHref))}\n className={className}\n >\n {content}\n </button>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmBI;AAjBJ,0BAA0B;AAC1B,kBAAiB;AACjB,oBAA0B;AAC1B,sBAAqB;AAErB,MAAM,YAAY;AAQX,SAAS,WAAW,EAAE,MAAM,OAAO,eAAe,aAAa,GAAoB;AACxF,QAAM,QAAI,sBAAK;AACf,QAAM,aAAS,yBAAU;AACzB,QAAM,UACJ,4EACE;AAAA,gDAAC,iCAAU,WAAU,eAAc;AAAA,IAClC,SAAS,EAAE,MAAM;AAAA,KACpB;AAEF,MAAI,MAAM;AACR,WACE,4CAAC,YAAAA,SAAA,EAAK,MAAY,WACf,mBACH;AAAA,EAEJ;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAS,MAAO,OAAO,QAAQ,SAAS,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,YAAY;AAAA,MACpF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":["Link"]}
@@ -1,7 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
- declare function BackButton({ fallbackHref }: {
3
+ interface BackButtonProps {
4
+ href?: string;
5
+ label?: string;
4
6
  fallbackHref?: string;
5
- }): react_jsx_runtime.JSX.Element;
7
+ }
8
+ declare function BackButton({ href, label, fallbackHref }: BackButtonProps): react_jsx_runtime.JSX.Element;
6
9
 
7
- export { BackButton };
10
+ export { BackButton, type BackButtonProps };
@@ -1,7 +1,10 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
 
3
- declare function BackButton({ fallbackHref }: {
3
+ interface BackButtonProps {
4
+ href?: string;
5
+ label?: string;
4
6
  fallbackHref?: string;
5
- }): react_jsx_runtime.JSX.Element;
7
+ }
8
+ declare function BackButton({ href, label, fallbackHref }: BackButtonProps): react_jsx_runtime.JSX.Element;
6
9
 
7
- export { BackButton };
10
+ export { BackButton, type BackButtonProps };
@@ -1,21 +1,27 @@
1
1
  "use client";
2
- import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
3
3
  import { ArrowLeft } from "lucide-react";
4
+ import Link from "./link.js";
4
5
  import { useRouter } from "./router.js";
5
6
  import { useT } from "../i18n/provider.js";
6
- function BackButton({ fallbackHref = "/launchpad" }) {
7
+ const className = "inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors";
8
+ function BackButton({ href, label, fallbackHref = "/launchpad" }) {
7
9
  const t = useT();
8
10
  const router = useRouter();
9
- return /* @__PURE__ */ jsxs(
11
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
12
+ /* @__PURE__ */ jsx(ArrowLeft, { className: "h-3.5 w-3.5" }),
13
+ label ?? t("Back")
14
+ ] });
15
+ if (href) {
16
+ return /* @__PURE__ */ jsx(Link, { href, className, children: content });
17
+ }
18
+ return /* @__PURE__ */ jsx(
10
19
  "button",
11
20
  {
12
21
  type: "button",
13
22
  onClick: () => window.history.length > 1 ? router.back() : router.push(fallbackHref),
14
- className: "inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors",
15
- children: [
16
- /* @__PURE__ */ jsx(ArrowLeft, { className: "h-3.5 w-3.5" }),
17
- t("Back")
18
- ]
23
+ className,
24
+ children: content
19
25
  }
20
26
  );
21
27
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/back-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { ArrowLeft } from \"lucide-react\";\nimport { useRouter } from \"./router.js\";\nimport { useT } from \"../i18n/provider.js\";\n\nexport function BackButton({ fallbackHref = \"/launchpad\" }: { fallbackHref?: string }) {\n const t = useT();\n const router = useRouter();\n return (\n <button\n type=\"button\"\n onClick={() => (window.history.length > 1 ? router.back() : router.push(fallbackHref))}\n className=\"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors\"\n >\n <ArrowLeft className=\"h-3.5 w-3.5\" />\n {t(\"Back\")}\n </button>\n );\n}\n"],"mappings":";AAUI,SAKE,KALF;AARJ,SAAS,iBAAiB;AAC1B,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAEd,SAAS,WAAW,EAAE,eAAe,aAAa,GAA8B;AACrF,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,UAAU;AACzB,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAS,MAAO,OAAO,QAAQ,SAAS,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,YAAY;AAAA,MACpF,WAAU;AAAA,MAEV;AAAA,4BAAC,aAAU,WAAU,eAAc;AAAA,QAClC,EAAE,MAAM;AAAA;AAAA;AAAA,EACX;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/back-button.tsx"],"sourcesContent":["\"use client\";\n\nimport { ArrowLeft } from \"lucide-react\";\nimport Link from \"./link.js\";\nimport { useRouter } from \"./router.js\";\nimport { useT } from \"../i18n/provider.js\";\n\nconst className = \"inline-flex items-center gap-1.5 text-sm text-muted-foreground hover:text-foreground transition-colors\";\n\nexport interface BackButtonProps {\n href?: string;\n label?: string;\n fallbackHref?: string;\n}\n\nexport function BackButton({ href, label, fallbackHref = \"/launchpad\" }: BackButtonProps) {\n const t = useT();\n const router = useRouter();\n const content = (\n <>\n <ArrowLeft className=\"h-3.5 w-3.5\" />\n {label ?? t(\"Back\")}\n </>\n );\n if (href) {\n return (\n <Link href={href} className={className}>\n {content}\n </Link>\n );\n }\n return (\n <button\n type=\"button\"\n onClick={() => (window.history.length > 1 ? router.back() : router.push(fallbackHref))}\n className={className}\n >\n {content}\n </button>\n );\n}\n"],"mappings":";AAmBI,mBACE,KADF;AAjBJ,SAAS,iBAAiB;AAC1B,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAAS,YAAY;AAErB,MAAM,YAAY;AAQX,SAAS,WAAW,EAAE,MAAM,OAAO,eAAe,aAAa,GAAoB;AACxF,QAAM,IAAI,KAAK;AACf,QAAM,SAAS,UAAU;AACzB,QAAM,UACJ,iCACE;AAAA,wBAAC,aAAU,WAAU,eAAc;AAAA,IAClC,SAAS,EAAE,MAAM;AAAA,KACpB;AAEF,MAAI,MAAM;AACR,WACE,oBAAC,QAAK,MAAY,WACf,mBACH;AAAA,EAEJ;AACA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAK;AAAA,MACL,SAAS,MAAO,OAAO,QAAQ,SAAS,IAAI,OAAO,KAAK,IAAI,OAAO,KAAK,YAAY;AAAA,MACpF;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;","names":[]}
@@ -4,7 +4,7 @@ import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
6
  variant?: "link" | "default" | "destructive" | "soft" | "secondary" | "ghost" | "tonal" | null | undefined;
7
- size?: "default" | "icon" | "sm" | "lg" | null | undefined;
7
+ size?: "icon" | "default" | "sm" | "lg" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
10
  asChild?: boolean;
@@ -4,7 +4,7 @@ import { VariantProps } from 'class-variance-authority';
4
4
 
5
5
  declare const buttonVariants: (props?: ({
6
6
  variant?: "link" | "default" | "destructive" | "soft" | "secondary" | "ghost" | "tonal" | null | undefined;
7
- size?: "default" | "icon" | "sm" | "lg" | null | undefined;
7
+ size?: "icon" | "default" | "sm" | "lg" | null | undefined;
8
8
  } & class_variance_authority_types.ClassProp) | undefined) => string;
9
9
  interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
10
10
  asChild?: boolean;
@@ -292,7 +292,7 @@ function CommentsSection({ contract, tokenId, className }) {
292
292
  }
293
293
  }
294
294
  ),
295
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_dialog.TransactionDialog, { tx, title: t("Comment"), workingLabel: "Posting your comment\u2026", firstStepLabel: "Prepare comment", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
295
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_transaction_dialog.TransactionDialog, { tx, title: t("Comment"), workingLabel: t("Posting your comment\u2026"), firstStepLabel: t("Prepare comment"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
296
296
  import_transaction_success.TransactionSuccess,
297
297
  {
298
298
  name: "Comment",
@@ -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\";\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(\"Comments are recorded onchain.\")}\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,C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AK,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(\"Comments are recorded onchain.\")}\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={t(\"Posting your comment…\")} firstStepLabel={t(\"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,IAAI;AAE1E,QAAM,kBAAc,qBAAuB,IAAI;AAC/C,QAAM,gBAAY,qBAAuB,IAAI;AAC7C,QAAM,iBAAa,qBAA4B,IAAI;AAEnD,QAAM,UAAU,IAAI,YAAY,EAAE,OAAO,IAAI,EAAE;AAC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AAC;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,cAAc,EAAE,4BAAuB,GAAG,gBAAgB,EAAE,iBAAiB,GAC3H;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"]}
@@ -259,7 +259,7 @@ function CommentsSection({ contract, tokenId, className }) {
259
259
  }
260
260
  }
261
261
  ),
262
- /* @__PURE__ */ jsx(TransactionDialog, { tx, title: t("Comment"), workingLabel: "Posting your comment\u2026", firstStepLabel: "Prepare comment", children: /* @__PURE__ */ jsx(
262
+ /* @__PURE__ */ jsx(TransactionDialog, { tx, title: t("Comment"), workingLabel: t("Posting your comment\u2026"), firstStepLabel: t("Prepare comment"), children: /* @__PURE__ */ jsx(
263
263
  TransactionSuccess,
264
264
  {
265
265
  name: "Comment",
@@ -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\";\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(\"Comments are recorded onchain.\")}\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 </T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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":[]}
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(\"Comments are recorded onchain.\")}\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={t(\"Posting your comment…\")} firstStepLabel={t(\"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,SAA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
  opt
71
71
  )) });
72
72
  }
73
- function Section({ title, icon, children }) {
73
+ function Section({ title, icon, action, children }) {
74
74
  return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "panel p-5 space-y-4", children: [
75
75
  /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 text-sm font-semibold", children: [
76
76
  /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-primary", children: icon }),
77
- title
77
+ title,
78
+ action && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "ml-auto text-xs font-normal text-muted-foreground", children: action })
78
79
  ] }),
79
80
  children
80
81
  ] });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/create-form-primitives.tsx"],"sourcesContent":["import { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { msg } from \"../i18n/translate.js\";\n\nconst OPTION_LABELS: Record<string, string> = {\n Allowed: msg(\"Allowed\"),\n \"Not Allowed\": msg(\"Not Allowed\"),\n \"Share-Alike\": msg(\"Share-Alike\"),\n \"Training Only\": msg(\"Training Only\"),\n Required: msg(\"Required\"),\n \"Not Required\": msg(\"Not Required\"),\n Yes: msg(\"Yes\"),\n No: msg(\"No\"),\n Free: msg(\"Free\"),\n Paid: msg(\"Paid\"),\n Everyone: msg(\"Everyone\"),\n \"Wallet list\": msg(\"Wallet list\"),\n \"At launch\": msg(\"At launch\"),\n \"Pick a date\": msg(\"Pick a date\"),\n \"No end\": msg(\"No end\"),\n \"No limit\": msg(\"No limit\"),\n \"Set a limit\": msg(\"Set a limit\"),\n Edition: msg(\"Edition\"),\n Collection: msg(\"Collection\"),\n};\n\nexport function ToggleGroup({\n value, options, onChange, tone = \"brand\",\n}: { value: string; options: readonly string[]; onChange: (v: string) => void; tone?: \"brand\" | \"neutral\" }) {\n const t = useT();\n return (\n <div className=\"flex rounded-2xl overflow-hidden w-full bg-muted/40\">\n {options.map((opt, i) => (\n <button\n key={opt}\n type=\"button\"\n aria-pressed={value === opt}\n onClick={() => onChange(opt)}\n className={cn(\n \"flex-1 px-3 py-2 text-sm transition-colors\",\n i > 0 && \"border-l border-border\",\n value === opt\n ? tone === \"neutral\" ? \"bg-muted text-foreground font-medium\" : \"bg-primary text-primary-foreground font-medium\"\n : \"bg-background hover:bg-muted text-muted-foreground\",\n )}\n >\n {t(OPTION_LABELS[opt] ?? opt)}\n </button>\n ))}\n </div>\n );\n}\n\nexport function Section({ title, icon, children }: {\n title: string; icon: React.ReactNode; children: React.ReactNode;\n}) {\n return (\n <div className=\"panel p-5 space-y-4\">\n <div className=\"flex items-center gap-2 text-sm font-semibold\">\n <span className=\"text-primary\">{icon}</span>\n {title}\n </div>\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiCQ;AAjCR,gBAAmB;AACnB,sBAAqB;AACrB,uBAAoB;AAEpB,MAAM,gBAAwC;AAAA,EAC5C,aAAS,sBAAI,SAAS;AAAA,EACtB,mBAAe,sBAAI,aAAa;AAAA,EAChC,mBAAe,sBAAI,aAAa;AAAA,EAChC,qBAAiB,sBAAI,eAAe;AAAA,EACpC,cAAU,sBAAI,UAAU;AAAA,EACxB,oBAAgB,sBAAI,cAAc;AAAA,EAClC,SAAK,sBAAI,KAAK;AAAA,EACd,QAAI,sBAAI,IAAI;AAAA,EACZ,UAAM,sBAAI,MAAM;AAAA,EAChB,UAAM,sBAAI,MAAM;AAAA,EAChB,cAAU,sBAAI,UAAU;AAAA,EACxB,mBAAe,sBAAI,aAAa;AAAA,EAChC,iBAAa,sBAAI,WAAW;AAAA,EAC5B,mBAAe,sBAAI,aAAa;AAAA,EAChC,cAAU,sBAAI,QAAQ;AAAA,EACtB,gBAAY,sBAAI,UAAU;AAAA,EAC1B,mBAAe,sBAAI,aAAa;AAAA,EAChC,aAAS,sBAAI,SAAS;AAAA,EACtB,gBAAY,sBAAI,YAAY;AAC9B;AAEO,SAAS,YAAY;AAAA,EAC1B;AAAA,EAAO;AAAA,EAAS;AAAA,EAAU,OAAO;AACnC,GAA6G;AAC3G,QAAM,QAAI,sBAAK;AACf,SACE,4CAAC,SAAI,WAAU,uDACZ,kBAAQ,IAAI,CAAC,KAAK,MACjB;AAAA,IAAC;AAAA;AAAA,MAEC,MAAK;AAAA,MACL,gBAAc,UAAU;AAAA,MACxB,SAAS,MAAM,SAAS,GAAG;AAAA,MAC3B,eAAW;AAAA,QACT;AAAA,QACA,IAAI,KAAK;AAAA,QACT,UAAU,MACN,SAAS,YAAY,yCAAyC,mDAC9D;AAAA,MACN;AAAA,MAEC,YAAE,cAAc,GAAG,KAAK,GAAG;AAAA;AAAA,IAZvB;AAAA,EAaP,CACD,GACH;AAEJ;AAEO,SAAS,QAAQ,EAAE,OAAO,MAAM,SAAS,GAE7C;AACD,SACE,6CAAC,SAAI,WAAU,uBACb;AAAA,iDAAC,SAAI,WAAU,iDACb;AAAA,kDAAC,UAAK,WAAU,gBAAgB,gBAAK;AAAA,MACpC;AAAA,OACH;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/create-form-primitives.tsx"],"sourcesContent":["import { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { msg } from \"../i18n/translate.js\";\n\nconst OPTION_LABELS: Record<string, string> = {\n Allowed: msg(\"Allowed\"),\n \"Not Allowed\": msg(\"Not Allowed\"),\n \"Share-Alike\": msg(\"Share-Alike\"),\n \"Training Only\": msg(\"Training Only\"),\n Required: msg(\"Required\"),\n \"Not Required\": msg(\"Not Required\"),\n Yes: msg(\"Yes\"),\n No: msg(\"No\"),\n Free: msg(\"Free\"),\n Paid: msg(\"Paid\"),\n Everyone: msg(\"Everyone\"),\n \"Wallet list\": msg(\"Wallet list\"),\n \"At launch\": msg(\"At launch\"),\n \"Pick a date\": msg(\"Pick a date\"),\n \"No end\": msg(\"No end\"),\n \"No limit\": msg(\"No limit\"),\n \"Set a limit\": msg(\"Set a limit\"),\n Edition: msg(\"Edition\"),\n Collection: msg(\"Collection\"),\n};\n\nexport function ToggleGroup({\n value, options, onChange, tone = \"brand\",\n}: { value: string; options: readonly string[]; onChange: (v: string) => void; tone?: \"brand\" | \"neutral\" }) {\n const t = useT();\n return (\n <div className=\"flex rounded-2xl overflow-hidden w-full bg-muted/40\">\n {options.map((opt, i) => (\n <button\n key={opt}\n type=\"button\"\n aria-pressed={value === opt}\n onClick={() => onChange(opt)}\n className={cn(\n \"flex-1 px-3 py-2 text-sm transition-colors\",\n i > 0 && \"border-l border-border\",\n value === opt\n ? tone === \"neutral\" ? \"bg-muted text-foreground font-medium\" : \"bg-primary text-primary-foreground font-medium\"\n : \"bg-background hover:bg-muted text-muted-foreground\",\n )}\n >\n {t(OPTION_LABELS[opt] ?? opt)}\n </button>\n ))}\n </div>\n );\n}\n\nexport function Section({ title, icon, action, children }: {\n title: string; icon: React.ReactNode; action?: React.ReactNode; children: React.ReactNode;\n}) {\n return (\n <div className=\"panel p-5 space-y-4\">\n <div className=\"flex items-center gap-2 text-sm font-semibold\">\n <span className=\"text-primary\">{icon}</span>\n {title}\n {action && <span className=\"ml-auto text-xs font-normal text-muted-foreground\">{action}</span>}\n </div>\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiCQ;AAjCR,gBAAmB;AACnB,sBAAqB;AACrB,uBAAoB;AAEpB,MAAM,gBAAwC;AAAA,EAC5C,aAAS,sBAAI,SAAS;AAAA,EACtB,mBAAe,sBAAI,aAAa;AAAA,EAChC,mBAAe,sBAAI,aAAa;AAAA,EAChC,qBAAiB,sBAAI,eAAe;AAAA,EACpC,cAAU,sBAAI,UAAU;AAAA,EACxB,oBAAgB,sBAAI,cAAc;AAAA,EAClC,SAAK,sBAAI,KAAK;AAAA,EACd,QAAI,sBAAI,IAAI;AAAA,EACZ,UAAM,sBAAI,MAAM;AAAA,EAChB,UAAM,sBAAI,MAAM;AAAA,EAChB,cAAU,sBAAI,UAAU;AAAA,EACxB,mBAAe,sBAAI,aAAa;AAAA,EAChC,iBAAa,sBAAI,WAAW;AAAA,EAC5B,mBAAe,sBAAI,aAAa;AAAA,EAChC,cAAU,sBAAI,QAAQ;AAAA,EACtB,gBAAY,sBAAI,UAAU;AAAA,EAC1B,mBAAe,sBAAI,aAAa;AAAA,EAChC,aAAS,sBAAI,SAAS;AAAA,EACtB,gBAAY,sBAAI,YAAY;AAC9B;AAEO,SAAS,YAAY;AAAA,EAC1B;AAAA,EAAO;AAAA,EAAS;AAAA,EAAU,OAAO;AACnC,GAA6G;AAC3G,QAAM,QAAI,sBAAK;AACf,SACE,4CAAC,SAAI,WAAU,uDACZ,kBAAQ,IAAI,CAAC,KAAK,MACjB;AAAA,IAAC;AAAA;AAAA,MAEC,MAAK;AAAA,MACL,gBAAc,UAAU;AAAA,MACxB,SAAS,MAAM,SAAS,GAAG;AAAA,MAC3B,eAAW;AAAA,QACT;AAAA,QACA,IAAI,KAAK;AAAA,QACT,UAAU,MACN,SAAS,YAAY,yCAAyC,mDAC9D;AAAA,MACN;AAAA,MAEC,YAAE,cAAc,GAAG,KAAK,GAAG;AAAA;AAAA,IAZvB;AAAA,EAaP,CACD,GACH;AAEJ;AAEO,SAAS,QAAQ,EAAE,OAAO,MAAM,QAAQ,SAAS,GAErD;AACD,SACE,6CAAC,SAAI,WAAU,uBACb;AAAA,iDAAC,SAAI,WAAU,iDACb;AAAA,kDAAC,UAAK,WAAU,gBAAgB,gBAAK;AAAA,MACpC;AAAA,MACA,UAAU,4CAAC,UAAK,WAAU,qDAAqD,kBAAO;AAAA,OACzF;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
@@ -6,9 +6,10 @@ declare function ToggleGroup({ value, options, onChange, tone, }: {
6
6
  onChange: (v: string) => void;
7
7
  tone?: "brand" | "neutral";
8
8
  }): react_jsx_runtime.JSX.Element;
9
- declare function Section({ title, icon, children }: {
9
+ declare function Section({ title, icon, action, children }: {
10
10
  title: string;
11
11
  icon: React.ReactNode;
12
+ action?: React.ReactNode;
12
13
  children: React.ReactNode;
13
14
  }): react_jsx_runtime.JSX.Element;
14
15
 
@@ -6,9 +6,10 @@ declare function ToggleGroup({ value, options, onChange, tone, }: {
6
6
  onChange: (v: string) => void;
7
7
  tone?: "brand" | "neutral";
8
8
  }): react_jsx_runtime.JSX.Element;
9
- declare function Section({ title, icon, children }: {
9
+ declare function Section({ title, icon, action, children }: {
10
10
  title: string;
11
11
  icon: React.ReactNode;
12
+ action?: React.ReactNode;
12
13
  children: React.ReactNode;
13
14
  }): react_jsx_runtime.JSX.Element;
14
15
 
@@ -46,11 +46,12 @@ function ToggleGroup({
46
46
  opt
47
47
  )) });
48
48
  }
49
- function Section({ title, icon, children }) {
49
+ function Section({ title, icon, action, children }) {
50
50
  return /* @__PURE__ */ jsxs("div", { className: "panel p-5 space-y-4", children: [
51
51
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-semibold", children: [
52
52
  /* @__PURE__ */ jsx("span", { className: "text-primary", children: icon }),
53
- title
53
+ title,
54
+ action && /* @__PURE__ */ jsx("span", { className: "ml-auto text-xs font-normal text-muted-foreground", children: action })
54
55
  ] }),
55
56
  children
56
57
  ] });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/create-form-primitives.tsx"],"sourcesContent":["import { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { msg } from \"../i18n/translate.js\";\n\nconst OPTION_LABELS: Record<string, string> = {\n Allowed: msg(\"Allowed\"),\n \"Not Allowed\": msg(\"Not Allowed\"),\n \"Share-Alike\": msg(\"Share-Alike\"),\n \"Training Only\": msg(\"Training Only\"),\n Required: msg(\"Required\"),\n \"Not Required\": msg(\"Not Required\"),\n Yes: msg(\"Yes\"),\n No: msg(\"No\"),\n Free: msg(\"Free\"),\n Paid: msg(\"Paid\"),\n Everyone: msg(\"Everyone\"),\n \"Wallet list\": msg(\"Wallet list\"),\n \"At launch\": msg(\"At launch\"),\n \"Pick a date\": msg(\"Pick a date\"),\n \"No end\": msg(\"No end\"),\n \"No limit\": msg(\"No limit\"),\n \"Set a limit\": msg(\"Set a limit\"),\n Edition: msg(\"Edition\"),\n Collection: msg(\"Collection\"),\n};\n\nexport function ToggleGroup({\n value, options, onChange, tone = \"brand\",\n}: { value: string; options: readonly string[]; onChange: (v: string) => void; tone?: \"brand\" | \"neutral\" }) {\n const t = useT();\n return (\n <div className=\"flex rounded-2xl overflow-hidden w-full bg-muted/40\">\n {options.map((opt, i) => (\n <button\n key={opt}\n type=\"button\"\n aria-pressed={value === opt}\n onClick={() => onChange(opt)}\n className={cn(\n \"flex-1 px-3 py-2 text-sm transition-colors\",\n i > 0 && \"border-l border-border\",\n value === opt\n ? tone === \"neutral\" ? \"bg-muted text-foreground font-medium\" : \"bg-primary text-primary-foreground font-medium\"\n : \"bg-background hover:bg-muted text-muted-foreground\",\n )}\n >\n {t(OPTION_LABELS[opt] ?? opt)}\n </button>\n ))}\n </div>\n );\n}\n\nexport function Section({ title, icon, children }: {\n title: string; icon: React.ReactNode; children: React.ReactNode;\n}) {\n return (\n <div className=\"panel p-5 space-y-4\">\n <div className=\"flex items-center gap-2 text-sm font-semibold\">\n <span className=\"text-primary\">{icon}</span>\n {title}\n </div>\n {children}\n </div>\n );\n}\n"],"mappings":"AAiCQ,cAyBF,YAzBE;AAjCR,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,WAAW;AAEpB,MAAM,gBAAwC;AAAA,EAC5C,SAAS,IAAI,SAAS;AAAA,EACtB,eAAe,IAAI,aAAa;AAAA,EAChC,eAAe,IAAI,aAAa;AAAA,EAChC,iBAAiB,IAAI,eAAe;AAAA,EACpC,UAAU,IAAI,UAAU;AAAA,EACxB,gBAAgB,IAAI,cAAc;AAAA,EAClC,KAAK,IAAI,KAAK;AAAA,EACd,IAAI,IAAI,IAAI;AAAA,EACZ,MAAM,IAAI,MAAM;AAAA,EAChB,MAAM,IAAI,MAAM;AAAA,EAChB,UAAU,IAAI,UAAU;AAAA,EACxB,eAAe,IAAI,aAAa;AAAA,EAChC,aAAa,IAAI,WAAW;AAAA,EAC5B,eAAe,IAAI,aAAa;AAAA,EAChC,UAAU,IAAI,QAAQ;AAAA,EACtB,YAAY,IAAI,UAAU;AAAA,EAC1B,eAAe,IAAI,aAAa;AAAA,EAChC,SAAS,IAAI,SAAS;AAAA,EACtB,YAAY,IAAI,YAAY;AAC9B;AAEO,SAAS,YAAY;AAAA,EAC1B;AAAA,EAAO;AAAA,EAAS;AAAA,EAAU,OAAO;AACnC,GAA6G;AAC3G,QAAM,IAAI,KAAK;AACf,SACE,oBAAC,SAAI,WAAU,uDACZ,kBAAQ,IAAI,CAAC,KAAK,MACjB;AAAA,IAAC;AAAA;AAAA,MAEC,MAAK;AAAA,MACL,gBAAc,UAAU;AAAA,MACxB,SAAS,MAAM,SAAS,GAAG;AAAA,MAC3B,WAAW;AAAA,QACT;AAAA,QACA,IAAI,KAAK;AAAA,QACT,UAAU,MACN,SAAS,YAAY,yCAAyC,mDAC9D;AAAA,MACN;AAAA,MAEC,YAAE,cAAc,GAAG,KAAK,GAAG;AAAA;AAAA,IAZvB;AAAA,EAaP,CACD,GACH;AAEJ;AAEO,SAAS,QAAQ,EAAE,OAAO,MAAM,SAAS,GAE7C;AACD,SACE,qBAAC,SAAI,WAAU,uBACb;AAAA,yBAAC,SAAI,WAAU,iDACb;AAAA,0BAAC,UAAK,WAAU,gBAAgB,gBAAK;AAAA,MACpC;AAAA,OACH;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/create-form-primitives.tsx"],"sourcesContent":["import { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { msg } from \"../i18n/translate.js\";\n\nconst OPTION_LABELS: Record<string, string> = {\n Allowed: msg(\"Allowed\"),\n \"Not Allowed\": msg(\"Not Allowed\"),\n \"Share-Alike\": msg(\"Share-Alike\"),\n \"Training Only\": msg(\"Training Only\"),\n Required: msg(\"Required\"),\n \"Not Required\": msg(\"Not Required\"),\n Yes: msg(\"Yes\"),\n No: msg(\"No\"),\n Free: msg(\"Free\"),\n Paid: msg(\"Paid\"),\n Everyone: msg(\"Everyone\"),\n \"Wallet list\": msg(\"Wallet list\"),\n \"At launch\": msg(\"At launch\"),\n \"Pick a date\": msg(\"Pick a date\"),\n \"No end\": msg(\"No end\"),\n \"No limit\": msg(\"No limit\"),\n \"Set a limit\": msg(\"Set a limit\"),\n Edition: msg(\"Edition\"),\n Collection: msg(\"Collection\"),\n};\n\nexport function ToggleGroup({\n value, options, onChange, tone = \"brand\",\n}: { value: string; options: readonly string[]; onChange: (v: string) => void; tone?: \"brand\" | \"neutral\" }) {\n const t = useT();\n return (\n <div className=\"flex rounded-2xl overflow-hidden w-full bg-muted/40\">\n {options.map((opt, i) => (\n <button\n key={opt}\n type=\"button\"\n aria-pressed={value === opt}\n onClick={() => onChange(opt)}\n className={cn(\n \"flex-1 px-3 py-2 text-sm transition-colors\",\n i > 0 && \"border-l border-border\",\n value === opt\n ? tone === \"neutral\" ? \"bg-muted text-foreground font-medium\" : \"bg-primary text-primary-foreground font-medium\"\n : \"bg-background hover:bg-muted text-muted-foreground\",\n )}\n >\n {t(OPTION_LABELS[opt] ?? opt)}\n </button>\n ))}\n </div>\n );\n}\n\nexport function Section({ title, icon, action, children }: {\n title: string; icon: React.ReactNode; action?: React.ReactNode; children: React.ReactNode;\n}) {\n return (\n <div className=\"panel p-5 space-y-4\">\n <div className=\"flex items-center gap-2 text-sm font-semibold\">\n <span className=\"text-primary\">{icon}</span>\n {title}\n {action && <span className=\"ml-auto text-xs font-normal text-muted-foreground\">{action}</span>}\n </div>\n {children}\n </div>\n );\n}\n"],"mappings":"AAiCQ,cAyBF,YAzBE;AAjCR,SAAS,UAAU;AACnB,SAAS,YAAY;AACrB,SAAS,WAAW;AAEpB,MAAM,gBAAwC;AAAA,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