@burdenoff/microfe-brainyrich 2026.512.1 → 2026.705.1

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 (109) hide show
  1. package/dist/brainyrich/BrainyRichRoot.js +53 -88
  2. package/dist/brainyrich/BrainyRichRoot.js.map +1 -1
  3. package/dist/brainyrich/BrainyRichRoutes.js +15 -35
  4. package/dist/brainyrich/BrainyRichRoutes.js.map +1 -1
  5. package/dist/brainyrich/hooks/useBrainyRichApi.js +543 -0
  6. package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -0
  7. package/dist/brainyrich/index.js +0 -1
  8. package/dist/brainyrich/pages/AccountsPage.js +690 -160
  9. package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
  10. package/dist/brainyrich/pages/AiAssistantPage.js +537 -363
  11. package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
  12. package/dist/brainyrich/pages/AnalyticsPage.js +587 -268
  13. package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
  14. package/dist/brainyrich/pages/DashboardPage.js +350 -232
  15. package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
  16. package/dist/brainyrich/pages/FamilyPage.js +550 -337
  17. package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
  18. package/dist/brainyrich/pages/GoalsPage.js +775 -142
  19. package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
  20. package/dist/brainyrich/pages/InvestmentsPage.js +410 -311
  21. package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
  22. package/dist/brainyrich/pages/PortfoliosPage.js +823 -154
  23. package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
  24. package/dist/brainyrich/pages/ReportsPage.js +388 -251
  25. package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
  26. package/dist/brainyrich/pages/RiskPage.js +411 -196
  27. package/dist/brainyrich/pages/RiskPage.js.map +1 -1
  28. package/dist/brainyrich/pages/TaxPage.js +622 -221
  29. package/dist/brainyrich/pages/TaxPage.js.map +1 -1
  30. package/dist/brainyrich/pages/_shared.js +222 -41
  31. package/dist/brainyrich/pages/_shared.js.map +1 -1
  32. package/dist/index.js +2 -3
  33. package/package.json +1 -1
  34. package/dist/brainyrich/BrainyRichRoot.d.ts +0 -5
  35. package/dist/brainyrich/BrainyRichRoot.d.ts.map +0 -1
  36. package/dist/brainyrich/BrainyRichRoutes.d.ts +0 -2
  37. package/dist/brainyrich/BrainyRichRoutes.d.ts.map +0 -1
  38. package/dist/brainyrich/index.d.ts +0 -5
  39. package/dist/brainyrich/index.d.ts.map +0 -1
  40. package/dist/brainyrich/pages/AccountsPage.d.ts +0 -2
  41. package/dist/brainyrich/pages/AccountsPage.d.ts.map +0 -1
  42. package/dist/brainyrich/pages/AdvisorsPage.d.ts +0 -2
  43. package/dist/brainyrich/pages/AdvisorsPage.d.ts.map +0 -1
  44. package/dist/brainyrich/pages/AdvisorsPage.js +0 -375
  45. package/dist/brainyrich/pages/AdvisorsPage.js.map +0 -1
  46. package/dist/brainyrich/pages/AiAssistantPage.d.ts +0 -2
  47. package/dist/brainyrich/pages/AiAssistantPage.d.ts.map +0 -1
  48. package/dist/brainyrich/pages/AnalyticsPage.d.ts +0 -2
  49. package/dist/brainyrich/pages/AnalyticsPage.d.ts.map +0 -1
  50. package/dist/brainyrich/pages/AssistantPage.d.ts +0 -2
  51. package/dist/brainyrich/pages/AssistantPage.d.ts.map +0 -1
  52. package/dist/brainyrich/pages/AssistantPage.js +0 -332
  53. package/dist/brainyrich/pages/AssistantPage.js.map +0 -1
  54. package/dist/brainyrich/pages/DashboardPage.d.ts +0 -2
  55. package/dist/brainyrich/pages/DashboardPage.d.ts.map +0 -1
  56. package/dist/brainyrich/pages/EstatePage.d.ts +0 -2
  57. package/dist/brainyrich/pages/EstatePage.d.ts.map +0 -1
  58. package/dist/brainyrich/pages/EstatePage.js +0 -269
  59. package/dist/brainyrich/pages/EstatePage.js.map +0 -1
  60. package/dist/brainyrich/pages/FamilyPage.d.ts +0 -2
  61. package/dist/brainyrich/pages/FamilyPage.d.ts.map +0 -1
  62. package/dist/brainyrich/pages/GoalsPage.d.ts +0 -2
  63. package/dist/brainyrich/pages/GoalsPage.d.ts.map +0 -1
  64. package/dist/brainyrich/pages/InsurancePage.d.ts +0 -2
  65. package/dist/brainyrich/pages/InsurancePage.d.ts.map +0 -1
  66. package/dist/brainyrich/pages/InsurancePage.js +0 -181
  67. package/dist/brainyrich/pages/InsurancePage.js.map +0 -1
  68. package/dist/brainyrich/pages/InvestmentsPage.d.ts +0 -2
  69. package/dist/brainyrich/pages/InvestmentsPage.d.ts.map +0 -1
  70. package/dist/brainyrich/pages/MarketplacePage.d.ts +0 -2
  71. package/dist/brainyrich/pages/MarketplacePage.d.ts.map +0 -1
  72. package/dist/brainyrich/pages/MarketplacePage.js +0 -450
  73. package/dist/brainyrich/pages/MarketplacePage.js.map +0 -1
  74. package/dist/brainyrich/pages/PortfoliosPage.d.ts +0 -2
  75. package/dist/brainyrich/pages/PortfoliosPage.d.ts.map +0 -1
  76. package/dist/brainyrich/pages/ReportsPage.d.ts +0 -2
  77. package/dist/brainyrich/pages/ReportsPage.d.ts.map +0 -1
  78. package/dist/brainyrich/pages/RiskPage.d.ts +0 -2
  79. package/dist/brainyrich/pages/RiskPage.d.ts.map +0 -1
  80. package/dist/brainyrich/pages/TaxPage.d.ts +0 -2
  81. package/dist/brainyrich/pages/TaxPage.d.ts.map +0 -1
  82. package/dist/brainyrich/pages/_shared.d.ts +0 -21
  83. package/dist/brainyrich/pages/_shared.d.ts.map +0 -1
  84. package/dist/brainyrich/providers/BrainyRichProvider.d.ts +0 -6
  85. package/dist/brainyrich/providers/BrainyRichProvider.d.ts.map +0 -1
  86. package/dist/brainyrich/store/brainyrichStore.d.ts +0 -19
  87. package/dist/brainyrich/store/brainyrichStore.d.ts.map +0 -1
  88. package/dist/brainyrich/store/brainyrichStore.js +0 -272
  89. package/dist/brainyrich/store/brainyrichStore.js.map +0 -1
  90. package/dist/brainyrich/types/index.d.ts +0 -116
  91. package/dist/brainyrich/types/index.d.ts.map +0 -1
  92. package/dist/brainyrich/utils/cn.d.ts +0 -4
  93. package/dist/brainyrich/utils/cn.d.ts.map +0 -1
  94. package/dist/brainyrich/utils/i18n.d.ts +0 -6
  95. package/dist/brainyrich/utils/i18n.d.ts.map +0 -1
  96. package/dist/brainyrich/utils/navigation.d.ts +0 -2
  97. package/dist/brainyrich/utils/navigation.d.ts.map +0 -1
  98. package/dist/dev/main.d.ts +0 -2
  99. package/dist/dev/main.d.ts.map +0 -1
  100. package/dist/generated/global-operations.d.ts +0 -2
  101. package/dist/generated/global-operations.d.ts.map +0 -1
  102. package/dist/generated/global-types.d.ts +0 -18199
  103. package/dist/generated/global-types.d.ts.map +0 -1
  104. package/dist/generated/wspace-operations.d.ts +0 -2
  105. package/dist/generated/wspace-operations.d.ts.map +0 -1
  106. package/dist/generated/wspace-types.d.ts +0 -43046
  107. package/dist/generated/wspace-types.d.ts.map +0 -1
  108. package/dist/index.d.ts +0 -2
  109. package/dist/index.d.ts.map +0 -1
