@medialane/ui 0.57.2 → 0.59.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 (37) hide show
  1. package/dist/components/listing-card.cjs +2 -2
  2. package/dist/components/listing-card.cjs.map +1 -1
  3. package/dist/components/listing-card.d.cts +8 -1
  4. package/dist/components/listing-card.d.ts +8 -1
  5. package/dist/components/listing-card.js +2 -2
  6. package/dist/components/listing-card.js.map +1 -1
  7. package/dist/components/portfolio-header.cjs +101 -0
  8. package/dist/components/portfolio-header.cjs.map +1 -0
  9. package/dist/components/portfolio-header.d.cts +32 -0
  10. package/dist/components/portfolio-header.d.ts +32 -0
  11. package/dist/components/portfolio-header.js +67 -0
  12. package/dist/components/portfolio-header.js.map +1 -0
  13. package/dist/components/portfolio-nav.cjs +128 -0
  14. package/dist/components/portfolio-nav.cjs.map +1 -0
  15. package/dist/components/portfolio-nav.d.cts +36 -0
  16. package/dist/components/portfolio-nav.d.ts +36 -0
  17. package/dist/components/portfolio-nav.js +94 -0
  18. package/dist/components/portfolio-nav.js.map +1 -0
  19. package/dist/components/portfolio-overview.cjs +147 -0
  20. package/dist/components/portfolio-overview.cjs.map +1 -0
  21. package/dist/components/portfolio-overview.d.cts +41 -0
  22. package/dist/components/portfolio-overview.d.ts +41 -0
  23. package/dist/components/portfolio-overview.js +113 -0
  24. package/dist/components/portfolio-overview.js.map +1 -0
  25. package/dist/index.cjs +9 -3
  26. package/dist/index.cjs.map +1 -1
  27. package/dist/index.d.cts +3 -1
  28. package/dist/index.d.ts +3 -1
  29. package/dist/index.js +6 -2
  30. package/dist/index.js.map +1 -1
  31. package/package.json +1 -1
  32. package/dist/components/portfolio-subnav.cjs +0 -94
  33. package/dist/components/portfolio-subnav.cjs.map +0 -1
  34. package/dist/components/portfolio-subnav.d.cts +0 -27
  35. package/dist/components/portfolio-subnav.d.ts +0 -27
  36. package/dist/components/portfolio-subnav.js +0 -60
  37. package/dist/components/portfolio-subnav.js.map +0 -1
@@ -44,11 +44,11 @@ var import_cn = require("../utils/cn.js");
44
44
  var import_ipfs = require("../utils/ipfs.js");
45
45
  var import_format = require("../utils/format.js");
46
46
  var import_time = require("../utils/time.js");
