@medialane/ui 0.132.1 → 0.134.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/coin-row.cjs +129 -0
- package/dist/components/coin-row.cjs.map +1 -0
- package/dist/components/coin-row.d.cts +22 -0
- package/dist/components/coin-row.d.ts +22 -0
- package/dist/components/coin-row.js +97 -0
- package/dist/components/coin-row.js.map +1 -0
- package/dist/components/coins-explorer.cjs +47 -42
- package/dist/components/coins-explorer.cjs.map +1 -1
- package/dist/components/coins-explorer.d.cts +1 -1
- package/dist/components/coins-explorer.d.ts +1 -1
- package/dist/components/coins-explorer.js +48 -43
- package/dist/components/coins-explorer.js.map +1 -1
- package/dist/components/hero-slider.cjs +4 -19
- package/dist/components/hero-slider.cjs.map +1 -1
- package/dist/components/hero-slider.js +4 -19
- package/dist/components/hero-slider.js.map +1 -1
- package/dist/data/coins.cjs +32 -8
- package/dist/data/coins.cjs.map +1 -1
- package/dist/data/coins.d.cts +4 -1
- package/dist/data/coins.d.ts +4 -1
- package/dist/data/coins.js +28 -7
- package/dist/data/coins.js.map +1 -1
- package/dist/data/drop-create-schema.d.cts +2 -2
- package/dist/data/drop-create-schema.d.ts +2 -2
- package/dist/index.cjs +18 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/dist/utils/format.cjs +20 -0
- package/dist/utils/format.cjs.map +1 -1
- package/dist/utils/format.d.cts +3 -1
- package/dist/utils/format.d.ts +3 -1
- package/dist/utils/format.js +18 -0
- package/dist/utils/format.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/coin-card.cjs +0 -141
- package/dist/components/coin-card.cjs.map +0 -1
- package/dist/components/coin-card.d.cts +0 -17
- package/dist/components/coin-card.d.ts +0 -17
- package/dist/components/coin-card.js +0 -108
- package/dist/components/coin-card.js.map +0 -1
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { useState, useMemo, useEffect } from "react";
|
|
4
|
-
import { Coins,
|
|
4
|
+
import { Coins, Search, SlidersHorizontal, X } from "lucide-react";
|
|
5
5
|
import { cn } from "../utils/cn.js";
|
|
6
|
-
import {
|
|
6
|
+
import { CoinRow, CoinRowSkeleton, COIN_GRID } from "./coin-row.js";
|
|
7
|
+
import { coinKind } from "../data/coins.js";
|
|
7
8
|
const FILTER_TABS = [
|
|
8
9
|
{ label: "All", value: "all" },
|
|
9
10
|
{ label: "Creator Coins", value: "creator" },
|
|
@@ -18,7 +19,6 @@ const sortLabel = (v) => SORT_OPTIONS.find((o) => o.value === v)?.label ?? "";
|
|
|
18
19
|
function CoinsExplorer({ useCoins, usePrice, coinHref, heading = true }) {
|
|
19
20
|
const [filter, setFilter] = useState("all");
|
|
20
21
|
const [sort, setSort] = useState("recent");
|
|
21
|
-
const [view, setView] = useState("grid");
|
|
22
22
|
const [query, setQuery] = useState("");
|
|
23
23
|
const [filtersOpen, setFiltersOpen] = useState(false);
|
|
24
24
|
const filterCount = (filter !== "all" ? 1 : 0) + (sort !== "recent" ? 1 : 0);
|
|
@@ -36,7 +36,8 @@ function CoinsExplorer({ useCoins, usePrice, coinHref, heading = true }) {
|
|
|
36
36
|
(c) => (c.name ?? "").toLowerCase().includes(q) || (c.symbol ?? "").toLowerCase().includes(q)
|
|
37
37
|
);
|
|
38
38
|
}, [collections, query]);
|
|
39
|
-
|
|
39
|
+
const showKind = useMemo(() => new Set(items.map((c) => coinKind(c.service))).size > 1, [items]);
|
|
40
|
+
return /* @__PURE__ */ jsxs("div", { className: "space-y-5", children: [
|
|
40
41
|
heading && /* @__PURE__ */ jsxs("div", { className: "space-y-2", children: [
|
|
41
42
|
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-primary", children: [
|
|
42
43
|
/* @__PURE__ */ jsx(Coins, { className: "h-5 w-5" }),
|
|
@@ -44,49 +45,53 @@ function CoinsExplorer({ useCoins, usePrice, coinHref, heading = true }) {
|
|
|
44
45
|
] }),
|
|
45
46
|
/* @__PURE__ */ jsx("h1", { className: "text-3xl", children: "Creator coins & memecoins" })
|
|
46
47
|
] }),
|
|
47
|
-
/* @__PURE__ */ jsxs("div", { className: "
|
|
48
|
-
/* @__PURE__ */ jsxs("div", { className: "flex
|
|
49
|
-
/* @__PURE__ */
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
"input",
|
|
53
|
-
{
|
|
54
|
-
value: query,
|
|
55
|
-
onChange: (e) => setQuery(e.target.value),
|
|
56
|
-
placeholder: "Search coins by name or symbol\u2026",
|
|
57
|
-
className: "w-full rounded-lg border border-border bg-background py-2 pl-9 pr-3 text-sm outline-none focus:border-primary/50"
|
|
58
|
-
}
|
|
59
|
-
)
|
|
60
|
-
] }),
|
|
61
|
-
/* @__PURE__ */ jsxs(
|
|
62
|
-
"button",
|
|
48
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
49
|
+
/* @__PURE__ */ jsxs("div", { className: "relative flex-1", children: [
|
|
50
|
+
/* @__PURE__ */ jsx(Search, { className: "pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground" }),
|
|
51
|
+
/* @__PURE__ */ jsx(
|
|
52
|
+
"input",
|
|
63
53
|
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
"Filters",
|
|
69
|
-
filterCount > 0 && /* @__PURE__ */ jsx("span", { className: "ml-0.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-2xs font-semibold text-primary-foreground", children: filterCount })
|
|
70
|
-
]
|
|
54
|
+
value: query,
|
|
55
|
+
onChange: (e) => setQuery(e.target.value),
|
|
56
|
+
placeholder: "Search coins by name or symbol\u2026",
|
|
57
|
+
className: "w-full rounded-lg border border-border bg-background py-2 pl-9 pr-3 text-sm outline-none focus:border-primary/50"
|
|
71
58
|
}
|
|
72
|
-
)
|
|
73
|
-
/* @__PURE__ */ jsx("div", { className: "inline-flex shrink-0 rounded-lg border border-border p-0.5", children: [{ v: "grid", Icon: LayoutGrid }, { v: "table", Icon: List }].map(({ v, Icon }) => /* @__PURE__ */ jsx(
|
|
74
|
-
"button",
|
|
75
|
-
{
|
|
76
|
-
onClick: () => setView(v),
|
|
77
|
-
"aria-label": v === "grid" ? "Grid view" : "Table view",
|
|
78
|
-
className: cn("rounded-md p-1.5 transition-colors", view === v ? "bg-primary/10 text-primary" : "text-muted-foreground hover:text-foreground"),
|
|
79
|
-
children: /* @__PURE__ */ jsx(Icon, { className: "h-4 w-4" })
|
|
80
|
-
},
|
|
81
|
-
v
|
|
82
|
-
)) })
|
|
59
|
+
)
|
|
83
60
|
] }),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
61
|
+
/* @__PURE__ */ jsxs(
|
|
62
|
+
"button",
|
|
63
|
+
{
|
|
64
|
+
onClick: () => setFiltersOpen(true),
|
|
65
|
+
className: "inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border px-3 py-2 text-xs font-medium text-foreground hover:border-primary/50",
|
|
66
|
+
children: [
|
|
67
|
+
/* @__PURE__ */ jsx(SlidersHorizontal, { className: "h-3.5 w-3.5" }),
|
|
68
|
+
"Filters",
|
|
69
|
+
filterCount > 0 && /* @__PURE__ */ jsx("span", { className: "ml-0.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-2xs font-semibold text-primary-foreground", children: filterCount })
|
|
70
|
+
]
|
|
71
|
+
}
|
|
72
|
+
)
|
|
73
|
+
] }),
|
|
74
|
+
filterCount > 0 && /* @__PURE__ */ jsxs("div", { className: "flex flex-wrap items-center gap-1.5", children: [
|
|
75
|
+
filter !== "all" && /* @__PURE__ */ jsx(Chip, { onClear: () => setFilter("all"), children: filterLabel(filter) }),
|
|
76
|
+
sort !== "recent" && /* @__PURE__ */ jsx(Chip, { onClear: () => setSort("recent"), children: sortLabel(sort) })
|
|
77
|
+
] }),
|
|
78
|
+
/* @__PURE__ */ jsxs("div", { children: [
|
|
79
|
+
/* @__PURE__ */ jsxs("div", { className: cn(COIN_GRID, "border-b border-border px-2 pb-2 text-2xs font-medium uppercase tracking-wide text-muted-foreground"), children: [
|
|
80
|
+
/* @__PURE__ */ jsx("span", { children: "Token" }),
|
|
81
|
+
/* @__PURE__ */ jsx("span", { className: "text-right", children: "Price" }),
|
|
82
|
+
/* @__PURE__ */ jsx("span", { className: "hidden text-right sm:block", children: "FDV" })
|
|
83
|
+
] }),
|
|
84
|
+
isLoading && items.length === 0 ? Array.from({ length: 6 }).map((_, i) => /* @__PURE__ */ jsx(CoinRowSkeleton, {}, i)) : items.length === 0 ? /* @__PURE__ */ jsx("p", { className: "py-16 text-center text-sm text-muted-foreground", children: query.trim() ? `No coins match "${query.trim()}".` : "No coins yet." }) : items.map((c) => /* @__PURE__ */ jsx(
|
|
85
|
+
CoinRow,
|
|
86
|
+
{
|
|
87
|
+
collection: c,
|
|
88
|
+
usePrice,
|
|
89
|
+
href: coinHref(c),
|
|
90
|
+
showKind
|
|
91
|
+
},
|
|
92
|
+
`${c.chain}-${c.contractAddress}`
|
|
93
|
+
))
|
|
88
94
|
] }),
|
|
89
|
-
isLoading && items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4", children: Array.from({ length: 8 }).map((_, i) => /* @__PURE__ */ jsx(CoinCardSkeleton, {}, i)) }) : items.length === 0 ? /* @__PURE__ */ jsx("div", { className: "rounded-xl border border-border/60 py-16 text-center text-muted-foreground", children: query.trim() ? `No coins match "${query.trim()}".` : "No coins yet." }) : view === "table" ? /* @__PURE__ */ jsx("div", { className: "space-y-2", children: items.map((c) => /* @__PURE__ */ jsx(CoinRow, { collection: c, usePrice, href: coinHref(c) }, `${c.chain}-${c.contractAddress}`)) }) : /* @__PURE__ */ jsx("div", { className: "grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4", children: items.map((c) => /* @__PURE__ */ jsx(CoinCard, { collection: c, usePrice, href: coinHref(c) }, `${c.chain}-${c.contractAddress}`)) }),
|
|
90
95
|
filtersOpen && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 z-50 flex items-center justify-center p-4", role: "dialog", "aria-modal": "true", "aria-label": "Filters", children: [
|
|
91
96
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-background/70 backdrop-blur-sm", onClick: () => setFiltersOpen(false) }),
|
|
92
97
|
/* @__PURE__ */ jsxs("div", { className: "relative z-10 w-full max-w-sm space-y-5 overflow-hidden rounded-[calc(var(--radius)*1.25)] bg-card p-5", children: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/coins-explorer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, useMemo, useEffect } from \"react\";\nimport { Coins, LayoutGrid, List, Search, SlidersHorizontal, X } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { CoinCard, CoinRow, CoinCardSkeleton, type UseCoinPrice } from \"./coin-card.js\";\nimport type { CoinCollectionLike } from \"../data/coins.js\";\n\nexport type CoinFilter = \"all\" | \"creator\" | \"memecoin\";\nexport type CoinSort = \"recent\" | \"name\";\nexport type UseCoins = (opts: { filter: CoinFilter; sort: CoinSort }) => {\n collections: CoinCollectionLike[];\n isLoading: boolean;\n};\n\nexport interface CoinsExplorerProps {\n useCoins: UseCoins;\n usePrice: UseCoinPrice;\n\n coinHref: (collection: CoinCollectionLike) => string;\n heading?: boolean;\n}\n\nconst FILTER_TABS: { label: string; value: CoinFilter }[] = [\n { label: \"All\", value: \"all\" },\n { label: \"Creator Coins\", value: \"creator\" },\n { label: \"Memecoins\", value: \"memecoin\" },\n];\n\nconst SORT_OPTIONS: { label: string; value: CoinSort }[] = [\n { label: \"Recently launched\", value: \"recent\" },\n { label: \"Name\", value: \"name\" },\n];\n\nconst filterLabel = (v: CoinFilter) => FILTER_TABS.find((t) => t.value === v)?.label ?? \"\";\nconst sortLabel = (v: CoinSort) => SORT_OPTIONS.find((o) => o.value === v)?.label ?? \"\";\n\nexport function CoinsExplorer({ useCoins, usePrice, coinHref, heading = true }: CoinsExplorerProps) {\n const [filter, setFilter] = useState<CoinFilter>(\"all\");\n const [sort, setSort] = useState<CoinSort>(\"recent\");\n const [view, setView] = useState<\"grid\" | \"table\">(\"grid\");\n const [query, setQuery] = useState(\"\");\n const [filtersOpen, setFiltersOpen] = useState(false);\n\n const filterCount = (filter !== \"all\" ? 1 : 0) + (sort !== \"recent\" ? 1 : 0);\n\n useEffect(() => {\n if (!filtersOpen) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && setFiltersOpen(false);\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [filtersOpen]);\n\n const { collections, isLoading } = useCoins({ filter, sort });\n const items = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return collections;\n return collections.filter(\n (c) => (c.name ?? \"\").toLowerCase().includes(q) || (c.symbol ?? \"\").toLowerCase().includes(q)\n );\n }, [collections, query]);\n\n return (\n <div className=\"space-y-6\">\n {heading && (\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2 text-primary\">\n <Coins className=\"h-5 w-5\" />\n <span className=\"text-sm font-semibold\">Coins</span>\n </div>\n <h1 className=\"text-3xl\">Creator coins & memecoins</h1>\n </div>\n )}\n\n <div className=\"space-y-3 border-b border-border/60 pb-3\">\n <div className=\"flex items-center gap-2\">\n <div className=\"relative flex-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search coins by name or symbol…\"\n className=\"w-full rounded-lg border border-border bg-background py-2 pl-9 pr-3 text-sm outline-none focus:border-primary/50\"\n />\n </div>\n <button\n onClick={() => setFiltersOpen(true)}\n className=\"inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border px-3 py-2 text-xs font-medium text-foreground hover:border-primary/50\"\n >\n <SlidersHorizontal className=\"h-3.5 w-3.5\" />\n Filters\n {filterCount > 0 && (\n <span className=\"ml-0.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-2xs font-semibold text-primary-foreground\">\n {filterCount}\n </span>\n )}\n </button>\n <div className=\"inline-flex shrink-0 rounded-lg border border-border p-0.5\">\n {([{ v: \"grid\", Icon: LayoutGrid }, { v: \"table\", Icon: List }] as const).map(({ v, Icon }) => (\n <button\n key={v}\n onClick={() => setView(v)}\n aria-label={v === \"grid\" ? \"Grid view\" : \"Table view\"}\n className={cn(\"rounded-md p-1.5 transition-colors\", view === v ? \"bg-primary/10 text-primary\" : \"text-muted-foreground hover:text-foreground\")}\n >\n <Icon className=\"h-4 w-4\" />\n </button>\n ))}\n </div>\n </div>\n\n {filterCount > 0 && (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n {filter !== \"all\" && (\n <Chip onClear={() => setFilter(\"all\")}>{filterLabel(filter)}</Chip>\n )}\n {sort !== \"recent\" && (\n <Chip onClear={() => setSort(\"recent\")}>{sortLabel(sort)}</Chip>\n )}\n </div>\n )}\n </div>\n\n {isLoading && items.length === 0 ? (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4\">\n {Array.from({ length: 8 }).map((_, i) => <CoinCardSkeleton key={i} />)}\n </div>\n ) : items.length === 0 ? (\n <div className=\"rounded-xl border border-border/60 py-16 text-center text-muted-foreground\">\n {query.trim() ? `No coins match \"${query.trim()}\".` : \"No coins yet.\"}\n </div>\n ) : view === \"table\" ? (\n <div className=\"space-y-2\">\n {items.map((c) => <CoinRow key={`${c.chain}-${c.contractAddress}`} collection={c} usePrice={usePrice} href={coinHref(c)} />)}\n </div>\n ) : (\n <div className=\"grid grid-cols-1 gap-4 sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4\">\n {items.map((c) => <CoinCard key={`${c.chain}-${c.contractAddress}`} collection={c} usePrice={usePrice} href={coinHref(c)} />)}\n </div>\n )}\n\n {filtersOpen && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center p-4\" role=\"dialog\" aria-modal=\"true\" aria-label=\"Filters\">\n <div className=\"absolute inset-0 bg-background/70 backdrop-blur-sm\" onClick={() => setFiltersOpen(false)} />\n <div className=\"relative z-10 w-full max-w-sm space-y-5 overflow-hidden rounded-[calc(var(--radius)*1.25)] bg-card p-5\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"flex items-center gap-2 text-base font-bold\">\n <SlidersHorizontal className=\"h-4 w-4 text-primary\" />\n Filters\n </h2>\n {filterCount > 0 && (\n <button\n onClick={() => { setFilter(\"all\"); setSort(\"recent\"); }}\n className=\"text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n Clear all\n </button>\n )}\n </div>\n\n <FilterGroup label=\"Type\">\n {FILTER_TABS.map(({ label, value }) => (\n <PillButton key={value} active={filter === value} onClick={() => setFilter(value)}>{label}</PillButton>\n ))}\n </FilterGroup>\n\n <FilterGroup label=\"Sort\">\n {SORT_OPTIONS.map(({ label, value }) => (\n <PillButton key={value} active={sort === value} onClick={() => setSort(value)}>{label}</PillButton>\n ))}\n </FilterGroup>\n\n <button\n onClick={() => setFiltersOpen(false)}\n className=\"w-full rounded-lg bg-gradient-to-r from-brand-blue to-brand-purple py-2.5 text-sm font-semibold text-white\"\n >\n Show {items.length} {items.length === 1 ? \"coin\" : \"coins\"}\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nfunction FilterGroup({ label, children }: { label: string; children: React.ReactNode }) {\n return (\n <div className=\"space-y-2\">\n <p className=\"text-2xs font-medium text-muted-foreground\">{label}</p>\n <div className=\"flex flex-wrap gap-1.5\">{children}</div>\n </div>\n );\n}\n\nfunction PillButton({ active, onClick, children }: { active: boolean; onClick: () => void; children: React.ReactNode }) {\n return (\n <button\n onClick={onClick}\n className={cn(\n \"rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors\",\n active ? \"border-primary bg-primary/10 text-primary\" : \"border-border text-muted-foreground hover:border-primary/50 hover:text-foreground\"\n )}\n >\n {children}\n </button>\n );\n}\n\nfunction Chip({ children, onClear }: { children: React.ReactNode; onClear: () => void }) {\n return (\n <span className=\"inline-flex items-center gap-1 rounded-full border border-primary/30 bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary\">\n {children}\n <button onClick={onClear} aria-label=\"Clear filter\" className=\"hover:text-primary/60\">\n <X className=\"h-3 w-3\" />\n </button>\n </span>\n );\n}\n"],"mappings":";AAkEU,SACE,KADF;AAhEV,SAAS,UAAU,SAAS,iBAAiB;AAC7C,SAAS,OAAO,YAAY,MAAM,QAAQ,mBAAmB,SAAS;AACtE,SAAS,UAAU;AACnB,SAAS,UAAU,SAAS,wBAA2C;AAkBvE,MAAM,cAAsD;AAAA,EAC1D,EAAE,OAAO,OAAO,OAAO,MAAM;AAAA,EAC7B,EAAE,OAAO,iBAAiB,OAAO,UAAU;AAAA,EAC3C,EAAE,OAAO,aAAa,OAAO,WAAW;AAC1C;AAEA,MAAM,eAAqD;AAAA,EACzD,EAAE,OAAO,qBAAqB,OAAO,SAAS;AAAA,EAC9C,EAAE,OAAO,QAAQ,OAAO,OAAO;AACjC;AAEA,MAAM,cAAc,CAAC,MAAkB,YAAY,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS;AACxF,MAAM,YAAY,CAAC,MAAgB,aAAa,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS;AAE9E,SAAS,cAAc,EAAE,UAAU,UAAU,UAAU,UAAU,KAAK,GAAuB;AAClG,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAqB,KAAK;AACtD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAmB,QAAQ;AACnD,QAAM,CAAC,MAAM,OAAO,IAAI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AAA,YACnC,WAAU;AAAA,YACX;AAAA;AAAA,cACO,MAAM;AAAA,cAAO;AAAA,cAAE,MAAM,WAAW,IAAI,SAAS;AAAA;AAAA;AAAA,QACrD;AAAA,SACF;AAAA,OACF;AAAA,KAEJ;AAEJ;AAEA,SAAS,YAAY,EAAE,OAAO,SAAS,GAAiD;AACtF,SACE,qBAAC,SAAI,WAAU,aACb;AAAA,wBAAC,OAAE,WAAU,8CAA8C,iBAAM;AAAA,IACjE,oBAAC,SAAI,WAAU,0BAA0B,UAAS;AAAA,KACpD;AAEJ;AAEA,SAAS,WAAW,EAAE,QAAQ,SAAS,SAAS,GAAwE;AACtH,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,WAAW;AAAA,QACT;AAAA,QACA,SAAS,8CAA8C;AAAA,MACzD;AAAA,MAEC;AAAA;AAAA,EACH;AAEJ;AAEA,SAAS,KAAK,EAAE,UAAU,QAAQ,GAAuD;AACvF,SACE,qBAAC,UAAK,WAAU,mIACb;AAAA;AAAA,IACD,oBAAC,YAAO,SAAS,SAAS,cAAW,gBAAe,WAAU,yBAC5D,8BAAC,KAAE,WAAU,WAAU,GACzB;AAAA,KACF;AAEJ;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../src/components/coins-explorer.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, useMemo, useEffect } from \"react\";\nimport { Coins, Search, SlidersHorizontal, X } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { CoinRow, CoinRowSkeleton, COIN_GRID, type UseCoinPrice } from \"./coin-row.js\";\nimport { coinKind, type CoinCollectionLike } from \"../data/coins.js\";\n\nexport type CoinFilter = \"all\" | \"creator\" | \"memecoin\";\nexport type CoinSort = \"recent\" | \"name\";\nexport type UseCoins = (opts: { filter: CoinFilter; sort: CoinSort }) => {\n collections: CoinCollectionLike[];\n isLoading: boolean;\n};\n\nexport interface CoinsExplorerProps {\n useCoins: UseCoins;\n usePrice: UseCoinPrice;\n\n coinHref: (collection: CoinCollectionLike) => string;\n heading?: boolean;\n}\n\nconst FILTER_TABS: { label: string; value: CoinFilter }[] = [\n { label: \"All\", value: \"all\" },\n { label: \"Creator Coins\", value: \"creator\" },\n { label: \"Memecoins\", value: \"memecoin\" },\n];\n\nconst SORT_OPTIONS: { label: string; value: CoinSort }[] = [\n { label: \"Recently launched\", value: \"recent\" },\n { label: \"Name\", value: \"name\" },\n];\n\nconst filterLabel = (v: CoinFilter) => FILTER_TABS.find((t) => t.value === v)?.label ?? \"\";\nconst sortLabel = (v: CoinSort) => SORT_OPTIONS.find((o) => o.value === v)?.label ?? \"\";\n\nexport function CoinsExplorer({ useCoins, usePrice, coinHref, heading = true }: CoinsExplorerProps) {\n const [filter, setFilter] = useState<CoinFilter>(\"all\");\n const [sort, setSort] = useState<CoinSort>(\"recent\");\n const [query, setQuery] = useState(\"\");\n const [filtersOpen, setFiltersOpen] = useState(false);\n\n const filterCount = (filter !== \"all\" ? 1 : 0) + (sort !== \"recent\" ? 1 : 0);\n\n useEffect(() => {\n if (!filtersOpen) return;\n const onKey = (e: KeyboardEvent) => e.key === \"Escape\" && setFiltersOpen(false);\n window.addEventListener(\"keydown\", onKey);\n return () => window.removeEventListener(\"keydown\", onKey);\n }, [filtersOpen]);\n\n const { collections, isLoading } = useCoins({ filter, sort });\n const items = useMemo(() => {\n const q = query.trim().toLowerCase();\n if (!q) return collections;\n return collections.filter(\n (c) => (c.name ?? \"\").toLowerCase().includes(q) || (c.symbol ?? \"\").toLowerCase().includes(q)\n );\n }, [collections, query]);\n\n const showKind = useMemo(() => new Set(items.map((c) => coinKind(c.service))).size > 1, [items]);\n\n return (\n <div className=\"space-y-5\">\n {heading && (\n <div className=\"space-y-2\">\n <div className=\"flex items-center gap-2 text-primary\">\n <Coins className=\"h-5 w-5\" />\n <span className=\"text-sm font-semibold\">Coins</span>\n </div>\n <h1 className=\"text-3xl\">Creator coins & memecoins</h1>\n </div>\n )}\n\n <div className=\"flex items-center gap-2\">\n <div className=\"relative flex-1\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-muted-foreground\" />\n <input\n value={query}\n onChange={(e) => setQuery(e.target.value)}\n placeholder=\"Search coins by name or symbol…\"\n className=\"w-full rounded-lg border border-border bg-background py-2 pl-9 pr-3 text-sm outline-none focus:border-primary/50\"\n />\n </div>\n <button\n onClick={() => setFiltersOpen(true)}\n className=\"inline-flex shrink-0 items-center gap-1.5 rounded-lg border border-border px-3 py-2 text-xs font-medium text-foreground hover:border-primary/50\"\n >\n <SlidersHorizontal className=\"h-3.5 w-3.5\" />\n Filters\n {filterCount > 0 && (\n <span className=\"ml-0.5 inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-primary px-1 text-2xs font-semibold text-primary-foreground\">\n {filterCount}\n </span>\n )}\n </button>\n </div>\n\n {filterCount > 0 && (\n <div className=\"flex flex-wrap items-center gap-1.5\">\n {filter !== \"all\" && <Chip onClear={() => setFilter(\"all\")}>{filterLabel(filter)}</Chip>}\n {sort !== \"recent\" && <Chip onClear={() => setSort(\"recent\")}>{sortLabel(sort)}</Chip>}\n </div>\n )}\n\n <div>\n <div className={cn(COIN_GRID, \"border-b border-border px-2 pb-2 text-2xs font-medium uppercase tracking-wide text-muted-foreground\")}>\n <span>Token</span>\n <span className=\"text-right\">Price</span>\n <span className=\"hidden text-right sm:block\">FDV</span>\n </div>\n\n {isLoading && items.length === 0 ? (\n Array.from({ length: 6 }).map((_, i) => <CoinRowSkeleton key={i} />)\n ) : items.length === 0 ? (\n <p className=\"py-16 text-center text-sm text-muted-foreground\">\n {query.trim() ? `No coins match \"${query.trim()}\".` : \"No coins yet.\"}\n </p>\n ) : (\n items.map((c) => (\n <CoinRow\n key={`${c.chain}-${c.contractAddress}`}\n collection={c}\n usePrice={usePrice}\n href={coinHref(c)}\n showKind={showKind}\n />\n ))\n )}\n </div>\n\n {filtersOpen && (\n <div className=\"fixed inset-0 z-50 flex items-center justify-center p-4\" role=\"dialog\" aria-modal=\"true\" aria-label=\"Filters\">\n <div className=\"absolute inset-0 bg-background/70 backdrop-blur-sm\" onClick={() => setFiltersOpen(false)} />\n <div className=\"relative z-10 w-full max-w-sm space-y-5 overflow-hidden rounded-[calc(var(--radius)*1.25)] bg-card p-5\">\n <div className=\"flex items-center justify-between\">\n <h2 className=\"flex items-center gap-2 text-base font-bold\">\n <SlidersHorizontal className=\"h-4 w-4 text-primary\" />\n Filters\n </h2>\n {filterCount > 0 && (\n <button\n onClick={() => { setFilter(\"all\"); setSort(\"recent\"); }}\n className=\"text-xs font-medium text-muted-foreground hover:text-foreground\"\n >\n Clear all\n </button>\n )}\n </div>\n\n <FilterGroup label=\"Type\">\n {FILTER_TABS.map(({ label, value }) => (\n <PillButton key={value} active={filter === value} onClick={() => setFilter(value)}>{label}</PillButton>\n ))}\n </FilterGroup>\n\n <FilterGroup label=\"Sort\">\n {SORT_OPTIONS.map(({ label, value }) => (\n <PillButton key={value} active={sort === value} onClick={() => setSort(value)}>{label}</PillButton>\n ))}\n </FilterGroup>\n\n <button\n onClick={() => setFiltersOpen(false)}\n className=\"w-full rounded-lg bg-gradient-to-r from-brand-blue to-brand-purple py-2.5 text-sm font-semibold text-white\"\n >\n Show {items.length} {items.length === 1 ? \"coin\" : \"coins\"}\n </button>\n </div>\n </div>\n )}\n </div>\n );\n}\n\nfunction FilterGroup({ label, children }: { label: string; children: React.ReactNode }) {\n return (\n <div className=\"space-y-2\">\n <p className=\"text-2xs font-medium text-muted-foreground\">{label}</p>\n <div className=\"flex flex-wrap gap-1.5\">{children}</div>\n </div>\n );\n}\n\nfunction PillButton({ active, onClick, children }: { active: boolean; onClick: () => void; children: React.ReactNode }) {\n return (\n <button\n onClick={onClick}\n className={cn(\n \"rounded-lg border px-3 py-1.5 text-xs font-medium transition-colors\",\n active ? \"border-primary bg-primary/10 text-primary\" : \"border-border text-muted-foreground hover:border-primary/50 hover:text-foreground\"\n )}\n >\n {children}\n </button>\n );\n}\n\nfunction Chip({ children, onClear }: { children: React.ReactNode; onClear: () => void }) {\n return (\n <span className=\"inline-flex items-center gap-1 rounded-full border border-primary/30 bg-primary/10 px-2.5 py-1 text-xs font-medium text-primary\">\n {children}\n <button onClick={onClear} aria-label=\"Clear filter\" className=\"hover:text-primary/60\">\n <X className=\"h-3 w-3\" />\n </button>\n </span>\n );\n}\n"],"mappings":";AAmEU,SACE,KADF;AAjEV,SAAS,UAAU,SAAS,iBAAiB;AAC7C,SAAS,OAAO,QAAQ,mBAAmB,SAAS;AACpD,SAAS,UAAU;AACnB,SAAS,SAAS,iBAAiB,iBAAoC;AACvE,SAAS,gBAAyC;AAiBlD,MAAM,cAAsD;AAAA,EAC1D,EAAE,OAAO,OAAO,OAAO,MAAM;AAAA,EAC7B,EAAE,OAAO,iBAAiB,OAAO,UAAU;AAAA,EAC3C,EAAE,OAAO,aAAa,OAAO,WAAW;AAC1C;AAEA,MAAM,eAAqD;AAAA,EACzD,EAAE,OAAO,qBAAqB,OAAO,SAAS;AAAA,EAC9C,EAAE,OAAO,QAAQ,OAAO,OAAO;AACjC;AAEA,MAAM,cAAc,CAAC,MAAkB,YAAY,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS;AACxF,MAAM,YAAY,CAAC,MAAgB,aAAa,KAAK,CAAC,MAAM,EAAE,UAAU,CAAC,GAAG,SAAS;AAE9E,SAAS,cAAc,EAAE,UAAU,UAAU,UAAU,UAAU,KAAK,GAAuB;AAClG,QAAM,CAAC,QAAQ,SAAS,IAAI,SAAqB,KAAK;AACtD,QAAM,CAAC,MAAM,OAAO,IAAI,SAAmB,QAAQ;AACnD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,aAAa,cAAc,IAAI,SAAS,KAAK;AAEpD,QAAM,eAAe,WAAW,QAAQ,IAAI,MAAM,SAAS,WAAW,IAAI;AAE1E,YAAU,MAAM;AACd,QAAI,CAAC,YAAa;AAClB,UAAM,QAAQ,CAAC,MAA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A,EACH;AAEJ;AAEA,SAAS,KAAK,EAAE,UAAU,QAAQ,GAAuD;AACvF,SACE,qBAAC,UAAK,WAAU,mIACb;AAAA;AAAA,IACD,oBAAC,YAAO,SAAS,SAAS,cAAW,gBAAe,WAAU,yBAC5D,8BAAC,KAAE,WAAU,WAAU,GACzB;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -40,14 +40,6 @@ var import_image = __toESM(require("./image.js"), 1);
|
|
|
40
40
|
var import_lucide_react = require("lucide-react");
|
|
41
41
|
var import_cn = require("../utils/cn.js");
|
|
42
42
|
var import_ipfs = require("../utils/ipfs.js");
|
|
43
|
-
function formatFloorPrice(price) {
|
|
44
|
-
if (!price) return "";
|
|
45
|
-
const n = parseFloat(price);
|
|
46
|
-
if (isNaN(n)) return price;
|
|
47
|
-
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}K`;
|
|
48
|
-
if (n >= 1) return n.toFixed(2);
|
|
49
|
-
return n.toPrecision(3);
|
|
50
|
-
}
|
|
51
43
|
function HeroPlaceholder({ hrefs }) {
|
|
52
44
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "absolute inset-0 bg-gradient-to-br from-brand-purple/30 via-brand-blue/20 to-brand-navy/50 flex flex-col items-center justify-center gap-4 text-center px-6 overflow-hidden", children: [
|
|
53
45
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-4xl sm:text-6xl font-black gradient-text relative z-10", children: "Medialane" }),
|
|
@@ -61,22 +53,15 @@ function HeroPlaceholder({ hrefs }) {
|
|
|
61
53
|
function HeroSlide({ collection, active, getHref }) {
|
|
62
54
|
const imageUrl = collection.image ? (0, import_ipfs.ipfsToHttp)(collection.image) : null;
|
|
63
55
|
const name = collection.name ?? "Collection";
|
|
64
|
-
const floor = collection.floorPrice;
|
|
65
56
|
const supply = collection.totalSupply;
|
|
66
57
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_cn.cn)("absolute inset-0 transition-opacity duration-700", active ? "opacity-100" : "opacity-0 pointer-events-none"), children: [
|
|
67
58
|
imageUrl ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "animate-kenburns absolute inset-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: imageUrl, alt: name, fill: true, className: "object-cover", priority: active, unoptimized: true }) }) }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60" }),
|
|
68
59
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "absolute bottom-0 left-0 right-0 p-6 sm:p-10 flex flex-col gap-3", children: [
|
|
69
60
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: getHref(collection), className: "hover:opacity-90 transition-opacity", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-4xl lg:text-5xl font-semibold text-white leading-tight", children: name }) }),
|
|
70
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
71
|
-
supply
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
] }),
|
|
75
|
-
floor && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "text-white font-semibold", children: [
|
|
76
|
-
"Floor ",
|
|
77
|
-
formatFloorPrice(floor)
|
|
78
|
-
] })
|
|
79
|
-
] })
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center gap-4 text-sm text-white/70", children: supply != null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { children: [
|
|
62
|
+
supply.toLocaleString(),
|
|
63
|
+
" items"
|
|
64
|
+
] }) })
|
|
80
65
|
] })
|
|
81
66
|
] });
|
|
82
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/hero-slider.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, useEffect, useCallback } from \"react\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport type { ApiCollection } from \"@medialane/sdk\";\n\nexport interface HeroSliderProps {\n collections: ApiCollection[];\n isLoading: boolean;\n getHref: (collection: ApiCollection) => string;\n\n placeholderHrefs?: { markets?: string; create?: string };\n}\n\nfunction
|
|
1
|
+
{"version":3,"sources":["../../src/components/hero-slider.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, useEffect, useCallback } from \"react\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport type { ApiCollection } from \"@medialane/sdk\";\n\nexport interface HeroSliderProps {\n collections: ApiCollection[];\n isLoading: boolean;\n getHref: (collection: ApiCollection) => string;\n\n placeholderHrefs?: { markets?: string; create?: string };\n}\n\nfunction HeroPlaceholder({ hrefs }: { hrefs: Required<HeroSliderProps>[\"placeholderHrefs\"] }) {\n return (\n <div className=\"absolute inset-0 bg-gradient-to-br from-brand-purple/30 via-brand-blue/20 to-brand-navy/50 flex flex-col items-center justify-center gap-4 text-center px-6 overflow-hidden\">\n\n <h2 className=\"text-4xl sm:text-6xl font-black gradient-text relative z-10\">Medialane</h2>\n <p className=\"text-muted-foreground text-lg relative z-10 max-w-md\">\n New monetization revenues for creative works\n </p>\n <div className=\"flex gap-3 relative z-10\">\n <Link href={hrefs.markets!} className=\"inline-flex items-center justify-center rounded-[11px] bg-brand-blue px-4 py-2 text-sm font-semibold text-white hover:brightness-110 active:scale-[0.98] transition-all\">\n Markets\n </Link>\n <Link href={hrefs.create!} className=\"inline-flex items-center justify-center rounded-[11px] border border-white/20 bg-background/20 backdrop-blur-sm px-4 py-2 text-sm font-semibold text-white hover:bg-white/10 transition-all\">\n Create\n </Link>\n </div>\n </div>\n );\n}\n\nfunction HeroSlide({ collection, active, getHref }: { collection: ApiCollection; active: boolean; getHref: (col: ApiCollection) => string }) {\n const imageUrl = collection.image ? ipfsToHttp(collection.image) : null;\n const name = collection.name ?? \"Collection\";\n const supply = collection.totalSupply;\n\n return (\n <div className={cn(\"absolute inset-0 transition-opacity duration-700\", active ? \"opacity-100\" : \"opacity-0 pointer-events-none\")}>\n {imageUrl ? (\n <div className=\"absolute inset-0 overflow-hidden\">\n <div className=\"animate-kenburns absolute inset-0\">\n <Image src={imageUrl} alt={name} fill className=\"object-cover\" priority={active} unoptimized />\n </div>\n </div>\n ) : (\n <div className=\"absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60\" />\n )}\n <div className=\"absolute bottom-0 left-0 right-0 p-6 sm:p-10 flex flex-col gap-3\">\n <Link href={getHref(collection)} className=\"hover:opacity-90 transition-opacity\">\n <h2 className=\"text-4xl lg:text-5xl font-semibold text-white leading-tight\">{name}</h2>\n </Link>\n <div className=\"flex items-center gap-4 text-sm text-white/70\">\n {supply != null && <span>{supply.toLocaleString()} items</span>}\n </div>\n </div>\n </div>\n );\n}\n\nexport function HeroSliderSkeleton() {\n return <section className=\"relative w-full h-[78vw] min-h-[420px] max-h-[768px] sm:h-[72vh] sm:max-h-[816px] bg-muted animate-pulse\" />;\n}\n\nexport function HeroSlider({ collections, isLoading, getHref, placeholderHrefs = {} }: HeroSliderProps) {\n const hrefs = { markets: \"/marketplace\", create: \"/create/asset\", ...placeholderHrefs };\n const [current, setCurrent] = useState(0);\n const count = collections.length;\n\n const next = useCallback(() => { if (count > 1) setCurrent((c) => (c + 1) % count); }, [count]);\n const prev = useCallback(() => { if (count > 1) setCurrent((c) => (c - 1 + count) % count); }, [count]);\n\n useEffect(() => {\n if (count <= 1) return;\n const id = setInterval(next, 7000);\n return () => clearInterval(id);\n }, [count, next]);\n\n if (isLoading) return <HeroSliderSkeleton />;\n\n return (\n <section className=\"relative w-full h-[78vw] min-h-[420px] max-h-[768px] sm:h-[72vh] sm:max-h-[816px] overflow-hidden bg-muted\">\n {count === 0 ? (\n <HeroPlaceholder hrefs={hrefs} />\n ) : (\n <>\n {collections.map((col, i) => (\n <HeroSlide key={col.contractAddress} collection={col} active={i === current} getHref={getHref} />\n ))}\n {count > 1 && (\n <>\n <button onClick={prev} aria-label=\"Previous slide\" className=\"absolute left-3 top-1/2 -translate-y-1/2 z-10 min-h-11 min-w-11 rounded-full flex items-center justify-center transition-colors\">\n <span className=\"flex h-9 w-9 items-center justify-center rounded-full bg-white/10 backdrop-blur-md hover:bg-white/20\">\n <ChevronLeft className=\"h-5 w-5 text-white\" />\n </span>\n </button>\n <button onClick={next} aria-label=\"Next slide\" className=\"absolute right-3 top-1/2 -translate-y-1/2 z-10 min-h-11 min-w-11 rounded-full flex items-center justify-center transition-colors\">\n <span className=\"flex h-9 w-9 items-center justify-center rounded-full bg-white/10 backdrop-blur-md hover:bg-white/20\">\n <ChevronRight className=\"h-5 w-5 text-white\" />\n </span>\n </button>\n <div className=\"absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-1.5 z-10\">\n {collections.map((_, i) => (\n <button key={i} onClick={() => setCurrent(i)} aria-label={`Go to slide ${i + 1}`} className={cn(\"h-1.5 rounded-full transition-all\", i === current ? \"w-6 bg-white\" : \"w-1.5 bg-white/40\")} />\n ))}\n </div>\n </>\n )}\n </>\n )}\n </section>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAsBM;AApBN,mBAAiD;AACjD,kBAAiB;AACjB,mBAAkB;AAClB,0BAA0C;AAC1C,gBAAmB;AACnB,kBAA2B;AAW3B,SAAS,gBAAgB,EAAE,MAAM,GAA6D;AAC5F,SACE,6CAAC,SAAI,WAAU,+KAEb;AAAA,gDAAC,QAAG,WAAU,+D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OACF;AAAA,KAEJ,GAEJ;AAEJ;","names":["Link","Image"]}
|
|
@@ -6,14 +6,6 @@ import Image from "./image.js";
|
|
|
6
6
|
import { ChevronLeft, ChevronRight } from "lucide-react";
|
|
7
7
|
import { cn } from "../utils/cn.js";
|
|
8
8
|
import { ipfsToHttp } from "../utils/ipfs.js";
|
|
9
|
-
function formatFloorPrice(price) {
|
|
10
|
-
if (!price) return "";
|
|
11
|
-
const n = parseFloat(price);
|
|
12
|
-
if (isNaN(n)) return price;
|
|
13
|
-
if (n >= 1e3) return `${(n / 1e3).toFixed(1)}K`;
|
|
14
|
-
if (n >= 1) return n.toFixed(2);
|
|
15
|
-
return n.toPrecision(3);
|
|
16
|
-
}
|
|
17
9
|
function HeroPlaceholder({ hrefs }) {
|
|
18
10
|
return /* @__PURE__ */ jsxs("div", { className: "absolute inset-0 bg-gradient-to-br from-brand-purple/30 via-brand-blue/20 to-brand-navy/50 flex flex-col items-center justify-center gap-4 text-center px-6 overflow-hidden", children: [
|
|
19
11
|
/* @__PURE__ */ jsx("h2", { className: "text-4xl sm:text-6xl font-black gradient-text relative z-10", children: "Medialane" }),
|
|
@@ -27,22 +19,15 @@ function HeroPlaceholder({ hrefs }) {
|
|
|
27
19
|
function HeroSlide({ collection, active, getHref }) {
|
|
28
20
|
const imageUrl = collection.image ? ipfsToHttp(collection.image) : null;
|
|
29
21
|
const name = collection.name ?? "Collection";
|
|
30
|
-
const floor = collection.floorPrice;
|
|
31
22
|
const supply = collection.totalSupply;
|
|
32
23
|
return /* @__PURE__ */ jsxs("div", { className: cn("absolute inset-0 transition-opacity duration-700", active ? "opacity-100" : "opacity-0 pointer-events-none"), children: [
|
|
33
24
|
imageUrl ? /* @__PURE__ */ jsx("div", { className: "absolute inset-0 overflow-hidden", children: /* @__PURE__ */ jsx("div", { className: "animate-kenburns absolute inset-0", children: /* @__PURE__ */ jsx(Image, { src: imageUrl, alt: name, fill: true, className: "object-cover", priority: active, unoptimized: true }) }) }) : /* @__PURE__ */ jsx("div", { className: "absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60" }),
|
|
34
25
|
/* @__PURE__ */ jsxs("div", { className: "absolute bottom-0 left-0 right-0 p-6 sm:p-10 flex flex-col gap-3", children: [
|
|
35
26
|
/* @__PURE__ */ jsx(Link, { href: getHref(collection), className: "hover:opacity-90 transition-opacity", children: /* @__PURE__ */ jsx("h2", { className: "text-4xl lg:text-5xl font-semibold text-white leading-tight", children: name }) }),
|
|
36
|
-
/* @__PURE__ */
|
|
37
|
-
supply
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
] }),
|
|
41
|
-
floor && /* @__PURE__ */ jsxs("span", { className: "text-white font-semibold", children: [
|
|
42
|
-
"Floor ",
|
|
43
|
-
formatFloorPrice(floor)
|
|
44
|
-
] })
|
|
45
|
-
] })
|
|
27
|
+
/* @__PURE__ */ jsx("div", { className: "flex items-center gap-4 text-sm text-white/70", children: supply != null && /* @__PURE__ */ jsxs("span", { children: [
|
|
28
|
+
supply.toLocaleString(),
|
|
29
|
+
" items"
|
|
30
|
+
] }) })
|
|
46
31
|
] })
|
|
47
32
|
] });
|
|
48
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/hero-slider.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, useEffect, useCallback } from \"react\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport type { ApiCollection } from \"@medialane/sdk\";\n\nexport interface HeroSliderProps {\n collections: ApiCollection[];\n isLoading: boolean;\n getHref: (collection: ApiCollection) => string;\n\n placeholderHrefs?: { markets?: string; create?: string };\n}\n\nfunction
|
|
1
|
+
{"version":3,"sources":["../../src/components/hero-slider.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState, useEffect, useCallback } from \"react\";\nimport Link from \"./link.js\";\nimport Image from \"./image.js\";\nimport { ChevronLeft, ChevronRight } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport type { ApiCollection } from \"@medialane/sdk\";\n\nexport interface HeroSliderProps {\n collections: ApiCollection[];\n isLoading: boolean;\n getHref: (collection: ApiCollection) => string;\n\n placeholderHrefs?: { markets?: string; create?: string };\n}\n\nfunction HeroPlaceholder({ hrefs }: { hrefs: Required<HeroSliderProps>[\"placeholderHrefs\"] }) {\n return (\n <div className=\"absolute inset-0 bg-gradient-to-br from-brand-purple/30 via-brand-blue/20 to-brand-navy/50 flex flex-col items-center justify-center gap-4 text-center px-6 overflow-hidden\">\n\n <h2 className=\"text-4xl sm:text-6xl font-black gradient-text relative z-10\">Medialane</h2>\n <p className=\"text-muted-foreground text-lg relative z-10 max-w-md\">\n New monetization revenues for creative works\n </p>\n <div className=\"flex gap-3 relative z-10\">\n <Link href={hrefs.markets!} className=\"inline-flex items-center justify-center rounded-[11px] bg-brand-blue px-4 py-2 text-sm font-semibold text-white hover:brightness-110 active:scale-[0.98] transition-all\">\n Markets\n </Link>\n <Link href={hrefs.create!} className=\"inline-flex items-center justify-center rounded-[11px] border border-white/20 bg-background/20 backdrop-blur-sm px-4 py-2 text-sm font-semibold text-white hover:bg-white/10 transition-all\">\n Create\n </Link>\n </div>\n </div>\n );\n}\n\nfunction HeroSlide({ collection, active, getHref }: { collection: ApiCollection; active: boolean; getHref: (col: ApiCollection) => string }) {\n const imageUrl = collection.image ? ipfsToHttp(collection.image) : null;\n const name = collection.name ?? \"Collection\";\n const supply = collection.totalSupply;\n\n return (\n <div className={cn(\"absolute inset-0 transition-opacity duration-700\", active ? \"opacity-100\" : \"opacity-0 pointer-events-none\")}>\n {imageUrl ? (\n <div className=\"absolute inset-0 overflow-hidden\">\n <div className=\"animate-kenburns absolute inset-0\">\n <Image src={imageUrl} alt={name} fill className=\"object-cover\" priority={active} unoptimized />\n </div>\n </div>\n ) : (\n <div className=\"absolute inset-0 bg-gradient-to-br from-brand-purple/40 via-brand-blue/20 to-brand-navy/60\" />\n )}\n <div className=\"absolute bottom-0 left-0 right-0 p-6 sm:p-10 flex flex-col gap-3\">\n <Link href={getHref(collection)} className=\"hover:opacity-90 transition-opacity\">\n <h2 className=\"text-4xl lg:text-5xl font-semibold text-white leading-tight\">{name}</h2>\n </Link>\n <div className=\"flex items-center gap-4 text-sm text-white/70\">\n {supply != null && <span>{supply.toLocaleString()} items</span>}\n </div>\n </div>\n </div>\n );\n}\n\nexport function HeroSliderSkeleton() {\n return <section className=\"relative w-full h-[78vw] min-h-[420px] max-h-[768px] sm:h-[72vh] sm:max-h-[816px] bg-muted animate-pulse\" />;\n}\n\nexport function HeroSlider({ collections, isLoading, getHref, placeholderHrefs = {} }: HeroSliderProps) {\n const hrefs = { markets: \"/marketplace\", create: \"/create/asset\", ...placeholderHrefs };\n const [current, setCurrent] = useState(0);\n const count = collections.length;\n\n const next = useCallback(() => { if (count > 1) setCurrent((c) => (c + 1) % count); }, [count]);\n const prev = useCallback(() => { if (count > 1) setCurrent((c) => (c - 1 + count) % count); }, [count]);\n\n useEffect(() => {\n if (count <= 1) return;\n const id = setInterval(next, 7000);\n return () => clearInterval(id);\n }, [count, next]);\n\n if (isLoading) return <HeroSliderSkeleton />;\n\n return (\n <section className=\"relative w-full h-[78vw] min-h-[420px] max-h-[768px] sm:h-[72vh] sm:max-h-[816px] overflow-hidden bg-muted\">\n {count === 0 ? (\n <HeroPlaceholder hrefs={hrefs} />\n ) : (\n <>\n {collections.map((col, i) => (\n <HeroSlide key={col.contractAddress} collection={col} active={i === current} getHref={getHref} />\n ))}\n {count > 1 && (\n <>\n <button onClick={prev} aria-label=\"Previous slide\" className=\"absolute left-3 top-1/2 -translate-y-1/2 z-10 min-h-11 min-w-11 rounded-full flex items-center justify-center transition-colors\">\n <span className=\"flex h-9 w-9 items-center justify-center rounded-full bg-white/10 backdrop-blur-md hover:bg-white/20\">\n <ChevronLeft className=\"h-5 w-5 text-white\" />\n </span>\n </button>\n <button onClick={next} aria-label=\"Next slide\" className=\"absolute right-3 top-1/2 -translate-y-1/2 z-10 min-h-11 min-w-11 rounded-full flex items-center justify-center transition-colors\">\n <span className=\"flex h-9 w-9 items-center justify-center rounded-full bg-white/10 backdrop-blur-md hover:bg-white/20\">\n <ChevronRight className=\"h-5 w-5 text-white\" />\n </span>\n </button>\n <div className=\"absolute bottom-4 left-1/2 -translate-x-1/2 flex gap-1.5 z-10\">\n {collections.map((_, i) => (\n <button key={i} onClick={() => setCurrent(i)} aria-label={`Go to slide ${i + 1}`} className={cn(\"h-1.5 rounded-full transition-all\", i === current ? \"w-6 bg-white\" : \"w-1.5 bg-white/40\")} />\n ))}\n </div>\n </>\n )}\n </>\n )}\n </section>\n );\n}\n"],"mappings":";AAsBM,SA0EM,UA1EN,KAIA,YAJA;AApBN,SAAS,UAAU,WAAW,mBAAmB;AACjD,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,SAAS,aAAa,oBAAoB;AAC1C,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAW3B,SAAS,gBAAgB,EAAE,MAAM,GAA6D;AAC5F,SACE,qBAAC,SAAI,WAAU,+KAEb;AAAA,wBAAC,QAAG,WAAU,+DAA8D,uBAAS;AAAA,IACrF,oBAAC,OAAE,WAAU,wDAAuD,0DAEpE;AAAA,IACA,qBAAC,SAAI,WAAU,4BACb;AAAA,0BAAC,QAAK,MAAM,MAAM,SAAU,WAAU,2KAA0K,qBAEhN;AAAA,MACA,oBAAC,QAAK,MAAM,MAAM,QAAS,WAAU,+LAA8L,oBAEnO;AAAA,OACF;AAAA,KACF;AAEJ;AAEA,SAAS,UAAU,EAAE,YAAY,QAAQ,QAAQ,GAA4F;AAC3I,QAAM,WAAW,WAAW,QAAQ,WAAW,WAAW,KAAK,IAAI;AACnE,QAAM,OAAO,WAAW,QAAQ;AAChC,QAAM,SAAS,WAAW;AAE1B,SACE,qBAAC,SAAI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AI,UAAW,QAAO,oBAAC,sBAAmB;AAE1C,SACE,oBAAC,aAAQ,WAAU,8GAChB,oBAAU,IACT,oBAAC,mBAAgB,OAAc,IAE/B,iCACG;AAAA,gBAAY,IAAI,CAAC,KAAK,MACrB,oBAAC,aAAoC,YAAY,KAAK,QAAQ,MAAM,SAAS,WAA7D,IAAI,eAA2E,CAChG;AAAA,IACA,QAAQ,KACP,iCACE;AAAA,0BAAC,YAAO,SAAS,MAAM,cAAW,kBAAiB,WAAU,mIAC3D,8BAAC,UAAK,WAAU,wGACd,8BAAC,eAAY,WAAU,sBAAqB,GAC9C,GACF;AAAA,MACA,oBAAC,YAAO,SAAS,MAAM,cAAW,cAAa,WAAU,oIACvD,8BAAC,UAAK,WAAU,wGACd,8BAAC,gBAAa,WAAU,sBAAqB,GAC/C,GACF;AAAA,MACA,oBAAC,SAAI,WAAU,iEACZ,sBAAY,IAAI,CAAC,GAAG,MACnB,oBAAC,YAAe,SAAS,MAAM,WAAW,CAAC,GAAG,cAAY,eAAe,IAAI,CAAC,IAAI,WAAW,GAAG,qCAAqC,MAAM,UAAU,iBAAiB,mBAAmB,KAA5K,CAA+K,CAC7L,GACH;AAAA,OACF;AAAA,KAEJ,GAEJ;AAEJ;","names":[]}
|
package/dist/data/coins.cjs
CHANGED
|
@@ -18,31 +18,55 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
var coins_exports = {};
|
|
20
20
|
__export(coins_exports, {
|
|
21
|
+
coinAccentHue: () => coinAccentHue,
|
|
21
22
|
coinKind: () => coinKind,
|
|
23
|
+
fdvUsd: () => fdvUsd,
|
|
22
24
|
formatCoinPrice: () => formatCoinPrice,
|
|
23
|
-
formatFdv: () => formatFdv
|
|
25
|
+
formatFdv: () => formatFdv,
|
|
26
|
+
formatFdvUsd: () => formatFdvUsd
|
|
24
27
|
});
|
|
25
28
|
module.exports = __toCommonJS(coins_exports);
|
|
29
|
+
var import_format = require("../utils/format.js");
|
|
26
30
|
function coinKind(service) {
|
|
27
31
|
return service === "external-erc20" ? "memecoin" : "creator";
|
|
28
32
|
}
|
|
29
33
|
function formatCoinPrice(n) {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
+
return (0, import_format.formatSmallDecimal)(n);
|
|
35
|
+
}
|
|
36
|
+
const ACCENT_HUES = [220, 258, 341, 23, 325];
|
|
37
|
+
function coinAccentHue(seed) {
|
|
38
|
+
const s = (seed ?? "?").trim().toUpperCase();
|
|
39
|
+
let h = 0;
|
|
40
|
+
for (let i = 0; i < s.length; i++) h = h * 31 + s.charCodeAt(i) >>> 0;
|
|
41
|
+
return ACCENT_HUES[h % ACCENT_HUES.length];
|
|
42
|
+
}
|
|
43
|
+
function abbreviate(n) {
|
|
44
|
+
if (n >= 1e9) return `${(n / 1e9).toLocaleString(void 0, { maximumFractionDigits: 1 })}B`;
|
|
45
|
+
if (n >= 1e6) return `${(n / 1e6).toLocaleString(void 0, { maximumFractionDigits: 1 })}M`;
|
|
46
|
+
if (n >= 1e3) return `${(n / 1e3).toLocaleString(void 0, { maximumFractionDigits: 1 })}K`;
|
|
47
|
+
return n.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
34
48
|
}
|
|
35
49
|
function formatFdv(quotePerCoin, totalSupply, quoteSymbol) {
|
|
36
50
|
if (quotePerCoin == null || !totalSupply) return null;
|
|
37
|
-
const fdv = quotePerCoin * totalSupply;
|
|
38
51
|
const sym = quoteSymbol ?? "";
|
|
39
|
-
const abbr =
|
|
52
|
+
const abbr = abbreviate(quotePerCoin * totalSupply);
|
|
40
53
|
return sym ? `${abbr} ${sym}` : abbr;
|
|
41
54
|
}
|
|
55
|
+
function fdvUsd(price, totalSupply) {
|
|
56
|
+
if (!price || !totalSupply || price.quoteUsdRate == null) return null;
|
|
57
|
+
return price.quotePerCoin * totalSupply * price.quoteUsdRate;
|
|
58
|
+
}
|
|
59
|
+
function formatFdvUsd(price, totalSupply) {
|
|
60
|
+
const v = fdvUsd(price, totalSupply);
|
|
61
|
+
return v == null ? null : `$${abbreviate(v)}`;
|
|
62
|
+
}
|
|
42
63
|
// Annotate the CommonJS export names for ESM import in node:
|
|
43
64
|
0 && (module.exports = {
|
|
65
|
+
coinAccentHue,
|
|
44
66
|
coinKind,
|
|
67
|
+
fdvUsd,
|
|
45
68
|
formatCoinPrice,
|
|
46
|
-
formatFdv
|
|
69
|
+
formatFdv,
|
|
70
|
+
formatFdvUsd
|
|
47
71
|
});
|
|
48
72
|
//# sourceMappingURL=coins.cjs.map
|
package/dist/data/coins.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data/coins.ts"],"sourcesContent":["\n\nexport type CoinKind = \"creator\" | \"memecoin\";\n\nexport interface CoinCollectionLike {\n contractAddress: string;\n chain?: string | null;\n name?: string | null;\n symbol?: string | null;\n image?: string | null;\n service?: string | null;\n claimedBy?: string | null;\n holderCount?: number | null;\n totalSupply?: number | null;\n profile?: { image?: string | null } | null;\n}\n\nexport interface CoinPriceLike {\n quotePerCoin: number;\n quoteSymbol: string | null;\n /** USD value of one unit of quoteSymbol, when known — lets price\n * displays show a fiat-equivalent alongside the on-chain quote. */\n quoteUsdRate?: number | null;\n}\n\nexport function coinKind(service: string | null | undefined): CoinKind {\n return service === \"external-erc20\" ? \"memecoin\" : \"creator\";\n}\n\nexport function formatCoinPrice(n: number): string {\n
|
|
1
|
+
{"version":3,"sources":["../../src/data/coins.ts"],"sourcesContent":["\n\nimport { formatSmallDecimal } from \"../utils/format.js\";\n\nexport type CoinKind = \"creator\" | \"memecoin\";\n\nexport interface CoinCollectionLike {\n contractAddress: string;\n chain?: string | null;\n name?: string | null;\n symbol?: string | null;\n image?: string | null;\n service?: string | null;\n claimedBy?: string | null;\n holderCount?: number | null;\n totalSupply?: number | null;\n profile?: { image?: string | null } | null;\n}\n\nexport interface CoinPriceLike {\n quotePerCoin: number;\n quoteSymbol: string | null;\n /** USD value of one unit of quoteSymbol, when known — lets price\n * displays show a fiat-equivalent alongside the on-chain quote. */\n quoteUsdRate?: number | null;\n}\n\nexport function coinKind(service: string | null | undefined): CoinKind {\n return service === \"external-erc20\" ? \"memecoin\" : \"creator\";\n}\n\nexport function formatCoinPrice(n: number): string {\n return formatSmallDecimal(n);\n}\n\nconst ACCENT_HUES = [220, 258, 341, 23, 325];\n\nexport function coinAccentHue(seed: string | null | undefined): number {\n const s = (seed ?? \"?\").trim().toUpperCase();\n let h = 0;\n for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) >>> 0;\n return ACCENT_HUES[h % ACCENT_HUES.length];\n}\n\nfunction abbreviate(n: number): string {\n if (n >= 1_000_000_000) return `${(n / 1_000_000_000).toLocaleString(undefined, { maximumFractionDigits: 1 })}B`;\n if (n >= 1_000_000) return `${(n / 1_000_000).toLocaleString(undefined, { maximumFractionDigits: 1 })}M`;\n if (n >= 1_000) return `${(n / 1_000).toLocaleString(undefined, { maximumFractionDigits: 1 })}K`;\n return n.toLocaleString(undefined, { maximumFractionDigits: 2 });\n}\n\nexport function formatFdv(\n quotePerCoin: number | null | undefined,\n totalSupply: number | null | undefined,\n quoteSymbol: string | null | undefined\n): string | null {\n if (quotePerCoin == null || !totalSupply) return null;\n const sym = quoteSymbol ?? \"\";\n const abbr = abbreviate(quotePerCoin * totalSupply);\n return sym ? `${abbr} ${sym}` : abbr;\n}\n\nexport function fdvUsd(price: CoinPriceLike | null, totalSupply: number | null | undefined): number | null {\n if (!price || !totalSupply || price.quoteUsdRate == null) return null;\n return price.quotePerCoin * totalSupply * price.quoteUsdRate;\n}\n\nexport function formatFdvUsd(price: CoinPriceLike | null, totalSupply: number | null | undefined): string | null {\n const v = fdvUsd(price, totalSupply);\n return v == null ? null : `$${abbreviate(v)}`;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;A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OAAO,IAAI,WAAW,CAAC,CAAC;AAC7C;","names":[]}
|
package/dist/data/coins.d.cts
CHANGED
|
@@ -22,6 +22,9 @@ interface CoinPriceLike {
|
|
|
22
22
|
}
|
|
23
23
|
declare function coinKind(service: string | null | undefined): CoinKind;
|
|
24
24
|
declare function formatCoinPrice(n: number): string;
|
|
25
|
+
declare function coinAccentHue(seed: string | null | undefined): number;
|
|
25
26
|
declare function formatFdv(quotePerCoin: number | null | undefined, totalSupply: number | null | undefined, quoteSymbol: string | null | undefined): string | null;
|
|
27
|
+
declare function fdvUsd(price: CoinPriceLike | null, totalSupply: number | null | undefined): number | null;
|
|
28
|
+
declare function formatFdvUsd(price: CoinPriceLike | null, totalSupply: number | null | undefined): string | null;
|
|
26
29
|
|
|
27
|
-
export { type CoinCollectionLike, type CoinKind, type CoinPriceLike, coinKind, formatCoinPrice, formatFdv };
|
|
30
|
+
export { type CoinCollectionLike, type CoinKind, type CoinPriceLike, coinAccentHue, coinKind, fdvUsd, formatCoinPrice, formatFdv, formatFdvUsd };
|
package/dist/data/coins.d.ts
CHANGED
|
@@ -22,6 +22,9 @@ interface CoinPriceLike {
|
|
|
22
22
|
}
|
|
23
23
|
declare function coinKind(service: string | null | undefined): CoinKind;
|
|
24
24
|
declare function formatCoinPrice(n: number): string;
|
|
25
|
+
declare function coinAccentHue(seed: string | null | undefined): number;
|
|
25
26
|
declare function formatFdv(quotePerCoin: number | null | undefined, totalSupply: number | null | undefined, quoteSymbol: string | null | undefined): string | null;
|
|
27
|
+
declare function fdvUsd(price: CoinPriceLike | null, totalSupply: number | null | undefined): number | null;
|
|
28
|
+
declare function formatFdvUsd(price: CoinPriceLike | null, totalSupply: number | null | undefined): string | null;
|
|
26
29
|
|
|
27
|
-
export { type CoinCollectionLike, type CoinKind, type CoinPriceLike, coinKind, formatCoinPrice, formatFdv };
|
|
30
|
+
export { type CoinCollectionLike, type CoinKind, type CoinPriceLike, coinAccentHue, coinKind, fdvUsd, formatCoinPrice, formatFdv, formatFdvUsd };
|
package/dist/data/coins.js
CHANGED
|
@@ -1,22 +1,43 @@
|
|
|
1
|
+
import { formatSmallDecimal } from "../utils/format.js";
|
|
1
2
|
function coinKind(service) {
|
|
2
3
|
return service === "external-erc20" ? "memecoin" : "creator";
|
|
3
4
|
}
|
|
4
5
|
function formatCoinPrice(n) {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
return formatSmallDecimal(n);
|
|
7
|
+
}
|
|
8
|
+
const ACCENT_HUES = [220, 258, 341, 23, 325];
|
|
9
|
+
function coinAccentHue(seed) {
|
|
10
|
+
const s = (seed ?? "?").trim().toUpperCase();
|
|
11
|
+
let h = 0;
|
|
12
|
+
for (let i = 0; i < s.length; i++) h = h * 31 + s.charCodeAt(i) >>> 0;
|
|
13
|
+
return ACCENT_HUES[h % ACCENT_HUES.length];
|
|
14
|
+
}
|
|
15
|
+
function abbreviate(n) {
|
|
16
|
+
if (n >= 1e9) return `${(n / 1e9).toLocaleString(void 0, { maximumFractionDigits: 1 })}B`;
|
|
17
|
+
if (n >= 1e6) return `${(n / 1e6).toLocaleString(void 0, { maximumFractionDigits: 1 })}M`;
|
|
18
|
+
if (n >= 1e3) return `${(n / 1e3).toLocaleString(void 0, { maximumFractionDigits: 1 })}K`;
|
|
19
|
+
return n.toLocaleString(void 0, { maximumFractionDigits: 2 });
|
|
9
20
|
}
|
|
10
21
|
function formatFdv(quotePerCoin, totalSupply, quoteSymbol) {
|
|
11
22
|
if (quotePerCoin == null || !totalSupply) return null;
|
|
12
|
-
const fdv = quotePerCoin * totalSupply;
|
|
13
23
|
const sym = quoteSymbol ?? "";
|
|
14
|
-
const abbr =
|
|
24
|
+
const abbr = abbreviate(quotePerCoin * totalSupply);
|
|
15
25
|
return sym ? `${abbr} ${sym}` : abbr;
|
|
16
26
|
}
|
|
27
|
+
function fdvUsd(price, totalSupply) {
|
|
28
|
+
if (!price || !totalSupply || price.quoteUsdRate == null) return null;
|
|
29
|
+
return price.quotePerCoin * totalSupply * price.quoteUsdRate;
|
|
30
|
+
}
|
|
31
|
+
function formatFdvUsd(price, totalSupply) {
|
|
32
|
+
const v = fdvUsd(price, totalSupply);
|
|
33
|
+
return v == null ? null : `$${abbreviate(v)}`;
|
|
34
|
+
}
|
|
17
35
|
export {
|
|
36
|
+
coinAccentHue,
|
|
18
37
|
coinKind,
|
|
38
|
+
fdvUsd,
|
|
19
39
|
formatCoinPrice,
|
|
20
|
-
formatFdv
|
|
40
|
+
formatFdv,
|
|
41
|
+
formatFdvUsd
|
|
21
42
|
};
|
|
22
43
|
//# sourceMappingURL=coins.js.map
|
package/dist/data/coins.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/data/coins.ts"],"sourcesContent":["\n\nexport type CoinKind = \"creator\" | \"memecoin\";\n\nexport interface CoinCollectionLike {\n contractAddress: string;\n chain?: string | null;\n name?: string | null;\n symbol?: string | null;\n image?: string | null;\n service?: string | null;\n claimedBy?: string | null;\n holderCount?: number | null;\n totalSupply?: number | null;\n profile?: { image?: string | null } | null;\n}\n\nexport interface CoinPriceLike {\n quotePerCoin: number;\n quoteSymbol: string | null;\n /** USD value of one unit of quoteSymbol, when known — lets price\n * displays show a fiat-equivalent alongside the on-chain quote. */\n quoteUsdRate?: number | null;\n}\n\nexport function coinKind(service: string | null | undefined): CoinKind {\n return service === \"external-erc20\" ? \"memecoin\" : \"creator\";\n}\n\nexport function formatCoinPrice(n: number): string {\n
|
|
1
|
+
{"version":3,"sources":["../../src/data/coins.ts"],"sourcesContent":["\n\nimport { formatSmallDecimal } from \"../utils/format.js\";\n\nexport type CoinKind = \"creator\" | \"memecoin\";\n\nexport interface CoinCollectionLike {\n contractAddress: string;\n chain?: string | null;\n name?: string | null;\n symbol?: string | null;\n image?: string | null;\n service?: string | null;\n claimedBy?: string | null;\n holderCount?: number | null;\n totalSupply?: number | null;\n profile?: { image?: string | null } | null;\n}\n\nexport interface CoinPriceLike {\n quotePerCoin: number;\n quoteSymbol: string | null;\n /** USD value of one unit of quoteSymbol, when known — lets price\n * displays show a fiat-equivalent alongside the on-chain quote. */\n quoteUsdRate?: number | null;\n}\n\nexport function coinKind(service: string | null | undefined): CoinKind {\n return service === \"external-erc20\" ? \"memecoin\" : \"creator\";\n}\n\nexport function formatCoinPrice(n: number): string {\n return formatSmallDecimal(n);\n}\n\nconst ACCENT_HUES = [220, 258, 341, 23, 325];\n\nexport function coinAccentHue(seed: string | null | undefined): number {\n const s = (seed ?? \"?\").trim().toUpperCase();\n let h = 0;\n for (let i = 0; i < s.length; i++) h = (h * 31 + s.charCodeAt(i)) >>> 0;\n return ACCENT_HUES[h % ACCENT_HUES.length];\n}\n\nfunction abbreviate(n: number): string {\n if (n >= 1_000_000_000) return `${(n / 1_000_000_000).toLocaleString(undefined, { maximumFractionDigits: 1 })}B`;\n if (n >= 1_000_000) return `${(n / 1_000_000).toLocaleString(undefined, { maximumFractionDigits: 1 })}M`;\n if (n >= 1_000) return `${(n / 1_000).toLocaleString(undefined, { maximumFractionDigits: 1 })}K`;\n return n.toLocaleString(undefined, { maximumFractionDigits: 2 });\n}\n\nexport function formatFdv(\n quotePerCoin: number | null | undefined,\n totalSupply: number | null | undefined,\n quoteSymbol: string | null | undefined\n): string | null {\n if (quotePerCoin == null || !totalSupply) return null;\n const sym = quoteSymbol ?? \"\";\n const abbr = abbreviate(quotePerCoin * totalSupply);\n return sym ? `${abbr} ${sym}` : abbr;\n}\n\nexport function fdvUsd(price: CoinPriceLike | null, totalSupply: number | null | undefined): number | null {\n if (!price || !totalSupply || price.quoteUsdRate == null) return null;\n return price.quotePerCoin * totalSupply * price.quoteUsdRate;\n}\n\nexport function formatFdvUsd(price: CoinPriceLike | null, totalSupply: number | null | undefined): string | null {\n const v = fdvUsd(price, totalSupply);\n return v == null ? null : `$${abbreviate(v)}`;\n}\n"],"mappings":"AAEA,SAAS,0BAA0B;AAyB5B,SAAS,SAAS,SAA8C;AACrE,SAAO,YAAY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CreateSchema: z.ZodEffects<z.ZodObject<{
|
|
|
23
23
|
allowlistAddresses: z.ZodDefault<z.ZodString>;
|
|
24
24
|
}, "strip", z.ZodTypeAny, {
|
|
25
25
|
symbol: string;
|
|
26
|
-
derivatives: string;
|
|
27
26
|
name: string;
|
|
27
|
+
derivatives: string;
|
|
28
28
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
|
|
29
29
|
licenseType: string;
|
|
30
30
|
commercialUse: string;
|
|
@@ -65,8 +65,8 @@ declare const dropCreateSchema: z.ZodEffects<z.ZodObject<{
|
|
|
65
65
|
allowlistAddresses?: string | undefined;
|
|
66
66
|
}>, {
|
|
67
67
|
symbol: string;
|
|
68
|
-
derivatives: string;
|
|
69
68
|
name: string;
|
|
69
|
+
derivatives: string;
|
|
70
70
|
ipType: "Audio" | "Video" | "Art" | "Photography" | "NFT" | "Software" | "RWA" | "Patents" | "Posts" | "Publications" | "Documents" | "Custom";
|
|
71
71
|
licenseType: string;
|
|
72
72
|
commercialUse: string;
|