@medialane/ui 0.202.0 → 0.204.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/dist/components/account/input-otp.d.cts +2 -2
  2. package/dist/components/account/input-otp.d.ts +2 -2
  3. package/dist/components/activity-row.cjs +2 -1
  4. package/dist/components/activity-row.cjs.map +1 -1
  5. package/dist/components/activity-row.js +2 -1
  6. package/dist/components/activity-row.js.map +1 -1
  7. package/dist/components/badge.d.cts +1 -1
  8. package/dist/components/badge.d.ts +1 -1
  9. package/dist/components/button.d.cts +2 -2
  10. package/dist/components/button.d.ts +2 -2
  11. package/dist/components/collection-name-claim.cjs +100 -0
  12. package/dist/components/collection-name-claim.cjs.map +1 -0
  13. package/dist/components/collection-name-claim.d.cts +5 -0
  14. package/dist/components/collection-name-claim.d.ts +5 -0
  15. package/dist/components/collection-name-claim.js +66 -0
  16. package/dist/components/collection-name-claim.js.map +1 -0
  17. package/dist/components/creators-page.cjs +218 -0
  18. package/dist/components/creators-page.cjs.map +1 -0
  19. package/dist/components/creators-page.d.cts +5 -0
  20. package/dist/components/creators-page.d.ts +5 -0
  21. package/dist/components/creators-page.js +184 -0
  22. package/dist/components/creators-page.js.map +1 -0
  23. package/dist/components/discover-community-section.cjs +171 -0
  24. package/dist/components/discover-community-section.cjs.map +1 -0
  25. package/dist/components/discover-community-section.d.cts +5 -0
  26. package/dist/components/discover-community-section.d.ts +5 -0
  27. package/dist/components/discover-community-section.js +137 -0
  28. package/dist/components/discover-community-section.js.map +1 -0
  29. package/dist/components/discover-page.cjs +96 -0
  30. package/dist/components/discover-page.cjs.map +1 -0
  31. package/dist/components/discover-page.d.cts +14 -0
  32. package/dist/components/discover-page.d.ts +14 -0
  33. package/dist/components/discover-page.js +72 -0
  34. package/dist/components/discover-page.js.map +1 -0
  35. package/dist/components/fast-mint/fast-mint.d.cts +2 -2
  36. package/dist/components/fast-mint/fast-mint.d.ts +2 -2
  37. package/dist/components/home-page.cjs +124 -0
  38. package/dist/components/home-page.cjs.map +1 -0
  39. package/dist/components/home-page.d.cts +13 -0
  40. package/dist/components/home-page.d.ts +13 -0
  41. package/dist/components/home-page.js +90 -0
  42. package/dist/components/home-page.js.map +1 -0
  43. package/dist/components/ip-type-nav.cjs +74 -0
  44. package/dist/components/ip-type-nav.cjs.map +1 -0
  45. package/dist/components/ip-type-nav.d.cts +5 -0
  46. package/dist/components/ip-type-nav.d.ts +5 -0
  47. package/dist/components/ip-type-nav.js +40 -0
  48. package/dist/components/ip-type-nav.js.map +1 -0
  49. package/dist/components/medialane-app.cjs.map +1 -1
  50. package/dist/components/medialane-app.d.cts +1 -0
  51. package/dist/components/medialane-app.d.ts +1 -0
  52. package/dist/components/medialane-app.js.map +1 -1
  53. package/dist/components/portfolio-assets.cjs +114 -0
  54. package/dist/components/portfolio-assets.cjs.map +1 -0
  55. package/dist/components/portfolio-assets.d.cts +19 -0
  56. package/dist/components/portfolio-assets.d.ts +19 -0
  57. package/dist/components/portfolio-assets.js +90 -0
  58. package/dist/components/portfolio-assets.js.map +1 -0
  59. package/dist/components/portfolio-orders.cjs +205 -0
  60. package/dist/components/portfolio-orders.cjs.map +1 -0
  61. package/dist/components/portfolio-orders.d.cts +23 -0
  62. package/dist/components/portfolio-orders.d.ts +23 -0
  63. package/dist/components/portfolio-orders.js +171 -0
  64. package/dist/components/portfolio-orders.js.map +1 -0
  65. package/dist/components/portfolio-shell.cjs +106 -0
  66. package/dist/components/portfolio-shell.cjs.map +1 -0
  67. package/dist/components/portfolio-shell.d.cts +18 -0
  68. package/dist/components/portfolio-shell.d.ts +18 -0
  69. package/dist/components/portfolio-shell.js +81 -0
  70. package/dist/components/portfolio-shell.js.map +1 -0
  71. package/dist/components/rewards/leaderboard-panel.cjs +107 -0
  72. package/dist/components/rewards/leaderboard-panel.cjs.map +1 -0
  73. package/dist/components/rewards/leaderboard-panel.d.cts +12 -0
  74. package/dist/components/rewards/leaderboard-panel.d.ts +12 -0
  75. package/dist/components/rewards/leaderboard-panel.js +73 -0
  76. package/dist/components/rewards/leaderboard-panel.js.map +1 -0
  77. package/dist/components/rewards/rewards-dashboard.cjs +341 -0
  78. package/dist/components/rewards/rewards-dashboard.cjs.map +1 -0
  79. package/dist/components/rewards/rewards-dashboard.d.cts +6 -0
  80. package/dist/components/rewards/rewards-dashboard.d.ts +6 -0
  81. package/dist/components/rewards/rewards-dashboard.js +331 -0
  82. package/dist/components/rewards/rewards-dashboard.js.map +1 -0
  83. package/dist/components/router.cjs +2 -0
  84. package/dist/components/router.cjs.map +1 -1
  85. package/dist/components/router.d.cts +1 -1
  86. package/dist/components/router.d.ts +1 -1
  87. package/dist/components/router.js +2 -1
  88. package/dist/components/router.js.map +1 -1
  89. package/dist/components/sheet.d.cts +1 -1
  90. package/dist/components/sheet.d.ts +1 -1
  91. package/dist/index.cjs +45 -0
  92. package/dist/index.cjs.map +1 -1
  93. package/dist/index.d.cts +13 -0
  94. package/dist/index.d.ts +13 -0
  95. package/dist/index.js +29 -0
  96. package/dist/index.js.map +1 -1
  97. package/dist/utils/order-usd.cjs +35 -0
  98. package/dist/utils/order-usd.cjs.map +1 -0
  99. package/dist/utils/order-usd.d.cts +8 -0
  100. package/dist/utils/order-usd.d.ts +8 -0
  101. package/dist/utils/order-usd.js +11 -0
  102. package/dist/utils/order-usd.js.map +1 -0
  103. package/dist/utils/portfolio-counts.cjs +8 -2
  104. package/dist/utils/portfolio-counts.cjs.map +1 -1
  105. package/dist/utils/portfolio-counts.d.cts +9 -3
  106. package/dist/utils/portfolio-counts.d.ts +9 -3
  107. package/dist/utils/portfolio-counts.js +8 -2
  108. package/dist/utils/portfolio-counts.js.map +1 -1
  109. package/dist/utils/seen-offers.cjs +52 -0
  110. package/dist/utils/seen-offers.cjs.map +1 -0
  111. package/dist/utils/seen-offers.d.cts +4 -0
  112. package/dist/utils/seen-offers.d.ts +4 -0
  113. package/dist/utils/seen-offers.js +27 -0
  114. package/dist/utils/seen-offers.js.map +1 -0
  115. package/package.json +1 -1
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/portfolio-orders.tsx"],"sourcesContent":["\"use client\";\n\nimport type { ReactNode } from \"react\";\nimport { assetHref, profileHref, type ApiOrder } from \"@medialane/sdk\";\nimport { ArrowLeftRight, ExternalLink, HandCoins, Inbox, Tag } from \"lucide-react\";\nimport Image from \"./image.js\";\nimport Link from \"./link.js\";\nimport { Badge } from \"./badge.js\";\nimport { Button } from \"./button.js\";\nimport { EmptyOrError } from \"./empty-or-error.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { EXPLORER_URL } from \"../utils/explorer-url.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { isExpired, timeUntil } from \"../utils/time.js\";\nimport { isSameAddress } from \"../utils/same-address.js\";\nimport { getSeenOffers } from \"../utils/seen-offers.js\";\nimport { useImageUrl } from \"../utils/use-image-url.js\";\nimport { useCounterOffers, useReceivedOffers, useUserOrders } from \"../utils/use-orders.js\";\n\nexport type PortfolioOrdersView = \"listings\" | \"offers\" | \"received\" | \"counter-offers\";\n\nexport interface PortfolioOrderActions {\n isProcessing: boolean;\n cancel?: (order: ApiOrder) => void;\n accept?: (order: ApiOrder, original?: ApiOrder) => void;\n counter?: (order: ApiOrder) => void;\n dialogs?: ReactNode;\n}\n\nexport type UsePortfolioOrderActions = (context: { view: PortfolioOrdersView; refresh: () => void }) => PortfolioOrderActions;\n\nconst VIEWS = {\n listings: {\n emptyTitle: \"No active listings\",\n emptyDescription: \"List an asset to start selling.\",\n emptyCta: { label: \"Browse assets\", href: \"/portfolio/assets\" },\n emptyIcon: Tag,\n priceLabel: \"Price\",\n count: (n: number) => `${n} active listing${n === 1 ? \"\" : \"s\"}`,\n },\n offers: {\n emptyTitle: \"No offers sent yet\",\n emptyDescription: \"Browse the marketplace to make offers on assets.\",\n emptyCta: { label: \"Browse marketplace\", href: \"/marketplace\" },\n emptyIcon: HandCoins,\n priceLabel: \"Offer price\",\n count: (n: number) => `${n} active offer${n === 1 ? \"\" : \"s\"}`,\n },\n received: {\n emptyTitle: \"No offers received yet\",\n emptyDescription: \"When someone makes an offer on your asset, it will appear here.\",\n emptyCta: undefined,\n emptyIcon: Inbox,\n priceLabel: \"Offer price\",\n count: null,\n },\n \"counter-offers\": {\n emptyTitle: \"No counter-offers yet\",\n emptyDescription: \"When a seller responds to your bid with a counter-offer, it will appear here.\",\n emptyCta: undefined,\n emptyIcon: Inbox,\n priceLabel: \"Their price / Your bid\",\n count: null,\n },\n} as const;\n\nconst isNft = (o: ApiOrder) => o.offer.itemType === \"ERC721\" || o.offer.itemType === \"ERC1155\";\n\nfunction expiryOf(order: ApiOrder) {\n const expired = isExpired(order.endTime);\n const urgent = !expired && Number(order.endTime) * 1000 - Date.now() < 86400000;\n return { label: timeUntil(order.endTime), expired, urgent };\n}\n\nfunction price(o: ApiOrder) {\n return `${formatDisplayPrice(o.price.formatted)} ${o.price.currency ?? \"\"}`.trim();\n}\n\nfunction OrderRow({ order, subtitle, from, priceCell, actions, isNew }: {\n order: ApiOrder;\n subtitle: ReactNode;\n from?: string;\n priceCell: ReactNode;\n actions: ReactNode;\n isNew?: boolean;\n}) {\n const resolveImage = useImageUrl();\n const name = order.token?.name || `#${order.nftTokenId}`;\n const image = resolveImage(order.token?.image, { width: 96 });\n const expiry = expiryOf(order);\n return (\n <div data-new={isNew ? \"true\" : undefined} className={cn(\"flex items-center gap-4 px-4 py-3 transition-colors hover:bg-muted/40\", isNew && \"border-l-2 border-primary\")}>\n <div className=\"relative h-12 w-12 shrink-0 overflow-hidden rounded-lg border border-border bg-muted\">\n {image && <Image src={image} alt={name} fill sizes=\"48px\" unoptimized className=\"object-cover\" />}\n </div>\n <div className=\"min-w-0 flex-1\">\n <Link href={assetHref(\"STARKNET\", order.nftContract, order.nftTokenId)} className=\"block truncate text-sm font-medium transition-colors hover:text-primary\">\n {name}\n </Link>\n {subtitle}\n </div>\n {from && (\n <div className=\"hidden shrink-0 sm:block\">\n <Link href={profileHref({ address: from })} className=\"text-xs tabular-nums text-muted-foreground transition-colors hover:text-foreground\">\n {from.slice(0, 6)}…{from.slice(-4)}\n </Link>\n </div>\n )}\n <div className=\"hidden shrink-0 text-right sm:block\">{priceCell}</div>\n <div className=\"hidden shrink-0 md:block\">\n <p className={cn(\"text-sm\", expiry.expired && \"text-muted-foreground\", expiry.urgent && \"font-medium text-destructive\")}>{expiry.label}</p>\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {order.txHash?.created && (\n <a href={`${EXPLORER_URL}/tx/${order.txHash.created}`} target=\"_blank\" rel=\"noopener noreferrer\" aria-label=\"View on explorer\" className=\"inline-flex h-7 w-7 items-center justify-center rounded-md transition-colors hover:bg-muted\">\n <ExternalLink className=\"h-3.5 w-3.5 text-muted-foreground\" />\n </a>\n )}\n {actions}\n </div>\n </div>\n );\n}\n\nfunction PriceText({ order }: { order: ApiOrder }) {\n return (\n <p className=\"text-sm font-semibold\">\n {formatDisplayPrice(order.price.formatted)} <span className=\"text-xs font-normal text-muted-foreground\">{order.price.currency}</span>\n </p>\n );\n}\n\nfunction CounterOfferRow({ bid, actions }: { bid: ApiOrder; actions: PortfolioOrderActions }) {\n const { counterOffers } = useCounterOffers({ originalOrderHash: bid.orderHash });\n const counter = counterOffers[0];\n if (!counter) return null;\n const closed = counter.status !== \"ACTIVE\" || isExpired(counter.endTime);\n return (\n <OrderRow\n order={counter}\n subtitle={\n <Badge variant=\"secondary\" className=\"mt-0.5 h-4 px-1.5 text-[10px]\">\n <ArrowLeftRight className=\"mr-1 h-2.5 w-2.5\" />\n Counter-offer\n </Badge>\n }\n priceCell={\n <div className=\"flex flex-col items-end gap-0.5\">\n <p className=\"text-xs text-muted-foreground line-through\">{price(bid)}</p>\n <p className=\"text-sm font-semibold\">{counter.price.formatted ? price(counter) : \"—\"}</p>\n </div>\n }\n actions={\n closed ? (\n <span className=\"text-xs text-muted-foreground\">{counter.status !== \"ACTIVE\" ? counter.status.toLowerCase() : \"Expired\"}</span>\n ) : (\n <Button size=\"sm\" className=\"h-8 text-xs\" disabled={actions.isProcessing} onClick={() => actions.accept?.(counter, bid)}>\n Accept\n </Button>\n )\n }\n />\n );\n}\n\nexport function PortfolioOrders({ view, address, useActions }: {\n view: PortfolioOrdersView;\n address: string;\n useActions: UsePortfolioOrderActions;\n}) {\n const mine = useUserOrders(view === \"received\" ? null : address);\n const received = useReceivedOffers(view === \"received\" ? address : null);\n const source = view === \"received\" ? received : mine;\n const actions = useActions({ view, refresh: () => void source.mutate() });\n const config = VIEWS[view];\n\n const orders =\n view === \"listings\" ? mine.orders.filter((o) => isNft(o) && o.status === \"ACTIVE\")\n : view === \"offers\" ? mine.orders.filter((o) => o.offer.itemType === \"ERC20\" && o.status === \"ACTIVE\")\n : view === \"counter-offers\" ? mine.orders.filter((o) => o.offer.itemType === \"ERC20\" && isSameAddress(o.offerer, address) && o.hasActiveCounterOffer === true)\n : received.orders;\n\n const seen = view === \"received\" ? getSeenOffers() : null;\n const EmptyIcon = config.emptyIcon;\n\n return (\n <>\n <EmptyOrError\n isLoading={source.isLoading}\n error={source.error}\n isEmpty={orders.length === 0}\n onRetry={() => void source.mutate()}\n emptyTitle={config.emptyTitle}\n emptyDescription={config.emptyDescription}\n emptyCta={config.emptyCta}\n emptyIcon={<EmptyIcon className=\"h-7 w-7 text-muted-foreground\" />}\n skeletonCount={3}\n >\n <div className=\"space-y-1\">\n {config.count && orders.length > 0 && <p className=\"pb-2 text-sm text-muted-foreground\">{config.count(orders.length)}</p>}\n <div className=\"overflow-hidden rounded-lg border border-border\">\n <div className=\"flex items-center gap-4 border-b border-border bg-muted/30 px-4 py-2 text-xs uppercase tracking-wide text-muted-foreground\">\n <div className=\"w-12 shrink-0\" />\n <div className=\"flex-1\">Asset</div>\n {view === \"received\" && <div className=\"hidden w-28 sm:block\">From</div>}\n <div className={cn(\"hidden text-right sm:block\", view === \"counter-offers\" ? \"w-40\" : \"w-24\")}>{config.priceLabel}</div>\n <div className=\"hidden w-28 md:block\">Expires</div>\n <div className=\"w-24 text-right\">Actions</div>\n </div>\n {view === \"counter-offers\"\n ? orders.map((bid) => <CounterOfferRow key={bid.orderHash} bid={bid} actions={actions} />)\n : orders.map((order) => (\n <OrderRow\n key={order.orderHash}\n order={order}\n isNew={seen ? !seen.has(order.orderHash) : false}\n from={view === \"received\" ? order.offerer : undefined}\n subtitle={<span className=\"text-xs text-muted-foreground\">{view === \"received\" ? \"Received offer\" : view === \"offers\" ? \"Offer\" : \"Active\"}</span>}\n priceCell={<PriceText order={order} />}\n actions={\n view === \"received\" ? (\n <>\n <Button size=\"sm\" variant=\"outline\" className=\"h-8 text-xs\" disabled={actions.isProcessing} onClick={() => actions.counter?.(order)}>Counter</Button>\n <Button size=\"sm\" className=\"h-8 text-xs\" disabled={actions.isProcessing} onClick={() => actions.accept?.(order)}>Accept</Button>\n </>\n ) : (\n <Button size=\"sm\" variant=\"outline\" className=\"h-8 text-xs text-destructive hover:text-destructive\" disabled={actions.isProcessing} onClick={() => actions.cancel?.(order)}>Cancel</Button>\n )\n }\n />\n ))}\n </div>\n </div>\n </EmptyOrError>\n {actions.dialogs}\n </>\n );\n}\n"],"mappings":";AA6FkB,SAgIM,UAhIN,KAEZ,YAFY;AA1FlB,SAAS,WAAW,mBAAkC;AACtD,SAAS,gBAAgB,cAAc,WAAW,OAAO,WAAW;AACpE,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,SAAS,aAAa;AACtB,SAAS,cAAc;AACvB,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,oBAAoB;AAC7B,SAAS,0BAA0B;AACnC,SAAS,WAAW,iBAAiB;AACrC,SAAS,qBAAqB;AAC9B,SAAS,qBAAqB;AAC9B,SAAS,mBAAmB;AAC5B,SAAS,kBAAkB,mBAAmB,qBAAqB;AAcnE,MAAM,QAAQ;AAAA,EACZ,UAAU;AAAA,IACR,YAAY;AAAA,IACZ,kBAAkB;AAAA,IAClB,UAAU,EAAE,OAAO,iBAAi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WAAzB,IAAI,SAAuC,CAAE,IACvF,OAAO,IAAI,CAAC,UACV;AAAA,cAAC;AAAA;AAAA,gBAEC;AAAA,gBACA,OAAO,OAAO,CAAC,KAAK,IAAI,MAAM,SAAS,IAAI;AAAA,gBAC3C,MAAM,SAAS,aAAa,MAAM,UAAU;AAAA,gBAC5C,UAAU,oBAAC,UAAK,WAAU,iCAAiC,mBAAS,aAAa,mBAAmB,SAAS,WAAW,UAAU,UAAS;AAAA,gBAC3I,WAAW,oBAAC,aAAU,OAAc;AAAA,gBACpC,SACE,SAAS,aACP,iCACE;AAAA,sCAAC,UAAO,MAAK,MAAK,SAAQ,WAAU,WAAU,eAAc,UAAU,QAAQ,cAAc,SAAS,MAAM,QAAQ,UAAU,KAAK,GAAG,qBAAO;AAAA,kBAC5I,oBAAC,UAAO,MAAK,MAAK,WAAU,eAAc,UAAU,QAAQ,cAAc,SAAS,MAAM,QAAQ,SAAS,KAAK,GAAG,oBAAM;AAAA,mBAC1H,IAEA,oBAAC,UAAO,MAAK,MAAK,SAAQ,WAAU,WAAU,uDAAsD,UAAU,QAAQ,cAAc,SAAS,MAAM,QAAQ,SAAS,KAAK,GAAG,oBAAM;AAAA;AAAA,cAbjL,MAAM;AAAA,YAgBb,CACD;AAAA,aACP;AAAA,WACF;AAAA;AAAA,IACF;AAAA,IACC,QAAQ;AAAA,KACX;AAEJ;","names":[]}
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ "use client";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+ var portfolio_shell_exports = {};
21
+ __export(portfolio_shell_exports, {
22
+ PORTFOLIO_TABS: () => PORTFOLIO_TABS,
23
+ PortfolioShell: () => PortfolioShell
24
+ });
25
+ module.exports = __toCommonJS(portfolio_shell_exports);
26
+ var import_jsx_runtime = require("react/jsx-runtime");
27
+ var import_react = require("react");
28
+ var import_lucide_react = require("lucide-react");
29
+ var import_router = require("./router.js");
30
+ var import_button = require("./button.js");
31
+ var import_skeleton = require("./skeleton.js");
32
+ var import_portfolio_header = require("./portfolio-header.js");
33
+ var import_portfolio_chip_filter = require("./portfolio-chip-filter.js");
34
+ var import_medialane_app = require("./medialane-app.js");
35
+ var import_portfolio_counts = require("../utils/portfolio-counts.js");
36
+ var import_seen_offers = require("../utils/seen-offers.js");
37
+ var import_use_orders = require("../utils/use-orders.js");
38
+ var import_use_rewards = require("../utils/use-rewards.js");
39
+ var import_use_sponsorship = require("../utils/use-sponsorship.js");
40
+ const PORTFOLIO_TABS = [
41
+ { key: "assets", label: "Assets", href: "/portfolio/assets" },
42
+ { key: "collections", label: "Collections", href: "/portfolio/collections" },
43
+ { key: "listings", label: "Listings", href: "/portfolio/listings" },
44
+ { key: "received", label: "Offers received", href: "/portfolio/received" },
45
+ { key: "offers", label: "Offers sent", href: "/portfolio/offers" },
46
+ { key: "counter", label: "Counter-offers", href: "/portfolio/counter-offers" },
47
+ { key: "licensing", label: "Licensing", href: "/portfolio/licensing" },
48
+ { key: "sponsorship", label: "Sponsorships", href: "/portfolio/sponsorships" },
49
+ { key: "activity", label: "Activity", href: "/portfolio/activity" }
50
+ ];
51
+ function SignedOut() {
52
+ const { onRequireWallet, connectLabel } = (0, import_medialane_app.useMedialaneApp)();
53
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8 text-center", children: [
54
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Wallet, { className: "mx-auto h-10 w-10 text-muted-foreground" }),
55
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h1", { className: "text-2xl font-bold", children: "Your portfolio" }),
56
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-muted-foreground", children: "Sign in to see your assets, listings and offers." }),
57
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_button.Button, { size: "lg", className: "rounded-full px-7", onClick: onRequireWallet, children: connectLabel ?? "Sign in" })
58
+ ] });
59
+ }
60
+ function Loading() {
61
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8", children: [
62
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "mx-auto h-10 w-10 rounded-full" }),
63
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "mx-auto h-7 w-56" }),
64
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "mx-auto h-4 w-72" })
65
+ ] });
66
+ }
67
+ function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }) {
68
+ const { walletAddress: address, walletLoading } = (0, import_medialane_app.useMedialaneApp)();
69
+ const pathname = (0, import_router.usePathname)();
70
+ const { orders } = (0, import_use_orders.useUserOrders)(address);
71
+ const { orders: receivedOffers } = (0, import_use_orders.useReceivedOffers)(address);
72
+ const { data: rewards } = (0, import_use_rewards.useRewards)(address);
73
+ const { pendingCount } = (0, import_use_sponsorship.useMySponsorshipDealCounts)(address);
74
+ (0, import_react.useEffect)(() => {
75
+ if (receivedOffers.length > 0) (0, import_seen_offers.markOffersAsSeen)(receivedOffers.map((o) => o.orderHash));
76
+ }, [receivedOffers]);
77
+ if (!address) return walletLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(Loading, {}) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(SignedOut, {});
78
+ const counts = (0, import_portfolio_counts.derivePortfolioCounts)({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: pendingCount });
79
+ const countFor = { received: counts.received, counter: counts.counter, licensing: counts.remix, sponsorship: counts.sponsorships };
80
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-6 px-4 pt-20 pb-8 sm:px-6 lg:px-8", children: [
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
82
+ import_portfolio_header.PortfolioHeader,
83
+ {
84
+ address,
85
+ score: rewards ? { levelName: rewards.currentLevelName, totalXp: rewards.totalXp, href: "/rewards" } : null
86
+ }
87
+ ),
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
89
+ import_portfolio_chip_filter.PortfolioChipFilter,
90
+ {
91
+ options: tabs.map((t) => ({ key: t.key, href: t.href, label: countFor[t.key] ? `${t.label} (${countFor[t.key]})` : t.label })),
92
+ value: pathname ?? "",
93
+ onChange: () => {
94
+ },
95
+ showAll: false
96
+ }
97
+ ),
98
+ children
99
+ ] });
100
+ }
101
+ // Annotate the CommonJS export names for ESM import in node:
102
+ 0 && (module.exports = {
103
+ PORTFOLIO_TABS,
104
+ PortfolioShell
105
+ });
106
+ //# sourceMappingURL=portfolio-shell.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/portfolio-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, type ReactNode } from \"react\";\nimport { Wallet } from \"lucide-react\";\nimport { usePathname } from \"./router.js\";\nimport { Button } from \"./button.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { PortfolioHeader } from \"./portfolio-header.js\";\nimport { PortfolioChipFilter } from \"./portfolio-chip-filter.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { derivePortfolioCounts } from \"../utils/portfolio-counts.js\";\nimport { markOffersAsSeen } from \"../utils/seen-offers.js\";\nimport { useReceivedOffers, useUserOrders } from \"../utils/use-orders.js\";\nimport { useRewards } from \"../utils/use-rewards.js\";\nimport { useMySponsorshipDealCounts } from \"../utils/use-sponsorship.js\";\n\nexport interface PortfolioTab {\n key: string;\n label: string;\n href: string;\n}\n\nexport const PORTFOLIO_TABS: PortfolioTab[] = [\n { key: \"assets\", label: \"Assets\", href: \"/portfolio/assets\" },\n { key: \"collections\", label: \"Collections\", href: \"/portfolio/collections\" },\n { key: \"listings\", label: \"Listings\", href: \"/portfolio/listings\" },\n { key: \"received\", label: \"Offers received\", href: \"/portfolio/received\" },\n { key: \"offers\", label: \"Offers sent\", href: \"/portfolio/offers\" },\n { key: \"counter\", label: \"Counter-offers\", href: \"/portfolio/counter-offers\" },\n { key: \"licensing\", label: \"Licensing\", href: \"/portfolio/licensing\" },\n { key: \"sponsorship\", label: \"Sponsorships\", href: \"/portfolio/sponsorships\" },\n { key: \"activity\", label: \"Activity\", href: \"/portfolio/activity\" },\n];\n\nfunction SignedOut() {\n const { onRequireWallet, connectLabel } = useMedialaneApp();\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8 text-center\">\n <Wallet className=\"mx-auto h-10 w-10 text-muted-foreground\" />\n <h1 className=\"text-2xl font-bold\">Your portfolio</h1>\n <p className=\"text-muted-foreground\">Sign in to see your assets, listings and offers.</p>\n <Button size=\"lg\" className=\"rounded-full px-7\" onClick={onRequireWallet}>\n {connectLabel ?? \"Sign in\"}\n </Button>\n </div>\n );\n}\n\nfunction Loading() {\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8\">\n <Skeleton className=\"mx-auto h-10 w-10 rounded-full\" />\n <Skeleton className=\"mx-auto h-7 w-56\" />\n <Skeleton className=\"mx-auto h-4 w-72\" />\n </div>\n );\n}\n\nexport function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }: {\n tabs?: PortfolioTab[];\n remixOffers?: ReadonlyArray<{ status: string }>;\n children: ReactNode;\n}) {\n const { walletAddress: address, walletLoading } = useMedialaneApp();\n const pathname = usePathname();\n const { orders } = useUserOrders(address);\n const { orders: receivedOffers } = useReceivedOffers(address);\n const { data: rewards } = useRewards(address);\n const { pendingCount } = useMySponsorshipDealCounts(address);\n\n useEffect(() => {\n if (receivedOffers.length > 0) markOffersAsSeen(receivedOffers.map((o) => o.orderHash));\n }, [receivedOffers]);\n\n if (!address) return walletLoading ? <Loading /> : <SignedOut />;\n\n const counts = derivePortfolioCounts({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: pendingCount });\n const countFor: Record<string, number> = { received: counts.received, counter: counts.counter, licensing: counts.remix, sponsorship: counts.sponsorships };\n\n return (\n <div className=\"space-y-6 px-4 pt-20 pb-8 sm:px-6 lg:px-8\">\n <PortfolioHeader\n address={address}\n score={rewards ? { levelName: rewards.currentLevelName, totalXp: rewards.totalXp, href: \"/rewards\" } : null}\n />\n <PortfolioChipFilter\n options={tabs.map((t) => ({ key: t.key, href: t.href, label: countFor[t.key] ? `${t.label} (${countFor[t.key]})` : t.label }))}\n value={pathname ?? \"\"}\n onChange={() => {}}\n showAll={false}\n />\n {children}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAqCI;AAnCJ,mBAA0C;AAC1C,0BAAuB;AACvB,oBAA4B;AAC5B,oBAAuB;AACvB,sBAAyB;AACzB,8BAAgC;AAChC,mCAAoC;AACpC,2BAAgC;AAChC,8BAAsC;AACtC,yBAAiC;AACjC,wBAAiD;AACjD,yBAA2B;AAC3B,6BAA2C;AAQpC,MAAM,iBAAiC;AAAA,EAC5C,EAAE,KAAK,UAAU,OAAO,UAAU,MAAM,oBAAoB;AAAA,EAC5D,EAAE,KAAK,eAAe,OAAO,eAAe,MAAM,yBAAyB;AAAA,EAC3E,EAAE,KAAK,YAAY,OAAO,YAAY,M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AAM;AACd,QAAI,eAAe,SAAS,EAAG,0CAAiB,eAAe,IAAI,CAAC,MAAM,EAAE,SAAS,CAAC;AAAA,EACxF,GAAG,CAAC,cAAc,CAAC;AAEnB,MAAI,CAAC,QAAS,QAAO,gBAAgB,4CAAC,WAAQ,IAAK,4CAAC,aAAU;AAE9D,QAAM,aAAS,+CAAsB,EAAE,QAAQ,gBAAgB,aAAa,SAAS,yBAAyB,aAAa,CAAC;AAC5H,QAAM,WAAmC,EAAE,UAAU,OAAO,UAAU,SAAS,OAAO,SAAS,WAAW,OAAO,OAAO,aAAa,OAAO,aAAa;AAEzJ,SACE,6CAAC,SAAI,WAAU,6CACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO,UAAU,EAAE,WAAW,QAAQ,kBAAkB,SAAS,QAAQ,SAAS,MAAM,WAAW,IAAI;AAAA;AAAA,IACzG;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,KAAK,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,OAAO,SAAS,EAAE,GAAG,IAAI,GAAG,EAAE,KAAK,KAAK,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE;AAAA,QAC7H,OAAO,YAAY;AAAA,QACnB,UAAU,MAAM;AAAA,QAAC;AAAA,QACjB,SAAS;AAAA;AAAA,IACX;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface PortfolioTab {
5
+ key: string;
6
+ label: string;
7
+ href: string;
8
+ }
9
+ declare const PORTFOLIO_TABS: PortfolioTab[];
10
+ declare function PortfolioShell({ tabs, remixOffers, children }: {
11
+ tabs?: PortfolioTab[];
12
+ remixOffers?: ReadonlyArray<{
13
+ status: string;
14
+ }>;
15
+ children: ReactNode;
16
+ }): react_jsx_runtime.JSX.Element;
17
+
18
+ export { PORTFOLIO_TABS, PortfolioShell, type PortfolioTab };
@@ -0,0 +1,18 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+ import { ReactNode } from 'react';
3
+
4
+ interface PortfolioTab {
5
+ key: string;
6
+ label: string;
7
+ href: string;
8
+ }
9
+ declare const PORTFOLIO_TABS: PortfolioTab[];
10
+ declare function PortfolioShell({ tabs, remixOffers, children }: {
11
+ tabs?: PortfolioTab[];
12
+ remixOffers?: ReadonlyArray<{
13
+ status: string;
14
+ }>;
15
+ children: ReactNode;
16
+ }): react_jsx_runtime.JSX.Element;
17
+
18
+ export { PORTFOLIO_TABS, PortfolioShell, type PortfolioTab };
@@ -0,0 +1,81 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { useEffect } from "react";
4
+ import { Wallet } from "lucide-react";
5
+ import { usePathname } from "./router.js";
6
+ import { Button } from "./button.js";
7
+ import { Skeleton } from "./skeleton.js";
8
+ import { PortfolioHeader } from "./portfolio-header.js";
9
+ import { PortfolioChipFilter } from "./portfolio-chip-filter.js";
10
+ import { useMedialaneApp } from "./medialane-app.js";
11
+ import { derivePortfolioCounts } from "../utils/portfolio-counts.js";
12
+ import { markOffersAsSeen } from "../utils/seen-offers.js";
13
+ import { useReceivedOffers, useUserOrders } from "../utils/use-orders.js";
14
+ import { useRewards } from "../utils/use-rewards.js";
15
+ import { useMySponsorshipDealCounts } from "../utils/use-sponsorship.js";
16
+ const PORTFOLIO_TABS = [
17
+ { key: "assets", label: "Assets", href: "/portfolio/assets" },
18
+ { key: "collections", label: "Collections", href: "/portfolio/collections" },
19
+ { key: "listings", label: "Listings", href: "/portfolio/listings" },
20
+ { key: "received", label: "Offers received", href: "/portfolio/received" },
21
+ { key: "offers", label: "Offers sent", href: "/portfolio/offers" },
22
+ { key: "counter", label: "Counter-offers", href: "/portfolio/counter-offers" },
23
+ { key: "licensing", label: "Licensing", href: "/portfolio/licensing" },
24
+ { key: "sponsorship", label: "Sponsorships", href: "/portfolio/sponsorships" },
25
+ { key: "activity", label: "Activity", href: "/portfolio/activity" }
26
+ ];
27
+ function SignedOut() {
28
+ const { onRequireWallet, connectLabel } = useMedialaneApp();
29
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8 text-center", children: [
30
+ /* @__PURE__ */ jsx(Wallet, { className: "mx-auto h-10 w-10 text-muted-foreground" }),
31
+ /* @__PURE__ */ jsx("h1", { className: "text-2xl font-bold", children: "Your portfolio" }),
32
+ /* @__PURE__ */ jsx("p", { className: "text-muted-foreground", children: "Sign in to see your assets, listings and offers." }),
33
+ /* @__PURE__ */ jsx(Button, { size: "lg", className: "rounded-full px-7", onClick: onRequireWallet, children: connectLabel ?? "Sign in" })
34
+ ] });
35
+ }
36
+ function Loading() {
37
+ return /* @__PURE__ */ jsxs("div", { className: "mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8", children: [
38
+ /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto h-10 w-10 rounded-full" }),
39
+ /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto h-7 w-56" }),
40
+ /* @__PURE__ */ jsx(Skeleton, { className: "mx-auto h-4 w-72" })
41
+ ] });
42
+ }
43
+ function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }) {
44
+ const { walletAddress: address, walletLoading } = useMedialaneApp();
45
+ const pathname = usePathname();
46
+ const { orders } = useUserOrders(address);
47
+ const { orders: receivedOffers } = useReceivedOffers(address);
48
+ const { data: rewards } = useRewards(address);
49
+ const { pendingCount } = useMySponsorshipDealCounts(address);
50
+ useEffect(() => {
51
+ if (receivedOffers.length > 0) markOffersAsSeen(receivedOffers.map((o) => o.orderHash));
52
+ }, [receivedOffers]);
53
+ if (!address) return walletLoading ? /* @__PURE__ */ jsx(Loading, {}) : /* @__PURE__ */ jsx(SignedOut, {});
54
+ const counts = derivePortfolioCounts({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: pendingCount });
55
+ const countFor = { received: counts.received, counter: counts.counter, licensing: counts.remix, sponsorship: counts.sponsorships };
56
+ return /* @__PURE__ */ jsxs("div", { className: "space-y-6 px-4 pt-20 pb-8 sm:px-6 lg:px-8", children: [
57
+ /* @__PURE__ */ jsx(
58
+ PortfolioHeader,
59
+ {
60
+ address,
61
+ score: rewards ? { levelName: rewards.currentLevelName, totalXp: rewards.totalXp, href: "/rewards" } : null
62
+ }
63
+ ),
64
+ /* @__PURE__ */ jsx(
65
+ PortfolioChipFilter,
66
+ {
67
+ options: tabs.map((t) => ({ key: t.key, href: t.href, label: countFor[t.key] ? `${t.label} (${countFor[t.key]})` : t.label })),
68
+ value: pathname ?? "",
69
+ onChange: () => {
70
+ },
71
+ showAll: false
72
+ }
73
+ ),
74
+ children
75
+ ] });
76
+ }
77
+ export {
78
+ PORTFOLIO_TABS,
79
+ PortfolioShell
80
+ };
81
+ //# sourceMappingURL=portfolio-shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/portfolio-shell.tsx"],"sourcesContent":["\"use client\";\n\nimport { useEffect, type ReactNode } from \"react\";\nimport { Wallet } from \"lucide-react\";\nimport { usePathname } from \"./router.js\";\nimport { Button } from \"./button.js\";\nimport { Skeleton } from \"./skeleton.js\";\nimport { PortfolioHeader } from \"./portfolio-header.js\";\nimport { PortfolioChipFilter } from \"./portfolio-chip-filter.js\";\nimport { useMedialaneApp } from \"./medialane-app.js\";\nimport { derivePortfolioCounts } from \"../utils/portfolio-counts.js\";\nimport { markOffersAsSeen } from \"../utils/seen-offers.js\";\nimport { useReceivedOffers, useUserOrders } from \"../utils/use-orders.js\";\nimport { useRewards } from \"../utils/use-rewards.js\";\nimport { useMySponsorshipDealCounts } from \"../utils/use-sponsorship.js\";\n\nexport interface PortfolioTab {\n key: string;\n label: string;\n href: string;\n}\n\nexport const PORTFOLIO_TABS: PortfolioTab[] = [\n { key: \"assets\", label: \"Assets\", href: \"/portfolio/assets\" },\n { key: \"collections\", label: \"Collections\", href: \"/portfolio/collections\" },\n { key: \"listings\", label: \"Listings\", href: \"/portfolio/listings\" },\n { key: \"received\", label: \"Offers received\", href: \"/portfolio/received\" },\n { key: \"offers\", label: \"Offers sent\", href: \"/portfolio/offers\" },\n { key: \"counter\", label: \"Counter-offers\", href: \"/portfolio/counter-offers\" },\n { key: \"licensing\", label: \"Licensing\", href: \"/portfolio/licensing\" },\n { key: \"sponsorship\", label: \"Sponsorships\", href: \"/portfolio/sponsorships\" },\n { key: \"activity\", label: \"Activity\", href: \"/portfolio/activity\" },\n];\n\nfunction SignedOut() {\n const { onRequireWallet, connectLabel } = useMedialaneApp();\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8 text-center\">\n <Wallet className=\"mx-auto h-10 w-10 text-muted-foreground\" />\n <h1 className=\"text-2xl font-bold\">Your portfolio</h1>\n <p className=\"text-muted-foreground\">Sign in to see your assets, listings and offers.</p>\n <Button size=\"lg\" className=\"rounded-full px-7\" onClick={onRequireWallet}>\n {connectLabel ?? \"Sign in\"}\n </Button>\n </div>\n );\n}\n\nfunction Loading() {\n return (\n <div className=\"mx-auto max-w-lg space-y-4 px-4 pt-24 pb-8\">\n <Skeleton className=\"mx-auto h-10 w-10 rounded-full\" />\n <Skeleton className=\"mx-auto h-7 w-56\" />\n <Skeleton className=\"mx-auto h-4 w-72\" />\n </div>\n );\n}\n\nexport function PortfolioShell({ tabs = PORTFOLIO_TABS, remixOffers, children }: {\n tabs?: PortfolioTab[];\n remixOffers?: ReadonlyArray<{ status: string }>;\n children: ReactNode;\n}) {\n const { walletAddress: address, walletLoading } = useMedialaneApp();\n const pathname = usePathname();\n const { orders } = useUserOrders(address);\n const { orders: receivedOffers } = useReceivedOffers(address);\n const { data: rewards } = useRewards(address);\n const { pendingCount } = useMySponsorshipDealCounts(address);\n\n useEffect(() => {\n if (receivedOffers.length > 0) markOffersAsSeen(receivedOffers.map((o) => o.orderHash));\n }, [receivedOffers]);\n\n if (!address) return walletLoading ? <Loading /> : <SignedOut />;\n\n const counts = derivePortfolioCounts({ orders, receivedOffers, remixOffers, address, sponsorshipPendingCount: pendingCount });\n const countFor: Record<string, number> = { received: counts.received, counter: counts.counter, licensing: counts.remix, sponsorship: counts.sponsorships };\n\n return (\n <div className=\"space-y-6 px-4 pt-20 pb-8 sm:px-6 lg:px-8\">\n <PortfolioHeader\n address={address}\n score={rewards ? { levelName: rewards.currentLevelName, totalXp: rewards.totalXp, href: \"/rewards\" } : null}\n />\n <PortfolioChipFilter\n options={tabs.map((t) => ({ key: t.key, href: t.href, label: countFor[t.key] ? `${t.label} (${countFor[t.key]})` : t.label }))}\n value={pathname ?? \"\"}\n onChange={() => {}}\n showAll={false}\n />\n {children}\n </div>\n );\n}\n"],"mappings":";AAqCI,SACE,KADF;AAnCJ,SAAS,iBAAiC;AAC1C,SAAS,cAAc;AACvB,SAAS,mBAAmB;AAC5B,SAAS,cAAc;AACvB,SAAS,gBAAgB;AACzB,SAAS,uBAAuB;AAChC,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,SAAS,6BAA6B;AACtC,SAAS,wBAAwB;AACjC,SAAS,mBAAmB,qBAAqB;AACjD,SAAS,kBAAkB;AAC3B,SAAS,kCAAkC;AAQpC,MAAM,iBAAiC;AAAA,EAC5C,EAAE,KAAK,UAAU,OAAO,UAAU,MAAM,oBAAoB;AAAA,EAC5D,EAAE,KAAK,eAAe,OAAO,eAAe,MAAM,yBAAyB;AAAA,EAC3E,EAAE,KAAK,YAAY,OAAO,YAAY,MAAM,sBAAsB;AAAA,EAClE,EAAE,KAAK,YAAY,OAAO,mBAAmB,MAAM,sBAAsB;AAAA,EACzE,EAAE,KAAK,UAAU,OAAO,eAAe,MAAM,oBAAoB;AAAA,EACjE,EAAE,KAAK,WAAW,OAAO,kBAAkB,MAAM,4BAA4B;AAAA,EAC7E,EAAE,KAAK,aAAa,OAAO,aAAa,MAAM,uBAAuB;AAAA,EACrE,EAAE,KAAK,eAAe,OAAO,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mC,EAAE,UAAU,OAAO,UAAU,SAAS,OAAO,SAAS,WAAW,OAAO,OAAO,aAAa,OAAO,aAAa;AAEzJ,SACE,qBAAC,SAAI,WAAU,6CACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,OAAO,UAAU,EAAE,WAAW,QAAQ,kBAAkB,SAAS,QAAQ,SAAS,MAAM,WAAW,IAAI;AAAA;AAAA,IACzG;AAAA,IACA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS,KAAK,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,KAAK,MAAM,EAAE,MAAM,OAAO,SAAS,EAAE,GAAG,IAAI,GAAG,EAAE,KAAK,KAAK,SAAS,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE;AAAA,QAC7H,OAAO,YAAY;AAAA,QACnB,UAAU,MAAM;AAAA,QAAC;AAAA,QACjB,SAAS;AAAA;AAAA,IACX;AAAA,IACC;AAAA,KACH;AAEJ;","names":[]}
@@ -0,0 +1,107 @@
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 leaderboard_panel_exports = {};
31
+ __export(leaderboard_panel_exports, {
32
+ LeaderboardPanel: () => LeaderboardPanel
33
+ });
34
+ module.exports = __toCommonJS(leaderboard_panel_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_lucide_react = require("lucide-react");
37
+ var import_sdk = require("@medialane/sdk");
38
+ var import_image = __toESM(require("../image.js"), 1);
39
+ var import_link = __toESM(require("../link.js"), 1);
40
+ var import_skeleton = require("../skeleton.js");
41
+ var import_address_display = require("../address-display.js");
42
+ var import_leaderboard_table = require("./leaderboard-table.js");
43
+ var import_cn = require("../../utils/cn.js");
44
+ var import_profile_identity = require("../../utils/profile-identity.js");
45
+ var import_use_profiles = require("../../utils/use-profiles.js");
46
+ var import_use_image_url = require("../../utils/use-image-url.js");
47
+ var import_use_rewards = require("../../utils/use-rewards.js");
48
+ function CreatorIdentity({ address }) {
49
+ const { profile } = (0, import_use_profiles.useCreatorProfile)(address);
50
+ const avatarUrl = (0, import_use_image_url.useImageUrl)()(profile?.avatarImage, { width: 96 });
51
+ const { identity: name } = (0, import_profile_identity.profileIdentity)({
52
+ username: profile?.username,
53
+ name: profile?.name,
54
+ walletAddress: address
55
+ });
56
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("span", { className: "inline-flex min-w-0 items-center gap-2.5", children: [
57
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "relative h-9 w-9 shrink-0 overflow-hidden rounded-full bg-foreground/[0.08]", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
58
+ import_image.default,
59
+ {
60
+ src: avatarUrl ?? "/icon.png",
61
+ alt: "",
62
+ fill: true,
63
+ unoptimized: true,
64
+ className: avatarUrl ? "object-cover" : "object-cover p-[15%] opacity-50"
65
+ }
66
+ ) }),
67
+ name ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "truncate text-base font-bold", children: name }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_address_display.AddressDisplay, { address, chars: 4, showCopy: false, className: "text-base font-bold" })
68
+ ] });
69
+ }
70
+ function LeaderboardPanel({
71
+ myAddress,
72
+ limit = 20,
73
+ showHeading = true,
74
+ viewAllHref,
75
+ className
76
+ }) {
77
+ const { data, isLoading } = (0, import_use_rewards.useLeaderboard)(1, limit);
78
+ const rows = data?.data ?? [];
79
+ const highlightAddress = myAddress ? (0, import_sdk.normalizeAddress)("STARKNET", myAddress) : null;
80
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_cn.cn)("space-y-3", className), children: [
81
+ showHeading && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2", children: [
82
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-rose to-brand-orange text-white shrink-0", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Sparkles, { className: "h-3.5 w-3.5" }) }),
83
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("h2", { className: "text-sm font-black", children: "Community Rewards" })
84
+ ] }),
85
+ isLoading ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "space-y-1.5", children: Array.from({ length: Math.min(limit, 6) }).map((_, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_skeleton.Skeleton, { className: "h-10 w-full rounded-lg" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm text-muted-foreground py-4", children: "Nobody's earned points yet \u2014 be the first." }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
86
+ import_leaderboard_table.LeaderboardTable,
87
+ {
88
+ entries: rows,
89
+ highlightAddress,
90
+ renderAddress: (address) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: (0, import_sdk.profileHref)({ address }), className: "hover:text-foreground transition-colors", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CreatorIdentity, { address }) })
91
+ }
92
+ ),
93
+ viewAllHref && rows.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
94
+ import_link.default,
95
+ {
96
+ href: viewAllHref,
97
+ className: "inline-flex items-center gap-1 text-xs font-semibold text-muted-foreground hover:text-foreground transition-colors pt-1",
98
+ children: "View scoreboard \u2192"
99
+ }
100
+ )
101
+ ] });
102
+ }
103
+ // Annotate the CommonJS export names for ESM import in node:
104
+ 0 && (module.exports = {
105
+ LeaderboardPanel
106
+ });
107
+ //# sourceMappingURL=leaderboard-panel.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/rewards/leaderboard-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { Sparkles } from \"lucide-react\";\nimport { normalizeAddress, profileHref } from \"@medialane/sdk\";\nimport Image from \"../image.js\";\nimport Link from \"../link.js\";\nimport { Skeleton } from \"../skeleton.js\";\nimport { AddressDisplay } from \"../address-display.js\";\nimport { LeaderboardTable } from \"./leaderboard-table.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { profileIdentity } from \"../../utils/profile-identity.js\";\nimport { useCreatorProfile } from \"../../utils/use-profiles.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\nimport { useLeaderboard } from \"../../utils/use-rewards.js\";\n\nexport interface LeaderboardPanelProps {\n myAddress?: string | null;\n limit?: number;\n showHeading?: boolean;\n viewAllHref?: string;\n className?: string;\n}\n\nfunction CreatorIdentity({ address }: { address: string }) {\n const { profile } = useCreatorProfile(address);\n const avatarUrl = useImageUrl()(profile?.avatarImage, { width: 96 });\n const { identity: name } = profileIdentity({\n username: profile?.username,\n name: profile?.name,\n walletAddress: address,\n });\n\n return (\n <span className=\"inline-flex min-w-0 items-center gap-2.5\">\n <span className=\"relative h-9 w-9 shrink-0 overflow-hidden rounded-full bg-foreground/[0.08]\">\n <Image\n src={avatarUrl ?? \"/icon.png\"}\n alt=\"\"\n fill\n unoptimized\n className={avatarUrl ? \"object-cover\" : \"object-cover p-[15%] opacity-50\"}\n />\n </span>\n {name ? (\n <span className=\"truncate text-base font-bold\">{name}</span>\n ) : (\n <AddressDisplay address={address} chars={4} showCopy={false} className=\"text-base font-bold\" />\n )}\n </span>\n );\n}\n\nexport function LeaderboardPanel({\n myAddress,\n limit = 20,\n showHeading = true,\n viewAllHref,\n className,\n}: LeaderboardPanelProps) {\n const { data, isLoading } = useLeaderboard(1, limit);\n const rows = data?.data ?? [];\n\n const highlightAddress = myAddress ? normalizeAddress(\"STARKNET\", myAddress) : null;\n\n return (\n <div className={cn(\"space-y-3\", className)}>\n {showHeading && (\n <div className=\"flex items-center gap-2\">\n <div className=\"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-rose to-brand-orange text-white shrink-0\">\n <Sparkles className=\"h-3.5 w-3.5\" />\n </div>\n <h2 className=\"text-sm font-black\">Community Rewards</h2>\n </div>\n )}\n\n {isLoading ? (\n <div className=\"space-y-1.5\">\n {Array.from({ length: Math.min(limit, 6) }).map((_, i) => (\n <Skeleton key={i} className=\"h-10 w-full rounded-lg\" />\n ))}\n </div>\n ) : rows.length === 0 ? (\n <p className=\"text-sm text-muted-foreground py-4\">\n Nobody&apos;s earned points yet — be the first.\n </p>\n ) : (\n <LeaderboardTable\n entries={rows}\n highlightAddress={highlightAddress}\n renderAddress={(address) => (\n <Link href={profileHref({ address })} className=\"hover:text-foreground transition-colors\">\n <CreatorIdentity address={address} />\n </Link>\n )}\n />\n )}\n\n {viewAllHref && rows.length > 0 && (\n <Link\n href={viewAllHref}\n className=\"inline-flex items-center gap-1 text-xs font-semibold text-muted-foreground hover:text-foreground transition-colors pt-1\"\n >\n View scoreboard →\n </Link>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAiCI;AA/BJ,0BAAyB;AACzB,iBAA8C;AAC9C,mBAAkB;AAClB,kBAAiB;AACjB,sBAAyB;AACzB,6BAA+B;AAC/B,+BAAiC;AACjC,gBAAmB;AACnB,8BAAgC;AAChC,0BAAkC;AAClC,2BAA4B;AAC5B,yBAA+B;AAU/B,SAAS,gBAAgB,EAAE,QAAQ,GAAwB;AACzD,QAAM,EAAE,QAAQ,QAAI,uCAAkB,OAAO;AAC7C,QAAM,gBAAY,kCAAY,EAAE,SAAS,aAAa,EAAE,OAAO,GAAG,CAAC;AACnE,QAAM,EAAE,UAAU,KAAK,QAAI,yCAAgB;AAAA,IACzC,UAAU,SAAS;AAAA,IACnB,MAAM,SAAS;AAAA,IACf,eAAe;AAAA,EACjB,CAAC;AAED,SACE,6CAAC,UAAK,WAAU,4CACd;AAAA,gDAAC,UAAK,WAAU,+EACd;AAAA,MAAC,aAAAA;AAAA,MAAA;AAAA,QACC,KAAK,aAAa;AAAA,QAClB,KAAI;AAAA,QACJ,MAAI;AAAA,QACJ,aAAW;AAAA,QACX,WAAW,YAAY,iBAAiB;AAAA;AAAA,IAC1C,GACF;AAAA,IACC,OACC,4CAAC,UAAK,WAAU,gCAAgC,gBAAK,IAErD,4CAAC,yCAAe,SAAkB,OAAO,GAAG,UAAU,OAAO,WAAU,uBAAsB;AAAA,KAEjG;AAEJ;AAEO,SAAS,iBAAiB;AAAA,EAC/B;AAAA,EACA,QAAQ;AAAA,EACR,cAAc;AAAA,EACd;AAAA,EACA;AACF,GAA0B;AACxB,QAAM,EAAE,MAAM,UAAU,QAAI,mCAAe,GAAG,KAAK;AACnD,QAAM,OAAO,MAAM,QAAQ,CAAC;AAE5B,QAAM,mBAAmB,gBAAY,6BAAiB,YAAY,SAAS,IAAI;AAE/E,SACE,6CAAC,SAAI,eAAW,cAAG,aAAa,SAAS,GACtC;AAAA,mBACC,6CAAC,SAAI,WAAU,2BACb;AAAA,kDAAC,SAAI,WAAU,6HACb,sDAAC,gCAAS,WAAU,eAAc,GACpC;AAAA,MACA,4CAAC,QAAG,WAAU,sBAAqB,+BAAiB;AAAA,OACtD;AAAA,IAGD,YACC,4CAAC,SAAI,WAAU,eACZ,gBAAM,KAAK,EAAE,QAAQ,KAAK,IAAI,OAAO,CAAC,EAAE,CAAC,EAAE,IAAI,CAAC,GAAG,MAClD,4CAAC,4BAAiB,WAAU,4BAAb,CAAsC,CACtD,GACH,IACE,KAAK,WAAW,IAClB,4CAAC,OAAE,WAAU,sCAAqC,6DAElD,IAEA;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT;AAAA,QACA,eAAe,CAAC,YACd,4CAAC,YAAAC,SAAA,EAAK,UAAM,wBAAY,EAAE,QAAQ,CAAC,GAAG,WAAU,2CAC9C,sDAAC,mBAAgB,SAAkB,GACrC;AAAA;AAAA,IAEJ;AAAA,IAGD,eAAe,KAAK,SAAS,KAC5B;AAAA,MAAC,YAAAA;AAAA,MAAA;AAAA,QACC,MAAM;AAAA,QACN,WAAU;AAAA,QACX;AAAA;AAAA,IAED;AAAA,KAEJ;AAEJ;","names":["Image","Link"]}
@@ -0,0 +1,12 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface LeaderboardPanelProps {
4
+ myAddress?: string | null;
5
+ limit?: number;
6
+ showHeading?: boolean;
7
+ viewAllHref?: string;
8
+ className?: string;
9
+ }
10
+ declare function LeaderboardPanel({ myAddress, limit, showHeading, viewAllHref, className, }: LeaderboardPanelProps): react_jsx_runtime.JSX.Element;
11
+
12
+ export { LeaderboardPanel, type LeaderboardPanelProps };
@@ -0,0 +1,12 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface LeaderboardPanelProps {
4
+ myAddress?: string | null;
5
+ limit?: number;
6
+ showHeading?: boolean;
7
+ viewAllHref?: string;
8
+ className?: string;
9
+ }
10
+ declare function LeaderboardPanel({ myAddress, limit, showHeading, viewAllHref, className, }: LeaderboardPanelProps): react_jsx_runtime.JSX.Element;
11
+
12
+ export { LeaderboardPanel, type LeaderboardPanelProps };
@@ -0,0 +1,73 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import { Sparkles } from "lucide-react";
4
+ import { normalizeAddress, profileHref } from "@medialane/sdk";
5
+ import Image from "../image.js";
6
+ import Link from "../link.js";
7
+ import { Skeleton } from "../skeleton.js";
8
+ import { AddressDisplay } from "../address-display.js";
9
+ import { LeaderboardTable } from "./leaderboard-table.js";
10
+ import { cn } from "../../utils/cn.js";
11
+ import { profileIdentity } from "../../utils/profile-identity.js";
12
+ import { useCreatorProfile } from "../../utils/use-profiles.js";
13
+ import { useImageUrl } from "../../utils/use-image-url.js";
14
+ import { useLeaderboard } from "../../utils/use-rewards.js";
15
+ function CreatorIdentity({ address }) {
16
+ const { profile } = useCreatorProfile(address);
17
+ const avatarUrl = useImageUrl()(profile?.avatarImage, { width: 96 });
18
+ const { identity: name } = profileIdentity({
19
+ username: profile?.username,
20
+ name: profile?.name,
21
+ walletAddress: address
22
+ });
23
+ return /* @__PURE__ */ jsxs("span", { className: "inline-flex min-w-0 items-center gap-2.5", children: [
24
+ /* @__PURE__ */ jsx("span", { className: "relative h-9 w-9 shrink-0 overflow-hidden rounded-full bg-foreground/[0.08]", children: /* @__PURE__ */ jsx(
25
+ Image,
26
+ {
27
+ src: avatarUrl ?? "/icon.png",
28
+ alt: "",
29
+ fill: true,
30
+ unoptimized: true,
31
+ className: avatarUrl ? "object-cover" : "object-cover p-[15%] opacity-50"
32
+ }
33
+ ) }),
34
+ name ? /* @__PURE__ */ jsx("span", { className: "truncate text-base font-bold", children: name }) : /* @__PURE__ */ jsx(AddressDisplay, { address, chars: 4, showCopy: false, className: "text-base font-bold" })
35
+ ] });
36
+ }
37
+ function LeaderboardPanel({
38
+ myAddress,
39
+ limit = 20,
40
+ showHeading = true,
41
+ viewAllHref,
42
+ className
43
+ }) {
44
+ const { data, isLoading } = useLeaderboard(1, limit);
45
+ const rows = data?.data ?? [];
46
+ const highlightAddress = myAddress ? normalizeAddress("STARKNET", myAddress) : null;
47
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), children: [
48
+ showHeading && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
49
+ /* @__PURE__ */ jsx("div", { className: "flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-rose to-brand-orange text-white shrink-0", children: /* @__PURE__ */ jsx(Sparkles, { className: "h-3.5 w-3.5" }) }),
50
+ /* @__PURE__ */ jsx("h2", { className: "text-sm font-black", children: "Community Rewards" })
51
+ ] }),
52
+ isLoading ? /* @__PURE__ */ jsx("div", { className: "space-y-1.5", children: Array.from({ length: Math.min(limit, 6) }).map((_, i) => /* @__PURE__ */ jsx(Skeleton, { className: "h-10 w-full rounded-lg" }, i)) }) : rows.length === 0 ? /* @__PURE__ */ jsx("p", { className: "text-sm text-muted-foreground py-4", children: "Nobody's earned points yet \u2014 be the first." }) : /* @__PURE__ */ jsx(
53
+ LeaderboardTable,
54
+ {
55
+ entries: rows,
56
+ highlightAddress,
57
+ renderAddress: (address) => /* @__PURE__ */ jsx(Link, { href: profileHref({ address }), className: "hover:text-foreground transition-colors", children: /* @__PURE__ */ jsx(CreatorIdentity, { address }) })
58
+ }
59
+ ),
60
+ viewAllHref && rows.length > 0 && /* @__PURE__ */ jsx(
61
+ Link,
62
+ {
63
+ href: viewAllHref,
64
+ className: "inline-flex items-center gap-1 text-xs font-semibold text-muted-foreground hover:text-foreground transition-colors pt-1",
65
+ children: "View scoreboard \u2192"
66
+ }
67
+ )
68
+ ] });
69
+ }
70
+ export {
71
+ LeaderboardPanel
72
+ };
73
+ //# sourceMappingURL=leaderboard-panel.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/rewards/leaderboard-panel.tsx"],"sourcesContent":["\"use client\";\n\nimport { Sparkles } from \"lucide-react\";\nimport { normalizeAddress, profileHref } from \"@medialane/sdk\";\nimport Image from \"../image.js\";\nimport Link from \"../link.js\";\nimport { Skeleton } from \"../skeleton.js\";\nimport { AddressDisplay } from \"../address-display.js\";\nimport { LeaderboardTable } from \"./leaderboard-table.js\";\nimport { cn } from \"../../utils/cn.js\";\nimport { profileIdentity } from \"../../utils/profile-identity.js\";\nimport { useCreatorProfile } from \"../../utils/use-profiles.js\";\nimport { useImageUrl } from \"../../utils/use-image-url.js\";\nimport { useLeaderboard } from \"../../utils/use-rewards.js\";\n\nexport interface LeaderboardPanelProps {\n myAddress?: string | null;\n limit?: number;\n showHeading?: boolean;\n viewAllHref?: string;\n className?: string;\n}\n\nfunction CreatorIdentity({ address }: { address: string }) {\n const { profile } = useCreatorProfile(address);\n const avatarUrl = useImageUrl()(profile?.avatarImage, { width: 96 });\n const { identity: name } = profileIdentity({\n username: profile?.username,\n name: profile?.name,\n walletAddress: address,\n });\n\n return (\n <span className=\"inline-flex min-w-0 items-center gap-2.5\">\n <span className=\"relative h-9 w-9 shrink-0 overflow-hidden rounded-full bg-foreground/[0.08]\">\n <Image\n src={avatarUrl ?? \"/icon.png\"}\n alt=\"\"\n fill\n unoptimized\n className={avatarUrl ? \"object-cover\" : \"object-cover p-[15%] opacity-50\"}\n />\n </span>\n {name ? (\n <span className=\"truncate text-base font-bold\">{name}</span>\n ) : (\n <AddressDisplay address={address} chars={4} showCopy={false} className=\"text-base font-bold\" />\n )}\n </span>\n );\n}\n\nexport function LeaderboardPanel({\n myAddress,\n limit = 20,\n showHeading = true,\n viewAllHref,\n className,\n}: LeaderboardPanelProps) {\n const { data, isLoading } = useLeaderboard(1, limit);\n const rows = data?.data ?? [];\n\n const highlightAddress = myAddress ? normalizeAddress(\"STARKNET\", myAddress) : null;\n\n return (\n <div className={cn(\"space-y-3\", className)}>\n {showHeading && (\n <div className=\"flex items-center gap-2\">\n <div className=\"flex h-7 w-7 items-center justify-center rounded-lg bg-gradient-to-br from-brand-rose to-brand-orange text-white shrink-0\">\n <Sparkles className=\"h-3.5 w-3.5\" />\n </div>\n <h2 className=\"text-sm font-black\">Community Rewards</h2>\n </div>\n )}\n\n {isLoading ? (\n <div className=\"space-y-1.5\">\n {Array.from({ length: Math.min(limit, 6) }).map((_, i) => (\n <Skeleton key={i} className=\"h-10 w-full rounded-lg\" />\n ))}\n </div>\n ) : rows.length === 0 ? (\n <p className=\"text-sm text-muted-foreground py-4\">\n Nobody&apos;s earned points yet — be the first.\n </p>\n ) : (\n <LeaderboardTable\n entries={rows}\n highlightAddress={highlightAddress}\n renderAddress={(address) => (\n <Link href={profileHref({ address })} className=\"hover:text-foreground transition-colors\">\n <CreatorIdentity address={address} />\n </Link>\n )}\n />\n )}\n\n {viewAllHref && rows.length > 0 && (\n <Link\n href={viewAllHref}\n className=\"inline-flex items-center gap-1 text-xs font-semibold text-muted-foreground hover:text-foreground transition-colors pt-1\"\n >\n View scoreboard →\n </Link>\n )}\n </div>\n );\n}\n"],"mappings":";AAiCI,SAEI,KAFJ;AA/BJ,SAAS,gBAAgB;AACzB,SAAS,kBAAkB,mBAAmB;AAC9C,OAAO,WAAW;AAClB,OAAO,UAAU;AACjB,SAAS,gBAAgB;AACzB,SAAS,sBAAsB;AAC/B,SAAS,wBAAwB;AACjC,SAAS,UAAU;AACnB,SAAS,uBAAuB;AAChC,SAAS,yBAAyB;AAClC,SAAS,mBAAmB;AAC5B,SAAS,sBAAsB;AAU/B,SAAS,gBAAgB,EAAE,QAAQ,GAAwB;AACzD,QAAM,EAAE,QAAQ,IAAI,kBAAkB,OAAO;AAC7C,QAAM,YAAY,YAAY,EAAE,SAAS,aAAa,EAAE,OAAO,GAAG,CAAC;AACnE,QAAM,EAAE,UAAU,KAAK,IAAI,gBAAgB;AAAA,IACzC,UAAU,SAAS;AAAA,IACnB,MAAM,SAAS;AAAA,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