@@ -1,330 +1,429 @@
1
1
  import { tWithFallback as e } from "../utils/i18n.js";
2
- import { useBrainyRichStore as t } from "../store/brainyrichStore.js";
3
- import { KpiGrid as n, SectionShell as r, formatMoney as i } from "./_shared.js";
4
- import { useState as a } from "react";
5
- import { ArrowDownRight as o, ArrowUpRight as s, DollarSign as c, PieChart as l, Plus as u, Target as d, TrendingUp as f } from "lucide-react";
6
- import { useI18n as p } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
- import { jsx as m, jsxs as h } from "react/jsx-runtime";
8
- import { Badge as g, Button as _, Card as v, CardContent as y, CardDescription as b, CardHeader as x, CardTitle as S, Table as C, TableBody as w, TableCell as T, TableHead as E, TableHeader as D, TableRow as O, Tabs as k, TabsContent as A, TabsList as j, TabsTrigger as M } from "@burdenoff/fe-libs/ui";
2
+ import { useCreateModelPortfolio as t, useModelPortfolio as n, useModelPortfolios as r } from "../hooks/useBrainyRichApi.js";
3
+ import { AllocationBars as i, EmptyState as a, ErrorState as o, KpiGrid as s, LoadingState as c, SectionShell as l, formatDate as u, statusBadgeVariant as d } from "./_shared.js";
4
+ import { useMemo as f, useState as p } from "react";
5
+ import { PieChart as m, Plus as h, Trash2 as ee, X as g } from "lucide-react";
6
+ import { useI18n as te } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
+ import { Fragment as ne, jsx as _, jsxs as v } from "react/jsx-runtime";
8
+ import { Badge as y, Button as b, Card as re, CardContent as ie, CardDescription as ae, CardHeader as oe, CardTitle as se, Dialog as ce, DialogContent as le, DialogDescription as ue, DialogFooter as x, DialogHeader as S, DialogTitle as C, Input as w, Label as T, Select as E, SelectContent as D, SelectItem as O, SelectTrigger as k, SelectValue as A, Textarea as de } from "@burdenoff/fe-libs/ui";
9
9
  //#region src/brainyrich/pages/InvestmentsPage.tsx
