@medialane/ui 0.353.0 → 0.355.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/accounts-page.cjs +40 -48
- package/dist/components/accounts-page.cjs.map +1 -1
- package/dist/components/accounts-page.js +40 -38
- package/dist/components/accounts-page.js.map +1 -1
- package/dist/components/button.d.cts +1 -1
- package/dist/components/button.d.ts +1 -1
- package/dist/components/collection-showcase.cjs +192 -0
- package/dist/components/collection-showcase.cjs.map +1 -0
- package/dist/components/collection-showcase.d.cts +11 -0
- package/dist/components/collection-showcase.d.ts +11 -0
- package/dist/components/collection-showcase.js +158 -0
- package/dist/components/collection-showcase.js.map +1 -0
- package/dist/components/home-page.cjs +2 -2
- package/dist/components/home-page.cjs.map +1 -1
- package/dist/components/home-page.js +2 -2
- package/dist/components/home-page.js.map +1 -1
- package/dist/components/launchpad/edition-mint-schema.d.cts +4 -4
- package/dist/components/launchpad/edition-mint-schema.d.ts +4 -4
- package/dist/index.cjs +3 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +2 -3
- package/dist/index.js.map +1 -1
- package/dist/medialane.css +1 -6
- package/dist/utils/media-wallet/use-erc20-balance.d.cts +1 -1
- package/dist/utils/media-wallet/use-erc20-balance.d.ts +1 -1
- package/dist/utils/use-accounts.cjs +3 -3
- package/dist/utils/use-accounts.cjs.map +1 -1
- package/dist/utils/use-accounts.d.cts +1 -1
- package/dist/utils/use-accounts.d.ts +1 -1
- package/dist/utils/use-accounts.js +3 -3
- package/dist/utils/use-accounts.js.map +1 -1
- package/package.json +3 -3
- package/dist/components/hero-slider.cjs +0 -103
- package/dist/components/hero-slider.cjs.map +0 -1
- package/dist/components/hero-slider.d.cts +0 -16
- package/dist/components/hero-slider.d.ts +0 -16
- package/dist/components/hero-slider.js +0 -68
- package/dist/components/hero-slider.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "maxLength" | "value" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "maxLength" | "value" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as input_otp from 'input-otp';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
|
|
4
|
-
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "
|
|
4
|
+
declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "maxLength" | "value" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
5
5
|
value?: string;
|
|
6
6
|
onChange?: (newValue: string) => unknown;
|
|
7
7
|
maxLength: number;
|
|
@@ -14,7 +14,7 @@ declare const InputOTP: React.ForwardRefExoticComponent<(Omit<Omit<React.InputHT
|
|
|
14
14
|
} & {
|
|
15
15
|
render: (props: input_otp.RenderProps) => React.ReactNode;
|
|
16
16
|
children?: never;
|
|
17
|
-
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>, "ref"> | Omit<Omit<React.InputHTMLAttributes<HTMLInputElement>, "onChange" | "maxLength" | "value" | "textAlign" | "onComplete" | "pushPasswordManagerStrategy" | "pasteTransformer" | "containerClassName" | "noScriptCSSFallback"> & {
|
|
18
18
|
value?: string;
|
|
19
19
|
onChange?: (newValue: string) => unknown;
|
|
20
20
|
maxLength: number;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
"use client";
|
|
3
|
-
var __create = Object.create;
|
|
4
3
|
var __defProp = Object.defineProperty;
|
|
5
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
8
6
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
7
|
var __export = (target, all) => {
|
|
10
8
|
for (var name in all)
|
|
@@ -18,14 +16,6 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
16
|
}
|
|
19
17
|
return to;
|
|
20
18
|
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
19
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
20
|
var accounts_page_exports = {};
|
|
31
21
|
__export(accounts_page_exports, {
|
|
@@ -36,44 +26,21 @@ var import_jsx_runtime = require("react/jsx-runtime");
|
|
|
36
26
|
var import_react = require("react");
|
|
37
27
|
var import_sdk = require("@medialane/sdk");
|
|
38
28
|
var import_lucide_react = require("lucide-react");
|
|
39
|
-
var
|
|
29
|
+
var import_asset_card = require("./asset-card.js");
|
|
30
|
+
var import_ip_type_badge = require("./ip-type-badge.js");
|
|
40
31
|
var import_input = require("./input.js");
|
|
41
|
-
var import_skeleton = require("./skeleton.js");
|
|
42
32
|
var import_load_more_sentinel = require("./load-more-sentinel.js");
|
|
43
33
|
var import_motion_primitives = require("./motion-primitives.js");
|
|
44
34
|
var import_use_accounts = require("../utils/use-accounts.js");
|
|
45
35
|
var import_address = require("../utils/address.js");
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
50
|
-
function plural(count, noun) {
|
|
51
|
-
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
52
|
-
}
|
|
53
|
-
function AccountCard({ account }) {
|
|
54
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
55
|
-
import_link.default,
|
|
56
|
-
{
|
|
57
|
-
href: (0, import_sdk.profileHref)({ address: account.address }),
|
|
58
|
-
className: "flex items-center gap-3 rounded-2xl border border-border bg-card p-4 transition-colors hover:bg-muted/40 active:scale-[0.98]",
|
|
59
|
-
children: [
|
|
60
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "h-11 w-11 shrink-0 rounded-full ring-2 ring-white/10", style: { background: addressGradient(account.address) } }),
|
|
61
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "min-w-0", children: [
|
|
62
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "block truncate font-mono text-sm font-semibold", children: (0, import_address.shortenAddress)(account.address, 6) }),
|
|
63
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "block truncate text-xs text-muted-foreground", children: [
|
|
64
|
-
plural(account.collections, "collection"),
|
|
65
|
-
" \xB7 ",
|
|
66
|
-
plural(account.assets, "asset")
|
|
67
|
-
] })
|
|
68
|
-
] })
|
|
69
|
-
]
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
}
|
|
36
|
+
var import_cn = require("../utils/cn.js");
|
|
37
|
+
const GRID = "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3 sm:gap-4";
|
|
38
|
+
const CHIP = "shrink-0 rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors";
|
|
73
39
|
function AccountsPage() {
|
|
74
40
|
const [search, setSearch] = (0, import_react.useState)("");
|
|
75
41
|
const [query, setQuery] = (0, import_react.useState)("");
|
|
76
|
-
const
|
|
42
|
+
const [ipType, setIpType] = (0, import_react.useState)("");
|
|
43
|
+
const { accounts, total, isLoading, isLoadingMore, hasMore, loadMore } = (0, import_use_accounts.useAccounts)(query, ipType);
|
|
77
44
|
(0, import_react.useEffect)(() => {
|
|
78
45
|
const timer = setTimeout(() => setQuery(search.trim()), 300);
|
|
79
46
|
return () => clearTimeout(timer);
|
|
@@ -91,7 +58,7 @@ function AccountsPage() {
|
|
|
91
58
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.16, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "mb-6 max-w-lg text-base leading-relaxed text-muted-foreground", children: "Every address with collections or assets onchain." }) }),
|
|
92
59
|
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.FadeIn, { delay: 0.22, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex flex-col items-start gap-4 sm:flex-row sm:items-center", children: [
|
|
93
60
|
!isLoading && total > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 rounded-full border border-border bg-card/80 px-4 py-1.5 text-sm", children: [
|
|
94
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-bold", children: total }),
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "font-bold tabular-nums", children: total.toLocaleString("en-US") }),
|
|
95
62
|
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "text-muted-foreground", children: [
|
|
96
63
|
"account",
|
|
97
64
|
total === 1 ? "" : "s"
|
|
@@ -121,13 +88,38 @@ function AccountsPage() {
|
|
|
121
88
|
] })
|
|
122
89
|
] }) })
|
|
123
90
|
] }),
|
|
124
|
-
/* @__PURE__ */ (0, import_jsx_runtime.
|
|
125
|
-
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
91
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "space-y-6 px-4 py-8 sm:px-6 lg:px-8", children: [
|
|
92
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "-mx-4 flex gap-2 overflow-x-auto px-4 pb-1 sm:mx-0 sm:px-0", role: "group", "aria-label": "Type of work", children: [{ slug: "", label: "All" }, ...import_ip_type_badge.IP_TYPE_CONFIG].map(({ slug, label }) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
93
|
+
"button",
|
|
94
|
+
{
|
|
95
|
+
type: "button",
|
|
96
|
+
"aria-pressed": ipType === slug,
|
|
97
|
+
onClick: () => setIpType(slug),
|
|
98
|
+
className: (0, import_cn.cn)(
|
|
99
|
+
CHIP,
|
|
100
|
+
ipType === slug ? "border-foreground bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:text-foreground"
|
|
101
|
+
),
|
|
102
|
+
children: label
|
|
103
|
+
},
|
|
104
|
+
slug || "all"
|
|
105
|
+
)) }),
|
|
106
|
+
isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: GRID, children: Array.from({ length: 10 }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_asset_card.AssetCardSkeleton, {}, i)) }) : accounts.length > 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_jsx_runtime.Fragment, { children: [
|
|
107
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.Stagger, { className: GRID, children: accounts.map((account) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion_primitives.StaggerItem, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
108
|
+
import_asset_card.AssetCard,
|
|
109
|
+
{
|
|
110
|
+
href: (0, import_sdk.profileHref)({ address: account.address }),
|
|
111
|
+
name: (0, import_address.shortenAddress)(account.address, 6),
|
|
112
|
+
image: account.image,
|
|
113
|
+
ipType: account.ipType,
|
|
114
|
+
fallbackId: account.address.slice(2, 8)
|
|
115
|
+
}
|
|
116
|
+
) }, account.address)) }),
|
|
117
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_load_more_sentinel.LoadMoreSentinel, { hasMore, isLoading: isLoadingMore, onLoadMore: loadMore })
|
|
118
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-4 py-24 text-center", children: [
|
|
119
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-muted", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Users, { className: "h-8 w-8 text-muted-foreground/40" }) }),
|
|
120
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-lg font-semibold", children: query ? `No accounts found for "${query}"` : "No accounts found" })
|
|
121
|
+
] })
|
|
122
|
+
] })
|
|
131
123
|
] });
|
|
132
124
|
}
|
|
133
125
|
// Annotate the CommonJS export names for ESM import in node:
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/accounts-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { profileHref
|
|
1
|
+
{"version":3,"sources":["../../src/components/accounts-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { profileHref } from \"@medialane/sdk\";\nimport { Search, Users, X } from \"lucide-react\";\nimport { AssetCard, AssetCardSkeleton } from \"./asset-card.js\";\nimport { IP_TYPE_CONFIG } from \"./ip-type-badge.js\";\nimport { Input } from \"./input.js\";\nimport { LoadMoreSentinel } from \"./load-more-sentinel.js\";\nimport { FadeIn, Stagger, StaggerItem } from \"./motion-primitives.js\";\nimport { useAccounts } from \"../utils/use-accounts.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { cn } from \"../utils/cn.js\";\n\nconst GRID = \"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3 sm:gap-4\";\nconst CHIP = \"shrink-0 rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors\";\n\nexport function AccountsPage() {\n const [search, setSearch] = useState(\"\");\n const [query, setQuery] = useState(\"\");\n const [ipType, setIpType] = useState(\"\");\n const { accounts, total, isLoading, isLoadingMore, hasMore, loadMore } = useAccounts(query, ipType);\n\n useEffect(() => {\n const timer = setTimeout(() => setQuery(search.trim()), 300);\n return () => clearTimeout(timer);\n }, [search]);\n\n return (\n <div className=\"pb-16\">\n <section className=\"border-b border-border/50 px-4 py-14 sm:px-6 sm:py-20 lg:px-8\">\n <FadeIn>\n <span className=\"pill-badge mb-5 inline-flex\">\n <Users className=\"h-3 w-3\" />\n Accounts directory\n </span>\n </FadeIn>\n <FadeIn delay={0.08}>\n <h1 className=\"mb-3 text-3xl font-semibold leading-tight sm:text-4xl lg:text-5xl\">\n Onchain <span className=\"gradient-text\">accounts</span>\n </h1>\n </FadeIn>\n <FadeIn delay={0.16}>\n <p className=\"mb-6 max-w-lg text-base leading-relaxed text-muted-foreground\">\n Every address with collections or assets onchain.\n </p>\n </FadeIn>\n <FadeIn delay={0.22}>\n <div className=\"flex flex-col items-start gap-4 sm:flex-row sm:items-center\">\n {!isLoading && total > 0 && (\n <div className=\"flex items-center gap-2 rounded-full border border-border bg-card/80 px-4 py-1.5 text-sm\">\n <span className=\"font-bold tabular-nums\">{total.toLocaleString(\"en-US\")}</span>\n <span className=\"text-muted-foreground\">account{total === 1 ? \"\" : \"s\"}</span>\n </div>\n )}\n <div className=\"relative w-full sm:max-w-xs\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground\" />\n <Input\n className=\"pl-9 pr-9\"\n placeholder=\"Search by address…\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n />\n {search && (\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onClick={() => setSearch(\"\")}\n className=\"absolute right-2.5 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-full bg-muted transition-colors hover:bg-muted/80\"\n >\n <X className=\"h-3 w-3 text-muted-foreground\" />\n </button>\n )}\n </div>\n </div>\n </FadeIn>\n </section>\n\n <section className=\"space-y-6 px-4 py-8 sm:px-6 lg:px-8\">\n <div className=\"-mx-4 flex gap-2 overflow-x-auto px-4 pb-1 sm:mx-0 sm:px-0\" role=\"group\" aria-label=\"Type of work\">\n {[{ slug: \"\", label: \"All\" }, ...IP_TYPE_CONFIG].map(({ slug, label }) => (\n <button\n key={slug || \"all\"}\n type=\"button\"\n aria-pressed={ipType === slug}\n onClick={() => setIpType(slug)}\n className={cn(\n CHIP,\n ipType === slug\n ? \"border-foreground bg-foreground text-background\"\n : \"border-border bg-card text-muted-foreground hover:text-foreground\",\n )}\n >\n {label}\n </button>\n ))}\n </div>\n\n {isLoading ? (\n <div className={GRID}>\n {Array.from({ length: 10 }).map((_, i) => (\n <AssetCardSkeleton key={i} />\n ))}\n </div>\n ) : accounts.length > 0 ? (\n <>\n <Stagger className={GRID}>\n {accounts.map((account) => (\n <StaggerItem key={account.address}>\n <AssetCard\n href={profileHref({ address: account.address })}\n name={shortenAddress(account.address, 6)}\n image={account.image}\n ipType={account.ipType}\n fallbackId={account.address.slice(2, 8)}\n />\n </StaggerItem>\n ))}\n </Stagger>\n <LoadMoreSentinel hasMore={hasMore} isLoading={isLoadingMore} onLoadMore={loadMore} />\n </>\n ) : (\n <div className=\"space-y-4 py-24 text-center\">\n <div className=\"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-muted\">\n <Users className=\"h-8 w-8 text-muted-foreground/40\" />\n </div>\n <p className=\"text-lg font-semibold\">{query ? `No accounts found for \"${query}\"` : \"No accounts found\"}</p>\n </div>\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgCU;AA9BV,mBAAoC;AACpC,iBAA4B;AAC5B,0BAAiC;AACjC,wBAA6C;AAC7C,2BAA+B;AAC/B,mBAAsB;AACtB,gCAAiC;AACjC,+BAA6C;AAC7C,0BAA4B;AAC5B,qBAA+B;AAC/B,gBAAmB;AAEnB,MAAM,OAAO;AACb,MAAM,OAAO;AAEN,SAAS,eAAe;AAC7B,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,EAAE;AACvC,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,EAAE;AACrC,QAAM,CAAC,QAAQ,SAAS,QAAI,uBAAS,EAAE;AACvC,QAAM,EAAE,UAAU,OAAO,WAAW,eAAe,SAAS,SAAS,QAAI,iCAAY,OAAO,MAAM;AAElG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J;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -3,44 +3,21 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { useEffect, useState } from "react";
|
|
4
4
|
import { profileHref } from "@medialane/sdk";
|
|
5
5
|
import { Search, Users, X } from "lucide-react";
|
|
6
|
-
import
|
|
6
|
+
import { AssetCard, AssetCardSkeleton } from "./asset-card.js";
|
|
7
|
+
import { IP_TYPE_CONFIG } from "./ip-type-badge.js";
|
|
7
8
|
import { Input } from "./input.js";
|
|
8
|
-
import { Skeleton } from "./skeleton.js";
|
|
9
9
|
import { LoadMoreSentinel } from "./load-more-sentinel.js";
|
|
10
10
|
import { FadeIn, Stagger, StaggerItem } from "./motion-primitives.js";
|
|
11
11
|
import { useAccounts } from "../utils/use-accounts.js";
|
|
12
12
|
import { shortenAddress } from "../utils/address.js";
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
}
|
|
17
|
-
function plural(count, noun) {
|
|
18
|
-
return `${count} ${noun}${count === 1 ? "" : "s"}`;
|
|
19
|
-
}
|
|
20
|
-
function AccountCard({ account }) {
|
|
21
|
-
return /* @__PURE__ */ jsxs(
|
|
22
|
-
Link,
|
|
23
|
-
{
|
|
24
|
-
href: profileHref({ address: account.address }),
|
|
25
|
-
className: "flex items-center gap-3 rounded-2xl border border-border bg-card p-4 transition-colors hover:bg-muted/40 active:scale-[0.98]",
|
|
26
|
-
children: [
|
|
27
|
-
/* @__PURE__ */ jsx("span", { className: "h-11 w-11 shrink-0 rounded-full ring-2 ring-white/10", style: { background: addressGradient(account.address) } }),
|
|
28
|
-
/* @__PURE__ */ jsxs("span", { className: "min-w-0", children: [
|
|
29
|
-
/* @__PURE__ */ jsx("span", { className: "block truncate font-mono text-sm font-semibold", children: shortenAddress(account.address, 6) }),
|
|
30
|
-
/* @__PURE__ */ jsxs("span", { className: "block truncate text-xs text-muted-foreground", children: [
|
|
31
|
-
plural(account.collections, "collection"),
|
|
32
|
-
" \xB7 ",
|
|
33
|
-
plural(account.assets, "asset")
|
|
34
|
-
] })
|
|
35
|
-
] })
|
|
36
|
-
]
|
|
37
|
-
}
|
|
38
|
-
);
|
|
39
|
-
}
|
|
13
|
+
import { cn } from "../utils/cn.js";
|
|
14
|
+
const GRID = "grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3 sm:gap-4";
|
|
15
|
+
const CHIP = "shrink-0 rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors";
|
|
40
16
|
function AccountsPage() {
|
|
41
17
|
const [search, setSearch] = useState("");
|
|
42
18
|
const [query, setQuery] = useState("");
|
|
43
|
-
const
|
|
19
|
+
const [ipType, setIpType] = useState("");
|
|
20
|
+
const { accounts, total, isLoading, isLoadingMore, hasMore, loadMore } = useAccounts(query, ipType);
|
|
44
21
|
useEffect(() => {
|
|
45
22
|
const timer = setTimeout(() => setQuery(search.trim()), 300);
|
|
46
23
|
return () => clearTimeout(timer);
|
|
@@ -58,7 +35,7 @@ function AccountsPage() {
|
|
|
58
35
|
/* @__PURE__ */ jsx(FadeIn, { delay: 0.16, children: /* @__PURE__ */ jsx("p", { className: "mb-6 max-w-lg text-base leading-relaxed text-muted-foreground", children: "Every address with collections or assets onchain." }) }),
|
|
59
36
|
/* @__PURE__ */ jsx(FadeIn, { delay: 0.22, children: /* @__PURE__ */ jsxs("div", { className: "flex flex-col items-start gap-4 sm:flex-row sm:items-center", children: [
|
|
60
37
|
!isLoading && total > 0 && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 rounded-full border border-border bg-card/80 px-4 py-1.5 text-sm", children: [
|
|
61
|
-
/* @__PURE__ */ jsx("span", { className: "font-bold", children: total }),
|
|
38
|
+
/* @__PURE__ */ jsx("span", { className: "font-bold tabular-nums", children: total.toLocaleString("en-US") }),
|
|
62
39
|
/* @__PURE__ */ jsxs("span", { className: "text-muted-foreground", children: [
|
|
63
40
|
"account",
|
|
64
41
|
total === 1 ? "" : "s"
|
|
@@ -88,13 +65,38 @@ function AccountsPage() {
|
|
|
88
65
|
] })
|
|
89
66
|
] }) })
|
|
90
67
|
] }),
|
|
91
|
-
/* @__PURE__ */
|
|
92
|
-
/* @__PURE__ */ jsx(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
68
|
+
/* @__PURE__ */ jsxs("section", { className: "space-y-6 px-4 py-8 sm:px-6 lg:px-8", children: [
|
|
69
|
+
/* @__PURE__ */ jsx("div", { className: "-mx-4 flex gap-2 overflow-x-auto px-4 pb-1 sm:mx-0 sm:px-0", role: "group", "aria-label": "Type of work", children: [{ slug: "", label: "All" }, ...IP_TYPE_CONFIG].map(({ slug, label }) => /* @__PURE__ */ jsx(
|
|
70
|
+
"button",
|
|
71
|
+
{
|
|
72
|
+
type: "button",
|
|
73
|
+
"aria-pressed": ipType === slug,
|
|
74
|
+
onClick: () => setIpType(slug),
|
|
75
|
+
className: cn(
|
|
76
|
+
CHIP,
|
|
77
|
+
ipType === slug ? "border-foreground bg-foreground text-background" : "border-border bg-card text-muted-foreground hover:text-foreground"
|
|
78
|
+
),
|
|
79
|
+
children: label
|
|
80
|
+
},
|
|
81
|
+
slug || "all"
|
|
82
|
+
)) }),
|
|
83
|
+
isLoading ? /* @__PURE__ */ jsx("div", { className: GRID, children: Array.from({ length: 10 }).map((_, i) => /* @__PURE__ */ jsx(AssetCardSkeleton, {}, i)) }) : accounts.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
84
|
+
/* @__PURE__ */ jsx(Stagger, { className: GRID, children: accounts.map((account) => /* @__PURE__ */ jsx(StaggerItem, { children: /* @__PURE__ */ jsx(
|
|
85
|
+
AssetCard,
|
|
86
|
+
{
|
|
87
|
+
href: profileHref({ address: account.address }),
|
|
88
|
+
name: shortenAddress(account.address, 6),
|
|
89
|
+
image: account.image,
|
|
90
|
+
ipType: account.ipType,
|
|
91
|
+
fallbackId: account.address.slice(2, 8)
|
|
92
|
+
}
|
|
93
|
+
) }, account.address)) }),
|
|
94
|
+
/* @__PURE__ */ jsx(LoadMoreSentinel, { hasMore, isLoading: isLoadingMore, onLoadMore: loadMore })
|
|
95
|
+
] }) : /* @__PURE__ */ jsxs("div", { className: "space-y-4 py-24 text-center", children: [
|
|
96
|
+
/* @__PURE__ */ jsx("div", { className: "mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-muted", children: /* @__PURE__ */ jsx(Users, { className: "h-8 w-8 text-muted-foreground/40" }) }),
|
|
97
|
+
/* @__PURE__ */ jsx("p", { className: "text-lg font-semibold", children: query ? `No accounts found for "${query}"` : "No accounts found" })
|
|
98
|
+
] })
|
|
99
|
+
] })
|
|
98
100
|
] });
|
|
99
101
|
}
|
|
100
102
|
export {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/accounts-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { profileHref
|
|
1
|
+
{"version":3,"sources":["../../src/components/accounts-page.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, useState } from \"react\";\nimport { profileHref } from \"@medialane/sdk\";\nimport { Search, Users, X } from \"lucide-react\";\nimport { AssetCard, AssetCardSkeleton } from \"./asset-card.js\";\nimport { IP_TYPE_CONFIG } from \"./ip-type-badge.js\";\nimport { Input } from \"./input.js\";\nimport { LoadMoreSentinel } from \"./load-more-sentinel.js\";\nimport { FadeIn, Stagger, StaggerItem } from \"./motion-primitives.js\";\nimport { useAccounts } from \"../utils/use-accounts.js\";\nimport { shortenAddress } from \"../utils/address.js\";\nimport { cn } from \"../utils/cn.js\";\n\nconst GRID = \"grid grid-cols-2 sm:grid-cols-3 lg:grid-cols-4 xl:grid-cols-5 gap-3 sm:gap-4\";\nconst CHIP = \"shrink-0 rounded-full border px-3.5 py-1.5 text-sm font-medium transition-colors\";\n\nexport function AccountsPage() {\n const [search, setSearch] = useState(\"\");\n const [query, setQuery] = useState(\"\");\n const [ipType, setIpType] = useState(\"\");\n const { accounts, total, isLoading, isLoadingMore, hasMore, loadMore } = useAccounts(query, ipType);\n\n useEffect(() => {\n const timer = setTimeout(() => setQuery(search.trim()), 300);\n return () => clearTimeout(timer);\n }, [search]);\n\n return (\n <div className=\"pb-16\">\n <section className=\"border-b border-border/50 px-4 py-14 sm:px-6 sm:py-20 lg:px-8\">\n <FadeIn>\n <span className=\"pill-badge mb-5 inline-flex\">\n <Users className=\"h-3 w-3\" />\n Accounts directory\n </span>\n </FadeIn>\n <FadeIn delay={0.08}>\n <h1 className=\"mb-3 text-3xl font-semibold leading-tight sm:text-4xl lg:text-5xl\">\n Onchain <span className=\"gradient-text\">accounts</span>\n </h1>\n </FadeIn>\n <FadeIn delay={0.16}>\n <p className=\"mb-6 max-w-lg text-base leading-relaxed text-muted-foreground\">\n Every address with collections or assets onchain.\n </p>\n </FadeIn>\n <FadeIn delay={0.22}>\n <div className=\"flex flex-col items-start gap-4 sm:flex-row sm:items-center\">\n {!isLoading && total > 0 && (\n <div className=\"flex items-center gap-2 rounded-full border border-border bg-card/80 px-4 py-1.5 text-sm\">\n <span className=\"font-bold tabular-nums\">{total.toLocaleString(\"en-US\")}</span>\n <span className=\"text-muted-foreground\">account{total === 1 ? \"\" : \"s\"}</span>\n </div>\n )}\n <div className=\"relative w-full sm:max-w-xs\">\n <Search className=\"pointer-events-none absolute left-3 top-1/2 h-4 w-4 -translate-y-1/2 text-muted-foreground\" />\n <Input\n className=\"pl-9 pr-9\"\n placeholder=\"Search by address…\"\n value={search}\n onChange={(e) => setSearch(e.target.value)}\n />\n {search && (\n <button\n type=\"button\"\n aria-label=\"Clear search\"\n onClick={() => setSearch(\"\")}\n className=\"absolute right-2.5 top-1/2 flex h-5 w-5 -translate-y-1/2 items-center justify-center rounded-full bg-muted transition-colors hover:bg-muted/80\"\n >\n <X className=\"h-3 w-3 text-muted-foreground\" />\n </button>\n )}\n </div>\n </div>\n </FadeIn>\n </section>\n\n <section className=\"space-y-6 px-4 py-8 sm:px-6 lg:px-8\">\n <div className=\"-mx-4 flex gap-2 overflow-x-auto px-4 pb-1 sm:mx-0 sm:px-0\" role=\"group\" aria-label=\"Type of work\">\n {[{ slug: \"\", label: \"All\" }, ...IP_TYPE_CONFIG].map(({ slug, label }) => (\n <button\n key={slug || \"all\"}\n type=\"button\"\n aria-pressed={ipType === slug}\n onClick={() => setIpType(slug)}\n className={cn(\n CHIP,\n ipType === slug\n ? \"border-foreground bg-foreground text-background\"\n : \"border-border bg-card text-muted-foreground hover:text-foreground\",\n )}\n >\n {label}\n </button>\n ))}\n </div>\n\n {isLoading ? (\n <div className={GRID}>\n {Array.from({ length: 10 }).map((_, i) => (\n <AssetCardSkeleton key={i} />\n ))}\n </div>\n ) : accounts.length > 0 ? (\n <>\n <Stagger className={GRID}>\n {accounts.map((account) => (\n <StaggerItem key={account.address}>\n <AssetCard\n href={profileHref({ address: account.address })}\n name={shortenAddress(account.address, 6)}\n image={account.image}\n ipType={account.ipType}\n fallbackId={account.address.slice(2, 8)}\n />\n </StaggerItem>\n ))}\n </Stagger>\n <LoadMoreSentinel hasMore={hasMore} isLoading={isLoadingMore} onLoadMore={loadMore} />\n </>\n ) : (\n <div className=\"space-y-4 py-24 text-center\">\n <div className=\"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-muted\">\n <Users className=\"h-8 w-8 text-muted-foreground/40\" />\n </div>\n <p className=\"text-lg font-semibold\">{query ? `No accounts found for \"${query}\"` : \"No accounts found\"}</p>\n </div>\n )}\n </section>\n </div>\n );\n}\n"],"mappings":";AAgCU,SAyEA,UAxEE,KADF;AA9BV,SAAS,WAAW,gBAAgB;AACpC,SAAS,mBAAmB;AAC5B,SAAS,QAAQ,OAAO,SAAS;AACjC,SAAS,WAAW,yBAAyB;AAC7C,SAAS,sBAAsB;AAC/B,SAAS,aAAa;AACtB,SAAS,wBAAwB;AACjC,SAAS,QAAQ,SAAS,mBAAmB;AAC7C,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;A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AAQ,OAQ1B,CACD,GACH;AAAA,QACA,oBAAC,oBAAiB,SAAkB,WAAW,eAAe,YAAY,UAAU;AAAA,SACtF,IAEA,qBAAC,SAAI,WAAU,+BACb;AAAA,4BAAC,SAAI,WAAU,2EACb,8BAAC,SAAM,WAAU,oCAAmC,GACtD;AAAA,QACA,oBAAC,OAAE,WAAU,yBAAyB,kBAAQ,0BAA0B,KAAK,MAAM,qBAAoB;AAAA,SACzG;AAAA,OAEJ;AAAA,KACF;AAEJ;","names":[]}
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
7
|
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
4
|
|
|
5
5
|
declare const buttonVariants: (props?: ({
|
|
6
|
-
variant?: "
|
|
6
|
+
variant?: "link" | "default" | "destructive" | "outline" | "secondary" | "ghost" | "premium" | "tonal" | "gradient-border" | "gradient-fill" | null | undefined;
|
|
7
7
|
size?: "default" | "icon" | "sm" | "lg" | null | undefined;
|
|
8
8
|
} & class_variance_authority_types.ClassProp) | undefined) => string;
|
|
9
9
|
interface ButtonProps extends React.ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof buttonVariants> {
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
"use client";
|
|
3
|
+
var __create = Object.create;
|
|
4
|
+
var __defProp = Object.defineProperty;
|
|
5
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
8
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
+
var __export = (target, all) => {
|
|
10
|
+
for (var name in all)
|
|
11
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
12
|
+
};
|
|
13
|
+
var __copyProps = (to, from, except, desc) => {
|
|
14
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
+
for (let key of __getOwnPropNames(from))
|
|
16
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
+
}
|
|
19
|
+
return to;
|
|
20
|
+
};
|
|
21
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
+
mod
|
|
28
|
+
));
|
|
29
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
30
|
+
var collection_showcase_exports = {};
|
|
31
|
+
__export(collection_showcase_exports, {
|
|
32
|
+
CollectionShowcase: () => CollectionShowcase
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(collection_showcase_exports);
|
|
35
|
+
var import_jsx_runtime = require("react/jsx-runtime");
|
|
36
|
+
var import_react = require("react");
|
|
37
|
+
var import_framer_motion = require("framer-motion");
|
|
38
|
+
var import_link = __toESM(require("./link.js"), 1);
|
|
39
|
+
var import_image = __toESM(require("./image.js"), 1);
|
|
40
|
+
var import_skeleton = require("./skeleton.js");
|
|
41
|
+
var import_cn = require("../utils/cn.js");
|
|
42
|
+
var import_use_image_url = require("../utils/use-image-url.js");
|
|
43
|
+
const AUTOPLAY_MS = 6e3;
|
|
44
|
+
const SWIPE_PX = 50;
|
|
45
|
+
const CARD_SIZE = "aspect-[4/5] w-[58vw] max-w-[260px] sm:max-w-[300px] lg:max-w-[340px]";
|
|
46
|
+
function offsetFrom(index, current, count) {
|
|
47
|
+
const distance = (index - current + count) % count;
|
|
48
|
+
return distance > count / 2 ? distance - count : distance;
|
|
49
|
+
}
|
|
50
|
+
function ShowcaseSkeleton() {
|
|
51
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("section", { className: "px-4 pb-8 pt-10 sm:pt-14", children: [
|
|
52
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: (0, import_cn.cn)("mx-auto rounded-2xl", CARD_SIZE) }),
|
|
53
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "mx-auto mt-6 h-9 w-56" })
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
function CollectionShowcase({ collections, isLoading, getHref }) {
|
|
57
|
+
const resolveImage = (0, import_use_image_url.useImageUrl)();
|
|
58
|
+
const reduceMotion = (0, import_framer_motion.useReducedMotion)();
|
|
59
|
+
const [current, setCurrent] = (0, import_react.useState)(0);
|
|
60
|
+
const [paused, setPaused] = (0, import_react.useState)(false);
|
|
61
|
+
const dragged = (0, import_react.useRef)(false);
|
|
62
|
+
const count = collections.length;
|
|
63
|
+
const go = (step) => setCurrent((index) => (index + step + count) % count);
|
|
64
|
+
(0, import_react.useEffect)(() => {
|
|
65
|
+
if (count <= 1 || paused || reduceMotion) return;
|
|
66
|
+
const id = setInterval(() => setCurrent((index) => (index + 1) % count), AUTOPLAY_MS);
|
|
67
|
+
return () => clearInterval(id);
|
|
68
|
+
}, [count, paused, reduceMotion]);
|
|
69
|
+
if (isLoading) return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ShowcaseSkeleton, {});
|
|
70
|
+
if (count === 0) return null;
|
|
71
|
+
const active = collections[current % count];
|
|
72
|
+
const activeImage = resolveImage(active.image, { width: 960 });
|
|
73
|
+
const supply = active.totalSupply;
|
|
74
|
+
const transition = reduceMotion ? { duration: 0 } : { type: "spring", stiffness: 220, damping: 26 };
|
|
75
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
76
|
+
"section",
|
|
77
|
+
{
|
|
78
|
+
className: "relative overflow-hidden px-4 pb-8 pt-10 sm:pt-14",
|
|
79
|
+
onPointerEnter: () => setPaused(true),
|
|
80
|
+
onPointerLeave: () => setPaused(false),
|
|
81
|
+
onFocus: () => setPaused(true),
|
|
82
|
+
onBlur: () => setPaused(false),
|
|
83
|
+
children: [
|
|
84
|
+
activeImage && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
85
|
+
import_framer_motion.motion.div,
|
|
86
|
+
{
|
|
87
|
+
"aria-hidden": true,
|
|
88
|
+
className: "pointer-events-none absolute inset-0 scale-125 opacity-30 blur-3xl dark:opacity-40",
|
|
89
|
+
initial: reduceMotion ? false : { opacity: 0 },
|
|
90
|
+
animate: { opacity: 1 },
|
|
91
|
+
transition: { duration: 0.6 },
|
|
92
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: activeImage, alt: "", fill: true, className: "object-cover", unoptimized: true })
|
|
93
|
+
},
|
|
94
|
+
active.contractAddress
|
|
95
|
+
),
|
|
96
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { "aria-hidden": true, className: "pointer-events-none absolute inset-x-0 bottom-0 h-1/2 bg-gradient-to-b from-transparent to-background" }),
|
|
97
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
98
|
+
import_framer_motion.motion.div,
|
|
99
|
+
{
|
|
100
|
+
className: (0, import_cn.cn)("relative mx-auto touch-pan-y", CARD_SIZE),
|
|
101
|
+
drag: count > 1 ? "x" : false,
|
|
102
|
+
dragConstraints: { left: 0, right: 0 },
|
|
103
|
+
dragElastic: 0.2,
|
|
104
|
+
onDragStart: () => {
|
|
105
|
+
dragged.current = true;
|
|
106
|
+
},
|
|
107
|
+
onDragEnd: (_, info) => {
|
|
108
|
+
if (info.offset.x < -SWIPE_PX) go(1);
|
|
109
|
+
else if (info.offset.x > SWIPE_PX) go(-1);
|
|
110
|
+
setTimeout(() => {
|
|
111
|
+
dragged.current = false;
|
|
112
|
+
}, 0);
|
|
113
|
+
},
|
|
114
|
+
children: collections.map((collection, index) => {
|
|
115
|
+
const offset = offsetFrom(index, current, count);
|
|
116
|
+
const distance = Math.abs(offset);
|
|
117
|
+
const image = resolveImage(collection.image, { width: 640 });
|
|
118
|
+
const name = collection.name ?? "Collection";
|
|
119
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
120
|
+
import_framer_motion.motion.div,
|
|
121
|
+
{
|
|
122
|
+
className: (0, import_cn.cn)("absolute inset-0", distance > 2 && "pointer-events-none"),
|
|
123
|
+
initial: false,
|
|
124
|
+
animate: {
|
|
125
|
+
x: `${offset * 58}%`,
|
|
126
|
+
rotate: offset * 9,
|
|
127
|
+
scale: 1 - distance * 0.12,
|
|
128
|
+
opacity: distance > 2 ? 0 : 1,
|
|
129
|
+
zIndex: 10 - distance
|
|
130
|
+
},
|
|
131
|
+
transition,
|
|
132
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
133
|
+
import_link.default,
|
|
134
|
+
{
|
|
135
|
+
href: getHref(collection),
|
|
136
|
+
"aria-label": name,
|
|
137
|
+
draggable: false,
|
|
138
|
+
onClick: (event) => {
|
|
139
|
+
if (dragged.current) event.preventDefault();
|
|
140
|
+
},
|
|
141
|
+
className: "relative block h-full w-full overflow-hidden rounded-2xl bg-muted shadow-2xl shadow-black/20 ring-1 ring-border dark:shadow-black/50",
|
|
142
|
+
children: [
|
|
143
|
+
image ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_image.default, { src: image, alt: "", fill: true, sizes: "(min-width: 1024px) 340px, 58vw", className: "object-cover", priority: index === 0, 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" }),
|
|
144
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_cn.cn)("absolute inset-0 bg-background/40 transition-opacity duration-500", offset === 0 ? "opacity-0" : "opacity-100") })
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
},
|
|
149
|
+
collection.contractAddress
|
|
150
|
+
);
|
|
151
|
+
})
|
|
152
|
+
}
|
|
153
|
+
),
|
|
154
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
155
|
+
import_framer_motion.motion.div,
|
|
156
|
+
{
|
|
157
|
+
className: "relative mt-8 flex flex-col items-center gap-1 text-center",
|
|
158
|
+
initial: reduceMotion ? false : { opacity: 0, y: 8 },
|
|
159
|
+
animate: { opacity: 1, y: 0 },
|
|
160
|
+
transition: { duration: 0.4 },
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: getHref(active), className: "transition-opacity hover:opacity-80", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-3xl font-semibold leading-tight tracking-tight text-foreground sm:text-4xl lg:text-5xl", children: active.name ?? "Collection" }) }),
|
|
163
|
+
supply != null && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-sm text-muted-foreground", children: [
|
|
164
|
+
supply.toLocaleString(),
|
|
165
|
+
" ",
|
|
166
|
+
supply === 1 ? "item" : "items"
|
|
167
|
+
] })
|
|
168
|
+
]
|
|
169
|
+
},
|
|
170
|
+
active.contractAddress
|
|
171
|
+
),
|
|
172
|
+
count > 1 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "relative mt-3 flex justify-center", children: collections.map((collection, index) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
173
|
+
"button",
|
|
174
|
+
{
|
|
175
|
+
type: "button",
|
|
176
|
+
"aria-label": `Show ${collection.name ?? "collection"}`,
|
|
177
|
+
"aria-current": index === current ? "true" : void 0,
|
|
178
|
+
onClick: () => setCurrent(index),
|
|
179
|
+
className: "flex h-8 items-center px-0.5",
|
|
180
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: (0, import_cn.cn)("h-1.5 rounded-full transition-all", index === current ? "w-6 bg-foreground" : "w-1.5 bg-foreground/30") })
|
|
181
|
+
},
|
|
182
|
+
collection.contractAddress
|
|
183
|
+
)) })
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
);
|
|
187
|
+
}
|
|
188
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
189
|
+
0 && (module.exports = {
|
|
190
|
+
CollectionShowcase
|
|
191
|
+
});
|
|
192
|
+
//# sourceMappingURL=collection-showcase.cjs.map
|