47
- function ListingCard({ order, inCart = false, onBuy, onCart, overflowMenu, primaryAction, compact = false }) {
47
+ function ListingCard({ order, inCart = false, onBuy, onCart, overflowMenu, primaryAction, compact = false, imageUrl }) {
48
48
  const [imgError, setImgError] = (0, import_react.useState)(false);
49
49
  const isListing = order.offer.itemType === "ERC721" || order.offer.itemType === "ERC1155";
50
50
  const name = order.token?.name ?? `Token #${order.nftTokenId}`;
51
- const image = order.token?.image ? (0, import_ipfs.ipfsToHttp)(order.token.image) : null;
51
+ const image = imageUrl !== void 0 ? imageUrl : order.token?.image ? (0, import_ipfs.ipfsToHttp)(order.token.image) : null;
52
52
  const assetHref = `/asset/${order.nftContract}/${order.nftTokenId}`;
53
53
  const showActionBar = !!(onBuy || onCart || overflowMenu || primaryAction);
54
54
  if (compact) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/listing-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { ShoppingCart, Check, Zap, ArrowUpRight } from \"lucide-react\";\nimport { MotionCard } from \"./motion-primitives.js\";\nimport { CurrencyIcon } from \"./currency-icon.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport type { ApiOrder } from \"@medialane/sdk\";\n\nexport interface ListingCardProps {\n order: ApiOrder;\n inCart?: boolean;\n onBuy?: (order: ApiOrder) => void;\n onCart?: (order: ApiOrder) => void;\n /** App passes a fully constructed <DropdownMenu> here */\n overflowMenu?: React.ReactNode;\n /**\n * Optional flex-1 primary control for listings, replacing the default\n * Buy/View button — lets a host inject its own action (e.g. an owner\n * \"Cancel\" with an app-specific, auth-coupled handler) while keeping this\n * card's layout. Ignored for offers (which always render \"View asset\").\n */\n primaryAction?: React.ReactNode;\n compact?: boolean;\n}\n\nexport function ListingCard({ order, inCart = false, onBuy, onCart, overflowMenu, primaryAction, compact = false }: ListingCardProps) {\n const [imgError, setImgError] = useState(false);\n const isListing = order.offer.itemType === \"ERC721\" || order.offer.itemType === \"ERC1155\";\n const name = order.token?.name ?? `Token #${order.nftTokenId}`;\n const image = order.token?.image ? ipfsToHttp(order.token.image) : null;\n const assetHref = `/asset/${order.nftContract}/${order.nftTokenId}`;\n\n // Show the action bar for listings (Buy/View) and for offers (View asset),\n // whenever the host wired any action or an overflow menu.\n const showActionBar = !!(onBuy || onCart || overflowMenu || primaryAction);\n\n // ─── Compact variant ──────────────────────────────────────────────────────\n if (compact) {\n return (\n <MotionCard className=\"card-base\">\n <Link href={assetHref} className=\"block\">\n <div className=\"relative aspect-square bg-muted overflow-hidden\">\n {image && !imgError ? (\n <Image src={image} alt={name} fill unoptimized sizes=\"(max-width: 640px) 33vw, 20vw\" className=\"object-cover group-hover:scale-105 transition-transform duration-500\" onError={() => setImgError(true)} />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-brand-purple/15 to-brand-blue/15\">\n <span className=\"text-xl font-mono text-muted-foreground\">#{order.nftTokenId}</span>\n </div>\n )}\n </div>\n <div className=\"p-2.5 space-y-0.5\">\n <p className=\"text-xs font-semibold truncate\">{name}</p>\n {order.price?.formatted && (\n <p className=\"text-[11px] font-bold price-value inline-flex items-center gap-1\">\n {order.price.currency && <CurrencyIcon symbol={order.price.currency} size={11} />}\n {formatDisplayPrice(order.price.formatted)}\n </p>\n )}\n <p className=\"text-[10px] text-muted-foreground\">{timeAgo(order.createdAt)}</p>\n </div>\n </Link>\n </MotionCard>\n );\n }\n\n // ─── Full variant ─────────────────────────────────────────────────────────\n return (\n <MotionCard className=\"card-base\">\n <Link href={assetHref} className=\"block\">\n <div className=\"relative aspect-square bg-muted overflow-hidden\">\n {image && !imgError ? (\n <Image src={image} alt={name} fill unoptimized sizes=\"(max-width: 640px) 50vw, (max-width: 1024px) 33vw, 25vw\" className=\"object-cover group-hover:scale-105 transition-transform duration-500\" onError={() => setImgError(true)} />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-brand-purple/15 to-brand-blue/15\">\n <span className=\"text-2xl font-mono text-muted-foreground\">#{order.nftTokenId}</span>\n </div>\n )}\n </div>\n\n <div className=\"p-3.5 space-y-3\">\n <div className=\"min-w-0\">\n <p className=\"font-semibold text-[15px] truncate leading-snug\">{name}</p>\n <p className=\"text-[11px] text-muted-foreground truncate leading-snug mt-0.5\">\n {order.token?.description ? order.token.description : `#${order.nftTokenId}`}\n </p>\n </div>\n\n {/* Price / Offer + age */}\n {order.price?.formatted && (\n <div className=\"flex items-end justify-between gap-2\">\n <div className=\"min-w-0\">\n <p className=\"text-[10px] uppercase tracking-widest text-muted-foreground/55 leading-none\">\n {isListing ? \"Price\" : \"Offer\"}\n </p>\n <p className=\"text-lg font-bold price-value leading-none inline-flex items-center gap-1.5 mt-1.5\">\n {order.price.currency && <CurrencyIcon symbol={order.price.currency} size={18} />}\n {formatDisplayPrice(order.price.formatted)}\n <span className=\"sr-only\">{order.price.currency}</span>\n </p>\n </div>\n <p className=\"text-[10px] text-muted-foreground/60 whitespace-nowrap shrink-0\">\n {timeAgo(order.createdAt)}\n </p>\n </div>\n )}\n\n {showActionBar && (\n <div className=\"flex items-center gap-1.5\">\n {isListing ? (\n primaryAction ? (\n primaryAction\n ) : onBuy ? (\n <div className=\"btn-border-animated p-[1.5px] rounded-[10px] flex-1 h-9\">\n <button\n className=\"w-full h-full rounded-[9px] bg-background flex items-center justify-center gap-1.5 text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n onClick={(e) => { e.preventDefault(); onBuy(order); }}\n >\n <Zap className=\"h-3.5 w-3.5 shrink-0\" /> Buy\n </button>\n </div>\n ) : (\n <Link\n href={assetHref}\n className=\"flex-1 h-9 inline-flex items-center justify-center gap-1.5 rounded-[9px] border border-border bg-background text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n >\n <ArrowUpRight className=\"h-3.5 w-3.5 shrink-0\" /> View\n </Link>\n )\n ) : (\n <Link\n href={assetHref}\n className=\"flex-1 h-9 inline-flex items-center justify-center gap-1.5 rounded-[9px] border border-border bg-background text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n >\n <ArrowUpRight className=\"h-3.5 w-3.5 shrink-0\" /> View asset\n </Link>\n )}\n {onCart && (\n <button\n className={cn(\n \"h-9 w-9 shrink-0 rounded-[9px] border flex items-center justify-center transition-colors\",\n inCart\n ? \"border-brand-orange/50 bg-brand-orange/10 text-brand-orange\"\n : \"border-border bg-background hover:bg-muted text-foreground\"\n )}\n onClick={(e) => { e.preventDefault(); if (!inCart) onCart(order); }}\n disabled={inCart}\n aria-label={inCart ? \"Added to cart\" : \"Add to cart\"}\n >\n {inCart ? <Check className=\"h-3.5 w-3.5\" /> : <ShoppingCart className=\"h-3.5 w-3.5\" />}\n </button>\n )}\n {overflowMenu}\n </div>\n )}\n </div>\n </Link>\n </MotionCard>\n );\n}\n\nexport function ListingCardSkeleton() {\n return (\n <div className=\"card-base\">\n <div className=\"aspect-square w-full bg-muted animate-pulse\" />\n <div className=\"p-3 space-y-2.5\">\n <div className=\"space-y-1\">\n <div className=\"h-4 w-3/4 bg-muted animate-pulse rounded\" />\n <div className=\"h-3 w-1/2 bg-muted animate-pulse rounded\" />\n </div>\n <div className=\"h-6 w-1/2 bg-muted animate-pulse rounded\" />\n <div className=\"h-3 w-2/3 bg-muted animate-pulse rounded\" />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAiDc;AA/Cd,mBAAyB;AACzB,kBAAiB;AACjB,mBAAkB;AAClB,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AAA,KACF;AAEJ;","names":["Link","Image"]}
1
+ {"version":3,"sources":["../../src/components/listing-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { ShoppingCart, Check, Zap, ArrowUpRight } from \"lucide-react\";\nimport { MotionCard } from \"./motion-primitives.js\";\nimport { CurrencyIcon } from \"./currency-icon.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport type { ApiOrder } from \"@medialane/sdk\";\n\nexport interface ListingCardProps {\n order: ApiOrder;\n inCart?: boolean;\n onBuy?: (order: ApiOrder) => void;\n onCart?: (order: ApiOrder) => void;\n /** App passes a fully constructed <DropdownMenu> here */\n overflowMenu?: React.ReactNode;\n /**\n * Optional flex-1 primary control for listings, replacing the default\n * Buy/View button — lets a host inject its own action (e.g. an owner\n * \"Cancel\" with an app-specific, auth-coupled handler) while keeping this\n * card's layout. Ignored for offers (which always render \"View asset\").\n */\n primaryAction?: React.ReactNode;\n compact?: boolean;\n /**\n * Pre-resolved, browser-loadable image URL. When provided (including null),\n * overrides the card's internal ipfsToHttp resolution — apps that proxy or\n * resize images (e.g. a same-origin /api/ipfs?w= proxy) pass it here.\n * Omit for the default gateway resolution; null renders the no-image fallback.\n */\n imageUrl?: string | null;\n}\n\nexport function ListingCard({ order, inCart = false, onBuy, onCart, overflowMenu, primaryAction, compact = false, imageUrl }: ListingCardProps) {\n const [imgError, setImgError] = useState(false);\n const isListing = order.offer.itemType === \"ERC721\" || order.offer.itemType === \"ERC1155\";\n const name = order.token?.name ?? `Token #${order.nftTokenId}`;\n const image = imageUrl !== undefined ? imageUrl : (order.token?.image ? ipfsToHttp(order.token.image) : null);\n const assetHref = `/asset/${order.nftContract}/${order.nftTokenId}`;\n\n // Show the action bar for listings (Buy/View) and for offers (View asset),\n // whenever the host wired any action or an overflow menu.\n const showActionBar = !!(onBuy || onCart || overflowMenu || primaryAction);\n\n // ─── Compact variant ──────────────────────────────────────────────────────\n if (compact) {\n return (\n <MotionCard className=\"card-base\">\n <Link href={assetHref} className=\"block\">\n <div className=\"relative aspect-square bg-muted overflow-hidden\">\n {image && !imgError ? (\n <Image src={image} alt={name} fill unoptimized sizes=\"(max-width: 640px) 33vw, 20vw\" className=\"object-cover group-hover:scale-105 transition-transform duration-500\" onError={() => setImgError(true)} />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-brand-purple/15 to-brand-blue/15\">\n <span className=\"text-xl font-mono text-muted-foreground\">#{order.nftTokenId}</span>\n </div>\n )}\n </div>\n <div className=\"p-2.5 space-y-0.5\">\n <p className=\"text-xs font-semibold truncate\">{name}</p>\n {order.price?.formatted && (\n <p className=\"text-[11px] font-bold price-value inline-flex items-center gap-1\">\n {order.price.currency && <CurrencyIcon symbol={order.price.currency} size={11} />}\n {formatDisplayPrice(order.price.formatted)}\n </p>\n )}\n <p className=\"text-[10px] text-muted-foreground\">{timeAgo(order.createdAt)}</p>\n </div>\n </Link>\n </MotionCard>\n );\n }\n\n // ─── Full variant ─────────────────────────────────────────────────────────\n return (\n <MotionCard className=\"card-base\">\n <Link href={assetHref} className=\"block\">\n <div className=\"relative aspect-square bg-muted overflow-hidden\">\n {image && !imgError ? (\n <Image src={image} alt={name} fill unoptimized sizes=\"(max-width: 640px) 50vw, (max-width: 1024px) 33vw, 25vw\" className=\"object-cover group-hover:scale-105 transition-transform duration-500\" onError={() => setImgError(true)} />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-brand-purple/15 to-brand-blue/15\">\n <span className=\"text-2xl font-mono text-muted-foreground\">#{order.nftTokenId}</span>\n </div>\n )}\n </div>\n\n <div className=\"p-3.5 space-y-3\">\n <div className=\"min-w-0\">\n <p className=\"font-semibold text-[15px] truncate leading-snug\">{name}</p>\n <p className=\"text-[11px] text-muted-foreground truncate leading-snug mt-0.5\">\n {order.token?.description ? order.token.description : `#${order.nftTokenId}`}\n </p>\n </div>\n\n {/* Price / Offer + age */}\n {order.price?.formatted && (\n <div className=\"flex items-end justify-between gap-2\">\n <div className=\"min-w-0\">\n <p className=\"text-[10px] uppercase tracking-widest text-muted-foreground/55 leading-none\">\n {isListing ? \"Price\" : \"Offer\"}\n </p>\n <p className=\"text-lg font-bold price-value leading-none inline-flex items-center gap-1.5 mt-1.5\">\n {order.price.currency && <CurrencyIcon symbol={order.price.currency} size={18} />}\n {formatDisplayPrice(order.price.formatted)}\n <span className=\"sr-only\">{order.price.currency}</span>\n </p>\n </div>\n <p className=\"text-[10px] text-muted-foreground/60 whitespace-nowrap shrink-0\">\n {timeAgo(order.createdAt)}\n </p>\n </div>\n )}\n\n {showActionBar && (\n <div className=\"flex items-center gap-1.5\">\n {isListing ? (\n primaryAction ? (\n primaryAction\n ) : onBuy ? (\n <div className=\"btn-border-animated p-[1.5px] rounded-[10px] flex-1 h-9\">\n <button\n className=\"w-full h-full rounded-[9px] bg-background flex items-center justify-center gap-1.5 text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n onClick={(e) => { e.preventDefault(); onBuy(order); }}\n >\n <Zap className=\"h-3.5 w-3.5 shrink-0\" /> Buy\n </button>\n </div>\n ) : (\n <Link\n href={assetHref}\n className=\"flex-1 h-9 inline-flex items-center justify-center gap-1.5 rounded-[9px] border border-border bg-background text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n >\n <ArrowUpRight className=\"h-3.5 w-3.5 shrink-0\" /> View\n </Link>\n )\n ) : (\n <Link\n href={assetHref}\n className=\"flex-1 h-9 inline-flex items-center justify-center gap-1.5 rounded-[9px] border border-border bg-background text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n >\n <ArrowUpRight className=\"h-3.5 w-3.5 shrink-0\" /> View asset\n </Link>\n )}\n {onCart && (\n <button\n className={cn(\n \"h-9 w-9 shrink-0 rounded-[9px] border flex items-center justify-center transition-colors\",\n inCart\n ? \"border-brand-orange/50 bg-brand-orange/10 text-brand-orange\"\n : \"border-border bg-background hover:bg-muted text-foreground\"\n )}\n onClick={(e) => { e.preventDefault(); if (!inCart) onCart(order); }}\n disabled={inCart}\n aria-label={inCart ? \"Added to cart\" : \"Add to cart\"}\n >\n {inCart ? <Check className=\"h-3.5 w-3.5\" /> : <ShoppingCart className=\"h-3.5 w-3.5\" />}\n </button>\n )}\n {overflowMenu}\n </div>\n )}\n </div>\n </Link>\n </MotionCard>\n );\n}\n\nexport function ListingCardSkeleton() {\n return (\n <div className=\"card-base\">\n <div className=\"aspect-square w-full bg-muted animate-pulse\" />\n <div className=\"p-3 space-y-2.5\">\n <div className=\"space-y-1\">\n <div className=\"h-4 w-3/4 bg-muted animate-pulse rounded\" />\n <div className=\"h-3 w-1/2 bg-muted animate-pulse rounded\" />\n </div>\n <div className=\"h-6 w-1/2 bg-muted animate-pulse rounded\" />\n <div className=\"h-3 w-2/3 bg-muted animate-pulse rounded\" />\n </div>\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAwDc;AAtDd,mBAAyB;AACzB,kBAAiB;AACjB,mBAAkB;AAClB,0BAAuD;AACvD,+BAA2B;AAC3B,2BAA6B;AAC7B,gBAAmB;AACnB,kBAA2B;AAC3B,oBAAmC;AACnC,kBAAwB;AA2BjB,SAAS,YAAY,EAAE,OAAO,SAAS,OAAO,OAAO,QAAQ,cAAc,eAAe,UAAU,OAAO,SAAS,GAAqB;AAC9I,QAAM,CAAC,UAAU,WAAW,QAAI,uBAAS,KAAK;AAC9C,QAAM,YAAY,MAAM,MAAM,aAAa,YAAY,MAAM,MAAM,aAAa;AAChF,QAAM,OAAO,MAAM,OAAO,QAAQ,UAAU,MAAM,UAAU;AAC5D,QAAM,QAAQ,aAAa,SAAY,WAAY,MAAM,OAAO,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ACC,MAAM;AAAA,YACN,WAAU;AAAA,YAEV;AAAA,0DAAC,oCAAa,WAAU,wBAAuB;AAAA,cAAE;AAAA;AAAA;AAAA,QACnD;AAAA,QAED,UACC;AAAA,UAAC;AAAA;AAAA,YACC,eAAW;AAAA,cACT;AAAA,cACA,SACI,gEACA;AAAA,YACN;AAAA,YACA,SAAS,CAAC,MAAM;AAAE,gBAAE,eAAe;AAAG,kBAAI,CAAC,OAAQ,QAAO,KAAK;AAAA,YAAG;AAAA,YAClE,UAAU;AAAA,YACV,cAAY,SAAS,kBAAkB;AAAA,YAEtC,mBAAS,4CAAC,6BAAM,WAAU,eAAc,IAAK,4CAAC,oCAAa,WAAU,eAAc;AAAA;AAAA,QACtF;AAAA,QAED;AAAA,SACH;AAAA,OAEJ;AAAA,KACF,GACF;AAEJ;AAEO,SAAS,sBAAsB;AACpC,SACE,6CAAC,SAAI,WAAU,aACb;AAAA,gDAAC,SAAI,WAAU,+CAA8C;AAAA,IAC7D,6CAAC,SAAI,WAAU,mBACb;AAAA,mDAAC,SAAI,WAAU,aACb;AAAA,oDAAC,SAAI,WAAU,4CAA2C;AAAA,QAC1D,4CAAC,SAAI,WAAU,4CAA2C;AAAA,SAC5D;AAAA,MACA,4CAAC,SAAI,WAAU,4CAA2C;AAAA,MAC1D,4CAAC,SAAI,WAAU,4CAA2C;AAAA,OAC5D;AAAA,KACF;AAEJ;","names":["Link","Image"]}
@@ -16,8 +16,15 @@ interface ListingCardProps {
16
16
  */
17
17
  primaryAction?: React.ReactNode;
18
18
  compact?: boolean;
19
+ /**
20
+ * Pre-resolved, browser-loadable image URL. When provided (including null),
21
+ * overrides the card's internal ipfsToHttp resolution — apps that proxy or
22
+ * resize images (e.g. a same-origin /api/ipfs?w= proxy) pass it here.
23
+ * Omit for the default gateway resolution; null renders the no-image fallback.
24
+ */
25
+ imageUrl?: string | null;
19
26
  }
20
- declare function ListingCard({ order, inCart, onBuy, onCart, overflowMenu, primaryAction, compact }: ListingCardProps): react_jsx_runtime.JSX.Element;
27
+ declare function ListingCard({ order, inCart, onBuy, onCart, overflowMenu, primaryAction, compact, imageUrl }: ListingCardProps): react_jsx_runtime.JSX.Element;
21
28
  declare function ListingCardSkeleton(): react_jsx_runtime.JSX.Element;
22
29
 
23
30
  export { ListingCard, type ListingCardProps, ListingCardSkeleton };
@@ -16,8 +16,15 @@ interface ListingCardProps {
16
16
  */
17
17
  primaryAction?: React.ReactNode;
18
18
  compact?: boolean;
19
+ /**
20
+ * Pre-resolved, browser-loadable image URL. When provided (including null),
21
+ * overrides the card's internal ipfsToHttp resolution — apps that proxy or
22
+ * resize images (e.g. a same-origin /api/ipfs?w= proxy) pass it here.
23
+ * Omit for the default gateway resolution; null renders the no-image fallback.
24
+ */
25
+ imageUrl?: string | null;
19
26
  }
20
- declare function ListingCard({ order, inCart, onBuy, onCart, overflowMenu, primaryAction, compact }: ListingCardProps): react_jsx_runtime.JSX.Element;
27
+ declare function ListingCard({ order, inCart, onBuy, onCart, overflowMenu, primaryAction, compact, imageUrl }: ListingCardProps): react_jsx_runtime.JSX.Element;
21
28
  declare function ListingCardSkeleton(): react_jsx_runtime.JSX.Element;
22
29
 
23
30
  export { ListingCard, type ListingCardProps, ListingCardSkeleton };
@@ -10,11 +10,11 @@ import { cn } from "../utils/cn.js";
10
10
  import { ipfsToHttp } from "../utils/ipfs.js";
11
11
  import { formatDisplayPrice } from "../utils/format.js";
12
12
  import { timeAgo } from "../utils/time.js";
13
- function ListingCard({ order, inCart = false, onBuy, onCart, overflowMenu, primaryAction, compact = false }) {
13
+ function ListingCard({ order, inCart = false, onBuy, onCart, overflowMenu, primaryAction, compact = false, imageUrl }) {
14
14
  const [imgError, setImgError] = useState(false);
15
15
  const isListing = order.offer.itemType === "ERC721" || order.offer.itemType === "ERC1155";
16
16
  const name = order.token?.name ?? `Token #${order.nftTokenId}`;
17
- const image = order.token?.image ? ipfsToHttp(order.token.image) : null;
17
+ const image = imageUrl !== void 0 ? imageUrl : order.token?.image ? ipfsToHttp(order.token.image) : null;
18
18
  const assetHref = `/asset/${order.nftContract}/${order.nftTokenId}`;
19
19
  const showActionBar = !!(onBuy || onCart || overflowMenu || primaryAction);
20
20
  if (compact) {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/components/listing-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { ShoppingCart, Check, Zap, ArrowUpRight } from \"lucide-react\";\nimport { MotionCard } from \"./motion-primitives.js\";\nimport { CurrencyIcon } from \"./currency-icon.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport type { ApiOrder } from \"@medialane/sdk\";\n\nexport interface ListingCardProps {\n order: ApiOrder;\n inCart?: boolean;\n onBuy?: (order: ApiOrder) => void;\n onCart?: (order: ApiOrder) => void;\n /** App passes a fully constructed <DropdownMenu> here */\n overflowMenu?: React.ReactNode;\n /**\n * Optional flex-1 primary control for listings, replacing the default\n * Buy/View button — lets a host inject its own action (e.g. an owner\n * \"Cancel\" with an app-specific, auth-coupled handler) while keeping this\n * card's layout. Ignored for offers (which always render \"View asset\").\n */\n primaryAction?: React.ReactNode;\n compact?: boolean;\n}\n\nexport function ListingCard({ order, inCart = false, onBuy, onCart, overflowMenu, primaryAction, compact = false }: ListingCardProps) {\n const [imgError, setImgError] = useState(false);\n const isListing = order.offer.itemType === \"ERC721\" || order.offer.itemType === \"ERC1155\";\n const name = order.token?.name ?? `Token #${order.nftTokenId}`;\n const image = order.token?.image ? ipfsToHttp(order.token.image) : null;\n const assetHref = `/asset/${order.nftContract}/${order.nftTokenId}`;\n\n // Show the action bar for listings (Buy/View) and for offers (View asset),\n // whenever the host wired any action or an overflow menu.\n const showActionBar = !!(onBuy || onCart || overflowMenu || primaryAction);\n\n // ─── Compact variant ──────────────────────────────────────────────────────\n if (compact) {\n return (\n <MotionCard className=\"card-base\">\n <Link href={assetHref} className=\"block\">\n <div className=\"relative aspect-square bg-muted overflow-hidden\">\n {image && !imgError ? (\n <Image src={image} alt={name} fill unoptimized sizes=\"(max-width: 640px) 33vw, 20vw\" className=\"object-cover group-hover:scale-105 transition-transform duration-500\" onError={() => setImgError(true)} />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-brand-purple/15 to-brand-blue/15\">\n <span className=\"text-xl font-mono text-muted-foreground\">#{order.nftTokenId}</span>\n </div>\n )}\n </div>\n <div className=\"p-2.5 space-y-0.5\">\n <p className=\"text-xs font-semibold truncate\">{name}</p>\n {order.price?.formatted && (\n <p className=\"text-[11px] font-bold price-value inline-flex items-center gap-1\">\n {order.price.currency && <CurrencyIcon symbol={order.price.currency} size={11} />}\n {formatDisplayPrice(order.price.formatted)}\n </p>\n )}\n <p className=\"text-[10px] text-muted-foreground\">{timeAgo(order.createdAt)}</p>\n </div>\n </Link>\n </MotionCard>\n );\n }\n\n // ─── Full variant ─────────────────────────────────────────────────────────\n return (\n <MotionCard className=\"card-base\">\n <Link href={assetHref} className=\"block\">\n <div className=\"relative aspect-square bg-muted overflow-hidden\">\n {image && !imgError ? (\n <Image src={image} alt={name} fill unoptimized sizes=\"(max-width: 640px) 50vw, (max-width: 1024px) 33vw, 25vw\" className=\"object-cover group-hover:scale-105 transition-transform duration-500\" onError={() => setImgError(true)} />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-brand-purple/15 to-brand-blue/15\">\n <span className=\"text-2xl font-mono text-muted-foreground\">#{order.nftTokenId}</span>\n </div>\n )}\n </div>\n\n <div className=\"p-3.5 space-y-3\">\n <div className=\"min-w-0\">\n <p className=\"font-semibold text-[15px] truncate leading-snug\">{name}</p>\n <p className=\"text-[11px] text-muted-foreground truncate leading-snug mt-0.5\">\n {order.token?.description ? order.token.description : `#${order.nftTokenId}`}\n </p>\n </div>\n\n {/* Price / Offer + age */}\n {order.price?.formatted && (\n <div className=\"flex items-end justify-between gap-2\">\n <div className=\"min-w-0\">\n <p className=\"text-[10px] uppercase tracking-widest text-muted-foreground/55 leading-none\">\n {isListing ? \"Price\" : \"Offer\"}\n </p>\n <p className=\"text-lg font-bold price-value leading-none inline-flex items-center gap-1.5 mt-1.5\">\n {order.price.currency && <CurrencyIcon symbol={order.price.currency} size={18} />}\n {formatDisplayPrice(order.price.formatted)}\n <span className=\"sr-only\">{order.price.currency}</span>\n </p>\n </div>\n <p className=\"text-[10px] text-muted-foreground/60 whitespace-nowrap shrink-0\">\n {timeAgo(order.createdAt)}\n </p>\n </div>\n )}\n\n {showActionBar && (\n <div className=\"flex items-center gap-1.5\">\n {isListing ? (\n primaryAction ? (\n primaryAction\n ) : onBuy ? (\n <div className=\"btn-border-animated p-[1.5px] rounded-[10px] flex-1 h-9\">\n <button\n className=\"w-full h-full rounded-[9px] bg-background flex items-center justify-center gap-1.5 text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n onClick={(e) => { e.preventDefault(); onBuy(order); }}\n >\n <Zap className=\"h-3.5 w-3.5 shrink-0\" /> Buy\n </button>\n </div>\n ) : (\n <Link\n href={assetHref}\n className=\"flex-1 h-9 inline-flex items-center justify-center gap-1.5 rounded-[9px] border border-border bg-background text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n >\n <ArrowUpRight className=\"h-3.5 w-3.5 shrink-0\" /> View\n </Link>\n )\n ) : (\n <Link\n href={assetHref}\n className=\"flex-1 h-9 inline-flex items-center justify-center gap-1.5 rounded-[9px] border border-border bg-background text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n >\n <ArrowUpRight className=\"h-3.5 w-3.5 shrink-0\" /> View asset\n </Link>\n )}\n {onCart && (\n <button\n className={cn(\n \"h-9 w-9 shrink-0 rounded-[9px] border flex items-center justify-center transition-colors\",\n inCart\n ? \"border-brand-orange/50 bg-brand-orange/10 text-brand-orange\"\n : \"border-border bg-background hover:bg-muted text-foreground\"\n )}\n onClick={(e) => { e.preventDefault(); if (!inCart) onCart(order); }}\n disabled={inCart}\n aria-label={inCart ? \"Added to cart\" : \"Add to cart\"}\n >\n {inCart ? <Check className=\"h-3.5 w-3.5\" /> : <ShoppingCart className=\"h-3.5 w-3.5\" />}\n </button>\n )}\n {overflowMenu}\n </div>\n )}\n </div>\n </Link>\n </MotionCard>\n );\n}\n\nexport function ListingCardSkeleton() {\n return (\n <div className=\"card-base\">\n <div className=\"aspect-square w-full bg-muted animate-pulse\" />\n <div className=\"p-3 space-y-2.5\">\n <div className=\"space-y-1\">\n <div className=\"h-4 w-3/4 bg-muted animate-pulse rounded\" />\n <div className=\"h-3 w-1/2 bg-muted animate-pulse rounded\" />\n </div>\n <div className=\"h-6 w-1/2 bg-muted animate-pulse rounded\" />\n <div className=\"h-3 w-2/3 bg-muted animate-pulse rounded\" />\n </div>\n </div>\n );\n}\n"],"mappings":";AAiDc,cAGE,YAHF;AA/Cd,SAAS,gBAAgB;AACzB,OAAO,UAAU;AACjB,OAAO,WAAW;AAClB,SAAS,cAAc,OAAO,KAAK,oBAAoB;AACvD,SAAS,kBAAkB;AAC3B,SAAS,oBAAoB;AAC7B,SAAS,UAAU;AACnB,SAAS,kBAAkB;AAC3B,SAAS,0BAA0B;AACnC,SAAS,eAAe;AAoBjB,SAAS,YAAY,EAAE,OAAO,SAAS,OAAO,OAAO,QAAQ,cAAc,eAAe,UAAU,MAAM,GAAqB;AACpI,QAAM,CAAC,UAAU,WAAW,IAAI,SAAS,KAAK;AAC9C,QAAM,YAAY,MAAM,MAAM,aAAa,YAAY,MAAM,MAAM,aAAa;AAChF,QAAM,OAAO,MAAM,OAAO,QAAQ,UAAU,MAAM,UAAU;AAC5D,QAAM,QAAQ,MAAM,OAAO,QAAQ,WAAW,MAAM,MAAM,KAAK,IAAI;AACnE,QAAM,YAAY,UAAU,MAAM,WAAW,IAAI,MAAM,UAAU;AAIjE,QAAM,gB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AAAA,YACN;AAAA,YACA,SAAS,CAAC,MAAM;AAAE,gBAAE,eAAe;AAAG,kBAAI,CAAC,OAAQ,QAAO,KAAK;AAAA,YAAG;AAAA,YAClE,UAAU;AAAA,YACV,cAAY,SAAS,kBAAkB;AAAA,YAEtC,mBAAS,oBAAC,SAAM,WAAU,eAAc,IAAK,oBAAC,gBAAa,WAAU,eAAc;AAAA;AAAA,QACtF;AAAA,QAED;AAAA,SACH;AAAA,OAEJ;AAAA,KACF,GACF;AAEJ;AAEO,SAAS,sBAAsB;AACpC,SACE,qBAAC,SAAI,WAAU,aACb;AAAA,wBAAC,SAAI,WAAU,+CAA8C;AAAA,IAC7D,qBAAC,SAAI,WAAU,mBACb;AAAA,2BAAC,SAAI,WAAU,aACb;AAAA,4BAAC,SAAI,WAAU,4CAA2C;AAAA,QAC1D,oBAAC,SAAI,WAAU,4CAA2C;AAAA,SAC5D;AAAA,MACA,oBAAC,SAAI,WAAU,4CAA2C;AAAA,MAC1D,oBAAC,SAAI,WAAU,4CAA2C;AAAA,OAC5D;AAAA,KACF;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../../src/components/listing-card.tsx"],"sourcesContent":["\"use client\";\n\nimport { useState } from \"react\";\nimport Link from \"next/link\";\nimport Image from \"next/image\";\nimport { ShoppingCart, Check, Zap, ArrowUpRight } from \"lucide-react\";\nimport { MotionCard } from \"./motion-primitives.js\";\nimport { CurrencyIcon } from \"./currency-icon.js\";\nimport { cn } from \"../utils/cn.js\";\nimport { ipfsToHttp } from \"../utils/ipfs.js\";\nimport { formatDisplayPrice } from \"../utils/format.js\";\nimport { timeAgo } from \"../utils/time.js\";\nimport type { ApiOrder } from \"@medialane/sdk\";\n\nexport interface ListingCardProps {\n order: ApiOrder;\n inCart?: boolean;\n onBuy?: (order: ApiOrder) => void;\n onCart?: (order: ApiOrder) => void;\n /** App passes a fully constructed <DropdownMenu> here */\n overflowMenu?: React.ReactNode;\n /**\n * Optional flex-1 primary control for listings, replacing the default\n * Buy/View button — lets a host inject its own action (e.g. an owner\n * \"Cancel\" with an app-specific, auth-coupled handler) while keeping this\n * card's layout. Ignored for offers (which always render \"View asset\").\n */\n primaryAction?: React.ReactNode;\n compact?: boolean;\n /**\n * Pre-resolved, browser-loadable image URL. When provided (including null),\n * overrides the card's internal ipfsToHttp resolution — apps that proxy or\n * resize images (e.g. a same-origin /api/ipfs?w= proxy) pass it here.\n * Omit for the default gateway resolution; null renders the no-image fallback.\n */\n imageUrl?: string | null;\n}\n\nexport function ListingCard({ order, inCart = false, onBuy, onCart, overflowMenu, primaryAction, compact = false, imageUrl }: ListingCardProps) {\n const [imgError, setImgError] = useState(false);\n const isListing = order.offer.itemType === \"ERC721\" || order.offer.itemType === \"ERC1155\";\n const name = order.token?.name ?? `Token #${order.nftTokenId}`;\n const image = imageUrl !== undefined ? imageUrl : (order.token?.image ? ipfsToHttp(order.token.image) : null);\n const assetHref = `/asset/${order.nftContract}/${order.nftTokenId}`;\n\n // Show the action bar for listings (Buy/View) and for offers (View asset),\n // whenever the host wired any action or an overflow menu.\n const showActionBar = !!(onBuy || onCart || overflowMenu || primaryAction);\n\n // ─── Compact variant ──────────────────────────────────────────────────────\n if (compact) {\n return (\n <MotionCard className=\"card-base\">\n <Link href={assetHref} className=\"block\">\n <div className=\"relative aspect-square bg-muted overflow-hidden\">\n {image && !imgError ? (\n <Image src={image} alt={name} fill unoptimized sizes=\"(max-width: 640px) 33vw, 20vw\" className=\"object-cover group-hover:scale-105 transition-transform duration-500\" onError={() => setImgError(true)} />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-brand-purple/15 to-brand-blue/15\">\n <span className=\"text-xl font-mono text-muted-foreground\">#{order.nftTokenId}</span>\n </div>\n )}\n </div>\n <div className=\"p-2.5 space-y-0.5\">\n <p className=\"text-xs font-semibold truncate\">{name}</p>\n {order.price?.formatted && (\n <p className=\"text-[11px] font-bold price-value inline-flex items-center gap-1\">\n {order.price.currency && <CurrencyIcon symbol={order.price.currency} size={11} />}\n {formatDisplayPrice(order.price.formatted)}\n </p>\n )}\n <p className=\"text-[10px] text-muted-foreground\">{timeAgo(order.createdAt)}</p>\n </div>\n </Link>\n </MotionCard>\n );\n }\n\n // ─── Full variant ─────────────────────────────────────────────────────────\n return (\n <MotionCard className=\"card-base\">\n <Link href={assetHref} className=\"block\">\n <div className=\"relative aspect-square bg-muted overflow-hidden\">\n {image && !imgError ? (\n <Image src={image} alt={name} fill unoptimized sizes=\"(max-width: 640px) 50vw, (max-width: 1024px) 33vw, 25vw\" className=\"object-cover group-hover:scale-105 transition-transform duration-500\" onError={() => setImgError(true)} />\n ) : (\n <div className=\"absolute inset-0 flex items-center justify-center bg-gradient-to-br from-brand-purple/15 to-brand-blue/15\">\n <span className=\"text-2xl font-mono text-muted-foreground\">#{order.nftTokenId}</span>\n </div>\n )}\n </div>\n\n <div className=\"p-3.5 space-y-3\">\n <div className=\"min-w-0\">\n <p className=\"font-semibold text-[15px] truncate leading-snug\">{name}</p>\n <p className=\"text-[11px] text-muted-foreground truncate leading-snug mt-0.5\">\n {order.token?.description ? order.token.description : `#${order.nftTokenId}`}\n </p>\n </div>\n\n {/* Price / Offer + age */}\n {order.price?.formatted && (\n <div className=\"flex items-end justify-between gap-2\">\n <div className=\"min-w-0\">\n <p className=\"text-[10px] uppercase tracking-widest text-muted-foreground/55 leading-none\">\n {isListing ? \"Price\" : \"Offer\"}\n </p>\n <p className=\"text-lg font-bold price-value leading-none inline-flex items-center gap-1.5 mt-1.5\">\n {order.price.currency && <CurrencyIcon symbol={order.price.currency} size={18} />}\n {formatDisplayPrice(order.price.formatted)}\n <span className=\"sr-only\">{order.price.currency}</span>\n </p>\n </div>\n <p className=\"text-[10px] text-muted-foreground/60 whitespace-nowrap shrink-0\">\n {timeAgo(order.createdAt)}\n </p>\n </div>\n )}\n\n {showActionBar && (\n <div className=\"flex items-center gap-1.5\">\n {isListing ? (\n primaryAction ? (\n primaryAction\n ) : onBuy ? (\n <div className=\"btn-border-animated p-[1.5px] rounded-[10px] flex-1 h-9\">\n <button\n className=\"w-full h-full rounded-[9px] bg-background flex items-center justify-center gap-1.5 text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n onClick={(e) => { e.preventDefault(); onBuy(order); }}\n >\n <Zap className=\"h-3.5 w-3.5 shrink-0\" /> Buy\n </button>\n </div>\n ) : (\n <Link\n href={assetHref}\n className=\"flex-1 h-9 inline-flex items-center justify-center gap-1.5 rounded-[9px] border border-border bg-background text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n >\n <ArrowUpRight className=\"h-3.5 w-3.5 shrink-0\" /> View\n </Link>\n )\n ) : (\n <Link\n href={assetHref}\n className=\"flex-1 h-9 inline-flex items-center justify-center gap-1.5 rounded-[9px] border border-border bg-background text-xs font-semibold text-foreground hover:bg-muted/60 transition-all active:scale-[0.98]\"\n >\n <ArrowUpRight className=\"h-3.5 w-3.5 shrink-0\" /> View asset\n </Link>\n )}\n {onCart && (\n <button\n className={cn(\n \"h-9 w-9 shrink-0 rounded-[9px] border flex items-center justify-center transition-colors\",\n inCart\n ? \"border-brand-orange/50 bg-brand-orange/10 text-brand-orange\"\n : \"border-border bg-background hover:bg-muted text-foreground\"\n )}\n onClick={(e) => { e.preventDefault(); if (!inCart) onCart(order); }}\n disabled={inCart}\n aria-label={inCart ? \"Added to cart\" : \"Add to cart\"}\n >\n {inCart ? <Check className=\"h-3.5 w-3.5\" /> : <ShoppingCart className=\"h-3.5 w-3.5\" />}\n </button>\n )}\n {overflowMenu}\n </div>\n )}\n </div>\n </Link>\n </MotionCard>\n );\n}\n\nexport function ListingCardSkeleton() {\n return (\n <div className=\"card-base\">\n <div className=\"aspect-square w-full bg-muted animate-pulse\" />\n <div className=\"p-3 space-y-2.5\">\n <div className=\"space-y-1\">\n <div className=\"h-4 w-3/4 bg-muted animate-pulse rounded\" />\n <div className=\"h-3 w-1/2 bg-muted animate-pulse rounded\" />\n </div>\n <div className=\"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AAAA,4BAAC,SAAI,WAAU,4CAA2C;AAAA,QAC1D,oBAAC,SAAI,WAAU,4CAA2C;AAAA,SAC5D;AAAA,MACA,oBAAC,SAAI,WAAU,4CAA2C;AAAA,MAC1D,oBAAC,SAAI,WAAU,4CAA2C;AAAA,OAC5D;AAAA,KACF;AAEJ;","names":[]}
@@ -0,0 +1,101 @@
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 portfolio_header_exports = {};
31
+ __export(portfolio_header_exports, {
32
+ PortfolioHeader: () => PortfolioHeader
33
+ });
34
+ module.exports = __toCommonJS(portfolio_header_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_link = __toESM(require("next/link"), 1);
37
+ var import_lucide_react = require("lucide-react");
38
+ var import_cn = require("../utils/cn.js");
39
+ var import_address_display = require("./address-display.js");
40
+ function StatChip({ stat }) {
41
+ if (stat.value == null) {
42
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "bg-muted rounded-full px-3 py-1 w-20 h-6 animate-pulse inline-block" });
43
+ }
44
+ const body = /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
45
+ "span",
46
+ {
47
+ className: (0, import_cn.cn)(
48
+ "inline-flex items-baseline gap-1.5 rounded-full px-3 py-1 text-sm font-medium",
49
+ stat.highlight ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
50
+ ),
51
+ children: [
52
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "tabular-nums font-semibold text-foreground/90", children: stat.value }),
53
+ stat.label
54
+ ]
55
+ }
56
+ );
57
+ if (!stat.href) return body;
58
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: stat.href, className: "active:opacity-80", children: body });
59
+ }
60
+ function PortfolioHeader({
61
+ address,
62
+ stats,
63
+ score,
64
+ className
65
+ }) {
66
+ const scoreChip = score && /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2.5 rounded-xl border border-border bg-card px-3 py-2", children: [
67
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
68
+ "div",
69
+ {
70
+ className: "h-8 w-8 rounded-lg shrink-0 flex items-center justify-center text-sm font-black text-white",
71
+ style: { backgroundColor: score.badgeColor },
72
+ children: score.level
73
+ }
74
+ ),
75
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 leading-tight", children: [
76
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-xs font-bold text-foreground truncate", children: score.levelName }),
77
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-[11px] text-muted-foreground tabular-nums", children: [
78
+ score.totalXp.toLocaleString(),
79
+ " XP"
80
+ ] })
81
+ ] })
82
+ ] });
83
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: (0, import_cn.cn)("space-y-3", className), children: [
84
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-start justify-between gap-4", children: [
85
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5 min-w-0", children: [
86
+ /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 text-primary", children: [
87
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Briefcase, { className: "h-4 w-4" }),
88
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs font-semibold uppercase tracking-wider", children: "Portfolio" })
89
+ ] }),
90
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_address_display.AddressDisplay, { address, chars: 6, className: "text-sm" })
91
+ ] }),
92
+ score?.href ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_link.default, { href: score.href, className: "shrink-0 active:opacity-80", children: scoreChip }) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "shrink-0", children: scoreChip })
93
+ ] }),
94
+ stats && stats.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center gap-2 flex-wrap", children: stats.map((stat, i) => /* @__PURE__ */ (0, import_jsx_runtime.jsx)(StatChip, { stat }, i)) })
95
+ ] });
96
+ }
97
+ // Annotate the CommonJS export names for ESM import in node:
98
+ 0 && (module.exports = {
99
+ PortfolioHeader
100
+ });
101
+ //# sourceMappingURL=portfolio-header.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/portfolio-header.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"next/link\";\nimport { Briefcase } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { AddressDisplay } from \"./address-display.js\";\n\nexport interface PortfolioHeaderStat {\n label: string;\n /** Pass null while loading — renders a pulse placeholder. */\n value: string | number | null;\n href?: string;\n /** Primary-tinted chip for counts that need action (e.g. offers received). */\n highlight?: boolean;\n}\n\nexport interface PortfolioHeaderScore {\n level: number;\n levelName: string;\n badgeColor: string;\n totalXp: number;\n /** Where the score chip links (\"/rewards\"). */\n href?: string;\n}\n\nexport interface PortfolioHeaderProps {\n address: string;\n stats?: PortfolioHeaderStat[];\n score?: PortfolioHeaderScore | null;\n className?: string;\n}\n\nfunction StatChip({ stat }: { stat: PortfolioHeaderStat }) {\n if (stat.value == null) {\n return (\n <span className=\"bg-muted rounded-full px-3 py-1 w-20 h-6 animate-pulse inline-block\" />\n );\n }\n const body = (\n <span\n className={cn(\n \"inline-flex items-baseline gap-1.5 rounded-full px-3 py-1 text-sm font-medium\",\n stat.highlight\n ? \"bg-primary/10 text-primary\"\n : \"bg-muted text-muted-foreground\",\n )}\n >\n <span className=\"tabular-nums font-semibold text-foreground/90\">\n {stat.value}\n </span>\n {stat.label}\n </span>\n );\n if (!stat.href) return body;\n return (\n <Link href={stat.href} className=\"active:opacity-80\">\n {body}\n </Link>\n );\n}\n\n/**\n * Compact single-block portfolio header: eyebrow + address on the left, a\n * level/XP score chip on the right, and a row of stat chips beneath. Replaces\n * the stacked identity / stat-pills / ScoreSummaryCard blocks.\n */\nexport function PortfolioHeader({\n address,\n stats,\n score,\n className,\n}: PortfolioHeaderProps) {\n const scoreChip = score && (\n <div className=\"flex items-center gap-2.5 rounded-xl border border-border bg-card px-3 py-2\">\n <div\n className=\"h-8 w-8 rounded-lg shrink-0 flex items-center justify-center text-sm font-black text-white\"\n style={{ backgroundColor: score.badgeColor }}\n >\n {score.level}\n </div>\n <div className=\"min-w-0 leading-tight\">\n <p className=\"text-xs font-bold text-foreground truncate\">\n {score.levelName}\n </p>\n <p className=\"text-[11px] text-muted-foreground tabular-nums\">\n {score.totalXp.toLocaleString()} XP\n </p>\n </div>\n </div>\n );\n\n return (\n <div className={cn(\"space-y-3\", className)}>\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"space-y-1.5 min-w-0\">\n <div className=\"flex items-center gap-2 text-primary\">\n <Briefcase className=\"h-4 w-4\" />\n <span className=\"text-xs font-semibold uppercase tracking-wider\">\n Portfolio\n </span>\n </div>\n <AddressDisplay address={address} chars={6} className=\"text-sm\" />\n </div>\n {score?.href ? (\n <Link href={score.href} className=\"shrink-0 active:opacity-80\">\n {scoreChip}\n </Link>\n ) : (\n <div className=\"shrink-0\">{scoreChip}</div>\n )}\n </div>\n {stats && stats.length > 0 && (\n <div className=\"flex items-center gap-2 flex-wrap\">\n {stats.map((stat, i) => (\n <StatChip key={i} stat={stat} />\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAmCM;AAjCN,kBAAiB;AACjB,0BAA0B;AAC1B,gBAAmB;AACnB,6BAA+B;AA2B/B,SAAS,SAAS,EAAE,KAAK,GAAkC;AACzD,MAAI,KAAK,SAAS,MAAM;AACtB,WACE,4CAAC,UAAK,WAAU,uEAAsE;AAAA,EAE1F;AACA,QAAM,OACJ;AAAA,IAAC;AAAA;AAAA,MACC,eAAW;AAAA,QACT;AAAA,QACA,KAAK,YACD,+BACA;AAAA,MACN;AAAA,MAEA;AAAA,oDAAC,UAAK,WAAU,iDACb,eAAK,OACR;AAAA,QACC,KAAK;AAAA;AAAA;AAAA,EACR;AAEF,MAAI,CAAC,KAAK,KAAM,QAAO;AACvB,SACE,4CAAC,YAAAA,SAAA,EAAK,MAAM,KAAK,MAAM,WAAU,qBAC9B,gBACH;AAEJ;AAOO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,YAAY,SAChB,6CAAC,SAAI,WAAU,+EACb;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,WAAU;AAAA,QACV,OAAO,EAAE,iBAAiB,MAAM,WAAW;AAAA,QAE1C,gBAAM;AAAA;AAAA,IACT;AAAA,IACA,6CAAC,SAAI,WAAU,yBACb;AAAA,kDAAC,OAAE,WAAU,8CACV,gBAAM,WACT;AAAA,MACA,6CAAC,OAAE,WAAU,kDACV;AAAA,cAAM,QAAQ,eAAe;AAAA,QAAE;AAAA,SAClC;AAAA,OACF;AAAA,KACF;AAGF,SACE,6CAAC,SAAI,eAAW,cAAG,aAAa,SAAS,GACvC;AAAA,iDAAC,SAAI,WAAU,0CACb;AAAA,mDAAC,SAAI,WAAU,uBACb;AAAA,qDAAC,SAAI,WAAU,wCACb;AAAA,sDAAC,iCAAU,WAAU,WAAU;AAAA,UAC/B,4CAAC,UAAK,WAAU,kDAAiD,uBAEjE;AAAA,WACF;AAAA,QACA,4CAAC,yCAAe,SAAkB,OAAO,GAAG,WAAU,WAAU;AAAA,SAClE;AAAA,MACC,OAAO,OACN,4CAAC,YAAAA,SAAA,EAAK,MAAM,MAAM,MAAM,WAAU,8BAC/B,qBACH,IAEA,4CAAC,SAAI,WAAU,YAAY,qBAAU;AAAA,OAEzC;AAAA,IACC,SAAS,MAAM,SAAS,KACvB,4CAAC,SAAI,WAAU,qCACZ,gBAAM,IAAI,CAAC,MAAM,MAChB,4CAAC,YAAiB,QAAH,CAAe,CAC/B,GACH;AAAA,KAEJ;AAEJ;","names":["Link"]}
@@ -0,0 +1,32 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface PortfolioHeaderStat {
4
+ label: string;
5
+ /** Pass null while loading — renders a pulse placeholder. */
6
+ value: string | number | null;
7
+ href?: string;
8
+ /** Primary-tinted chip for counts that need action (e.g. offers received). */
9
+ highlight?: boolean;
10
+ }
11
+ interface PortfolioHeaderScore {
12
+ level: number;
13
+ levelName: string;
14
+ badgeColor: string;
15
+ totalXp: number;
16
+ /** Where the score chip links ("/rewards"). */
17
+ href?: string;
18
+ }
19
+ interface PortfolioHeaderProps {
20
+ address: string;
21
+ stats?: PortfolioHeaderStat[];
22
+ score?: PortfolioHeaderScore | null;
23
+ className?: string;
24
+ }
25
+ /**
26
+ * Compact single-block portfolio header: eyebrow + address on the left, a
27
+ * level/XP score chip on the right, and a row of stat chips beneath. Replaces
28
+ * the stacked identity / stat-pills / ScoreSummaryCard blocks.
29
+ */
30
+ declare function PortfolioHeader({ address, stats, score, className, }: PortfolioHeaderProps): react_jsx_runtime.JSX.Element;
31
+
32
+ export { PortfolioHeader, type PortfolioHeaderProps, type PortfolioHeaderScore, type PortfolioHeaderStat };
@@ -0,0 +1,32 @@
1
+ import * as react_jsx_runtime from 'react/jsx-runtime';
2
+
3
+ interface PortfolioHeaderStat {
4
+ label: string;
5
+ /** Pass null while loading — renders a pulse placeholder. */
6
+ value: string | number | null;
7
+ href?: string;
8
+ /** Primary-tinted chip for counts that need action (e.g. offers received). */
9
+ highlight?: boolean;
10
+ }
11
+ interface PortfolioHeaderScore {
12
+ level: number;
13
+ levelName: string;
14
+ badgeColor: string;
15
+ totalXp: number;
16
+ /** Where the score chip links ("/rewards"). */
17
+ href?: string;
18
+ }
19
+ interface PortfolioHeaderProps {
20
+ address: string;
21
+ stats?: PortfolioHeaderStat[];
22
+ score?: PortfolioHeaderScore | null;
23
+ className?: string;
24
+ }
25
+ /**
26
+ * Compact single-block portfolio header: eyebrow + address on the left, a
27
+ * level/XP score chip on the right, and a row of stat chips beneath. Replaces
28
+ * the stacked identity / stat-pills / ScoreSummaryCard blocks.
29
+ */
30
+ declare function PortfolioHeader({ address, stats, score, className, }: PortfolioHeaderProps): react_jsx_runtime.JSX.Element;
31
+
32
+ export { PortfolioHeader, type PortfolioHeaderProps, type PortfolioHeaderScore, type PortfolioHeaderStat };
@@ -0,0 +1,67 @@
1
+ "use client";
2
+ import { jsx, jsxs } from "react/jsx-runtime";
3
+ import Link from "next/link";
4
+ import { Briefcase } from "lucide-react";
5
+ import { cn } from "../utils/cn.js";
6
+ import { AddressDisplay } from "./address-display.js";
7
+ function StatChip({ stat }) {
8
+ if (stat.value == null) {
9
+ return /* @__PURE__ */ jsx("span", { className: "bg-muted rounded-full px-3 py-1 w-20 h-6 animate-pulse inline-block" });
10
+ }
11
+ const body = /* @__PURE__ */ jsxs(
12
+ "span",
13
+ {
14
+ className: cn(
15
+ "inline-flex items-baseline gap-1.5 rounded-full px-3 py-1 text-sm font-medium",
16
+ stat.highlight ? "bg-primary/10 text-primary" : "bg-muted text-muted-foreground"
17
+ ),
18
+ children: [
19
+ /* @__PURE__ */ jsx("span", { className: "tabular-nums font-semibold text-foreground/90", children: stat.value }),
20
+ stat.label
21
+ ]
22
+ }
23
+ );
24
+ if (!stat.href) return body;
25
+ return /* @__PURE__ */ jsx(Link, { href: stat.href, className: "active:opacity-80", children: body });
26
+ }
27
+ function PortfolioHeader({
28
+ address,
29
+ stats,
30
+ score,
31
+ className
32
+ }) {
33
+ const scoreChip = score && /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2.5 rounded-xl border border-border bg-card px-3 py-2", children: [
34
+ /* @__PURE__ */ jsx(
35
+ "div",
36
+ {
37
+ className: "h-8 w-8 rounded-lg shrink-0 flex items-center justify-center text-sm font-black text-white",
38
+ style: { backgroundColor: score.badgeColor },
39
+ children: score.level
40
+ }
41
+ ),
42
+ /* @__PURE__ */ jsxs("div", { className: "min-w-0 leading-tight", children: [
43
+ /* @__PURE__ */ jsx("p", { className: "text-xs font-bold text-foreground truncate", children: score.levelName }),
44
+ /* @__PURE__ */ jsxs("p", { className: "text-[11px] text-muted-foreground tabular-nums", children: [
45
+ score.totalXp.toLocaleString(),
46
+ " XP"
47
+ ] })
48
+ ] })
49
+ ] });
50
+ return /* @__PURE__ */ jsxs("div", { className: cn("space-y-3", className), children: [
51
+ /* @__PURE__ */ jsxs("div", { className: "flex items-start justify-between gap-4", children: [
52
+ /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 min-w-0", children: [
53
+ /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-primary", children: [
54
+ /* @__PURE__ */ jsx(Briefcase, { className: "h-4 w-4" }),
55
+ /* @__PURE__ */ jsx("span", { className: "text-xs font-semibold uppercase tracking-wider", children: "Portfolio" })
56
+ ] }),
57
+ /* @__PURE__ */ jsx(AddressDisplay, { address, chars: 6, className: "text-sm" })
58
+ ] }),
59
+ score?.href ? /* @__PURE__ */ jsx(Link, { href: score.href, className: "shrink-0 active:opacity-80", children: scoreChip }) : /* @__PURE__ */ jsx("div", { className: "shrink-0", children: scoreChip })
60
+ ] }),
61
+ stats && stats.length > 0 && /* @__PURE__ */ jsx("div", { className: "flex items-center gap-2 flex-wrap", children: stats.map((stat, i) => /* @__PURE__ */ jsx(StatChip, { stat }, i)) })
62
+ ] });
63
+ }
64
+ export {
65
+ PortfolioHeader
66
+ };
67
+ //# sourceMappingURL=portfolio-header.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/portfolio-header.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"next/link\";\nimport { Briefcase } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { AddressDisplay } from \"./address-display.js\";\n\nexport interface PortfolioHeaderStat {\n label: string;\n /** Pass null while loading — renders a pulse placeholder. */\n value: string | number | null;\n href?: string;\n /** Primary-tinted chip for counts that need action (e.g. offers received). */\n highlight?: boolean;\n}\n\nexport interface PortfolioHeaderScore {\n level: number;\n levelName: string;\n badgeColor: string;\n totalXp: number;\n /** Where the score chip links (\"/rewards\"). */\n href?: string;\n}\n\nexport interface PortfolioHeaderProps {\n address: string;\n stats?: PortfolioHeaderStat[];\n score?: PortfolioHeaderScore | null;\n className?: string;\n}\n\nfunction StatChip({ stat }: { stat: PortfolioHeaderStat }) {\n if (stat.value == null) {\n return (\n <span className=\"bg-muted rounded-full px-3 py-1 w-20 h-6 animate-pulse inline-block\" />\n );\n }\n const body = (\n <span\n className={cn(\n \"inline-flex items-baseline gap-1.5 rounded-full px-3 py-1 text-sm font-medium\",\n stat.highlight\n ? \"bg-primary/10 text-primary\"\n : \"bg-muted text-muted-foreground\",\n )}\n >\n <span className=\"tabular-nums font-semibold text-foreground/90\">\n {stat.value}\n </span>\n {stat.label}\n </span>\n );\n if (!stat.href) return body;\n return (\n <Link href={stat.href} className=\"active:opacity-80\">\n {body}\n </Link>\n );\n}\n\n/**\n * Compact single-block portfolio header: eyebrow + address on the left, a\n * level/XP score chip on the right, and a row of stat chips beneath. Replaces\n * the stacked identity / stat-pills / ScoreSummaryCard blocks.\n */\nexport function PortfolioHeader({\n address,\n stats,\n score,\n className,\n}: PortfolioHeaderProps) {\n const scoreChip = score && (\n <div className=\"flex items-center gap-2.5 rounded-xl border border-border bg-card px-3 py-2\">\n <div\n className=\"h-8 w-8 rounded-lg shrink-0 flex items-center justify-center text-sm font-black text-white\"\n style={{ backgroundColor: score.badgeColor }}\n >\n {score.level}\n </div>\n <div className=\"min-w-0 leading-tight\">\n <p className=\"text-xs font-bold text-foreground truncate\">\n {score.levelName}\n </p>\n <p className=\"text-[11px] text-muted-foreground tabular-nums\">\n {score.totalXp.toLocaleString()} XP\n </p>\n </div>\n </div>\n );\n\n return (\n <div className={cn(\"space-y-3\", className)}>\n <div className=\"flex items-start justify-between gap-4\">\n <div className=\"space-y-1.5 min-w-0\">\n <div className=\"flex items-center gap-2 text-primary\">\n <Briefcase className=\"h-4 w-4\" />\n <span className=\"text-xs font-semibold uppercase tracking-wider\">\n Portfolio\n </span>\n </div>\n <AddressDisplay address={address} chars={6} className=\"text-sm\" />\n </div>\n {score?.href ? (\n <Link href={score.href} className=\"shrink-0 active:opacity-80\">\n {scoreChip}\n </Link>\n ) : (\n <div className=\"shrink-0\">{scoreChip}</div>\n )}\n </div>\n {stats && stats.length > 0 && (\n <div className=\"flex items-center gap-2 flex-wrap\">\n {stats.map((stat, i) => (\n <StatChip key={i} stat={stat} />\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";AAmCM,cAIF,YAJE;AAjCN,OAAO,UAAU;AACjB,SAAS,iBAAiB;AAC1B,SAA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AM,MAAM,MAAM,WAAU,8BAC/B,qBACH,IAEA,oBAAC,SAAI,WAAU,YAAY,qBAAU;AAAA,OAEzC;AAAA,IACC,SAAS,MAAM,SAAS,KACvB,oBAAC,SAAI,WAAU,qCACZ,gBAAM,IAAI,CAAC,MAAM,MAChB,oBAAC,YAAiB,QAAH,CAAe,CAC/B,GACH;AAAA,KAEJ;AAEJ;","names":[]}
@@ -0,0 +1,128 @@
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 portfolio_nav_exports = {};
31
+ __export(portfolio_nav_exports, {
32
+ PortfolioNav: () => PortfolioNav
33
+ });
34
+ module.exports = __toCommonJS(portfolio_nav_exports);
35
+ var import_jsx_runtime = require("react/jsx-runtime");
36
+ var import_link = __toESM(require("next/link"), 1);
37
+ var import_cn = require("../utils/cn.js");
38
+ const BADGE_VARIANT_CLASS = {
39
+ destructive: "bg-destructive text-destructive-foreground",
40
+ primary: "bg-primary text-primary-foreground",
41
+ warning: "bg-amber-500 text-white"
42
+ };
43
+ function CountBadge({
44
+ count,
45
+ variant
46
+ }) {
47
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
48
+ "span",
49
+ {
50
+ className: (0, import_cn.cn)(
51
+ "h-4 min-w-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1",
52
+ BADGE_VARIANT_CLASS[variant ?? "primary"]
53
+ ),
54
+ children: count
55
+ }
56
+ );
57
+ }
58
+ function matches(pathname, href) {
59
+ return pathname === href || pathname.startsWith(href + "/");
60
+ }
61
+ function PortfolioNav({
62
+ sections,
63
+ pathname,
64
+ badgeCounts = {},
65
+ className
66
+ }) {
67
+ const count = (badge) => badge ? badgeCounts[badge.key] ?? 0 : 0;
68
+ let activeSection = null;
69
+ let bestLen = -1;
70
+ for (const section of sections) {
71
+ const hrefs = [section.href, ...(section.children ?? []).map((c) => c.href)];
72
+ for (const href of hrefs) {
73
+ if (matches(pathname, href) && href.length > bestLen) {
74
+ bestLen = href.length;
75
+ activeSection = section;
76
+ }
77
+ }
78
+ }
79
+ const edgeBleed = "overflow-x-auto scrollbar-hide -mx-4 px-4 sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8";
80
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className, children: [
81
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: (0, import_cn.cn)(edgeBleed, "border-b border-border/60"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center min-w-max", children: sections.map((section) => {
82
+ const active = section === activeSection;
83
+ const rollup = (section.children ?? []).reduce(
84
+ (sum, child) => sum + count(child.badge),
85
+ 0
86
+ );
87
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
88
+ import_link.default,
89
+ {
90
+ href: section.href,
91
+ className: (0, import_cn.cn)(
92
+ "relative flex items-center gap-1.5 px-3 py-2.5 text-sm whitespace-nowrap transition-colors shrink-0 border-b-2 min-h-10",
93
+ active ? "border-primary text-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"
94
+ ),
95
+ children: [
96
+ section.label,
97
+ rollup > 0 && !active && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountBadge, { count: rollup, variant: "destructive" })
98
+ ]
99
+ },
100
+ section.href
101
+ );
102
+ }) }) }),
103
+ activeSection?.children && activeSection.children.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("nav", { className: (0, import_cn.cn)(edgeBleed, "pt-3"), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "flex items-center min-w-max gap-1.5", children: activeSection.children.map((child) => {
104
+ const active = matches(pathname, child.href);
105
+ const childCount = count(child.badge);
106
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
107
+ import_link.default,
108
+ {
109
+ href: child.href,
110
+ className: (0, import_cn.cn)(
111
+ "flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-[13px] whitespace-nowrap transition-colors shrink-0",
112
+ active ? "bg-primary text-primary-foreground font-medium" : "bg-muted text-muted-foreground hover:text-foreground"
113
+ ),
114
+ children: [
115
+ child.label,
116
+ child.badge && childCount > 0 && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(CountBadge, { count: childCount, variant: child.badge.variant })
117
+ ]
118
+ },
119
+ child.href
120
+ );
121
+ }) }) })
122
+ ] });
123
+ }
124
+ // Annotate the CommonJS export names for ESM import in node:
125
+ 0 && (module.exports = {
126
+ PortfolioNav
127
+ });
128
+ //# sourceMappingURL=portfolio-nav.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/components/portfolio-nav.tsx"],"sourcesContent":["\"use client\";\n\nimport Link from \"next/link\";\nimport { cn } from \"../utils/cn.js\";\n\nexport type PortfolioBadgeVariant = \"destructive\" | \"primary\" | \"warning\";\n\nexport interface PortfolioNavChild {\n label: string;\n href: string;\n /** Optional count badge. `key` indexes `badgeCounts`; `variant` sets color. */\n badge?: { key: string; variant?: PortfolioBadgeVariant };\n}\n\nexport interface PortfolioNavSection {\n label: string;\n /** Where the top-level tab links. For sections with children this is the first child. */\n href: string;\n /** Inner segments rendered as a pill row when the section is active. */\n children?: PortfolioNavChild[];\n}\n\nexport interface PortfolioNavProps {\n sections: PortfolioNavSection[];\n /** Current pathname — caller passes `usePathname()`. */\n pathname: string;\n /** Badge counts keyed by `child.badge.key`. A badge renders only when > 0. */\n badgeCounts?: Record<string, number>;\n className?: string;\n}\n\nconst BADGE_VARIANT_CLASS: Record<PortfolioBadgeVariant, string> = {\n destructive: \"bg-destructive text-destructive-foreground\",\n primary: \"bg-primary text-primary-foreground\",\n warning: \"bg-amber-500 text-white\",\n};\n\nfunction CountBadge({\n count,\n variant,\n}: {\n count: number;\n variant?: PortfolioBadgeVariant;\n}) {\n return (\n <span\n className={cn(\n \"h-4 min-w-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1\",\n BADGE_VARIANT_CLASS[variant ?? \"primary\"],\n )}\n >\n {count}\n </span>\n );\n}\n\nfunction matches(pathname: string, href: string): boolean {\n return pathname === href || pathname.startsWith(href + \"/\");\n}\n\n/**\n * Two-level portfolio navigation: top-level underline tabs + a segmented pill\n * row when the active section has children. The active section is resolved by\n * the longest href match across section hrefs and child hrefs, so a root\n * \"Overview\" section (`/portfolio`) doesn't swallow every route.\n */\nexport function PortfolioNav({\n sections,\n pathname,\n badgeCounts = {},\n className,\n}: PortfolioNavProps) {\n const count = (badge?: { key: string }) =>\n badge ? (badgeCounts[badge.key] ?? 0) : 0;\n\n // Longest-match resolution of the active section.\n let activeSection: PortfolioNavSection | null = null;\n let bestLen = -1;\n for (const section of sections) {\n const hrefs = [section.href, ...(section.children ?? []).map((c) => c.href)];\n for (const href of hrefs) {\n if (matches(pathname, href) && href.length > bestLen) {\n bestLen = href.length;\n activeSection = section;\n }\n }\n }\n\n const edgeBleed =\n \"overflow-x-auto scrollbar-hide -mx-4 px-4 sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8\";\n\n return (\n <div className={className}>\n <nav className={cn(edgeBleed, \"border-b border-border/60\")}>\n <div className=\"flex items-center min-w-max\">\n {sections.map((section) => {\n const active = section === activeSection;\n // Rolled-up pending count across the section's children.\n const rollup = (section.children ?? []).reduce(\n (sum, child) => sum + count(child.badge),\n 0,\n );\n return (\n <Link\n key={section.href}\n href={section.href}\n className={cn(\n \"relative flex items-center gap-1.5 px-3 py-2.5 text-sm whitespace-nowrap transition-colors shrink-0 border-b-2 min-h-10\",\n active\n ? \"border-primary text-foreground font-medium\"\n : \"border-transparent text-muted-foreground hover:text-foreground\",\n )}\n >\n {section.label}\n {rollup > 0 && !active && (\n <CountBadge count={rollup} variant=\"destructive\" />\n )}\n </Link>\n );\n })}\n </div>\n </nav>\n {activeSection?.children && activeSection.children.length > 0 && (\n <nav className={cn(edgeBleed, \"pt-3\")}>\n <div className=\"flex items-center min-w-max gap-1.5\">\n {activeSection.children.map((child) => {\n const active = matches(pathname, child.href);\n const childCount = count(child.badge);\n return (\n <Link\n key={child.href}\n href={child.href}\n className={cn(\n \"flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-[13px] whitespace-nowrap transition-colors shrink-0\",\n active\n ? \"bg-primary text-primary-foreground font-medium\"\n : \"bg-muted text-muted-foreground hover:text-foreground\",\n )}\n >\n {child.label}\n {child.badge && childCount > 0 && (\n <CountBadge count={childCount} variant={child.badge.variant} />\n )}\n </Link>\n );\n })}\n </div>\n </nav>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AA6CI;AA3CJ,kBAAiB;AACjB,gBAAmB;AA4BnB,MAAM,sBAA6D;AAAA,EACjE,aAAa;AAAA,EACb,S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