@burdenoff/microfe-brainyrich 2026.525.1 → 2026.706.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.
- package/dist/brainyrich/BrainyRichRoot.js +55 -90
- package/dist/brainyrich/BrainyRichRoot.js.map +1 -1
- package/dist/brainyrich/BrainyRichRoutes.js +15 -35
- package/dist/brainyrich/BrainyRichRoutes.js.map +1 -1
- package/dist/brainyrich/components/ActorName.js +38 -0
- package/dist/brainyrich/components/ActorName.js.map +1 -0
- package/dist/brainyrich/components/ConfirmDialog.js +25 -0
- package/dist/brainyrich/components/ConfirmDialog.js.map +1 -0
- package/dist/brainyrich/components/LoadMore.js +24 -0
- package/dist/brainyrich/components/LoadMore.js.map +1 -0
- package/dist/brainyrich/components/index.js +5 -0
- package/dist/brainyrich/components/notify.js +38 -0
- package/dist/brainyrich/components/notify.js.map +1 -0
- package/dist/brainyrich/components/pickers.js +232 -0
- package/dist/brainyrich/components/pickers.js.map +1 -0
- package/dist/brainyrich/components/reuse/CommentThread.js +208 -0
- package/dist/brainyrich/components/reuse/CommentThread.js.map +1 -0
- package/dist/brainyrich/components/reuse/DocumentsPanel.js +237 -0
- package/dist/brainyrich/components/reuse/DocumentsPanel.js.map +1 -0
- package/dist/brainyrich/components/reuse/TagField.js +206 -0
- package/dist/brainyrich/components/reuse/TagField.js.map +1 -0
- package/dist/brainyrich/components/reuse/transport.js +24 -0
- package/dist/brainyrich/components/reuse/transport.js.map +1 -0
- package/dist/brainyrich/hooks/useBrainyRichApi.js +815 -0
- package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -0
- package/dist/brainyrich/index.js +0 -1
- package/dist/brainyrich/pages/AccountsPage.js +743 -160
- package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
- package/dist/brainyrich/pages/AiAssistantPage.js +556 -363
- package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
- package/dist/brainyrich/pages/AnalyticsPage.js +601 -268
- package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
- package/dist/brainyrich/pages/DashboardPage.js +375 -231
- package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
- package/dist/brainyrich/pages/FamilyPage.js +599 -337
- package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
- package/dist/brainyrich/pages/GoalsPage.js +810 -141
- package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
- package/dist/brainyrich/pages/InvestmentsPage.js +410 -311
- package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
- package/dist/brainyrich/pages/PortfoliosPage.js +867 -156
- package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
- package/dist/brainyrich/pages/ReportsPage.js +421 -251
- package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
- package/dist/brainyrich/pages/RiskPage.js +557 -194
- package/dist/brainyrich/pages/RiskPage.js.map +1 -1
- package/dist/brainyrich/pages/TaxPage.js +655 -221
- package/dist/brainyrich/pages/TaxPage.js.map +1 -1
- package/dist/brainyrich/pages/_shared.js +222 -41
- package/dist/brainyrich/pages/_shared.js.map +1 -1
- package/dist/index.js +2 -3
- package/dist/node_modules/sonner/dist/index.js +163 -0
- package/dist/node_modules/sonner/dist/index.js.map +1 -0
- package/package.json +3 -2
- package/dist/brainyrich/pages/AdvisorsPage.js +0 -375
- package/dist/brainyrich/pages/AdvisorsPage.js.map +0 -1
- package/dist/brainyrich/pages/AssistantPage.js +0 -332
- package/dist/brainyrich/pages/AssistantPage.js.map +0 -1
- package/dist/brainyrich/pages/EstatePage.js +0 -269
- package/dist/brainyrich/pages/EstatePage.js.map +0 -1
- package/dist/brainyrich/pages/InsurancePage.js +0 -181
- package/dist/brainyrich/pages/InsurancePage.js.map +0 -1
- package/dist/brainyrich/pages/MarketplacePage.js +0 -450
- package/dist/brainyrich/pages/MarketplacePage.js.map +0 -1
- package/dist/brainyrich/store/brainyrichStore.js +0 -272
- package/dist/brainyrich/store/brainyrichStore.js.map +0 -1
|
@@ -1,330 +1,429 @@
|
|
|
1
1
|
import { tWithFallback as e } from "../utils/i18n.js";
|
|
2
|
-
import {
|
|
3
|
-
import { KpiGrid as
|
|
4
|
-
import { useState as
|
|
5
|
-
import {
|
|
6
|
-
import { useI18n as
|
|
7
|
-
import { jsx as
|
|
8
|
-
import { Badge as
|
|
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
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
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
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
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
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
className: "
|
|
165
|
-
|
|
166
|
-
|
|
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
|
-
}
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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
|
-
|
|
235
|
-
|
|
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__ */
|
|
240
|
-
className: "text-
|
|
241
|
-
children:
|
|
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
|
-
]
|
|
244
|
-
}),
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
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__ */
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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 {
|
|
427
|
+
export { P as InvestmentsPage };
|
|
329
428
|
|
|
330
429
|
//# sourceMappingURL=InvestmentsPage.js.map
|