@medialane/ui 0.375.0 → 0.377.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/account/input-otp.d.cts +2 -2
- package/dist/components/account/input-otp.d.ts +2 -2
- package/dist/components/action-button.cjs +9 -7
- package/dist/components/action-button.cjs.map +1 -1
- package/dist/components/action-button.d.cts +8 -4
- package/dist/components/action-button.d.ts +8 -4
- package/dist/components/action-button.js +10 -8
- package/dist/components/action-button.js.map +1 -1
- package/dist/components/alert.d.cts +1 -1
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/archived-asset-notice.cjs +2 -1
- package/dist/components/archived-asset-notice.cjs.map +1 -1
- package/dist/components/archived-asset-notice.js +2 -1
- package/dist/components/archived-asset-notice.js.map +1 -1
- package/dist/components/asset-access-cards.cjs +2 -1
- package/dist/components/asset-access-cards.cjs.map +1 -1
- package/dist/components/asset-access-cards.js +2 -1
- package/dist/components/asset-access-cards.js.map +1 -1
- package/dist/components/asset-collection-bar.cjs +3 -2
- package/dist/components/asset-collection-bar.cjs.map +1 -1
- package/dist/components/asset-collection-bar.js +3 -2
- package/dist/components/asset-collection-bar.js.map +1 -1
- package/dist/components/asset-license-summary.cjs +4 -10
- package/dist/components/asset-license-summary.cjs.map +1 -1
- package/dist/components/asset-license-summary.js +4 -10
- package/dist/components/asset-license-summary.js.map +1 -1
- package/dist/components/asset-marketplace-panel.cjs +7 -17
- package/dist/components/asset-marketplace-panel.cjs.map +1 -1
- package/dist/components/asset-marketplace-panel.js +7 -17
- package/dist/components/asset-marketplace-panel.js.map +1 -1
- package/dist/components/asset-markets-tab.cjs +6 -23
- package/dist/components/asset-markets-tab.cjs.map +1 -1
- package/dist/components/asset-markets-tab.js +6 -23
- package/dist/components/asset-markets-tab.js.map +1 -1
- package/dist/components/asset-overview-content.cjs +27 -36
- package/dist/components/asset-overview-content.cjs.map +1 -1
- package/dist/components/asset-overview-content.js +27 -36
- package/dist/components/asset-overview-content.js.map +1 -1
- package/dist/components/asset-owners-panel.cjs +2 -1
- package/dist/components/asset-owners-panel.cjs.map +1 -1
- package/dist/components/asset-owners-panel.js +2 -1
- package/dist/components/asset-owners-panel.js.map +1 -1
- package/dist/components/asset-provenance-tab.cjs +15 -12
- package/dist/components/asset-provenance-tab.cjs.map +1 -1
- package/dist/components/asset-provenance-tab.js +15 -12
- package/dist/components/asset-provenance-tab.js.map +1 -1
- package/dist/components/asset-publication.cjs +2 -1
- package/dist/components/asset-publication.cjs.map +1 -1
- package/dist/components/asset-publication.js +2 -1
- package/dist/components/asset-publication.js.map +1 -1
- package/dist/components/asset-type-panels.cjs +4 -5
- package/dist/components/asset-type-panels.cjs.map +1 -1
- package/dist/components/asset-type-panels.js +4 -5
- package/dist/components/asset-type-panels.js.map +1 -1
- package/dist/components/badge.d.cts +1 -1
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/button.d.cts +2 -2
- package/dist/components/button.d.ts +2 -2
- package/dist/components/hidden-content-banner.cjs +4 -3
- package/dist/components/hidden-content-banner.cjs.map +1 -1
- package/dist/components/hidden-content-banner.js +4 -3
- package/dist/components/hidden-content-banner.js.map +1 -1
- package/dist/components/ip-type-badge.cjs +2 -3
- package/dist/components/ip-type-badge.cjs.map +1 -1
- package/dist/components/ip-type-badge.js +2 -3
- package/dist/components/ip-type-badge.js.map +1 -1
- package/dist/components/ip-type-display.cjs +5 -2
- package/dist/components/ip-type-display.cjs.map +1 -1
- package/dist/components/ip-type-display.js +5 -2
- package/dist/components/ip-type-display.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/panel.cjs +81 -0
- package/dist/components/panel.cjs.map +1 -0
- package/dist/components/panel.d.cts +22 -0
- package/dist/components/panel.d.ts +22 -0
- package/dist/components/panel.js +44 -0
- package/dist/components/panel.js.map +1 -0
- package/dist/components/sheet.d.cts +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/components/soulbound-card.cjs +2 -1
- package/dist/components/soulbound-card.cjs.map +1 -1
- package/dist/components/soulbound-card.js +2 -1
- package/dist/components/soulbound-card.js.map +1 -1
- package/dist/data/brand.cjs +37 -25
- package/dist/data/brand.cjs.map +1 -1
- package/dist/data/brand.d.cts +31 -14
- package/dist/data/brand.d.ts +31 -14
- package/dist/data/brand.js +33 -24
- package/dist/data/brand.js.map +1 -1
- package/dist/data/ip-types.cjs +11 -9
- package/dist/data/ip-types.cjs.map +1 -1
- package/dist/data/ip-types.js +11 -9
- package/dist/data/ip-types.js.map +1 -1
- package/dist/index.cjs +9 -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 +5 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/hidden-content-banner.tsx"],"sourcesContent":["\"use client\";\n\nimport { AlertTriangle } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\n\nexport function HiddenContentBanner() {\n const t = useT();\n return (\n <
|
|
1
|
+
{"version":3,"sources":["../../src/components/hidden-content-banner.tsx"],"sourcesContent":["\"use client\";\n\nimport { AlertTriangle } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\nimport { Panel } from \"./panel.js\";\n\nexport function HiddenContentBanner() {\n const t = useT();\n return (\n <Panel tone={[\"rose\", \"orange\"]} className=\"w-full px-4 py-3 flex items-start gap-3 mb-6\">\n <AlertTriangle className=\"w-4 h-4 text-brand-rose mt-0.5 shrink-0\" />\n <p className=\"text-sm text-foreground leading-relaxed\">\n {t(\"This content is not public visible on Medialane. For more information you can request support.\")}\n </p>\n </Panel>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AASI;AAPJ,0BAA8B;AAC9B,sBAAqB;AACrB,mBAAsB;AAEf,SAAS,sBAAsB;AACpC,QAAM,QAAI,sBAAK;AACf,SACE,6CAAC,sBAAM,MAAM,CAAC,QAAQ,QAAQ,GAAG,WAAU,gDACzC;AAAA,gDAAC,qCAAc,WAAU,2CAA0C;AAAA,IACnE,4CAAC,OAAE,WAAU,2CACV,YAAE,gGAAgG,GACrG;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -2,11 +2,12 @@
|
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { AlertTriangle } from "lucide-react";
|
|
4
4
|
import { useT } from "../i18n/provider.js";
|
|
5
|
+
import { Panel } from "./panel.js";
|
|
5
6
|
function HiddenContentBanner() {
|
|
6
7
|
const t = useT();
|
|
7
|
-
return /* @__PURE__ */ jsxs("
|
|
8
|
-
/* @__PURE__ */ jsx(AlertTriangle, { className: "w-4 h-4 text-
|
|
9
|
-
/* @__PURE__ */ jsx("p", { className: "text-sm text-
|
|
8
|
+
return /* @__PURE__ */ jsxs(Panel, { tone: ["rose", "orange"], className: "w-full px-4 py-3 flex items-start gap-3 mb-6", children: [
|
|
9
|
+
/* @__PURE__ */ jsx(AlertTriangle, { className: "w-4 h-4 text-brand-rose mt-0.5 shrink-0" }),
|
|
10
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm text-foreground leading-relaxed", children: t("This content is not public visible on Medialane. For more information you can request support.") })
|
|
10
11
|
] });
|
|
11
12
|
}
|
|
12
13
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/hidden-content-banner.tsx"],"sourcesContent":["\"use client\";\n\nimport { AlertTriangle } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\n\nexport function HiddenContentBanner() {\n const t = useT();\n return (\n <
|
|
1
|
+
{"version":3,"sources":["../../src/components/hidden-content-banner.tsx"],"sourcesContent":["\"use client\";\n\nimport { AlertTriangle } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\nimport { Panel } from \"./panel.js\";\n\nexport function HiddenContentBanner() {\n const t = useT();\n return (\n <Panel tone={[\"rose\", \"orange\"]} className=\"w-full px-4 py-3 flex items-start gap-3 mb-6\">\n <AlertTriangle className=\"w-4 h-4 text-brand-rose mt-0.5 shrink-0\" />\n <p className=\"text-sm text-foreground leading-relaxed\">\n {t(\"This content is not public visible on Medialane. For more information you can request support.\")}\n </p>\n </Panel>\n );\n}\n"],"mappings":";AASI,SACE,KADF;AAPJ,SAAS,qBAAqB;AAC9B,SAAS,YAAY;AACrB,SAAS,aAAa;AAEf,SAAS,sBAAsB;AACpC,QAAM,IAAI,KAAK;AACf,SACE,qBAAC,SAAM,MAAM,CAAC,QAAQ,QAAQ,GAAG,WAAU,gDACzC;AAAA,wBAAC,iBAAc,WAAU,2CAA0C;AAAA,IACnE,oBAAC,OAAE,WAAU,2CACV,YAAE,gGAAgG,GACrG;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -62,7 +62,7 @@ function IpTypeBadge({ ipType, size = "sm", showLabel = false, className, baseUr
|
|
|
62
62
|
(c) => c.label === ipType || c.apiValue === ipType
|
|
63
63
|
);
|
|
64
64
|
if (!config) return null;
|
|
65
|
-
const { icon: Icon, colorClass,
|
|
65
|
+
const { icon: Icon, colorClass, slug, label } = config;
|
|
66
66
|
const { container, icon } = SIZE[size];
|
|
67
67
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
68
68
|
"a",
|
|
@@ -71,8 +71,7 @@ function IpTypeBadge({ ipType, size = "sm", showLabel = false, className, baseUr
|
|
|
71
71
|
title: t(label),
|
|
72
72
|
className: (0, import_cn.cn)(
|
|
73
73
|
"inline-flex items-center justify-center rounded-full",
|
|
74
|
-
"transition-opacity hover:opacity-80",
|
|
75
|
-
bgClass,
|
|
74
|
+
"bg-background/40 transition-opacity hover:opacity-80",
|
|
76
75
|
showLabel ? PILL[size] : container,
|
|
77
76
|
className
|
|
78
77
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ip-type-badge.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Music, Palette, Film, Camera, Gem,\n FileText, BookOpen, File, Building, Layers,\n} from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { IP_TYPE_DATA, IP_TYPE_DATA_MAP } from \"../data/ip-types.js\";\nimport type { IpTypeData } from \"../data/ip-types.js\";\n\nexport interface IpTypeConfig extends IpTypeData {\n icon: React.ElementType;\n}\n\nexport const IP_TYPE_CONFIG: IpTypeConfig[] = IP_TYPE_DATA.map((d) => {\n const icons: Record<string, React.ElementType> = {\n audio: Music,\n video: Film,\n art: Palette,\n photography: Camera,\n nft: Gem,\n rwa: Building,\n posts: FileText,\n publications: BookOpen,\n documents: File,\n };\n return { ...d, icon: icons[d.slug] ?? Layers };\n});\n\nexport const IP_TYPE_MAP = Object.fromEntries(\n IP_TYPE_CONFIG.map((c) => [c.slug, c])\n) as Record<string, IpTypeConfig>;\n\nexport { IP_TYPE_DATA, IP_TYPE_DATA_MAP };\nexport type { IpTypeData };\n\nconst SIZE = {\n sm: { container: \"h-6 w-6\", icon: \"h-3 w-3\" },\n md: { container: \"h-8 w-8\", icon: \"h-4 w-4\" },\n};\n\nconst PILL = {\n sm: \"h-6 gap-1.5 px-2.5\",\n md: \"h-8 gap-2 px-3\",\n};\n\nexport interface IpTypeBadgeProps {\n ipType: string;\n size?: \"sm\" | \"md\";\n showLabel?: boolean;\n className?: string;\n\n baseUrl?: string;\n}\n\nexport function IpTypeBadge({ ipType, size = \"sm\", showLabel = false, className, baseUrl = \"\" }: IpTypeBadgeProps) {\n const t = useT();\n const config = IP_TYPE_CONFIG.find(\n (c) => c.label === ipType || c.apiValue === ipType\n );\n if (!config) return null;\n const { icon: Icon, colorClass,
|
|
1
|
+
{"version":3,"sources":["../../src/components/ip-type-badge.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Music, Palette, Film, Camera, Gem,\n FileText, BookOpen, File, Building, Layers,\n} from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { IP_TYPE_DATA, IP_TYPE_DATA_MAP } from \"../data/ip-types.js\";\nimport type { IpTypeData } from \"../data/ip-types.js\";\n\nexport interface IpTypeConfig extends IpTypeData {\n icon: React.ElementType;\n}\n\nexport const IP_TYPE_CONFIG: IpTypeConfig[] = IP_TYPE_DATA.map((d) => {\n const icons: Record<string, React.ElementType> = {\n audio: Music,\n video: Film,\n art: Palette,\n photography: Camera,\n nft: Gem,\n rwa: Building,\n posts: FileText,\n publications: BookOpen,\n documents: File,\n };\n return { ...d, icon: icons[d.slug] ?? Layers };\n});\n\nexport const IP_TYPE_MAP = Object.fromEntries(\n IP_TYPE_CONFIG.map((c) => [c.slug, c])\n) as Record<string, IpTypeConfig>;\n\nexport { IP_TYPE_DATA, IP_TYPE_DATA_MAP };\nexport type { IpTypeData };\n\nconst SIZE = {\n sm: { container: \"h-6 w-6\", icon: \"h-3 w-3\" },\n md: { container: \"h-8 w-8\", icon: \"h-4 w-4\" },\n};\n\nconst PILL = {\n sm: \"h-6 gap-1.5 px-2.5\",\n md: \"h-8 gap-2 px-3\",\n};\n\nexport interface IpTypeBadgeProps {\n ipType: string;\n size?: \"sm\" | \"md\";\n showLabel?: boolean;\n className?: string;\n\n baseUrl?: string;\n}\n\nexport function IpTypeBadge({ ipType, size = \"sm\", showLabel = false, className, baseUrl = \"\" }: IpTypeBadgeProps) {\n const t = useT();\n const config = IP_TYPE_CONFIG.find(\n (c) => c.label === ipType || c.apiValue === ipType\n );\n if (!config) return null;\n const { icon: Icon, colorClass, slug, label } = config;\n const { container, icon } = SIZE[size];\n return (\n <a\n href={`${baseUrl}/${slug}`}\n title={t(label)}\n className={cn(\n \"inline-flex items-center justify-center rounded-full\",\n \"bg-background/40 transition-opacity hover:opacity-80\",\n showLabel ? PILL[size] : container,\n className\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <Icon className={cn(colorClass, icon)} />\n {showLabel ? <span className={cn(\"text-xs font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A,QACT;AAAA,QACA;AAAA,QACA,YAAY,KAAK,IAAI,IAAI;AAAA,QACzB;AAAA,MACF;AAAA,MACA,SAAS,CAAC,MAAM,EAAE,gBAAgB;AAAA,MAElC;AAAA,oDAAC,QAAK,eAAW,cAAG,YAAY,IAAI,GAAG;AAAA,QACtC,YAAY,4CAAC,UAAK,eAAW,cAAG,yBAAyB,UAAU,GAAI,YAAE,KAAK,GAAE,IAAU;AAAA;AAAA;AAAA,EAC7F;AAEJ;","names":[]}
|
|
@@ -46,7 +46,7 @@ function IpTypeBadge({ ipType, size = "sm", showLabel = false, className, baseUr
|
|
|
46
46
|
(c) => c.label === ipType || c.apiValue === ipType
|
|
47
47
|
);
|
|
48
48
|
if (!config) return null;
|
|
49
|
-
const { icon: Icon, colorClass,
|
|
49
|
+
const { icon: Icon, colorClass, slug, label } = config;
|
|
50
50
|
const { container, icon } = SIZE[size];
|
|
51
51
|
return /* @__PURE__ */ jsxs(
|
|
52
52
|
"a",
|
|
@@ -55,8 +55,7 @@ function IpTypeBadge({ ipType, size = "sm", showLabel = false, className, baseUr
|
|
|
55
55
|
title: t(label),
|
|
56
56
|
className: cn(
|
|
57
57
|
"inline-flex items-center justify-center rounded-full",
|
|
58
|
-
"transition-opacity hover:opacity-80",
|
|
59
|
-
bgClass,
|
|
58
|
+
"bg-background/40 transition-opacity hover:opacity-80",
|
|
60
59
|
showLabel ? PILL[size] : container,
|
|
61
60
|
className
|
|
62
61
|
),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ip-type-badge.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Music, Palette, Film, Camera, Gem,\n FileText, BookOpen, File, Building, Layers,\n} from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { IP_TYPE_DATA, IP_TYPE_DATA_MAP } from \"../data/ip-types.js\";\nimport type { IpTypeData } from \"../data/ip-types.js\";\n\nexport interface IpTypeConfig extends IpTypeData {\n icon: React.ElementType;\n}\n\nexport const IP_TYPE_CONFIG: IpTypeConfig[] = IP_TYPE_DATA.map((d) => {\n const icons: Record<string, React.ElementType> = {\n audio: Music,\n video: Film,\n art: Palette,\n photography: Camera,\n nft: Gem,\n rwa: Building,\n posts: FileText,\n publications: BookOpen,\n documents: File,\n };\n return { ...d, icon: icons[d.slug] ?? Layers };\n});\n\nexport const IP_TYPE_MAP = Object.fromEntries(\n IP_TYPE_CONFIG.map((c) => [c.slug, c])\n) as Record<string, IpTypeConfig>;\n\nexport { IP_TYPE_DATA, IP_TYPE_DATA_MAP };\nexport type { IpTypeData };\n\nconst SIZE = {\n sm: { container: \"h-6 w-6\", icon: \"h-3 w-3\" },\n md: { container: \"h-8 w-8\", icon: \"h-4 w-4\" },\n};\n\nconst PILL = {\n sm: \"h-6 gap-1.5 px-2.5\",\n md: \"h-8 gap-2 px-3\",\n};\n\nexport interface IpTypeBadgeProps {\n ipType: string;\n size?: \"sm\" | \"md\";\n showLabel?: boolean;\n className?: string;\n\n baseUrl?: string;\n}\n\nexport function IpTypeBadge({ ipType, size = \"sm\", showLabel = false, className, baseUrl = \"\" }: IpTypeBadgeProps) {\n const t = useT();\n const config = IP_TYPE_CONFIG.find(\n (c) => c.label === ipType || c.apiValue === ipType\n );\n if (!config) return null;\n const { icon: Icon, colorClass,
|
|
1
|
+
{"version":3,"sources":["../../src/components/ip-type-badge.tsx"],"sourcesContent":["\"use client\";\n\nimport {\n Music, Palette, Film, Camera, Gem,\n FileText, BookOpen, File, Building, Layers,\n} from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { useT } from \"../i18n/provider.js\";\nimport { IP_TYPE_DATA, IP_TYPE_DATA_MAP } from \"../data/ip-types.js\";\nimport type { IpTypeData } from \"../data/ip-types.js\";\n\nexport interface IpTypeConfig extends IpTypeData {\n icon: React.ElementType;\n}\n\nexport const IP_TYPE_CONFIG: IpTypeConfig[] = IP_TYPE_DATA.map((d) => {\n const icons: Record<string, React.ElementType> = {\n audio: Music,\n video: Film,\n art: Palette,\n photography: Camera,\n nft: Gem,\n rwa: Building,\n posts: FileText,\n publications: BookOpen,\n documents: File,\n };\n return { ...d, icon: icons[d.slug] ?? Layers };\n});\n\nexport const IP_TYPE_MAP = Object.fromEntries(\n IP_TYPE_CONFIG.map((c) => [c.slug, c])\n) as Record<string, IpTypeConfig>;\n\nexport { IP_TYPE_DATA, IP_TYPE_DATA_MAP };\nexport type { IpTypeData };\n\nconst SIZE = {\n sm: { container: \"h-6 w-6\", icon: \"h-3 w-3\" },\n md: { container: \"h-8 w-8\", icon: \"h-4 w-4\" },\n};\n\nconst PILL = {\n sm: \"h-6 gap-1.5 px-2.5\",\n md: \"h-8 gap-2 px-3\",\n};\n\nexport interface IpTypeBadgeProps {\n ipType: string;\n size?: \"sm\" | \"md\";\n showLabel?: boolean;\n className?: string;\n\n baseUrl?: string;\n}\n\nexport function IpTypeBadge({ ipType, size = \"sm\", showLabel = false, className, baseUrl = \"\" }: IpTypeBadgeProps) {\n const t = useT();\n const config = IP_TYPE_CONFIG.find(\n (c) => c.label === ipType || c.apiValue === ipType\n );\n if (!config) return null;\n const { icon: Icon, colorClass, slug, label } = config;\n const { container, icon } = SIZE[size];\n return (\n <a\n href={`${baseUrl}/${slug}`}\n title={t(label)}\n className={cn(\n \"inline-flex items-center justify-center rounded-full\",\n \"bg-background/40 transition-opacity hover:opacity-80\",\n showLabel ? PILL[size] : container,\n className\n )}\n onClick={(e) => e.stopPropagation()}\n >\n <Icon className={cn(colorClass, icon)} />\n {showLabel ? <span className={cn(\"text-xs font-semibold\", colorClass)}>{t(label)}</span> : null}\n </a>\n );\n}\n"],"mappings":";AAiEI,SAWE,KAXF;AA/DJ;AAAA,EACE;AAAA,EAAO;AAAA,EAAS;AAAA,EAAM;AAAA,EAAQ;AAAA,EAC9B;AAAA,EAAU;AAAA,EAAU;AAAA,EAAM;AAAA,EAAU;AAAA,OAC/B;AACP,SAAS,UAAU;AACnB,SAAS,YAAY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I,GAAG;AAAA,QACtC,YAAY,oBAAC,UAAK,WAAW,GAAG,yBAAyB,UAAU,GAAI,YAAE,KAAK,GAAE,IAAU;AAAA;AAAA;AAAA,EAC7F;AAEJ;","names":[]}
|
|
@@ -28,6 +28,8 @@ var import_ip_templates = require("../data/ip-templates.js");
|
|
|
28
28
|
var import_ipfs = require("../utils/ipfs.js");
|
|
29
29
|
var import_lucide_react = require("lucide-react");
|
|
30
30
|
var import_provider = require("../i18n/provider.js");
|
|
31
|
+
var import_panel = require("./panel.js");
|
|
32
|
+
var import_cn = require("../utils/cn.js");
|
|
31
33
|
function parseYouTubeEmbed(url) {
|
|
32
34
|
try {
|
|
33
35
|
const u = new URL(url);
|
|
@@ -140,7 +142,8 @@ function IPTypeDisplay({ attributes }) {
|
|
|
140
142
|
href: docUri.startsWith("ipfs://") ? (0, import_ipfs.ipfsToHttp)(docUri) : docUri,
|
|
141
143
|
target: "_blank",
|
|
142
144
|
rel: "noopener noreferrer",
|
|
143
|
-
className: "flex items-center gap-3 rounded-
|
|
145
|
+
className: "flex items-center gap-3 rounded-2xl px-4 py-3 transition-colors hover:bg-background/40 group",
|
|
146
|
+
style: { backgroundImage: (0, import_panel.panelBackground)() },
|
|
144
147
|
children: [
|
|
145
148
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.FileText, { className: "h-5 w-5 text-primary shrink-0" }),
|
|
146
149
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
@@ -210,7 +213,7 @@ function IPTypeDisplay({ attributes }) {
|
|
|
210
213
|
href: value,
|
|
211
214
|
target: "_blank",
|
|
212
215
|
rel: "noopener noreferrer",
|
|
213
|
-
className: "inline-flex items-center gap-1.5 rounded-full
|
|
216
|
+
className: (0, import_cn.cn)("inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground", import_panel.PANEL_INSET),
|
|
214
217
|
children: [
|
|
215
218
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(SIcon, { className: "h-3.5 w-3.5" }),
|
|
216
219
|
t(meta.label)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ip-type-display.tsx"],"sourcesContent":["\"use client\";\n\nimport type { IPType } from \"../data/ip.js\";\nimport {\n IP_TEMPLATES,\n EMBED_PLATFORM_META,\n SOCIAL_PLATFORM_META,\n type EmbedPlatform,\n} from \"../data/ip-templates.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { ExternalLink, FileText, ShieldCheck } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\n\ninterface Attr {\n trait_type?: string | null;\n value?: string | null;\n}\n\ninterface IPTypeDisplayProps {\n attributes: Attr[] | null | undefined;\n}\n\nfunction parseYouTubeEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n let id: string | null = null;\n if (u.hostname.includes(\"youtu.be\")) {\n id = u.pathname.slice(1);\n } else if (u.hostname.includes(\"youtube.com\")) {\n id = u.searchParams.get(\"v\");\n }\n if (!id) return null;\n return `https://www.youtube.com/embed/${id}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSpotifyEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"spotify.com\")) return null;\n\n const match = u.pathname.match(\n /(track|album|playlist|episode|show|artist)\\/([A-Za-z0-9]+)/\n );\n if (!match) return null;\n return `https://open.spotify.com/embed/${match[1]}/${match[2]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSoundCloudEmbed(url: string): string | null {\n try {\n new URL(url);\n if (!url.includes(\"soundcloud.com\")) return null;\n const encoded = encodeURIComponent(url);\n return `https://w.soundcloud.com/player/?url=${encoded}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false`;\n } catch {\n return null;\n }\n}\n\nfunction parseTikTokEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"tiktok.com\")) return null;\n const match = u.pathname.match(/\\/video\\/(\\d+)/);\n if (!match) return null;\n return `https://www.tiktok.com/embed/v2/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseVimeoEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"vimeo.com\")) return null;\n const match = u.pathname.match(/(\\d+)/);\n if (!match) return null;\n return `https://player.vimeo.com/video/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nexport function getEmbedSrc(platform: EmbedPlatform, value: string): string | null {\n switch (platform) {\n case \"youtube\": return parseYouTubeEmbed(value);\n case \"spotify\": return parseSpotifyEmbed(value);\n case \"soundcloud\": return parseSoundCloudEmbed(value);\n case \"tiktok\": return parseTikTokEmbed(value);\n case \"vimeo\": return parseVimeoEmbed(value);\n }\n}\n\nconst COMPACT: Record<EmbedPlatform, boolean> = {\n spotify: true,\n soundcloud: true,\n youtube: false,\n tiktok: false,\n vimeo: false,\n};\n\nexport function IPTypeDisplay({ attributes }: IPTypeDisplayProps) {\n const t = useT();\n const attrs = attributes ?? [];\n\n const ipType = attrs.find(\n (a) => a.trait_type?.toLowerCase() === \"ip type\"\n )?.value as IPType | undefined;\n if (!ipType) return null;\n\n const template = IP_TEMPLATES[ipType];\n if (!template) return null;\n\n const getAttr = (key: string) =>\n attrs.find((a) => a.trait_type === key)?.value ?? null;\n\n const embeds = (template.embeds ?? []).flatMap((platform) => {\n const meta = EMBED_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const socials = (template.socials ?? []).flatMap((platform) => {\n const meta = SOCIAL_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const docUri = template.docUpload ? getAttr(template.docUpload.traitType) : null;\n\n if (embeds.length === 0 && socials.length === 0 && !docUri) return null;\n\n return (\n <div className=\"space-y-5\">\n\n {docUri && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Document\")}\n </p>\n <a\n href={docUri.startsWith(\"ipfs://\") ? ipfsToHttp(docUri) : docUri}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-3 rounded-xl border border-border bg-muted/20 px-4 py-3 transition-colors hover:border-primary/40 group\"\n >\n <FileText className=\"h-5 w-5 text-primary shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold group-hover:text-primary transition-colors\">\n {t(\"View document\")}\n </p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1 mt-0.5\">\n <ShieldCheck className=\"h-3 w-3 shrink-0\" />\n {t(\"Stored on IPFS — immutable, timestamped copy of the original\")}\n </p>\n </div>\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </a>\n </div>\n )}\n {embeds.map(({ platform, meta, value }) => {\n const src = getEmbedSrc(platform, value);\n if (src) {\n return (\n <div key={platform} className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(meta.label)}\n </p>\n {COMPACT[platform] ? (\n <iframe\n src={src}\n className=\"w-full rounded-xl border-0\"\n height={166}\n allow=\"autoplay\"\n loading=\"lazy\"\n title={t(meta.label)}\n />\n ) : (\n <div className=\"relative w-full aspect-video rounded-xl overflow-hidden bg-muted/20\">\n <iframe\n src={src}\n className=\"absolute inset-0 w-full h-full\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n loading=\"lazy\"\n title={t(meta.label)}\n />\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div key={platform}>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n {t(meta.label)}\n </p>\n <a\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\"\n >\n <ExternalLink className=\"h-3.5 w-3.5\" />\n {t(\"Open link\")}\n </a>\n </div>\n );\n })}\n\n {socials.length > 0 && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Links\")}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {socials.map(({ platform, meta, value }) => {\n const SIcon = meta.icon;\n return (\n <a\n key={platform}\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground\"\n >\n <SIcon className=\"h-3.5 w-3.5\" />\n {t(meta.label)}\n </a>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AA8IU;AA3IV,0BAKO;AACP,kBAA2B;AAC3B,0BAAoD;AACpD,sBAAqB;AAWrB,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,KAAoB;AACxB,QAAI,EAAE,SAAS,SAAS,UAAU,GAAG;AACnC,WAAK,EAAE,SAAS,MAAM,CAAC;AAAA,IACzB,WAAW,EAAE,SAAS,SAAS,aAAa,GAAG;AAC7C,WAAK,EAAE,aAAa,IAAI,GAAG;AAAA,IAC7B;AACA,QAAI,CAAC,GAAI,QAAO;AAChB,WAAO,iCAAiC,EAAE;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,CAAC,EAAE,SAAS,SAAS,aAAa,EAAG,QAAO;AAEhD,UAAM,QAAQ,EAAE,SAAS;AAAA,MACvB;AAAA,IACF;AACA,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,kCAAkC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA,EAC/D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,S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A,kDAAC,OAAE,WAAU,6CACV,YAAE,OAAO,GACZ;AAAA,MACA,4CAAC,SAAI,WAAU,wBACZ,kBAAQ,IAAI,CAAC,EAAE,UAAU,MAAM,MAAM,MAAM;AAC1C,cAAM,QAAQ,KAAK;AACnB,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,WAAU;AAAA,YAEV;AAAA,0DAAC,SAAM,WAAU,eAAc;AAAA,cAC9B,EAAE,KAAK,KAAK;AAAA;AAAA;AAAA,UAPR;AAAA,QAQP;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/ip-type-display.tsx"],"sourcesContent":["\"use client\";\n\nimport type { IPType } from \"../data/ip.js\";\nimport {\n IP_TEMPLATES,\n EMBED_PLATFORM_META,\n SOCIAL_PLATFORM_META,\n type EmbedPlatform,\n} from \"../data/ip-templates.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { ExternalLink, FileText, ShieldCheck } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\nimport { PANEL_INSET, panelBackground } from \"./panel.js\";\nimport { cn } from \"../utils/cn.js\";\n\ninterface Attr {\n trait_type?: string | null;\n value?: string | null;\n}\n\ninterface IPTypeDisplayProps {\n attributes: Attr[] | null | undefined;\n}\n\nfunction parseYouTubeEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n let id: string | null = null;\n if (u.hostname.includes(\"youtu.be\")) {\n id = u.pathname.slice(1);\n } else if (u.hostname.includes(\"youtube.com\")) {\n id = u.searchParams.get(\"v\");\n }\n if (!id) return null;\n return `https://www.youtube.com/embed/${id}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSpotifyEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"spotify.com\")) return null;\n\n const match = u.pathname.match(\n /(track|album|playlist|episode|show|artist)\\/([A-Za-z0-9]+)/\n );\n if (!match) return null;\n return `https://open.spotify.com/embed/${match[1]}/${match[2]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSoundCloudEmbed(url: string): string | null {\n try {\n new URL(url);\n if (!url.includes(\"soundcloud.com\")) return null;\n const encoded = encodeURIComponent(url);\n return `https://w.soundcloud.com/player/?url=${encoded}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false`;\n } catch {\n return null;\n }\n}\n\nfunction parseTikTokEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"tiktok.com\")) return null;\n const match = u.pathname.match(/\\/video\\/(\\d+)/);\n if (!match) return null;\n return `https://www.tiktok.com/embed/v2/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseVimeoEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"vimeo.com\")) return null;\n const match = u.pathname.match(/(\\d+)/);\n if (!match) return null;\n return `https://player.vimeo.com/video/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nexport function getEmbedSrc(platform: EmbedPlatform, value: string): string | null {\n switch (platform) {\n case \"youtube\": return parseYouTubeEmbed(value);\n case \"spotify\": return parseSpotifyEmbed(value);\n case \"soundcloud\": return parseSoundCloudEmbed(value);\n case \"tiktok\": return parseTikTokEmbed(value);\n case \"vimeo\": return parseVimeoEmbed(value);\n }\n}\n\nconst COMPACT: Record<EmbedPlatform, boolean> = {\n spotify: true,\n soundcloud: true,\n youtube: false,\n tiktok: false,\n vimeo: false,\n};\n\nexport function IPTypeDisplay({ attributes }: IPTypeDisplayProps) {\n const t = useT();\n const attrs = attributes ?? [];\n\n const ipType = attrs.find(\n (a) => a.trait_type?.toLowerCase() === \"ip type\"\n )?.value as IPType | undefined;\n if (!ipType) return null;\n\n const template = IP_TEMPLATES[ipType];\n if (!template) return null;\n\n const getAttr = (key: string) =>\n attrs.find((a) => a.trait_type === key)?.value ?? null;\n\n const embeds = (template.embeds ?? []).flatMap((platform) => {\n const meta = EMBED_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const socials = (template.socials ?? []).flatMap((platform) => {\n const meta = SOCIAL_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const docUri = template.docUpload ? getAttr(template.docUpload.traitType) : null;\n\n if (embeds.length === 0 && socials.length === 0 && !docUri) return null;\n\n return (\n <div className=\"space-y-5\">\n\n {docUri && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Document\")}\n </p>\n <a\n href={docUri.startsWith(\"ipfs://\") ? ipfsToHttp(docUri) : docUri}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-3 rounded-2xl px-4 py-3 transition-colors hover:bg-background/40 group\"\n style={{ backgroundImage: panelBackground() }}\n >\n <FileText className=\"h-5 w-5 text-primary shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold group-hover:text-primary transition-colors\">\n {t(\"View document\")}\n </p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1 mt-0.5\">\n <ShieldCheck className=\"h-3 w-3 shrink-0\" />\n {t(\"Stored on IPFS — immutable, timestamped copy of the original\")}\n </p>\n </div>\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </a>\n </div>\n )}\n {embeds.map(({ platform, meta, value }) => {\n const src = getEmbedSrc(platform, value);\n if (src) {\n return (\n <div key={platform} className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(meta.label)}\n </p>\n {COMPACT[platform] ? (\n <iframe\n src={src}\n className=\"w-full rounded-xl border-0\"\n height={166}\n allow=\"autoplay\"\n loading=\"lazy\"\n title={t(meta.label)}\n />\n ) : (\n <div className=\"relative w-full aspect-video rounded-xl overflow-hidden bg-muted/20\">\n <iframe\n src={src}\n className=\"absolute inset-0 w-full h-full\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n loading=\"lazy\"\n title={t(meta.label)}\n />\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div key={platform}>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n {t(meta.label)}\n </p>\n <a\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\"\n >\n <ExternalLink className=\"h-3.5 w-3.5\" />\n {t(\"Open link\")}\n </a>\n </div>\n );\n })}\n\n {socials.length > 0 && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Links\")}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {socials.map(({ platform, meta, value }) => {\n const SIcon = meta.icon;\n return (\n <a\n key={platform}\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\"inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground\", PANEL_INSET)}\n >\n <SIcon className=\"h-3.5 w-3.5\" />\n {t(meta.label)}\n </a>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAgJU;AA7IV,0BAKO;AACP,kBAA2B;AAC3B,0BAAoD;AACpD,sBAAqB;AACrB,mBAA6C;AAC7C,gBAAmB;AAWnB,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,KAAoB;AACxB,QAAI,EAAE,SAAS,SAAS,UAAU,GAAG;AACnC,WAAK,EAAE,SAAS,MAAM,CAAC;AAAA,IACzB,WAAW,EAAE,SAAS,SAAS,aAAa,GAAG;AAC7C,WAAK,EAAE,aAAa,IAAI,GAAG;AAAA,IAC7B;AACA,QAAI,CAAC,GAA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;AAAA,cACR,OAAO,EAAE,KAAK,KAAK;AAAA;AAAA,UACrB,GACF;AAAA,aAvBM,QAyBV;AAAA,MAEJ;AAEA,aACE,6CAAC,SACC;AAAA,oDAAC,OAAE,WAAU,kDACV,YAAE,KAAK,KAAK,GACf;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,WAAU;AAAA,YAEV;AAAA,0DAAC,oCAAa,WAAU,eAAc;AAAA,cACrC,EAAE,WAAW;AAAA;AAAA;AAAA,QAChB;AAAA,WAZQ,QAaV;AAAA,IAEJ,CAAC;AAAA,IAEA,QAAQ,SAAS,KAChB,6CAAC,SAAI,WAAU,eACb;AAAA,kDAAC,OAAE,WAAU,6CACV,YAAE,OAAO,GACZ;AAAA,MACA,4CAAC,SAAI,WAAU,wBACZ,kBAAQ,IAAI,CAAC,EAAE,UAAU,MAAM,MAAM,MAAM;AAC1C,cAAM,QAAQ,KAAK;AACnB,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,eAAW,cAAG,6HAA6H,wBAAW;AAAA,YAEtJ;AAAA,0DAAC,SAAM,WAAU,eAAc;AAAA,cAC9B,EAAE,KAAK,KAAK;AAAA;AAAA;AAAA,UAPR;AAAA,QAQP;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -8,6 +8,8 @@ import {
|
|
|
8
8
|
import { ipfsToHttp } from "../utils/ipfs.js";
|
|
9
9
|
import { ExternalLink, FileText, ShieldCheck } from "lucide-react";
|
|
10
10
|
import { useT } from "../i18n/provider.js";
|
|
11
|
+
import { PANEL_INSET, panelBackground } from "./panel.js";
|
|
12
|
+
import { cn } from "../utils/cn.js";
|
|
11
13
|
function parseYouTubeEmbed(url) {
|
|
12
14
|
try {
|
|
13
15
|
const u = new URL(url);
|
|
@@ -120,7 +122,8 @@ function IPTypeDisplay({ attributes }) {
|
|
|
120
122
|
href: docUri.startsWith("ipfs://") ? ipfsToHttp(docUri) : docUri,
|
|
121
123
|
target: "_blank",
|
|
122
124
|
rel: "noopener noreferrer",
|
|
123
|
-
className: "flex items-center gap-3 rounded-
|
|
125
|
+
className: "flex items-center gap-3 rounded-2xl px-4 py-3 transition-colors hover:bg-background/40 group",
|
|
126
|
+
style: { backgroundImage: panelBackground() },
|
|
124
127
|
children: [
|
|
125
128
|
/* @__PURE__ */ jsx(FileText, { className: "h-5 w-5 text-primary shrink-0" }),
|
|
126
129
|
/* @__PURE__ */ jsxs("div", { className: "min-w-0 flex-1", children: [
|
|
@@ -190,7 +193,7 @@ function IPTypeDisplay({ attributes }) {
|
|
|
190
193
|
href: value,
|
|
191
194
|
target: "_blank",
|
|
192
195
|
rel: "noopener noreferrer",
|
|
193
|
-
className: "inline-flex items-center gap-1.5 rounded-full
|
|
196
|
+
className: cn("inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground", PANEL_INSET),
|
|
194
197
|
children: [
|
|
195
198
|
/* @__PURE__ */ jsx(SIcon, { className: "h-3.5 w-3.5" }),
|
|
196
199
|
t(meta.label)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/ip-type-display.tsx"],"sourcesContent":["\"use client\";\n\nimport type { IPType } from \"../data/ip.js\";\nimport {\n IP_TEMPLATES,\n EMBED_PLATFORM_META,\n SOCIAL_PLATFORM_META,\n type EmbedPlatform,\n} from \"../data/ip-templates.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { ExternalLink, FileText, ShieldCheck } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\n\ninterface Attr {\n trait_type?: string | null;\n value?: string | null;\n}\n\ninterface IPTypeDisplayProps {\n attributes: Attr[] | null | undefined;\n}\n\nfunction parseYouTubeEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n let id: string | null = null;\n if (u.hostname.includes(\"youtu.be\")) {\n id = u.pathname.slice(1);\n } else if (u.hostname.includes(\"youtube.com\")) {\n id = u.searchParams.get(\"v\");\n }\n if (!id) return null;\n return `https://www.youtube.com/embed/${id}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSpotifyEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"spotify.com\")) return null;\n\n const match = u.pathname.match(\n /(track|album|playlist|episode|show|artist)\\/([A-Za-z0-9]+)/\n );\n if (!match) return null;\n return `https://open.spotify.com/embed/${match[1]}/${match[2]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSoundCloudEmbed(url: string): string | null {\n try {\n new URL(url);\n if (!url.includes(\"soundcloud.com\")) return null;\n const encoded = encodeURIComponent(url);\n return `https://w.soundcloud.com/player/?url=${encoded}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false`;\n } catch {\n return null;\n }\n}\n\nfunction parseTikTokEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"tiktok.com\")) return null;\n const match = u.pathname.match(/\\/video\\/(\\d+)/);\n if (!match) return null;\n return `https://www.tiktok.com/embed/v2/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseVimeoEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"vimeo.com\")) return null;\n const match = u.pathname.match(/(\\d+)/);\n if (!match) return null;\n return `https://player.vimeo.com/video/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nexport function getEmbedSrc(platform: EmbedPlatform, value: string): string | null {\n switch (platform) {\n case \"youtube\": return parseYouTubeEmbed(value);\n case \"spotify\": return parseSpotifyEmbed(value);\n case \"soundcloud\": return parseSoundCloudEmbed(value);\n case \"tiktok\": return parseTikTokEmbed(value);\n case \"vimeo\": return parseVimeoEmbed(value);\n }\n}\n\nconst COMPACT: Record<EmbedPlatform, boolean> = {\n spotify: true,\n soundcloud: true,\n youtube: false,\n tiktok: false,\n vimeo: false,\n};\n\nexport function IPTypeDisplay({ attributes }: IPTypeDisplayProps) {\n const t = useT();\n const attrs = attributes ?? [];\n\n const ipType = attrs.find(\n (a) => a.trait_type?.toLowerCase() === \"ip type\"\n )?.value as IPType | undefined;\n if (!ipType) return null;\n\n const template = IP_TEMPLATES[ipType];\n if (!template) return null;\n\n const getAttr = (key: string) =>\n attrs.find((a) => a.trait_type === key)?.value ?? null;\n\n const embeds = (template.embeds ?? []).flatMap((platform) => {\n const meta = EMBED_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const socials = (template.socials ?? []).flatMap((platform) => {\n const meta = SOCIAL_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const docUri = template.docUpload ? getAttr(template.docUpload.traitType) : null;\n\n if (embeds.length === 0 && socials.length === 0 && !docUri) return null;\n\n return (\n <div className=\"space-y-5\">\n\n {docUri && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Document\")}\n </p>\n <a\n href={docUri.startsWith(\"ipfs://\") ? ipfsToHttp(docUri) : docUri}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-3 rounded-xl border border-border bg-muted/20 px-4 py-3 transition-colors hover:border-primary/40 group\"\n >\n <FileText className=\"h-5 w-5 text-primary shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold group-hover:text-primary transition-colors\">\n {t(\"View document\")}\n </p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1 mt-0.5\">\n <ShieldCheck className=\"h-3 w-3 shrink-0\" />\n {t(\"Stored on IPFS — immutable, timestamped copy of the original\")}\n </p>\n </div>\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </a>\n </div>\n )}\n {embeds.map(({ platform, meta, value }) => {\n const src = getEmbedSrc(platform, value);\n if (src) {\n return (\n <div key={platform} className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(meta.label)}\n </p>\n {COMPACT[platform] ? (\n <iframe\n src={src}\n className=\"w-full rounded-xl border-0\"\n height={166}\n allow=\"autoplay\"\n loading=\"lazy\"\n title={t(meta.label)}\n />\n ) : (\n <div className=\"relative w-full aspect-video rounded-xl overflow-hidden bg-muted/20\">\n <iframe\n src={src}\n className=\"absolute inset-0 w-full h-full\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n loading=\"lazy\"\n title={t(meta.label)}\n />\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div key={platform}>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n {t(meta.label)}\n </p>\n <a\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\"\n >\n <ExternalLink className=\"h-3.5 w-3.5\" />\n {t(\"Open link\")}\n </a>\n </div>\n );\n })}\n\n {socials.length > 0 && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Links\")}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {socials.map(({ platform, meta, value }) => {\n const SIcon = meta.icon;\n return (\n <a\n key={platform}\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 rounded-full border border-border bg-muted/30 px-3 py-1.5 text-xs font-medium text-muted-foreground transition-colors hover:border-primary/40 hover:text-foreground\"\n >\n <SIcon className=\"h-3.5 w-3.5\" />\n {t(meta.label)}\n </a>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AA8IU,cAcI,YAdJ;AA3IV;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAC3B,SAAS,cAAc,UAAU,mBAAmB;AACpD,SAAS,YAAY;A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AAU;AAAA,cACV,QAAQ;AAAA,cACR,OAAM;AAAA,cACN,SAAQ;AAAA,cACR,OAAO,EAAE,KAAK,KAAK;AAAA;AAAA,UACrB,IAEA,oBAAC,SAAI,WAAU,uEACb;AAAA,YAAC;AAAA;AAAA,cACC;AAAA,cACA,WAAU;AAAA,cACV,OAAM;AAAA,cACN,iBAAe;AAAA,cACf,SAAQ;AAAA,cACR,OAAO,EAAE,KAAK,KAAK;AAAA;AAAA,UACrB,GACF;AAAA,aAvBM,QAyBV;AAAA,MAEJ;AAEA,aACE,qBAAC,SACC;AAAA,4BAAC,OAAE,WAAU,kDACV,YAAE,KAAK,KAAK,GACf;AAAA,QACA;AAAA,UAAC;AAAA;AAAA,YACC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,WAAU;AAAA,YAEV;AAAA,kCAAC,gBAAa,WAAU,eAAc;AAAA,cACrC,EAAE,WAAW;AAAA;AAAA;AAAA,QAChB;AAAA,WAZQ,QAaV;AAAA,IAEJ,CAAC;AAAA,IAEA,QAAQ,SAAS,KAChB,qBAAC,SAAI,WAAU,eACb;AAAA,0BAAC,OAAE,WAAU,6CACV,YAAE,OAAO,GACZ;AAAA,MACA,oBAAC,SAAI,WAAU,wBACZ,kBAAQ,IAAI,CAAC,EAAE,UAAU,MAAM,MAAM,MAAM;AAC1C,cAAM,QAAQ,KAAK;AACnB,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,WAAU;AAAA,YAEV;AAAA,kCAAC,SAAM,WAAU,eAAc;AAAA,cAC9B,EAAE,KAAK,KAAK;AAAA;AAAA;AAAA,UAPR;AAAA,QAQP;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/ip-type-display.tsx"],"sourcesContent":["\"use client\";\n\nimport type { IPType } from \"../data/ip.js\";\nimport {\n IP_TEMPLATES,\n EMBED_PLATFORM_META,\n SOCIAL_PLATFORM_META,\n type EmbedPlatform,\n} from \"../data/ip-templates.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { ExternalLink, FileText, ShieldCheck } from \"lucide-react\";\nimport { useT } from \"../i18n/provider.js\";\nimport { PANEL_INSET, panelBackground } from \"./panel.js\";\nimport { cn } from \"../utils/cn.js\";\n\ninterface Attr {\n trait_type?: string | null;\n value?: string | null;\n}\n\ninterface IPTypeDisplayProps {\n attributes: Attr[] | null | undefined;\n}\n\nfunction parseYouTubeEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n let id: string | null = null;\n if (u.hostname.includes(\"youtu.be\")) {\n id = u.pathname.slice(1);\n } else if (u.hostname.includes(\"youtube.com\")) {\n id = u.searchParams.get(\"v\");\n }\n if (!id) return null;\n return `https://www.youtube.com/embed/${id}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSpotifyEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"spotify.com\")) return null;\n\n const match = u.pathname.match(\n /(track|album|playlist|episode|show|artist)\\/([A-Za-z0-9]+)/\n );\n if (!match) return null;\n return `https://open.spotify.com/embed/${match[1]}/${match[2]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseSoundCloudEmbed(url: string): string | null {\n try {\n new URL(url);\n if (!url.includes(\"soundcloud.com\")) return null;\n const encoded = encodeURIComponent(url);\n return `https://w.soundcloud.com/player/?url=${encoded}&color=%23ff5500&auto_play=false&hide_related=true&show_comments=false&show_user=true&show_reposts=false`;\n } catch {\n return null;\n }\n}\n\nfunction parseTikTokEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"tiktok.com\")) return null;\n const match = u.pathname.match(/\\/video\\/(\\d+)/);\n if (!match) return null;\n return `https://www.tiktok.com/embed/v2/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nfunction parseVimeoEmbed(url: string): string | null {\n try {\n const u = new URL(url);\n if (!u.hostname.includes(\"vimeo.com\")) return null;\n const match = u.pathname.match(/(\\d+)/);\n if (!match) return null;\n return `https://player.vimeo.com/video/${match[1]}`;\n } catch {\n return null;\n }\n}\n\nexport function getEmbedSrc(platform: EmbedPlatform, value: string): string | null {\n switch (platform) {\n case \"youtube\": return parseYouTubeEmbed(value);\n case \"spotify\": return parseSpotifyEmbed(value);\n case \"soundcloud\": return parseSoundCloudEmbed(value);\n case \"tiktok\": return parseTikTokEmbed(value);\n case \"vimeo\": return parseVimeoEmbed(value);\n }\n}\n\nconst COMPACT: Record<EmbedPlatform, boolean> = {\n spotify: true,\n soundcloud: true,\n youtube: false,\n tiktok: false,\n vimeo: false,\n};\n\nexport function IPTypeDisplay({ attributes }: IPTypeDisplayProps) {\n const t = useT();\n const attrs = attributes ?? [];\n\n const ipType = attrs.find(\n (a) => a.trait_type?.toLowerCase() === \"ip type\"\n )?.value as IPType | undefined;\n if (!ipType) return null;\n\n const template = IP_TEMPLATES[ipType];\n if (!template) return null;\n\n const getAttr = (key: string) =>\n attrs.find((a) => a.trait_type === key)?.value ?? null;\n\n const embeds = (template.embeds ?? []).flatMap((platform) => {\n const meta = EMBED_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const socials = (template.socials ?? []).flatMap((platform) => {\n const meta = SOCIAL_PLATFORM_META[platform];\n const value = getAttr(meta.traitKey);\n return value ? [{ platform, meta, value }] : [];\n });\n\n const docUri = template.docUpload ? getAttr(template.docUpload.traitType) : null;\n\n if (embeds.length === 0 && socials.length === 0 && !docUri) return null;\n\n return (\n <div className=\"space-y-5\">\n\n {docUri && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Document\")}\n </p>\n <a\n href={docUri.startsWith(\"ipfs://\") ? ipfsToHttp(docUri) : docUri}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"flex items-center gap-3 rounded-2xl px-4 py-3 transition-colors hover:bg-background/40 group\"\n style={{ backgroundImage: panelBackground() }}\n >\n <FileText className=\"h-5 w-5 text-primary shrink-0\" />\n <div className=\"min-w-0 flex-1\">\n <p className=\"text-sm font-semibold group-hover:text-primary transition-colors\">\n {t(\"View document\")}\n </p>\n <p className=\"text-xs text-muted-foreground flex items-center gap-1 mt-0.5\">\n <ShieldCheck className=\"h-3 w-3 shrink-0\" />\n {t(\"Stored on IPFS — immutable, timestamped copy of the original\")}\n </p>\n </div>\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground shrink-0\" />\n </a>\n </div>\n )}\n {embeds.map(({ platform, meta, value }) => {\n const src = getEmbedSrc(platform, value);\n if (src) {\n return (\n <div key={platform} className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(meta.label)}\n </p>\n {COMPACT[platform] ? (\n <iframe\n src={src}\n className=\"w-full rounded-xl border-0\"\n height={166}\n allow=\"autoplay\"\n loading=\"lazy\"\n title={t(meta.label)}\n />\n ) : (\n <div className=\"relative w-full aspect-video rounded-xl overflow-hidden bg-muted/20\">\n <iframe\n src={src}\n className=\"absolute inset-0 w-full h-full\"\n allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture\"\n allowFullScreen\n loading=\"lazy\"\n title={t(meta.label)}\n />\n </div>\n )}\n </div>\n );\n }\n\n return (\n <div key={platform}>\n <p className=\"text-xs font-medium text-muted-foreground mb-1\">\n {t(meta.label)}\n </p>\n <a\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className=\"inline-flex items-center gap-1.5 text-sm text-primary hover:underline\"\n >\n <ExternalLink className=\"h-3.5 w-3.5\" />\n {t(\"Open link\")}\n </a>\n </div>\n );\n })}\n\n {socials.length > 0 && (\n <div className=\"space-y-1.5\">\n <p className=\"text-xs font-medium text-muted-foreground\">\n {t(\"Links\")}\n </p>\n <div className=\"flex flex-wrap gap-2\">\n {socials.map(({ platform, meta, value }) => {\n const SIcon = meta.icon;\n return (\n <a\n key={platform}\n href={value}\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n className={cn(\"inline-flex items-center gap-1.5 rounded-full px-3 py-1.5 text-xs font-medium text-muted-foreground hover:text-foreground\", PANEL_INSET)}\n >\n <SIcon className=\"h-3.5 w-3.5\" />\n {t(meta.label)}\n </a>\n );\n })}\n </div>\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAgJU,cAeI,YAfJ;AA7IV;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP,SAAS,kBAAkB;AAC3B,SAAS,cAAc,UAAU,mBAAmB;AACpD,SAAS,YAAY;AACrB,SAAS,aAAa,uBAAuB;AAC7C,SAAS,UAAU;AAWnB,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,KAAoB;AACxB,QAAI,EAAE,SAAS,SAAS,UAAU,GAAG;AACnC,WAAK,EAAE,SAAS,MAAM,CAAC;AAAA,IACzB,WAAW,EAAE,SAAS,SAAS,aAAa,GAAG;AAC7C,WAAK,EAAE,aAAa,IAAI,GAAG;AAAA,IAC7B;AACA,QAAI,CAAC,GAAI,QAAO;AAChB,WAAO,iCAAiC,EAAE;AAAA,EAC5C,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,kBAAkB,KAA4B;AACrD,MAAI;AACF,UAAM,IAAI,IAAI,IAAI,GAAG;AACrB,QAAI,CAAC,EAAE,SAAS,SAAS,aAAa,EAAG,QAAO;AAEhD,UAAM,QAAQ,EAAE,SAAS;AAAA,MACvB;AAAA,IACF;AACA,QAAI,CAAC,MAAO,QAAO;AACnB,WAAO,kCAAkC,MAAM,CAAC,CAAC,IAAI,MAAM,CAAC,CAAC;AAAA,EAC/D,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAEA,SAAS,qBAAqB,KAA4B;AACxD,MAAI;AACF,QAAI,IAAI,GAAG;AACX,QAAI,CAAC,IAAI,SAAS,gBA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AAA,MACA,oBAAC,SAAI,WAAU,wBACZ,kBAAQ,IAAI,CAAC,EAAE,UAAU,MAAM,MAAM,MAAM;AAC1C,cAAM,QAAQ,KAAK;AACnB,eACE;AAAA,UAAC;AAAA;AAAA,YAEC,MAAM;AAAA,YACN,QAAO;AAAA,YACP,KAAI;AAAA,YACJ,WAAW,GAAG,6HAA6H,WAAW;AAAA,YAEtJ;AAAA,kCAAC,SAAM,WAAU,eAAc;AAAA,cAC9B,EAAE,KAAK,KAAK;AAAA;AAAA;AAAA,UAPR;AAAA,QAQP;AAAA,MAEJ,CAAC,GACH;AAAA,OACF;AAAA,KAEJ;AAEJ;","names":[]}
|
|
@@ -16,6 +16,7 @@ declare const editionMintSchema: z.ZodObject<{
|
|
|
16
16
|
royalty: z.ZodNumber;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
name: string;
|
|
19
|
+
value: string;
|
|
19
20
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "RWA" | "Posts" | "Publications" | "Documents";
|
|
20
21
|
licenseType: string;
|
|
21
22
|
commercialUse: "Yes" | "No";
|
|
@@ -24,12 +25,12 @@ declare const editionMintSchema: z.ZodObject<{
|
|
|
24
25
|
geographicScope: string;
|
|
25
26
|
aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
|
|
26
27
|
royalty: number;
|
|
27
|
-
value: string;
|
|
28
28
|
recipient: string;
|
|
29
29
|
description?: string | undefined;
|
|
30
30
|
external_url?: string | undefined;
|
|
31
31
|
}, {
|
|
32
32
|
name: string;
|
|
33
|
+
value: string;
|
|
33
34
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "RWA" | "Posts" | "Publications" | "Documents";
|
|
34
35
|
licenseType: string;
|
|
35
36
|
commercialUse: "Yes" | "No";
|
|
@@ -38,7 +39,6 @@ declare const editionMintSchema: z.ZodObject<{
|
|
|
38
39
|
geographicScope: string;
|
|
39
40
|
aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
|
|
40
41
|
royalty: number;
|
|
41
|
-
value: string;
|
|
42
42
|
recipient: string;
|
|
43
43
|
description?: string | undefined;
|
|
44
44
|
external_url?: string | undefined;
|
|
@@ -16,6 +16,7 @@ declare const editionMintSchema: z.ZodObject<{
|
|
|
16
16
|
royalty: z.ZodNumber;
|
|
17
17
|
}, "strip", z.ZodTypeAny, {
|
|
18
18
|
name: string;
|
|
19
|
+
value: string;
|
|
19
20
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "RWA" | "Posts" | "Publications" | "Documents";
|
|
20
21
|
licenseType: string;
|
|
21
22
|
commercialUse: "Yes" | "No";
|
|
@@ -24,12 +25,12 @@ declare const editionMintSchema: z.ZodObject<{
|
|
|
24
25
|
geographicScope: string;
|
|
25
26
|
aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
|
|
26
27
|
royalty: number;
|
|
27
|
-
value: string;
|
|
28
28
|
recipient: string;
|
|
29
29
|
description?: string | undefined;
|
|
30
30
|
external_url?: string | undefined;
|
|
31
31
|
}, {
|
|
32
32
|
name: string;
|
|
33
|
+
value: string;
|
|
33
34
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "RWA" | "Posts" | "Publications" | "Documents";
|
|
34
35
|
licenseType: string;
|
|
35
36
|
commercialUse: "Yes" | "No";
|
|
@@ -38,7 +39,6 @@ declare const editionMintSchema: z.ZodObject<{
|
|
|
38
39
|
geographicScope: string;
|
|
39
40
|
aiPolicy: "Allowed" | "Not Allowed" | "Training Only";
|
|
40
41
|
royalty: number;
|
|
41
|
-
value: string;
|
|
42
42
|
recipient: string;
|
|
43
43
|
description?: string | undefined;
|
|
44
44
|
external_url?: string | undefined;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __export = (target, all) => {
|
|
9
|
+
for (var name in all)
|
|
10
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
+
};
|
|
12
|
+
var __copyProps = (to, from, except, desc) => {
|
|
13
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
+
for (let key of __getOwnPropNames(from))
|
|
15
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
28
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
+
var panel_exports = {};
|
|
30
|
+
__export(panel_exports, {
|
|
31
|
+
PANEL_INSET: () => PANEL_INSET,
|
|
32
|
+
Panel: () => Panel,
|
|
33
|
+
Pill: () => Pill,
|
|
34
|
+
panelBackground: () => panelBackground
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(panel_exports);
|
|
37
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
38
|
+
var React = __toESM(require("react"), 1);
|
|
39
|
+
var import_cn = require("../utils/cn.js");
|
|
40
|
+
var import_brand = require("../data/brand.js");
|
|
41
|
+
const stop = (color, alpha) => `hsl(var(--brand-${color}) / ${alpha})`;
|
|
42
|
+
function panelBackground(tone = "neutral") {
|
|
43
|
+
if (tone === "neutral") return "linear-gradient(to bottom right, hsl(var(--muted) / 0.4), transparent)";
|
|
44
|
+
if (typeof tone === "string") return `linear-gradient(to bottom right, ${stop(tone, 0.32)}, transparent)`;
|
|
45
|
+
const [from, to] = tone;
|
|
46
|
+
return `linear-gradient(to bottom right, ${stop(from, 0.32)}, ${stop(to, 0.16)}, transparent)`;
|
|
47
|
+
}
|
|
48
|
+
const Panel = React.forwardRef(
|
|
49
|
+
({ tone = "neutral", className, style, ...props }, ref) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
50
|
+
"div",
|
|
51
|
+
{
|
|
52
|
+
ref,
|
|
53
|
+
className: (0, import_cn.cn)("rounded-2xl", className),
|
|
54
|
+
style: { backgroundImage: panelBackground(tone), ...style },
|
|
55
|
+
...props
|
|
56
|
+
}
|
|
57
|
+
)
|
|
58
|
+
);
|
|
59
|
+
Panel.displayName = "Panel";
|
|
60
|
+
const PANEL_INSET = "bg-background/40 hover:bg-background/70 transition-colors";
|
|
61
|
+
function Pill({ color, className, ...props }) {
|
|
62
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
63
|
+
"span",
|
|
64
|
+
{
|
|
65
|
+
className: (0, import_cn.cn)(
|
|
66
|
+
"inline-flex w-fit items-center gap-1.5 rounded-full bg-background/40 px-3 py-1 text-xs font-medium",
|
|
67
|
+
color ? import_brand.BRAND[color].text : "text-muted-foreground",
|
|
68
|
+
className
|
|
69
|
+
),
|
|
70
|
+
...props
|
|
71
|
+
}
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
75
|
+
0 && (module.exports = {
|
|
76
|
+
PANEL_INSET,
|
|
77
|
+
Panel,
|
|
78
|
+
Pill,
|
|
79
|
+
panelBackground
|
|
80
|
+
});
|
|
81
|
+
//# sourceMappingURL=panel.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/panel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../utils/cn.js\";\nimport { BRAND } from \"../data/brand.js\";\n\nexport type PanelColor = keyof typeof BRAND;\n\n/** \"neutral\", one brand colour, or a pair blended from the first into the second. */\nexport type PanelTone = \"neutral\" | PanelColor | readonly [PanelColor, PanelColor];\n\nconst stop = (color: PanelColor, alpha: number) => `hsl(var(--brand-${color}) / ${alpha})`;\n\n/** Borderless surface: a soft gradient from the top-left corner that fades to transparent. */\nexport function panelBackground(tone: PanelTone = \"neutral\"): string {\n if (tone === \"neutral\") return \"linear-gradient(to bottom right, hsl(var(--muted) / 0.4), transparent)\";\n if (typeof tone === \"string\") return `linear-gradient(to bottom right, ${stop(tone, 0.32)}, transparent)`;\n const [from, to] = tone;\n return `linear-gradient(to bottom right, ${stop(from, 0.32)}, ${stop(to, 0.16)}, transparent)`;\n}\n\nexport interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {\n tone?: PanelTone;\n}\n\nexport const Panel = React.forwardRef<HTMLDivElement, PanelProps>(\n ({ tone = \"neutral\", className, style, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"rounded-2xl\", className)}\n style={{ backgroundImage: panelBackground(tone), ...style }}\n {...props}\n />\n ),\n);\nPanel.displayName = \"Panel\";\n\n/** Surface for controls and chips that sit on a panel. */\nexport const PANEL_INSET = \"bg-background/40 hover:bg-background/70 transition-colors\";\n\nexport interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Brand colour for the text and icon; muted text when omitted. */\n color?: PanelColor;\n}\n\nexport function Pill({ color, className, ...props }: PillProps) {\n return (\n <span\n className={cn(\n \"inline-flex w-fit items-center gap-1.5 rounded-full bg-background/40 px-3 py-1 text-xs font-medium\",\n color ? BRAND[color].text : \"text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAyBI;AAzBJ,YAAuB;AACvB,gBAAmB;AACnB,mBAAsB;AAOtB,MAAM,OAAO,CAAC,OAAmB,UAAkB,mBAAmB,KAAK,OAAO,KAAK;AAGhF,SAAS,gBAAgB,OAAkB,WAAmB;AACnE,MAAI,SAAS,UAAW,QAAO;AAC/B,MAAI,OAAO,SAAS,SAAU,QAAO,oCAAoC,KAAK,MAAM,IAAI,CAAC;AACzF,QAAM,CAAC,MAAM,EAAE,IAAI;AACnB,SAAO,oCAAoC,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC;AAChF;AAMO,MAAM,QAAQ,MAAM;AAAA,EACzB,CAAC,EAAE,OAAO,WAAW,WAAW,OAAO,GAAG,MAAM,GAAG,QACjD;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,eAAW,cAAG,eAAe,SAAS;AAAA,MACtC,OAAO,EAAE,iBAAiB,gBAAgB,IAAI,GAAG,GAAG,MAAM;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,MAAM,cAAc;AAGb,MAAM,cAAc;AAOpB,SAAS,KAAK,EAAE,OAAO,WAAW,GAAG,MAAM,GAAc;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,QACA,QAAQ,mBAAM,KAAK,EAAE,OAAO;AAAA,QAC5B;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { BRAND } from '../data/brand.cjs';
|
|
4
|
+
|
|
5
|
+
type PanelColor = keyof typeof BRAND;
|
|
6
|
+
/** "neutral", one brand colour, or a pair blended from the first into the second. */
|
|
7
|
+
type PanelTone = "neutral" | PanelColor | readonly [PanelColor, PanelColor];
|
|
8
|
+
/** Borderless surface: a soft gradient from the top-left corner that fades to transparent. */
|
|
9
|
+
declare function panelBackground(tone?: PanelTone): string;
|
|
10
|
+
interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
tone?: PanelTone;
|
|
12
|
+
}
|
|
13
|
+
declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
/** Surface for controls and chips that sit on a panel. */
|
|
15
|
+
declare const PANEL_INSET = "bg-background/40 hover:bg-background/70 transition-colors";
|
|
16
|
+
interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
17
|
+
/** Brand colour for the text and icon; muted text when omitted. */
|
|
18
|
+
color?: PanelColor;
|
|
19
|
+
}
|
|
20
|
+
declare function Pill({ color, className, ...props }: PillProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { PANEL_INSET, Panel, type PanelColor, type PanelProps, type PanelTone, Pill, type PillProps, panelBackground };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { BRAND } from '../data/brand.js';
|
|
4
|
+
|
|
5
|
+
type PanelColor = keyof typeof BRAND;
|
|
6
|
+
/** "neutral", one brand colour, or a pair blended from the first into the second. */
|
|
7
|
+
type PanelTone = "neutral" | PanelColor | readonly [PanelColor, PanelColor];
|
|
8
|
+
/** Borderless surface: a soft gradient from the top-left corner that fades to transparent. */
|
|
9
|
+
declare function panelBackground(tone?: PanelTone): string;
|
|
10
|
+
interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
11
|
+
tone?: PanelTone;
|
|
12
|
+
}
|
|
13
|
+
declare const Panel: React.ForwardRefExoticComponent<PanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
/** Surface for controls and chips that sit on a panel. */
|
|
15
|
+
declare const PANEL_INSET = "bg-background/40 hover:bg-background/70 transition-colors";
|
|
16
|
+
interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {
|
|
17
|
+
/** Brand colour for the text and icon; muted text when omitted. */
|
|
18
|
+
color?: PanelColor;
|
|
19
|
+
}
|
|
20
|
+
declare function Pill({ color, className, ...props }: PillProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
|
|
22
|
+
export { PANEL_INSET, Panel, type PanelColor, type PanelProps, type PanelTone, Pill, type PillProps, panelBackground };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
import { cn } from "../utils/cn.js";
|
|
4
|
+
import { BRAND } from "../data/brand.js";
|
|
5
|
+
const stop = (color, alpha) => `hsl(var(--brand-${color}) / ${alpha})`;
|
|
6
|
+
function panelBackground(tone = "neutral") {
|
|
7
|
+
if (tone === "neutral") return "linear-gradient(to bottom right, hsl(var(--muted) / 0.4), transparent)";
|
|
8
|
+
if (typeof tone === "string") return `linear-gradient(to bottom right, ${stop(tone, 0.32)}, transparent)`;
|
|
9
|
+
const [from, to] = tone;
|
|
10
|
+
return `linear-gradient(to bottom right, ${stop(from, 0.32)}, ${stop(to, 0.16)}, transparent)`;
|
|
11
|
+
}
|
|
12
|
+
const Panel = React.forwardRef(
|
|
13
|
+
({ tone = "neutral", className, style, ...props }, ref) => /* @__PURE__ */ jsx(
|
|
14
|
+
"div",
|
|
15
|
+
{
|
|
16
|
+
ref,
|
|
17
|
+
className: cn("rounded-2xl", className),
|
|
18
|
+
style: { backgroundImage: panelBackground(tone), ...style },
|
|
19
|
+
...props
|
|
20
|
+
}
|
|
21
|
+
)
|
|
22
|
+
);
|
|
23
|
+
Panel.displayName = "Panel";
|
|
24
|
+
const PANEL_INSET = "bg-background/40 hover:bg-background/70 transition-colors";
|
|
25
|
+
function Pill({ color, className, ...props }) {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"span",
|
|
28
|
+
{
|
|
29
|
+
className: cn(
|
|
30
|
+
"inline-flex w-fit items-center gap-1.5 rounded-full bg-background/40 px-3 py-1 text-xs font-medium",
|
|
31
|
+
color ? BRAND[color].text : "text-muted-foreground",
|
|
32
|
+
className
|
|
33
|
+
),
|
|
34
|
+
...props
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
export {
|
|
39
|
+
PANEL_INSET,
|
|
40
|
+
Panel,
|
|
41
|
+
Pill,
|
|
42
|
+
panelBackground
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=panel.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/components/panel.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { cn } from \"../utils/cn.js\";\nimport { BRAND } from \"../data/brand.js\";\n\nexport type PanelColor = keyof typeof BRAND;\n\n/** \"neutral\", one brand colour, or a pair blended from the first into the second. */\nexport type PanelTone = \"neutral\" | PanelColor | readonly [PanelColor, PanelColor];\n\nconst stop = (color: PanelColor, alpha: number) => `hsl(var(--brand-${color}) / ${alpha})`;\n\n/** Borderless surface: a soft gradient from the top-left corner that fades to transparent. */\nexport function panelBackground(tone: PanelTone = \"neutral\"): string {\n if (tone === \"neutral\") return \"linear-gradient(to bottom right, hsl(var(--muted) / 0.4), transparent)\";\n if (typeof tone === \"string\") return `linear-gradient(to bottom right, ${stop(tone, 0.32)}, transparent)`;\n const [from, to] = tone;\n return `linear-gradient(to bottom right, ${stop(from, 0.32)}, ${stop(to, 0.16)}, transparent)`;\n}\n\nexport interface PanelProps extends React.HTMLAttributes<HTMLDivElement> {\n tone?: PanelTone;\n}\n\nexport const Panel = React.forwardRef<HTMLDivElement, PanelProps>(\n ({ tone = \"neutral\", className, style, ...props }, ref) => (\n <div\n ref={ref}\n className={cn(\"rounded-2xl\", className)}\n style={{ backgroundImage: panelBackground(tone), ...style }}\n {...props}\n />\n ),\n);\nPanel.displayName = \"Panel\";\n\n/** Surface for controls and chips that sit on a panel. */\nexport const PANEL_INSET = \"bg-background/40 hover:bg-background/70 transition-colors\";\n\nexport interface PillProps extends React.HTMLAttributes<HTMLSpanElement> {\n /** Brand colour for the text and icon; muted text when omitted. */\n color?: PanelColor;\n}\n\nexport function Pill({ color, className, ...props }: PillProps) {\n return (\n <span\n className={cn(\n \"inline-flex w-fit items-center gap-1.5 rounded-full bg-background/40 px-3 py-1 text-xs font-medium\",\n color ? BRAND[color].text : \"text-muted-foreground\",\n className,\n )}\n {...props}\n />\n );\n}\n"],"mappings":"AAyBI;AAzBJ,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,aAAa;AAOtB,MAAM,OAAO,CAAC,OAAmB,UAAkB,mBAAmB,KAAK,OAAO,KAAK;AAGhF,SAAS,gBAAgB,OAAkB,WAAmB;AACnE,MAAI,SAAS,UAAW,QAAO;AAC/B,MAAI,OAAO,SAAS,SAAU,QAAO,oCAAoC,KAAK,MAAM,IAAI,CAAC;AACzF,QAAM,CAAC,MAAM,EAAE,IAAI;AACnB,SAAO,oCAAoC,KAAK,MAAM,IAAI,CAAC,KAAK,KAAK,IAAI,IAAI,CAAC;AAChF;AAMO,MAAM,QAAQ,MAAM;AAAA,EACzB,CAAC,EAAE,OAAO,WAAW,WAAW,OAAO,GAAG,MAAM,GAAG,QACjD;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW,GAAG,eAAe,SAAS;AAAA,MACtC,OAAO,EAAE,iBAAiB,gBAAgB,IAAI,GAAG,GAAG,MAAM;AAAA,MACzD,GAAG;AAAA;AAAA,EACN;AAEJ;AACA,MAAM,cAAc;AAGb,MAAM,cAAc;AAOpB,SAAS,KAAK,EAAE,OAAO,WAAW,GAAG,MAAM,GAAc;AAC9D,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA,QAAQ,MAAM,KAAK,EAAE,OAAO;AAAA,QAC5B;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;","names":[]}
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -10,7 +10,7 @@ declare const SheetClose: React.ForwardRefExoticComponent<SheetPrimitive.DialogC
|
|
|
10
10
|
declare const SheetPortal: React.FC<SheetPrimitive.DialogPortalProps>;
|
|
11
11
|
declare const SheetOverlay: React.ForwardRefExoticComponent<Omit<SheetPrimitive.DialogOverlayProps & React.RefAttributes<HTMLDivElement>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
12
12
|
declare const sheetVariants: (props?: ({
|
|
13
|
-
side?: "
|
|
13
|
+
side?: "left" | "right" | "bottom" | "top" | null | undefined;
|
|
14
14
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
15
15
|
interface SheetContentProps extends React.ComponentPropsWithoutRef<typeof SheetPrimitive.Content>, VariantProps<typeof sheetVariants> {
|
|
16
16
|
overlayClassName?: string;
|
|
@@ -38,6 +38,7 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
38
38
|
var import_lucide_react = require("lucide-react");
|
|
39
39
|
var import_sdk = require("@medialane/sdk");
|
|
40
40
|
var import_link = __toESM(require("./link.js"), 1);
|
|
41
|
+
var import_panel = require("./panel.js");
|
|
41
42
|
var import_address = require("../utils/address.js");
|
|
42
43
|
var import_provider = require("../i18n/provider.js");
|
|
43
44
|
var import_format = require("../i18n/format.js");
|
|
@@ -57,7 +58,7 @@ function SoulboundCard({ history = [], ownerAddress }) {
|
|
|
57
58
|
const t = (0, import_provider.useT)();
|
|
58
59
|
const locale = (0, import_provider.useLocale)();
|
|
59
60
|
const issued = issuedAt(history, locale);
|
|
60
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { "aria-label": t("Soulbound asset"), className: "flex items-center gap-4 overflow-hidden rounded-2xl
|
|
61
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { "aria-label": t("Soulbound asset"), className: "flex items-center gap-4 overflow-hidden rounded-2xl p-4", style: { backgroundImage: (0, import_panel.panelBackground)() }, children: [
|
|
61
62
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Fingerprint, { className: "h-7 w-7 shrink-0 text-brand-purple", strokeWidth: 1.5, "aria-hidden": true }),
|
|
62
63
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 flex-1", children: [
|
|
63
64
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h3", { className: "font-display text-base font-bold leading-tight text-foreground", children: t("Soulbound") }),
|