10
- var N = [
11
- {
12
- id: "t1",
13
- date: "2026-05-28",
14
- symbol: "AAPL",
15
- type: "BUY",
16
- qty: 25,
17
- price: 189.4,
18
- status: "Executed"
19
- },
20
- {
21
- id: "t2",
22
- date: "2026-05-22",
23
- symbol: "VTI",
24
- type: "BUY",
25
- qty: 50,
26
- price: 228.1,
27
- status: "Executed"
28
- },
29
- {
30
- id: "t3",
31
- date: "2026-05-15",
32
- symbol: "HDFC",
33
- type: "SELL",
34
- qty: 30,
35
- price: 1620.5,
36
- status: "Executed"
37
- }
38
- ], P = [
39
- {
40
- sector: "Technology",
41
- value: 142760,
42
- pct: 47.8
43
- },
44
- {
45
- sector: "Index / ETF",
46
- value: 113400,
47
- pct: 38
48
- },
49
- {
50
- sector: "Financial",
51
- value: 42900,
52
- pct: 14.2
53
- }
10
+ var fe = [
11
+ "CONSERVATIVE",
12
+ "MODERATE",
13
+ "BALANCED",
14
+ "GROWTH",
15
+ "AGGRESSIVE"
16
+ ], pe = [
17
+ "EQUITY",
18
+ "FIXED_INCOME",
19
+ "CASH",
20
+ "REAL_ESTATE",
21
+ "COMMODITY",
22
+ "CRYPTO",
23
+ "ALTERNATIVE"
54
24
  ];
55
- function F() {
56
- let { t: F } = p(), [I, L] = a("overview"), { holdings: R, portfolios: z } = t(), B = (t, n, r) => e(F, t, n, r), V = R.reduce((e, t) => e + t.marketValue, 0), H = z.reduce((e, t) => e + t.value, 0);
57
- return /* @__PURE__ */ h(r, {
58
- title: B("brainyrich.investments.title", "Investment Portfolio"),
59
- description: B("brainyrich.investments.description", "Track, trade, and optimize your investment positions"),
60
- actionLabel: B("brainyrich.investments.actions.newTrade", "New Trade"),
61
- badges: [B("brainyrich.investments.badges.holdingsCount", "{count} Holdings", { count: R.length })],
62
- children: [/* @__PURE__ */ m(n, { items: [
63
- {
64
- label: B("brainyrich.investments.metrics.totalInvested", "Total Invested"),
65
- value: i(V),
66
- trend: B("brainyrich.investments.metrics.totalInvestedTrend", "Across all accounts")
67
- },
68
- {
69
- label: B("brainyrich.investments.metrics.dayChange", "Day Change"),
70
- value: "+$2,410",
71
- trend: "+0.81%"
72
- },
73
- {
74
- label: B("brainyrich.investments.metrics.holdingsCount", "Holdings Count"),
75
- value: String(R.length)
25
+ function j(e) {
26
+ return e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
27
+ }
28
+ var M = [
29
+ "accent",
30
+ "default",
31
+ "positive",
32
+ "warning",
33
+ "negative"
34
+ ], N = () => ({
35
+ assetClass: "EQUITY",
36
+ targetPct: ""
37
+ });
38
+ function P() {
39
+ let { t: n } = te(), u = (t, r, i) => e(n, t, r, i), { data: g, isLoading: P, isError: F, refetch: he } = r(), I = t(), [ge, L] = p(!1), [_e, R] = p(null), [z, B] = p(""), [V, H] = p("BALANCED"), [U, W] = p("USD"), [G, K] = p(""), [q, J] = p([N()]), [Y, X] = p(null), Z = () => {
40
+ B(""), H("BALANCED"), W("USD"), K(""), J([N()]), X(null);
41
+ }, Q = f(() => q.reduce((e, t) => e + (Number.isFinite(parseFloat(t.targetPct)) ? parseFloat(t.targetPct) : 0), 0), [q]), ve = (e, t) => {
42
+ J((n) => n.map((n, r) => r === e ? {
43
+ ...n,
44
+ ...t
45
+ } : n));
46
+ }, ye = () => J((e) => [...e, N()]), be = (e) => J((t) => t.length > 1 ? t.filter((t, n) => n !== e) : t), xe = () => {
47
+ X(null);
48
+ let e = z.trim();
49
+ if (!e) {
50
+ X(u("brainyrich.investments.form.errorName", "A model name is required."));
51
+ return;
52
+ }
53
+ let t = [];
54
+ for (let e of q) {
55
+ let n = parseFloat(e.targetPct);
56
+ if (!e.targetPct.trim() || !Number.isFinite(n)) {
57
+ X(u("brainyrich.investments.form.errorPct", "Every allocation row needs a numeric target %."));
58
+ return;
59
+ }
60
+ if (n < 0) {
61
+ X(u("brainyrich.investments.form.errorNegative", "Target % cannot be negative."));
62
+ return;
63
+ }
64
+ t.push({
65
+ assetClass: e.assetClass,
66
+ targetPct: n
67
+ });
68
+ }
69
+ if (Math.abs(Q - 100) > .5) {
70
+ X(u("brainyrich.investments.form.errorSum", "Allocation targets must sum to ~100% (currently {sum}%).", { sum: Q.toFixed(1) }));
71
+ return;
72
+ }
73
+ I.mutate({
74
+ name: e,
75
+ riskProfile: V,
76
+ baseCurrency: U.trim() || "USD",
77
+ description: G.trim() ? G.trim() : null,
78
+ allocations: t
79
+ }, {
80
+ onSuccess: () => {
81
+ L(!1), Z();
76
82
  },
77
- {
78
- label: B("brainyrich.investments.metrics.totalGainLoss", "Total Gain/Loss"),
79
- value: "+$45,230",
80
- trend: B("brainyrich.investments.metrics.totalGainLossTrend", "+10.2% all-time")
83
+ onError: (e) => {
84
+ X(e instanceof Error ? e.message : u("brainyrich.investments.form.errorGeneric", "Could not create the model."));
81
85
  }
82
- ] }), /* @__PURE__ */ h(k, {
83
- value: I,
84
- onValueChange: L,
85
- className: "space-y-4",
86
- children: [
87
- /* @__PURE__ */ h(j, {
88
- className: "grid w-full grid-cols-4",
89
- children: [
90
- /* @__PURE__ */ m(M, {
91
- value: "overview",
92
- children: B("brainyrich.investments.tabs.overview", "Overview")
93
- }),
94
- /* @__PURE__ */ m(M, {
95
- value: "holdings",
96
- children: B("brainyrich.investments.tabs.holdings", "Holdings")
97
- }),
98
- /* @__PURE__ */ m(M, {
99
- value: "sectors",
100
- children: B("brainyrich.investments.tabs.sectors", "Sector Analysis")
101
- }),
102
- /* @__PURE__ */ m(M, {
103
- value: "history",
104
- children: B("brainyrich.investments.tabs.history", "Trade History")
105
- })
106
- ]
86
+ });
87
+ }, Se = u("brainyrich.investments.title", "Model Portfolios"), Ce = u("brainyrich.investments.description", "Reusable target allocations you can benchmark and drive rebalancing against"), we = g.filter((e) => e.isActive).length, Te = new Set(g.map((e) => e.riskProfile)).size, Ee = new Set(g.flatMap((e) => e.allocations.map((e) => e.assetClass))).size, De = [
88
+ {
89
+ label: u("brainyrich.investments.kpi.total", "Model portfolios"),
90
+ value: String(g.length)
91
+ },
92
+ {
93
+ label: u("brainyrich.investments.kpi.active", "Active"),
94
+ value: String(we)
95
+ },
96
+ {
97
+ label: u("brainyrich.investments.kpi.risk", "Risk profiles"),
98
+ value: String(Te)
99
+ },
100
+ {
101
+ label: u("brainyrich.investments.kpi.classes", "Asset classes"),
102
+ value: String(Ee)
103
+ }
104
+ ], $ = u("brainyrich.investments.actions.newModel", "New model");
105
+ return /* @__PURE__ */ v(ne, { children: [
106
+ /* @__PURE__ */ v(l, {
107
+ title: Se,
108
+ description: Ce,
109
+ actionLabel: $,
110
+ onAction: () => L(!0),
111
+ badges: !P && !F ? [u("brainyrich.investments.badges.count", "{count} models", { count: g.length })] : [],
112
+ children: [!P && !F && g.length > 0 ? /* @__PURE__ */ _(s, { items: De }) : null, P ? /* @__PURE__ */ _(c, { rows: 4 }) : F ? /* @__PURE__ */ _(o, {
113
+ title: u("brainyrich.investments.error.title", "Could not load model portfolios"),
114
+ onRetry: () => he()
115
+ }) : g.length === 0 ? /* @__PURE__ */ _(a, {
116
+ icon: /* @__PURE__ */ _(m, {
117
+ className: "size-6",
118
+ "aria-hidden": "true"
107
119
  }),
108
- /* @__PURE__ */ h(A, {
109
- value: "overview",
110
- className: "space-y-4",
111
- children: [/* @__PURE__ */ m("div", {
112
- className: "grid gap-4 md:grid-cols-2 lg:grid-cols-4",
113
- children: [
114
- {
115
- icon: c,
116
- label: B("brainyrich.investments.overview.totalValue", "Total Value"),
117
- val: i(H),
118
- color: "bg-blue-100 text-blue-600"
119
- },
120
- {
121
- icon: f,
122
- label: B("brainyrich.investments.overview.todaysChange", "Today's Change"),
123
- val: "+$2,410",
124
- color: "bg-emerald-100 text-emerald-600"
125
- },
126
- {
127
- icon: l,
128
- label: B("brainyrich.investments.overview.holdings", "Holdings"),
129
- val: String(R.length),
130
- color: "bg-purple-100 text-purple-600"
131
- },
132
- {
133
- icon: d,
134
- label: B("brainyrich.investments.overview.performance", "Performance"),
135
- val: "+10.2%",
136
- color: "bg-orange-100 text-orange-600"
137
- }
138
- ].map((e) => /* @__PURE__ */ m(v, { children: /* @__PURE__ */ h(y, {
139
- className: "flex items-center gap-4 p-4",
140
- children: [/* @__PURE__ */ m("div", {
141
- className: `rounded-lg p-2 ${e.color}`,
142
- children: /* @__PURE__ */ m(e.icon, { className: "h-5 w-5" })
143
- }), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
144
- className: "text-xs text-muted-foreground",
145
- children: e.label
146
- }), /* @__PURE__ */ m("p", {
147
- className: "text-xl font-bold",
148
- children: e.val
149
- })] })]
150
- }) }, e.label))
151
- }), /* @__PURE__ */ h(v, { children: [/* @__PURE__ */ h(x, {
152
- className: "flex flex-row items-center justify-between",
153
- children: [/* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m(S, { children: B("brainyrich.investments.sections.topHoldings", "Top Holdings") }), /* @__PURE__ */ m(b, { children: B("brainyrich.investments.sections.topHoldingsDescription", "Largest positions by market value") })] }), /* @__PURE__ */ m(_, {
154
- variant: "outline",
155
- size: "sm",
156
- onClick: () => L("holdings"),
157
- children: B("brainyrich.investments.actions.viewAll", "View All")
158
- })]
159
- }), /* @__PURE__ */ m(y, {
160
- className: "space-y-3",
161
- children: R.map((e) => /* @__PURE__ */ h("div", {
162
- className: "flex items-center justify-between rounded-lg border p-3",
163
- children: [/* @__PURE__ */ h("div", {
164
- className: "flex items-center gap-3",
165
- children: [/* @__PURE__ */ m("div", {
166
- className: "flex h-10 w-10 items-center justify-center rounded-lg bg-blue-100 text-xs font-bold text-blue-600",
167
- children: e.symbol.slice(0, 2)
168
- }), /* @__PURE__ */ h("div", { children: [/* @__PURE__ */ m("p", {
169
- className: "font-medium text-sm",
170
- children: e.symbol
171
- }), /* @__PURE__ */ m("p", {
172
- className: "text-xs text-muted-foreground",
173
- children: e.name
174
- })] })]
175
- }), /* @__PURE__ */ h("div", {
176
- className: "text-right",
177
- children: [/* @__PURE__ */ m("p", {
178
- className: "text-sm font-medium",
179
- children: i(e.marketValue)
180
- }), /* @__PURE__ */ h("p", {
181
- className: `text-xs flex items-center justify-end gap-0.5 ${e.changePct >= 0 ? "text-emerald-600" : "text-red-600"}`,
182
- children: [
183
- e.changePct >= 0 ? /* @__PURE__ */ m(s, { className: "h-3 w-3" }) : /* @__PURE__ */ m(o, { className: "h-3 w-3" }),
184
- e.changePct >= 0 ? "+" : "",
185
- e.changePct,
186
- "%"
187
- ]
188
- })]
120
+ title: u("brainyrich.investments.empty.title", "No model portfolios yet"),
121
+ description: u("brainyrich.investments.empty.description", "Create a target allocation model to benchmark portfolios and drive rebalancing."),
122
+ action: /* @__PURE__ */ v(b, {
123
+ size: "sm",
124
+ onClick: () => L(!0),
125
+ children: [/* @__PURE__ */ _(h, {
126
+ className: "mr-1 size-4",
127
+ "aria-hidden": "true"
128
+ }), $]
129
+ })
130
+ }) : /* @__PURE__ */ _("div", {
131
+ className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
132
+ children: g.map((e) => {
133
+ let t = e.allocations.map((e, t) => ({
134
+ label: j(e.assetClass),
135
+ value: e.targetPct,
136
+ tone: M[t % M.length]
137
+ }));
138
+ return /* @__PURE__ */ v(re, {
139
+ className: "flex flex-col",
140
+ children: [/* @__PURE__ */ v(oe, {
141
+ className: "space-y-2",
142
+ children: [
143
+ /* @__PURE__ */ v("div", {
144
+ className: "flex items-start justify-between gap-2",
145
+ children: [/* @__PURE__ */ _(se, {
146
+ className: "text-base text-text-primary",
147
+ children: e.name
148
+ }), /* @__PURE__ */ _(y, {
149
+ variant: e.isActive ? d("ACTIVE") : "secondary",
150
+ children: e.isActive ? u("brainyrich.investments.badge.active", "Active") : u("brainyrich.investments.badge.inactive", "Inactive")
151
+ })]
152
+ }),
153
+ /* @__PURE__ */ v("div", {
154
+ className: "flex flex-wrap items-center gap-2",
155
+ children: [/* @__PURE__ */ _(y, {
156
+ variant: "outline",
157
+ children: j(e.riskProfile)
158
+ }), /* @__PURE__ */ _(y, {
159
+ variant: "outline",
160
+ children: e.baseCurrency
161
+ })]
162
+ }),
163
+ e.description ? /* @__PURE__ */ _(ae, {
164
+ className: "text-text-secondary",
165
+ children: e.description
166
+ }) : null
167
+ ]
168
+ }), /* @__PURE__ */ v(ie, {
169
+ className: "mt-auto space-y-4",
170
+ children: [t.length > 0 ? /* @__PURE__ */ _(i, { data: t }) : /* @__PURE__ */ _("p", {
171
+ className: "text-sm text-text-secondary",
172
+ children: u("brainyrich.investments.card.noAllocations", "No target allocations set.")
173
+ }), /* @__PURE__ */ _(b, {
174
+ variant: "outline",
175
+ size: "sm",
176
+ className: "w-full",
177
+ onClick: () => R(e.id),
178
+ children: u("brainyrich.investments.actions.viewDetails", "View details")
189
179
  })]
190
- }, e.symbol))
191
- })] })]
192
- }),
193
- /* @__PURE__ */ m(A, {
194
- value: "holdings",
195
- children: /* @__PURE__ */ h(v, { children: [/* @__PURE__ */ h(x, {
196
- className: "flex flex-row items-center justify-between",
197
- children: [/* @__PURE__ */ m(S, { children: B("brainyrich.investments.sections.allHoldings", "All Holdings") }), /* @__PURE__ */ h(_, {
198
- size: "sm",
199
- children: [/* @__PURE__ */ m(u, { className: "mr-1 h-4 w-4" }), B("brainyrich.investments.actions.addPosition", "Add Position")]
200
180
  })]
201
- }), /* @__PURE__ */ m(y, { children: /* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(D, { children: /* @__PURE__ */ h(O, { children: [
202
- /* @__PURE__ */ m(E, { children: B("brainyrich.investments.table.symbol", "Symbol") }),
203
- /* @__PURE__ */ m(E, { children: B("brainyrich.investments.table.name", "Name") }),
204
- /* @__PURE__ */ m(E, { children: B("brainyrich.investments.table.sector", "Sector") }),
205
- /* @__PURE__ */ m(E, {
206
- className: "text-right",
207
- children: B("brainyrich.investments.table.marketValue", "Market Value")
208
- }),
209
- /* @__PURE__ */ m(E, {
210
- className: "text-right",
211
- children: B("brainyrich.investments.table.changePct", "Change %")
212
- }),
213
- /* @__PURE__ */ m(E, {
214
- className: "text-right",
215
- children: B("brainyrich.investments.table.allocation", "Allocation")
216
- })
217
- ] }) }), /* @__PURE__ */ m(w, { children: R.map((e) => /* @__PURE__ */ h(O, { children: [
218
- /* @__PURE__ */ m(T, {
219
- className: "font-semibold",
220
- children: e.symbol
221
- }),
222
- /* @__PURE__ */ m(T, { children: e.name }),
223
- /* @__PURE__ */ m(T, { children: /* @__PURE__ */ m(g, {
224
- variant: "outline",
225
- children: e.sector
226
- }) }),
227
- /* @__PURE__ */ m(T, {
228
- className: "text-right",
229
- children: i(e.marketValue)
230
- }),
231
- /* @__PURE__ */ h(T, {
232
- className: `text-right ${e.changePct >= 0 ? "text-emerald-600" : "text-red-600"}`,
181
+ }, e.id);
182
+ })
183
+ })]
184
+ }),
185
+ /* @__PURE__ */ _(ce, {
186
+ open: ge,
187
+ onOpenChange: (e) => {
188
+ L(e), e || Z();
189
+ },
190
+ children: /* @__PURE__ */ v(le, {
191
+ className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
192
+ children: [
193
+ /* @__PURE__ */ v(S, { children: [/* @__PURE__ */ _(C, { children: $ }), /* @__PURE__ */ _(ue, { children: u("brainyrich.investments.form.subtitle", "Define a target allocation. Targets should sum to about 100%.") })] }),
194
+ /* @__PURE__ */ v("div", {
195
+ className: "space-y-4 py-2",
196
+ children: [
197
+ /* @__PURE__ */ v("div", {
198
+ className: "space-y-2",
199
+ children: [/* @__PURE__ */ _(T, {
200
+ htmlFor: "bra-model-name",
201
+ children: u("brainyrich.investments.form.name", "Name")
202
+ }), /* @__PURE__ */ _(w, {
203
+ id: "bra-model-name",
204
+ value: z,
205
+ onChange: (e) => B(e.target.value),
206
+ placeholder: u("brainyrich.investments.form.namePlaceholder", "Balanced Growth 60/40")
207
+ })]
208
+ }),
209
+ /* @__PURE__ */ v("div", {
210
+ className: "grid gap-4 sm:grid-cols-2",
211
+ children: [/* @__PURE__ */ v("div", {
212
+ className: "space-y-2",
213
+ children: [/* @__PURE__ */ _(T, {
214
+ htmlFor: "bra-model-risk",
215
+ children: u("brainyrich.investments.form.risk", "Risk profile")
216
+ }), /* @__PURE__ */ v(E, {
217
+ value: V,
218
+ onValueChange: (e) => H(e),
219
+ children: [/* @__PURE__ */ _(k, {
220
+ id: "bra-model-risk",
221
+ children: /* @__PURE__ */ _(A, {})
222
+ }), /* @__PURE__ */ _(D, { children: fe.map((e) => /* @__PURE__ */ _(O, {
223
+ value: e,
224
+ children: j(e)
225
+ }, e)) })]
226
+ })]
227
+ }), /* @__PURE__ */ v("div", {
228
+ className: "space-y-2",
229
+ children: [/* @__PURE__ */ _(T, {
230
+ htmlFor: "bra-model-currency",
231
+ children: u("brainyrich.investments.form.currency", "Base currency")
232
+ }), /* @__PURE__ */ _(w, {
233
+ id: "bra-model-currency",
234
+ value: U,
235
+ onChange: (e) => W(e.target.value.toUpperCase().slice(0, 3)),
236
+ placeholder: "USD"
237
+ })]
238
+ })]
239
+ }),
240
+ /* @__PURE__ */ v("div", {
241
+ className: "space-y-2",
242
+ children: [/* @__PURE__ */ _(T, {
243
+ htmlFor: "bra-model-desc",
244
+ children: u("brainyrich.investments.form.description", "Description")
245
+ }), /* @__PURE__ */ _(de, {
246
+ id: "bra-model-desc",
247
+ value: G,
248
+ onChange: (e) => K(e.target.value),
249
+ rows: 2,
250
+ placeholder: u("brainyrich.investments.form.descriptionPlaceholder", "Who this model is for and how it is used")
251
+ })]
252
+ }),
253
+ /* @__PURE__ */ v("div", {
254
+ className: "space-y-2",
255
+ children: [
256
+ /* @__PURE__ */ v("div", {
257
+ className: "flex items-center justify-between",
258
+ children: [/* @__PURE__ */ _(T, { children: u("brainyrich.investments.form.allocations", "Target allocations") }), /* @__PURE__ */ _("span", {
259
+ className: Math.abs(Q - 100) <= .5 ? "text-xs font-medium text-status-success-text" : "text-xs font-medium text-status-warning-text",
260
+ children: u("brainyrich.investments.form.sum", "Sum: {sum}%", { sum: Q.toFixed(1) })
261
+ })]
262
+ }),
263
+ /* @__PURE__ */ _("div", {
264
+ className: "space-y-2",
265
+ children: q.map((e, t) => /* @__PURE__ */ v("div", {
266
+ className: "flex items-center gap-2",
267
+ children: [
268
+ /* @__PURE__ */ v(E, {
269
+ value: e.assetClass,
270
+ onValueChange: (e) => ve(t, { assetClass: e }),
271
+ children: [/* @__PURE__ */ _(k, {
272
+ className: "flex-1",
273
+ children: /* @__PURE__ */ _(A, {})
274
+ }), /* @__PURE__ */ _(D, { children: pe.map((e) => /* @__PURE__ */ _(O, {
275
+ value: e,
276
+ children: j(e)
277
+ }, e)) })]
278
+ }),
279
+ /* @__PURE__ */ _(w, {
280
+ type: "number",
281
+ inputMode: "decimal",
282
+ min: 0,
283
+ max: 100,
284
+ step: "0.1",
285
+ className: "w-24",
286
+ value: e.targetPct,
287
+ onChange: (e) => ve(t, { targetPct: e.target.value }),
288
+ placeholder: "%",
289
+ "aria-label": u("brainyrich.investments.form.targetPct", "Target percent")
290
+ }),
291
+ /* @__PURE__ */ _(b, {
292
+ type: "button",
293
+ variant: "ghost",
294
+ size: "icon",
295
+ onClick: () => be(t),
296
+ disabled: q.length <= 1,
297
+ "aria-label": u("brainyrich.investments.form.removeRow", "Remove allocation row"),
298
+ children: /* @__PURE__ */ _(ee, {
299
+ className: "size-4",
300
+ "aria-hidden": "true"
301
+ })
302
+ })
303
+ ]
304
+ }, t))
305
+ }),
306
+ /* @__PURE__ */ v(b, {
307
+ type: "button",
308
+ variant: "outline",
309
+ size: "sm",
310
+ onClick: ye,
311
+ children: [/* @__PURE__ */ _(h, {
312
+ className: "mr-1 size-4",
313
+ "aria-hidden": "true"
314
+ }), u("brainyrich.investments.form.addRow", "Add asset class")]
315
+ })
316
+ ]
317
+ }),
318
+ Y ? /* @__PURE__ */ _("p", {
319
+ className: "text-sm text-status-error-text",
320
+ role: "alert",
321
+ children: Y
322
+ }) : null
323
+ ]
324
+ }),
325
+ /* @__PURE__ */ v(x, { children: [/* @__PURE__ */ _(b, {
326
+ variant: "outline",
327
+ onClick: () => {
328
+ L(!1), Z();
329
+ },
330
+ disabled: I.isPending,
331
+ children: u("brainyrich.investments.form.cancel", "Cancel")
332
+ }), /* @__PURE__ */ _(b, {
333
+ onClick: xe,
334
+ disabled: I.isPending,
335
+ children: I.isPending ? u("brainyrich.investments.form.saving", "Creating…") : u("brainyrich.investments.form.create", "Create model")
336
+ })] })
337
+ ]
338
+ })
339
+ }),
340
+ /* @__PURE__ */ _(me, {
341
+ id: _e,
342
+ onClose: () => R(null),
343
+ translate: u
344
+ })
345
+ ] });
346
+ }
347
+ function me({ id: e, onClose: t, translate: r }) {
348
+ let { data: s, isLoading: l, isError: f, refetch: p } = n(e ?? void 0), m = (s?.allocations ?? []).map((e, t) => ({
349
+ label: j(e.assetClass),
350
+ value: e.targetPct,
351
+ tone: M[t % M.length]
352
+ }));
353
+ return /* @__PURE__ */ _(ce, {
354
+ open: !!e,
355
+ onOpenChange: (e) => e ? void 0 : t(),
356
+ children: /* @__PURE__ */ v(le, {
357
+ className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
358
+ children: [
359
+ /* @__PURE__ */ v(S, { children: [/* @__PURE__ */ _(C, {
360
+ className: "flex items-center justify-between gap-2 pr-6",
361
+ children: s?.name ?? r("brainyrich.investments.detail.title", "Model portfolio")
362
+ }), s?.description ? /* @__PURE__ */ _(ue, { children: s.description }) : null] }),
363
+ l ? /* @__PURE__ */ _(c, { rows: 3 }) : f ? /* @__PURE__ */ _(o, {
364
+ title: r("brainyrich.investments.detail.error", "Could not load this model"),
365
+ onRetry: () => p()
366
+ }) : s ? /* @__PURE__ */ v("div", {
367
+ className: "space-y-5 py-1",
368
+ children: [
369
+ /* @__PURE__ */ v("div", {
370
+ className: "flex flex-wrap items-center gap-2",
233
371
  children: [
234
- e.changePct >= 0 ? "+" : "",
235
- e.changePct,
236
- "%"
372
+ /* @__PURE__ */ _(y, {
373
+ variant: s.isActive ? d("ACTIVE") : "secondary",
374
+ children: s.isActive ? r("brainyrich.investments.badge.active", "Active") : r("brainyrich.investments.badge.inactive", "Inactive")
375
+ }),
376
+ /* @__PURE__ */ _(y, {
377
+ variant: "outline",
378
+ children: j(s.riskProfile)
379
+ }),
380
+ /* @__PURE__ */ _(y, {
381
+ variant: "outline",
382
+ children: s.baseCurrency
383
+ })
237
384
  ]
238
385
  }),
239
- /* @__PURE__ */ h(T, {
240
- className: "text-right",
241
- children: [(e.marketValue / V * 100).toFixed(1), "%"]
386
+ /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("p", {
387
+ className: "mb-2 text-sm font-medium text-text-primary",
388
+ children: r("brainyrich.investments.detail.allocations", "Target allocations")
389
+ }), m.length > 0 ? /* @__PURE__ */ _(i, { data: m }) : /* @__PURE__ */ _("p", {
390
+ className: "text-sm text-text-secondary",
391
+ children: r("brainyrich.investments.card.noAllocations", "No target allocations set.")
392
+ })] }),
393
+ /* @__PURE__ */ v("dl", {
394
+ className: "grid grid-cols-2 gap-4 border-t border-border-subtle pt-4 text-sm",
395
+ children: [/* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
396
+ className: "text-text-secondary",
397
+ children: r("brainyrich.investments.detail.created", "Created")
398
+ }), /* @__PURE__ */ _("dd", {
399
+ className: "text-text-primary",
400
+ children: u(s.createdAt)
401
+ })] }), /* @__PURE__ */ v("div", { children: [/* @__PURE__ */ _("dt", {
402
+ className: "text-text-secondary",
403
+ children: r("brainyrich.investments.detail.updated", "Updated")
404
+ }), /* @__PURE__ */ _("dd", {
405
+ className: "text-text-primary",
406
+ children: u(s.updatedAt)
407
+ })] })]
242
408
  })
243
- ] }, e.symbol)) })] }) })] })
244
- }),
245
- /* @__PURE__ */ m(A, {
246
- value: "sectors",
247
- className: "space-y-4",
248
- children: /* @__PURE__ */ h(v, { children: [/* @__PURE__ */ h(x, { children: [/* @__PURE__ */ m(S, { children: B("brainyrich.investments.sections.sectorAllocation", "Sector Allocation") }), /* @__PURE__ */ m(b, { children: B("brainyrich.investments.sections.sectorAllocationDescription", "How your investments are distributed across sectors") })] }), /* @__PURE__ */ m(y, {
249
- className: "space-y-4",
250
- children: P.map((e) => /* @__PURE__ */ h("div", {
251
- className: "space-y-1",
252
- children: [/* @__PURE__ */ h("div", {
253
- className: "flex items-center justify-between text-sm",
254
- children: [/* @__PURE__ */ m("span", {
255
- className: "font-medium",
256
- children: e.sector
257
- }), /* @__PURE__ */ h("span", { children: [
258
- i(e.value),
259
- " (",
260
- e.pct,
261
- "%)"
262
- ] })]
263
- }), /* @__PURE__ */ m("div", {
264
- className: "h-3 rounded bg-muted overflow-hidden",
265
- children: /* @__PURE__ */ m("div", {
266
- className: "h-3 rounded bg-primary",
267
- style: { width: `${e.pct}%` }
268
- })
269
- })]
270
- }, e.sector))
271
- })] })
409
+ ]
410
+ }) : /* @__PURE__ */ _(a, {
411
+ icon: /* @__PURE__ */ _(g, {
412
+ className: "size-6",
413
+ "aria-hidden": "true"
414
+ }),
415
+ title: r("brainyrich.investments.detail.notFound", "Model not found")
272
416
  }),
273
- /* @__PURE__ */ m(A, {
274
- value: "history",
275
- children: /* @__PURE__ */ h(v, { children: [/* @__PURE__ */ h(x, { children: [/* @__PURE__ */ m(S, { children: B("brainyrich.investments.sections.tradeHistory", "Trade History") }), /* @__PURE__ */ m(b, { children: B("brainyrich.investments.sections.tradeHistoryDescription", "Your recent trading activity") })] }), /* @__PURE__ */ m(y, { children: /* @__PURE__ */ h(C, { children: [/* @__PURE__ */ m(D, { children: /* @__PURE__ */ h(O, { children: [
276
- /* @__PURE__ */ m(E, { children: B("brainyrich.investments.history.date", "Date") }),
277
- /* @__PURE__ */ m(E, { children: B("brainyrich.investments.history.symbol", "Symbol") }),
278
- /* @__PURE__ */ m(E, { children: B("brainyrich.investments.history.type", "Type") }),
279
- /* @__PURE__ */ m(E, {
280
- className: "text-right",
281
- children: B("brainyrich.investments.history.qty", "Qty")
282
- }),
283
- /* @__PURE__ */ m(E, {
284
- className: "text-right",
285
- children: B("brainyrich.investments.history.price", "Price")
286
- }),
287
- /* @__PURE__ */ m(E, {
288
- className: "text-right",
289
- children: B("brainyrich.investments.history.total", "Total")
290
- }),
291
- /* @__PURE__ */ m(E, { children: B("brainyrich.investments.history.status", "Status") })
292
- ] }) }), /* @__PURE__ */ m(w, { children: N.map((e) => /* @__PURE__ */ h(O, { children: [
293
- /* @__PURE__ */ m(T, {
294
- className: "text-sm",
295
- children: e.date
296
- }),
297
- /* @__PURE__ */ m(T, {
298
- className: "font-semibold",
299
- children: e.symbol
300
- }),
301
- /* @__PURE__ */ m(T, { children: /* @__PURE__ */ m(g, {
302
- variant: e.type === "BUY" ? "default" : "destructive",
303
- children: e.type
304
- }) }),
305
- /* @__PURE__ */ m(T, {
306
- className: "text-right",
307
- children: e.qty
308
- }),
309
- /* @__PURE__ */ h(T, {
310
- className: "text-right",
311
- children: ["$", e.price.toLocaleString()]
312
- }),
313
- /* @__PURE__ */ m(T, {
314
- className: "text-right",
315
- children: i(e.qty * e.price)
316
- }),
317
- /* @__PURE__ */ m(T, { children: /* @__PURE__ */ m(g, {
318
- variant: "secondary",
319
- children: e.status
320
- }) })
321
- ] }, e.id)) })] }) })] })
322
- })
417
+ /* @__PURE__ */ _(x, { children: /* @__PURE__ */ _(b, {
418
+ variant: "outline",
419
+ onClick: t,
420
+ children: r("brainyrich.investments.detail.close", "Close")
421
+ }) })
323
422
  ]
324
- })]
423
+ })
325
424
  });
326
425
  }
327
426
  //#endregion
328
- export { F as InvestmentsPage };
427
+ export { P as InvestmentsPage };
329
428
 
330
429
  //# sourceMappingURL=InvestmentsPage.js.map