@medialane/ui 0.58.0 → 0.60.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/portfolio-header.cjs +76 -0
- package/dist/components/portfolio-header.cjs.map +1 -0
- package/dist/components/portfolio-header.d.cts +23 -0
- package/dist/components/portfolio-header.d.ts +23 -0
- package/dist/components/portfolio-header.js +42 -0
- package/dist/components/portfolio-header.js.map +1 -0
- package/dist/components/portfolio-nav.cjs +128 -0
- package/dist/components/portfolio-nav.cjs.map +1 -0
- package/dist/components/portfolio-nav.d.cts +36 -0
- package/dist/components/portfolio-nav.d.ts +36 -0
- package/dist/components/portfolio-nav.js +94 -0
- package/dist/components/portfolio-nav.js.map +1 -0
- package/dist/components/portfolio-overview.cjs +160 -0
- package/dist/components/portfolio-overview.cjs.map +1 -0
- package/dist/components/portfolio-overview.d.cts +47 -0
- package/dist/components/portfolio-overview.d.ts +47 -0
- package/dist/components/portfolio-overview.js +126 -0
- package/dist/components/portfolio-overview.js.map +1 -0
- package/dist/index.cjs +9 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +6 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/components/portfolio-subnav.cjs +0 -94
- package/dist/components/portfolio-subnav.cjs.map +0 -1
- package/dist/components/portfolio-subnav.d.cts +0 -27
- package/dist/components/portfolio-subnav.d.ts +0 -27
- package/dist/components/portfolio-subnav.js +0 -60
- package/dist/components/portfolio-subnav.js.map +0 -1
|
@@ -0,0 +1,76 @@
|
|
|
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 PortfolioHeader({
|
|
41
|
+
address,
|
|
42
|
+
score,
|
|
43
|
+
className
|
|
44
|
+
}) {
|
|
45
|
+
const scoreChip = score && /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "btn-border-animated p-[1.5px] rounded-2xl", children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "rounded-[14px] bg-card px-4 py-2.5 flex items-center gap-3", children: [
|
|
46
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className: "h-8 w-8 rounded-full shrink-0 flex items-center justify-center bg-gradient-to-br from-brand-blue via-brand-purple to-brand-rose", children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Sparkles, { className: "h-4 w-4 text-white" }) }),
|
|
47
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "min-w-0 leading-tight", children: [
|
|
48
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("p", { className: "text-sm font-bold gradient-text-full truncate", children: score.levelName }),
|
|
49
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("p", { className: "text-[11px] text-muted-foreground tabular-nums", children: [
|
|
50
|
+
score.totalXp.toLocaleString(),
|
|
51
|
+
" XP"
|
|
52
|
+
] })
|
|
53
|
+
] })
|
|
54
|
+
] }) });
|
|
55
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
56
|
+
"div",
|
|
57
|
+
{
|
|
58
|
+
className: (0, import_cn.cn)("flex items-start justify-between gap-4", className),
|
|
59
|
+
children: [
|
|
60
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "space-y-1.5 min-w-0", children: [
|
|
61
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className: "flex items-center gap-2 text-primary", children: [
|
|
62
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_lucide_react.Briefcase, { className: "h-4 w-4" }),
|
|
63
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)("span", { className: "text-xs font-semibold uppercase tracking-wider", children: "Portfolio" })
|
|
64
|
+
] }),
|
|
65
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_address_display.AddressDisplay, { address, chars: 6, className: "text-sm" })
|
|
66
|
+
] }),
|
|
67
|
+
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 })
|
|
68
|
+
]
|
|
69
|
+
}
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
73
|
+
0 && (module.exports = {
|
|
74
|
+
PortfolioHeader
|
|
75
|
+
});
|
|
76
|
+
//# 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, Sparkles } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { AddressDisplay } from \"./address-display.js\";\n\nexport interface PortfolioHeaderScore {\n /** Journey level name (\"Starter\", \"Explorer\", …) — no numeric level shown. */\n levelName: string;\n totalXp: number;\n /** Where the score chip links (\"/rewards\"). */\n href?: string;\n}\n\nexport interface PortfolioHeaderProps {\n address: string;\n score?: PortfolioHeaderScore | null;\n className?: string;\n}\n\n/**\n * Compact portfolio header: eyebrow + address on the left, the rewards\n * journey chip on the right — level name + XP inside the animated\n * full-spectrum brand border (`.btn-border-animated`). Counts live in the\n * Overview stat tiles, not here.\n */\nexport function PortfolioHeader({\n address,\n score,\n className,\n}: PortfolioHeaderProps) {\n const scoreChip = score && (\n <div className=\"btn-border-animated p-[1.5px] rounded-2xl\">\n <div className=\"rounded-[14px] bg-card px-4 py-2.5 flex items-center gap-3\">\n <div className=\"h-8 w-8 rounded-full shrink-0 flex items-center justify-center bg-gradient-to-br from-brand-blue via-brand-purple to-brand-rose\">\n <Sparkles className=\"h-4 w-4 text-white\" />\n </div>\n <div className=\"min-w-0 leading-tight\">\n <p className=\"text-sm font-bold gradient-text-full 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 </div>\n );\n\n return (\n <div\n className={cn(\"flex items-start justify-between gap-4\", className)}\n >\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 );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAoCU;AAlCV,kBAAiB;AACjB,0BAAoC;AACpC,gBAAmB;AACnB,6BAA+B;AAsBxB,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,YAAY,SAChB,4CAAC,SAAI,WAAU,6CACb,uDAAC,SAAI,WAAU,8DACb;AAAA,gDAAC,SAAI,WAAU,mIACb,sDAAC,gCAAS,WAAU,sBAAqB,GAC3C;AAAA,IACA,6CAAC,SAAI,WAAU,yBACb;AAAA,kDAAC,OAAE,WAAU,iDACV,gBAAM,WACT;AAAA,MACA,6CAAC,OAAE,WAAU,kDACV;AAAA,cAAM,QAAQ,eAAe;AAAA,QAAE;AAAA,SAClC;AAAA,OACF;AAAA,KACF,GACF;AAGF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,eAAW,cAAG,0CAA0C,SAAS;AAAA,MAEjE;AAAA,qDAAC,SAAI,WAAU,uBACb;AAAA,uDAAC,SAAI,WAAU,wCACb;AAAA,wDAAC,iCAAU,WAAU,WAAU;AAAA,YAC/B,4CAAC,UAAK,WAAU,kDAAiD,uBAEjE;AAAA,aACF;AAAA,UACA,4CAAC,yCAAe,SAAkB,OAAO,GAAG,WAAU,WAAU;AAAA,WAClE;AAAA,QACC,OAAO,OACN,4CAAC,YAAAA,SAAA,EAAK,MAAM,MAAM,MAAM,WAAU,8BAC/B,qBACH,IAEA,4CAAC,SAAI,WAAU,YAAY,qBAAU;AAAA;AAAA;AAAA,EAEzC;AAEJ;","names":["Link"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface PortfolioHeaderScore {
|
|
4
|
+
/** Journey level name ("Starter", "Explorer", …) — no numeric level shown. */
|
|
5
|
+
levelName: string;
|
|
6
|
+
totalXp: number;
|
|
7
|
+
/** Where the score chip links ("/rewards"). */
|
|
8
|
+
href?: string;
|
|
9
|
+
}
|
|
10
|
+
interface PortfolioHeaderProps {
|
|
11
|
+
address: string;
|
|
12
|
+
score?: PortfolioHeaderScore | null;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Compact portfolio header: eyebrow + address on the left, the rewards
|
|
17
|
+
* journey chip on the right — level name + XP inside the animated
|
|
18
|
+
* full-spectrum brand border (`.btn-border-animated`). Counts live in the
|
|
19
|
+
* Overview stat tiles, not here.
|
|
20
|
+
*/
|
|
21
|
+
declare function PortfolioHeader({ address, score, className, }: PortfolioHeaderProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { PortfolioHeader, type PortfolioHeaderProps, type PortfolioHeaderScore };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
interface PortfolioHeaderScore {
|
|
4
|
+
/** Journey level name ("Starter", "Explorer", …) — no numeric level shown. */
|
|
5
|
+
levelName: string;
|
|
6
|
+
totalXp: number;
|
|
7
|
+
/** Where the score chip links ("/rewards"). */
|
|
8
|
+
href?: string;
|
|
9
|
+
}
|
|
10
|
+
interface PortfolioHeaderProps {
|
|
11
|
+
address: string;
|
|
12
|
+
score?: PortfolioHeaderScore | null;
|
|
13
|
+
className?: string;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Compact portfolio header: eyebrow + address on the left, the rewards
|
|
17
|
+
* journey chip on the right — level name + XP inside the animated
|
|
18
|
+
* full-spectrum brand border (`.btn-border-animated`). Counts live in the
|
|
19
|
+
* Overview stat tiles, not here.
|
|
20
|
+
*/
|
|
21
|
+
declare function PortfolioHeader({ address, score, className, }: PortfolioHeaderProps): react_jsx_runtime.JSX.Element;
|
|
22
|
+
|
|
23
|
+
export { PortfolioHeader, type PortfolioHeaderProps, type PortfolioHeaderScore };
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { Briefcase, Sparkles } from "lucide-react";
|
|
5
|
+
import { cn } from "../utils/cn.js";
|
|
6
|
+
import { AddressDisplay } from "./address-display.js";
|
|
7
|
+
function PortfolioHeader({
|
|
8
|
+
address,
|
|
9
|
+
score,
|
|
10
|
+
className
|
|
11
|
+
}) {
|
|
12
|
+
const scoreChip = score && /* @__PURE__ */ jsx("div", { className: "btn-border-animated p-[1.5px] rounded-2xl", children: /* @__PURE__ */ jsxs("div", { className: "rounded-[14px] bg-card px-4 py-2.5 flex items-center gap-3", children: [
|
|
13
|
+
/* @__PURE__ */ jsx("div", { className: "h-8 w-8 rounded-full shrink-0 flex items-center justify-center bg-gradient-to-br from-brand-blue via-brand-purple to-brand-rose", children: /* @__PURE__ */ jsx(Sparkles, { className: "h-4 w-4 text-white" }) }),
|
|
14
|
+
/* @__PURE__ */ jsxs("div", { className: "min-w-0 leading-tight", children: [
|
|
15
|
+
/* @__PURE__ */ jsx("p", { className: "text-sm font-bold gradient-text-full truncate", children: score.levelName }),
|
|
16
|
+
/* @__PURE__ */ jsxs("p", { className: "text-[11px] text-muted-foreground tabular-nums", children: [
|
|
17
|
+
score.totalXp.toLocaleString(),
|
|
18
|
+
" XP"
|
|
19
|
+
] })
|
|
20
|
+
] })
|
|
21
|
+
] }) });
|
|
22
|
+
return /* @__PURE__ */ jsxs(
|
|
23
|
+
"div",
|
|
24
|
+
{
|
|
25
|
+
className: cn("flex items-start justify-between gap-4", className),
|
|
26
|
+
children: [
|
|
27
|
+
/* @__PURE__ */ jsxs("div", { className: "space-y-1.5 min-w-0", children: [
|
|
28
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-primary", children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Briefcase, { className: "h-4 w-4" }),
|
|
30
|
+
/* @__PURE__ */ jsx("span", { className: "text-xs font-semibold uppercase tracking-wider", children: "Portfolio" })
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ jsx(AddressDisplay, { address, chars: 6, className: "text-sm" })
|
|
33
|
+
] }),
|
|
34
|
+
score?.href ? /* @__PURE__ */ jsx(Link, { href: score.href, className: "shrink-0 active:opacity-80", children: scoreChip }) : /* @__PURE__ */ jsx("div", { className: "shrink-0", children: scoreChip })
|
|
35
|
+
]
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
export {
|
|
40
|
+
PortfolioHeader
|
|
41
|
+
};
|
|
42
|
+
//# 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, Sparkles } from \"lucide-react\";\nimport { cn } from \"../utils/cn.js\";\nimport { AddressDisplay } from \"./address-display.js\";\n\nexport interface PortfolioHeaderScore {\n /** Journey level name (\"Starter\", \"Explorer\", …) — no numeric level shown. */\n levelName: string;\n totalXp: number;\n /** Where the score chip links (\"/rewards\"). */\n href?: string;\n}\n\nexport interface PortfolioHeaderProps {\n address: string;\n score?: PortfolioHeaderScore | null;\n className?: string;\n}\n\n/**\n * Compact portfolio header: eyebrow + address on the left, the rewards\n * journey chip on the right — level name + XP inside the animated\n * full-spectrum brand border (`.btn-border-animated`). Counts live in the\n * Overview stat tiles, not here.\n */\nexport function PortfolioHeader({\n address,\n score,\n className,\n}: PortfolioHeaderProps) {\n const scoreChip = score && (\n <div className=\"btn-border-animated p-[1.5px] rounded-2xl\">\n <div className=\"rounded-[14px] bg-card px-4 py-2.5 flex items-center gap-3\">\n <div className=\"h-8 w-8 rounded-full shrink-0 flex items-center justify-center bg-gradient-to-br from-brand-blue via-brand-purple to-brand-rose\">\n <Sparkles className=\"h-4 w-4 text-white\" />\n </div>\n <div className=\"min-w-0 leading-tight\">\n <p className=\"text-sm font-bold gradient-text-full 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 </div>\n );\n\n return (\n <div\n className={cn(\"flex items-start justify-between gap-4\", className)}\n >\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 );\n}\n"],"mappings":";AAoCU,cAMA,YANA;AAlCV,OAAO,UAAU;AACjB,SAAS,WAAW,gBAAgB;AACpC,SAAS,UAAU;AACnB,SAAS,sBAAsB;AAsBxB,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,YAAY,SAChB,oBAAC,SAAI,WAAU,6CACb,+BAAC,SAAI,WAAU,8DACb;AAAA,wBAAC,SAAI,WAAU,mIACb,8BAAC,YAAS,WAAU,sBAAqB,GAC3C;AAAA,IACA,qBAAC,SAAI,WAAU,yBACb;AAAA,0BAAC,OAAE,WAAU,iDACV,gBAAM,WACT;AAAA,MACA,qBAAC,OAAE,WAAU,kDACV;AAAA,cAAM,QAAQ,eAAe;AAAA,QAAE;AAAA,SAClC;AAAA,OACF;AAAA,KACF,GACF;AAGF,SACE;AAAA,IAAC;AAAA;AAAA,MACC,WAAW,GAAG,0CAA0C,SAAS;AAAA,MAEjE;AAAA,6BAAC,SAAI,WAAU,uBACb;AAAA,+BAAC,SAAI,WAAU,wCACb;AAAA,gCAAC,aAAU,WAAU,WAAU;AAAA,YAC/B,oBAAC,UAAK,WAAU,kDAAiD,uBAEjE;AAAA,aACF;AAAA,UACA,oBAAC,kBAAe,SAAkB,OAAO,GAAG,WAAU,WAAU;AAAA,WAClE;AAAA,QACC,OAAO,OACN,oBAAC,QAAK,MAAM,MAAM,MAAM,WAAU,8BAC/B,qBACH,IAEA,oBAAC,SAAI,WAAU,YAAY,qBAAU;AAAA;AAAA;AAAA,EAEzC;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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AAU,MAAM,MAAM,MAAM,KAAK;AAAA,QACvC;AAAA,MACF;AACA,aACE;AAAA,QAAC,YAAAA;AAAA,QAAA;AAAA,UAEC,MAAM,QAAQ;AAAA,UACd,eAAW;AAAA,YACT;AAAA,YACA,SACI,+CACA;AAAA,UACN;AAAA,UAEC;AAAA,oBAAQ;AAAA,YACR,SAAS,KAAK,CAAC,UACd,4CAAC,cAAW,OAAO,QAAQ,SAAQ,eAAc;AAAA;AAAA;AAAA,QAX9C,QAAQ;AAAA,MAaf;AAAA,IAEJ,CAAC,GACH,GACF;AAAA,IACC,eAAe,YAAY,cAAc,SAAS,SAAS,KAC1D,4CAAC,SAAI,eAAW,cAAG,WAAW,MAAM,GAClC,sDAAC,SAAI,WAAU,uCACZ,wBAAc,SAAS,IAAI,CAAC,UAAU;AACrC,YAAM,SAAS,QAAQ,UAAU,MAAM,IAAI;AAC3C,YAAM,aAAa,MAAM,MAAM,KAAK;AACpC,aACE;AAAA,QAAC,YAAAA;AAAA,QAAA;AAAA,UAEC,MAAM,MAAM;AAAA,UACZ,eAAW;AAAA,YACT;AAAA,YACA,SACI,mDACA;AAAA,UACN;AAAA,UAEC;AAAA,kBAAM;AAAA,YACN,MAAM,SAAS,aAAa,KAC3B,4CAAC,cAAW,OAAO,YAAY,SAAS,MAAM,MAAM,SAAS;AAAA;AAAA;AAAA,QAX1D,MAAM;AAAA,MAab;AAAA,IAEJ,CAAC,GACH,GACF;AAAA,KAEJ;AAEJ;","names":["Link"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type PortfolioBadgeVariant = "destructive" | "primary" | "warning";
|
|
4
|
+
interface PortfolioNavChild {
|
|
5
|
+
label: string;
|
|
6
|
+
href: string;
|
|
7
|
+
/** Optional count badge. `key` indexes `badgeCounts`; `variant` sets color. */
|
|
8
|
+
badge?: {
|
|
9
|
+
key: string;
|
|
10
|
+
variant?: PortfolioBadgeVariant;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface PortfolioNavSection {
|
|
14
|
+
label: string;
|
|
15
|
+
/** Where the top-level tab links. For sections with children this is the first child. */
|
|
16
|
+
href: string;
|
|
17
|
+
/** Inner segments rendered as a pill row when the section is active. */
|
|
18
|
+
children?: PortfolioNavChild[];
|
|
19
|
+
}
|
|
20
|
+
interface PortfolioNavProps {
|
|
21
|
+
sections: PortfolioNavSection[];
|
|
22
|
+
/** Current pathname — caller passes `usePathname()`. */
|
|
23
|
+
pathname: string;
|
|
24
|
+
/** Badge counts keyed by `child.badge.key`. A badge renders only when > 0. */
|
|
25
|
+
badgeCounts?: Record<string, number>;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Two-level portfolio navigation: top-level underline tabs + a segmented pill
|
|
30
|
+
* row when the active section has children. The active section is resolved by
|
|
31
|
+
* the longest href match across section hrefs and child hrefs, so a root
|
|
32
|
+
* "Overview" section (`/portfolio`) doesn't swallow every route.
|
|
33
|
+
*/
|
|
34
|
+
declare function PortfolioNav({ sections, pathname, badgeCounts, className, }: PortfolioNavProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { type PortfolioBadgeVariant, PortfolioNav, type PortfolioNavChild, type PortfolioNavProps, type PortfolioNavSection };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
|
+
|
|
3
|
+
type PortfolioBadgeVariant = "destructive" | "primary" | "warning";
|
|
4
|
+
interface PortfolioNavChild {
|
|
5
|
+
label: string;
|
|
6
|
+
href: string;
|
|
7
|
+
/** Optional count badge. `key` indexes `badgeCounts`; `variant` sets color. */
|
|
8
|
+
badge?: {
|
|
9
|
+
key: string;
|
|
10
|
+
variant?: PortfolioBadgeVariant;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
interface PortfolioNavSection {
|
|
14
|
+
label: string;
|
|
15
|
+
/** Where the top-level tab links. For sections with children this is the first child. */
|
|
16
|
+
href: string;
|
|
17
|
+
/** Inner segments rendered as a pill row when the section is active. */
|
|
18
|
+
children?: PortfolioNavChild[];
|
|
19
|
+
}
|
|
20
|
+
interface PortfolioNavProps {
|
|
21
|
+
sections: PortfolioNavSection[];
|
|
22
|
+
/** Current pathname — caller passes `usePathname()`. */
|
|
23
|
+
pathname: string;
|
|
24
|
+
/** Badge counts keyed by `child.badge.key`. A badge renders only when > 0. */
|
|
25
|
+
badgeCounts?: Record<string, number>;
|
|
26
|
+
className?: string;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Two-level portfolio navigation: top-level underline tabs + a segmented pill
|
|
30
|
+
* row when the active section has children. The active section is resolved by
|
|
31
|
+
* the longest href match across section hrefs and child hrefs, so a root
|
|
32
|
+
* "Overview" section (`/portfolio`) doesn't swallow every route.
|
|
33
|
+
*/
|
|
34
|
+
declare function PortfolioNav({ sections, pathname, badgeCounts, className, }: PortfolioNavProps): react_jsx_runtime.JSX.Element;
|
|
35
|
+
|
|
36
|
+
export { type PortfolioBadgeVariant, PortfolioNav, type PortfolioNavChild, type PortfolioNavProps, type PortfolioNavSection };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import Link from "next/link";
|
|
4
|
+
import { cn } from "../utils/cn.js";
|
|
5
|
+
const BADGE_VARIANT_CLASS = {
|
|
6
|
+
destructive: "bg-destructive text-destructive-foreground",
|
|
7
|
+
primary: "bg-primary text-primary-foreground",
|
|
8
|
+
warning: "bg-amber-500 text-white"
|
|
9
|
+
};
|
|
10
|
+
function CountBadge({
|
|
11
|
+
count,
|
|
12
|
+
variant
|
|
13
|
+
}) {
|
|
14
|
+
return /* @__PURE__ */ jsx(
|
|
15
|
+
"span",
|
|
16
|
+
{
|
|
17
|
+
className: cn(
|
|
18
|
+
"h-4 min-w-4 rounded-full text-[10px] font-bold flex items-center justify-center px-1",
|
|
19
|
+
BADGE_VARIANT_CLASS[variant ?? "primary"]
|
|
20
|
+
),
|
|
21
|
+
children: count
|
|
22
|
+
}
|
|
23
|
+
);
|
|
24
|
+
}
|
|
25
|
+
function matches(pathname, href) {
|
|
26
|
+
return pathname === href || pathname.startsWith(href + "/");
|
|
27
|
+
}
|
|
28
|
+
function PortfolioNav({
|
|
29
|
+
sections,
|
|
30
|
+
pathname,
|
|
31
|
+
badgeCounts = {},
|
|
32
|
+
className
|
|
33
|
+
}) {
|
|
34
|
+
const count = (badge) => badge ? badgeCounts[badge.key] ?? 0 : 0;
|
|
35
|
+
let activeSection = null;
|
|
36
|
+
let bestLen = -1;
|
|
37
|
+
for (const section of sections) {
|
|
38
|
+
const hrefs = [section.href, ...(section.children ?? []).map((c) => c.href)];
|
|
39
|
+
for (const href of hrefs) {
|
|
40
|
+
if (matches(pathname, href) && href.length > bestLen) {
|
|
41
|
+
bestLen = href.length;
|
|
42
|
+
activeSection = section;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const edgeBleed = "overflow-x-auto scrollbar-hide -mx-4 px-4 sm:-mx-6 sm:px-6 lg:-mx-8 lg:px-8";
|
|
47
|
+
return /* @__PURE__ */ jsxs("div", { className, children: [
|
|
48
|
+
/* @__PURE__ */ jsx("nav", { className: cn(edgeBleed, "border-b border-border/60"), children: /* @__PURE__ */ jsx("div", { className: "flex items-center min-w-max", children: sections.map((section) => {
|
|
49
|
+
const active = section === activeSection;
|
|
50
|
+
const rollup = (section.children ?? []).reduce(
|
|
51
|
+
(sum, child) => sum + count(child.badge),
|
|
52
|
+
0
|
|
53
|
+
);
|
|
54
|
+
return /* @__PURE__ */ jsxs(
|
|
55
|
+
Link,
|
|
56
|
+
{
|
|
57
|
+
href: section.href,
|
|
58
|
+
className: cn(
|
|
59
|
+
"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",
|
|
60
|
+
active ? "border-primary text-foreground font-medium" : "border-transparent text-muted-foreground hover:text-foreground"
|
|
61
|
+
),
|
|
62
|
+
children: [
|
|
63
|
+
section.label,
|
|
64
|
+
rollup > 0 && !active && /* @__PURE__ */ jsx(CountBadge, { count: rollup, variant: "destructive" })
|
|
65
|
+
]
|
|
66
|
+
},
|
|
67
|
+
section.href
|
|
68
|
+
);
|
|
69
|
+
}) }) }),
|
|
70
|
+
activeSection?.children && activeSection.children.length > 0 && /* @__PURE__ */ jsx("nav", { className: cn(edgeBleed, "pt-3"), children: /* @__PURE__ */ jsx("div", { className: "flex items-center min-w-max gap-1.5", children: activeSection.children.map((child) => {
|
|
71
|
+
const active = matches(pathname, child.href);
|
|
72
|
+
const childCount = count(child.badge);
|
|
73
|
+
return /* @__PURE__ */ jsxs(
|
|
74
|
+
Link,
|
|
75
|
+
{
|
|
76
|
+
href: child.href,
|
|
77
|
+
className: cn(
|
|
78
|
+
"flex items-center gap-1.5 rounded-full px-3.5 py-1.5 text-[13px] whitespace-nowrap transition-colors shrink-0",
|
|
79
|
+
active ? "bg-primary text-primary-foreground font-medium" : "bg-muted text-muted-foreground hover:text-foreground"
|
|
80
|
+
),
|
|
81
|
+
children: [
|
|
82
|
+
child.label,
|
|
83
|
+
child.badge && childCount > 0 && /* @__PURE__ */ jsx(CountBadge, { count: childCount, variant: child.badge.variant })
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
child.href
|
|
87
|
+
);
|
|
88
|
+
}) }) })
|
|
89
|
+
] });
|
|
90
|
+
}
|
|
91
|
+
export {
|
|
92
|
+
PortfolioNav
|
|
93
|
+
};
|
|
94
|
+
//# sourceMappingURL=portfolio-nav.js.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":";AA6CI,cA0DU,YA1DV;AA3CJ,OAAO,UAAU;AACjB,SAAS,UAAU;AA4BnB,MAAM,sBAA6D;AAAA,EACjE,aAAa;AAAA,EACb,SAAS;AAAA,EACT,SAAS;AACX;AAEA,SAAS,WAAW;AAAA,EAClB;AAAA,EACA;AACF,GAGG;AACD,SACE;A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