@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.
- package/dist/brainyrich/BrainyRichRoot.js +53 -88
- 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/hooks/useBrainyRichApi.js +543 -0
- package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -0
- package/dist/brainyrich/index.js +0 -1
- package/dist/brainyrich/pages/AccountsPage.js +690 -160
- package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
- package/dist/brainyrich/pages/AiAssistantPage.js +537 -363
- package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
- package/dist/brainyrich/pages/AnalyticsPage.js +587 -268
- package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
- package/dist/brainyrich/pages/DashboardPage.js +350 -232
- package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
- package/dist/brainyrich/pages/FamilyPage.js +550 -337
- package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
- package/dist/brainyrich/pages/GoalsPage.js +775 -142
- 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 +823 -154
- package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
- package/dist/brainyrich/pages/ReportsPage.js +388 -251
- package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
- package/dist/brainyrich/pages/RiskPage.js +411 -196
- package/dist/brainyrich/pages/RiskPage.js.map +1 -1
- package/dist/brainyrich/pages/TaxPage.js +622 -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/package.json +1 -1
- package/dist/brainyrich/BrainyRichRoot.d.ts +0 -5
- package/dist/brainyrich/BrainyRichRoot.d.ts.map +0 -1
- package/dist/brainyrich/BrainyRichRoutes.d.ts +0 -2
- package/dist/brainyrich/BrainyRichRoutes.d.ts.map +0 -1
- package/dist/brainyrich/index.d.ts +0 -5
- package/dist/brainyrich/index.d.ts.map +0 -1
- package/dist/brainyrich/pages/AccountsPage.d.ts +0 -2
- package/dist/brainyrich/pages/AccountsPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/AdvisorsPage.d.ts +0 -2
- package/dist/brainyrich/pages/AdvisorsPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/AdvisorsPage.js +0 -375
- package/dist/brainyrich/pages/AdvisorsPage.js.map +0 -1
- package/dist/brainyrich/pages/AiAssistantPage.d.ts +0 -2
- package/dist/brainyrich/pages/AiAssistantPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/AnalyticsPage.d.ts +0 -2
- package/dist/brainyrich/pages/AnalyticsPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/AssistantPage.d.ts +0 -2
- package/dist/brainyrich/pages/AssistantPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/AssistantPage.js +0 -332
- package/dist/brainyrich/pages/AssistantPage.js.map +0 -1
- package/dist/brainyrich/pages/DashboardPage.d.ts +0 -2
- package/dist/brainyrich/pages/DashboardPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/EstatePage.d.ts +0 -2
- package/dist/brainyrich/pages/EstatePage.d.ts.map +0 -1
- package/dist/brainyrich/pages/EstatePage.js +0 -269
- package/dist/brainyrich/pages/EstatePage.js.map +0 -1
- package/dist/brainyrich/pages/FamilyPage.d.ts +0 -2
- package/dist/brainyrich/pages/FamilyPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/GoalsPage.d.ts +0 -2
- package/dist/brainyrich/pages/GoalsPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/InsurancePage.d.ts +0 -2
- package/dist/brainyrich/pages/InsurancePage.d.ts.map +0 -1
- package/dist/brainyrich/pages/InsurancePage.js +0 -181
- package/dist/brainyrich/pages/InsurancePage.js.map +0 -1
- package/dist/brainyrich/pages/InvestmentsPage.d.ts +0 -2
- package/dist/brainyrich/pages/InvestmentsPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/MarketplacePage.d.ts +0 -2
- package/dist/brainyrich/pages/MarketplacePage.d.ts.map +0 -1
- package/dist/brainyrich/pages/MarketplacePage.js +0 -450
- package/dist/brainyrich/pages/MarketplacePage.js.map +0 -1
- package/dist/brainyrich/pages/PortfoliosPage.d.ts +0 -2
- package/dist/brainyrich/pages/PortfoliosPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/ReportsPage.d.ts +0 -2
- package/dist/brainyrich/pages/ReportsPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/RiskPage.d.ts +0 -2
- package/dist/brainyrich/pages/RiskPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/TaxPage.d.ts +0 -2
- package/dist/brainyrich/pages/TaxPage.d.ts.map +0 -1
- package/dist/brainyrich/pages/_shared.d.ts +0 -21
- package/dist/brainyrich/pages/_shared.d.ts.map +0 -1
- package/dist/brainyrich/providers/BrainyRichProvider.d.ts +0 -6
- package/dist/brainyrich/providers/BrainyRichProvider.d.ts.map +0 -1
- package/dist/brainyrich/store/brainyrichStore.d.ts +0 -19
- package/dist/brainyrich/store/brainyrichStore.d.ts.map +0 -1
- package/dist/brainyrich/store/brainyrichStore.js +0 -272
- package/dist/brainyrich/store/brainyrichStore.js.map +0 -1
- package/dist/brainyrich/types/index.d.ts +0 -116
- package/dist/brainyrich/types/index.d.ts.map +0 -1
- package/dist/brainyrich/utils/cn.d.ts +0 -4
- package/dist/brainyrich/utils/cn.d.ts.map +0 -1
- package/dist/brainyrich/utils/i18n.d.ts +0 -6
- package/dist/brainyrich/utils/i18n.d.ts.map +0 -1
- package/dist/brainyrich/utils/navigation.d.ts +0 -2
- package/dist/brainyrich/utils/navigation.d.ts.map +0 -1
- package/dist/dev/main.d.ts +0 -2
- package/dist/dev/main.d.ts.map +0 -1
- package/dist/generated/global-operations.d.ts +0 -2
- package/dist/generated/global-operations.d.ts.map +0 -1
- package/dist/generated/global-types.d.ts +0 -18199
- package/dist/generated/global-types.d.ts.map +0 -1
- package/dist/generated/wspace-operations.d.ts +0 -2
- package/dist/generated/wspace-operations.d.ts.map +0 -1
- package/dist/generated/wspace-types.d.ts +0 -43046
- package/dist/generated/wspace-types.d.ts.map +0 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +0 -1
|
@@ -1,175 +1,844 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { KpiGrid as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
1
|
+
import { useAccounts as e, useArchivePortfolio as t, useCreateHolding as n, useCreatePortfolio as r, useDeleteHolding as i, useHouseholds as a, useModelPortfolios as o, usePortfolio as s, usePortfolios as c, useUpdateHolding as l, useUpdatePortfolio as u } from "../hooks/useBrainyRichApi.js";
|
|
2
|
+
import { AllocationBars as d, EmptyState as f, ErrorState as p, KpiGrid as m, LoadingState as h, SectionShell as g, formatMoney as _, formatPct as v, statusBadgeVariant as y } from "./_shared.js";
|
|
3
|
+
import { useMemo as b, useState as x } from "react";
|
|
4
|
+
import { ArrowDownRight as S, ArrowUpRight as C, Briefcase as w, MoreHorizontal as ee, Pencil as te, Plus as T, Trash2 as ne } from "lucide-react";
|
|
5
|
+
import { Fragment as re, jsx as E, jsxs as D } from "react/jsx-runtime";
|
|
6
|
+
import { Badge as O, Button as k, Card as A, CardContent as j, CardDescription as ie, CardHeader as M, CardTitle as N, Dialog as P, DialogContent as F, DialogDescription as I, DialogFooter as L, DialogHeader as R, DialogTitle as ae, DropdownMenu as z, DropdownMenuContent as oe, DropdownMenuItem as B, DropdownMenuLabel as se, DropdownMenuSeparator as ce, DropdownMenuTrigger as le, Input as V, Label as H, Select as U, SelectContent as W, SelectItem as G, SelectTrigger as K, SelectValue as q, Sheet as ue, SheetContent as de, SheetDescription as fe, SheetHeader as pe, SheetTitle as me, Table as he, TableBody as ge, TableCell as J, TableHead as Y, TableHeader as _e, TableRow as ve, Textarea as ye } from "@burdenoff/fe-libs/ui";
|
|
6
7
|
//#region src/brainyrich/pages/PortfoliosPage.tsx
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
var be = [
|
|
9
|
+
"EQUITY",
|
|
10
|
+
"FIXED_INCOME",
|
|
11
|
+
"CASH",
|
|
12
|
+
"REAL_ESTATE",
|
|
13
|
+
"COMMODITY",
|
|
14
|
+
"CRYPTO",
|
|
15
|
+
"ALTERNATIVE"
|
|
16
|
+
], xe = [
|
|
17
|
+
"DRAFT",
|
|
18
|
+
"ACTIVE",
|
|
19
|
+
"ARCHIVED"
|
|
20
|
+
], X = "__none__", Z = (e) => e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" "), Q = (e) => {
|
|
21
|
+
if (e.trim() === "") return;
|
|
22
|
+
let t = Number(e);
|
|
23
|
+
return Number.isFinite(t) ? t : void 0;
|
|
24
|
+
};
|
|
25
|
+
function Se(e) {
|
|
26
|
+
return !e || typeof e != "object" ? [] : Object.entries(e).map(([e, t]) => ({
|
|
27
|
+
label: e,
|
|
28
|
+
value: Number(t)
|
|
29
|
+
})).filter((e) => Number.isFinite(e.value)).map((e) => ({
|
|
30
|
+
label: Z(e.label),
|
|
31
|
+
value: e.value,
|
|
32
|
+
tone: "accent"
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
35
|
+
function Ce({ value: e, currency: t }) {
|
|
36
|
+
let n = e > 0, r = e < 0, i = n ? "text-status-success-text" : r ? "text-status-error-text" : "text-text-secondary", a = n ? C : r ? S : null;
|
|
37
|
+
return /* @__PURE__ */ D("span", {
|
|
38
|
+
className: `inline-flex items-center justify-end gap-1 font-medium ${i}`,
|
|
14
39
|
children: [
|
|
15
|
-
/* @__PURE__ */
|
|
40
|
+
a ? /* @__PURE__ */ E(a, {
|
|
41
|
+
className: "size-3.5",
|
|
42
|
+
"aria-hidden": "true"
|
|
43
|
+
}) : null,
|
|
44
|
+
n ? "+" : "",
|
|
45
|
+
_(e, t)
|
|
46
|
+
]
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function $() {
|
|
50
|
+
return {
|
|
51
|
+
name: "",
|
|
52
|
+
baseCurrency: "USD",
|
|
53
|
+
description: "",
|
|
54
|
+
driftThresholdPct: "5",
|
|
55
|
+
status: "DRAFT",
|
|
56
|
+
modelPortfolioId: X,
|
|
57
|
+
householdId: X
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function we({ open: e, onOpenChange: t, editing: n }) {
|
|
61
|
+
let { data: i } = o(), { data: s } = a(), c = r(), l = u(), [d, f] = x($), [p, m] = x(null), h = n?.id ?? "new";
|
|
62
|
+
e && p !== h && (m(h), f(n ? {
|
|
63
|
+
name: n.name,
|
|
64
|
+
baseCurrency: n.baseCurrency,
|
|
65
|
+
description: n.description ?? "",
|
|
66
|
+
driftThresholdPct: String(n.driftThresholdPct),
|
|
67
|
+
status: n.status,
|
|
68
|
+
modelPortfolioId: n.modelPortfolioId ?? X,
|
|
69
|
+
householdId: n.householdId ?? X
|
|
70
|
+
} : $())), !e && p !== null && m(null);
|
|
71
|
+
let g = c.isPending || l.isPending, _ = d.name.trim().length > 0;
|
|
72
|
+
return /* @__PURE__ */ E(P, {
|
|
73
|
+
open: e,
|
|
74
|
+
onOpenChange: t,
|
|
75
|
+
children: /* @__PURE__ */ D(F, {
|
|
76
|
+
className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ D(R, { children: [/* @__PURE__ */ E(ae, { children: n ? "Edit portfolio" : "New portfolio" }), /* @__PURE__ */ E(I, { children: n ? "Update this portfolio’s strategy settings." : "Create an investment portfolio to organize and rebalance holdings." })] }),
|
|
79
|
+
/* @__PURE__ */ D("div", {
|
|
80
|
+
className: "space-y-4 py-2",
|
|
81
|
+
children: [
|
|
82
|
+
/* @__PURE__ */ D("div", {
|
|
83
|
+
className: "space-y-1.5",
|
|
84
|
+
children: [/* @__PURE__ */ E(H, {
|
|
85
|
+
htmlFor: "pf-name",
|
|
86
|
+
children: "Name"
|
|
87
|
+
}), /* @__PURE__ */ E(V, {
|
|
88
|
+
id: "pf-name",
|
|
89
|
+
value: d.name,
|
|
90
|
+
onChange: (e) => f((t) => ({
|
|
91
|
+
...t,
|
|
92
|
+
name: e.target.value
|
|
93
|
+
})),
|
|
94
|
+
placeholder: "Growth Portfolio",
|
|
95
|
+
"aria-invalid": !_
|
|
96
|
+
})]
|
|
97
|
+
}),
|
|
98
|
+
/* @__PURE__ */ D("div", {
|
|
99
|
+
className: "grid grid-cols-2 gap-4",
|
|
100
|
+
children: [/* @__PURE__ */ D("div", {
|
|
101
|
+
className: "space-y-1.5",
|
|
102
|
+
children: [/* @__PURE__ */ E(H, {
|
|
103
|
+
htmlFor: "pf-currency",
|
|
104
|
+
children: "Base currency"
|
|
105
|
+
}), /* @__PURE__ */ E(V, {
|
|
106
|
+
id: "pf-currency",
|
|
107
|
+
value: d.baseCurrency,
|
|
108
|
+
onChange: (e) => f((t) => ({
|
|
109
|
+
...t,
|
|
110
|
+
baseCurrency: e.target.value.toUpperCase()
|
|
111
|
+
})),
|
|
112
|
+
placeholder: "USD",
|
|
113
|
+
maxLength: 3
|
|
114
|
+
})]
|
|
115
|
+
}), /* @__PURE__ */ D("div", {
|
|
116
|
+
className: "space-y-1.5",
|
|
117
|
+
children: [/* @__PURE__ */ E(H, {
|
|
118
|
+
htmlFor: "pf-drift",
|
|
119
|
+
children: "Drift threshold %"
|
|
120
|
+
}), /* @__PURE__ */ E(V, {
|
|
121
|
+
id: "pf-drift",
|
|
122
|
+
type: "number",
|
|
123
|
+
min: 0,
|
|
124
|
+
step: "0.5",
|
|
125
|
+
value: d.driftThresholdPct,
|
|
126
|
+
onChange: (e) => f((t) => ({
|
|
127
|
+
...t,
|
|
128
|
+
driftThresholdPct: e.target.value
|
|
129
|
+
}))
|
|
130
|
+
})]
|
|
131
|
+
})]
|
|
132
|
+
}),
|
|
133
|
+
n ? /* @__PURE__ */ D("div", {
|
|
134
|
+
className: "space-y-1.5",
|
|
135
|
+
children: [/* @__PURE__ */ E(H, {
|
|
136
|
+
htmlFor: "pf-status",
|
|
137
|
+
children: "Status"
|
|
138
|
+
}), /* @__PURE__ */ D(U, {
|
|
139
|
+
value: d.status,
|
|
140
|
+
onValueChange: (e) => f((t) => ({
|
|
141
|
+
...t,
|
|
142
|
+
status: e
|
|
143
|
+
})),
|
|
144
|
+
children: [/* @__PURE__ */ E(K, {
|
|
145
|
+
id: "pf-status",
|
|
146
|
+
children: /* @__PURE__ */ E(q, {})
|
|
147
|
+
}), /* @__PURE__ */ E(W, { children: xe.map((e) => /* @__PURE__ */ E(G, {
|
|
148
|
+
value: e,
|
|
149
|
+
children: Z(e)
|
|
150
|
+
}, e)) })]
|
|
151
|
+
})]
|
|
152
|
+
}) : null,
|
|
153
|
+
/* @__PURE__ */ D("div", {
|
|
154
|
+
className: "space-y-1.5",
|
|
155
|
+
children: [/* @__PURE__ */ E(H, {
|
|
156
|
+
htmlFor: "pf-model",
|
|
157
|
+
children: "Model portfolio"
|
|
158
|
+
}), /* @__PURE__ */ D(U, {
|
|
159
|
+
value: d.modelPortfolioId,
|
|
160
|
+
onValueChange: (e) => f((t) => ({
|
|
161
|
+
...t,
|
|
162
|
+
modelPortfolioId: e
|
|
163
|
+
})),
|
|
164
|
+
children: [/* @__PURE__ */ E(K, {
|
|
165
|
+
id: "pf-model",
|
|
166
|
+
children: /* @__PURE__ */ E(q, { placeholder: "None" })
|
|
167
|
+
}), /* @__PURE__ */ D(W, { children: [/* @__PURE__ */ E(G, {
|
|
168
|
+
value: X,
|
|
169
|
+
children: "None"
|
|
170
|
+
}), i.map((e) => /* @__PURE__ */ E(G, {
|
|
171
|
+
value: e.id,
|
|
172
|
+
children: e.name
|
|
173
|
+
}, e.id))] })]
|
|
174
|
+
})]
|
|
175
|
+
}),
|
|
176
|
+
n ? null : /* @__PURE__ */ D("div", {
|
|
177
|
+
className: "space-y-1.5",
|
|
178
|
+
children: [/* @__PURE__ */ E(H, {
|
|
179
|
+
htmlFor: "pf-household",
|
|
180
|
+
children: "Household"
|
|
181
|
+
}), /* @__PURE__ */ D(U, {
|
|
182
|
+
value: d.householdId,
|
|
183
|
+
onValueChange: (e) => f((t) => ({
|
|
184
|
+
...t,
|
|
185
|
+
householdId: e
|
|
186
|
+
})),
|
|
187
|
+
children: [/* @__PURE__ */ E(K, {
|
|
188
|
+
id: "pf-household",
|
|
189
|
+
children: /* @__PURE__ */ E(q, { placeholder: "None" })
|
|
190
|
+
}), /* @__PURE__ */ D(W, { children: [/* @__PURE__ */ E(G, {
|
|
191
|
+
value: X,
|
|
192
|
+
children: "None"
|
|
193
|
+
}), s.map((e) => /* @__PURE__ */ E(G, {
|
|
194
|
+
value: e.id,
|
|
195
|
+
children: e.name
|
|
196
|
+
}, e.id))] })]
|
|
197
|
+
})]
|
|
198
|
+
}),
|
|
199
|
+
/* @__PURE__ */ D("div", {
|
|
200
|
+
className: "space-y-1.5",
|
|
201
|
+
children: [/* @__PURE__ */ E(H, {
|
|
202
|
+
htmlFor: "pf-desc",
|
|
203
|
+
children: "Description"
|
|
204
|
+
}), /* @__PURE__ */ E(ye, {
|
|
205
|
+
id: "pf-desc",
|
|
206
|
+
value: d.description,
|
|
207
|
+
onChange: (e) => f((t) => ({
|
|
208
|
+
...t,
|
|
209
|
+
description: e.target.value
|
|
210
|
+
})),
|
|
211
|
+
placeholder: "Optional notes about this strategy",
|
|
212
|
+
rows: 3
|
|
213
|
+
})]
|
|
214
|
+
})
|
|
215
|
+
]
|
|
216
|
+
}),
|
|
217
|
+
/* @__PURE__ */ D(L, { children: [/* @__PURE__ */ E(k, {
|
|
218
|
+
variant: "outline",
|
|
219
|
+
onClick: () => t(!1),
|
|
220
|
+
disabled: g,
|
|
221
|
+
children: "Cancel"
|
|
222
|
+
}), /* @__PURE__ */ E(k, {
|
|
223
|
+
onClick: () => {
|
|
224
|
+
if (!_) return;
|
|
225
|
+
let e = Q(d.driftThresholdPct), r = d.modelPortfolioId === X ? null : d.modelPortfolioId, i = d.householdId === X ? null : d.householdId;
|
|
226
|
+
n ? l.mutate({
|
|
227
|
+
id: n.id,
|
|
228
|
+
input: {
|
|
229
|
+
name: d.name.trim(),
|
|
230
|
+
baseCurrency: d.baseCurrency.trim() || "USD",
|
|
231
|
+
description: d.description.trim() || null,
|
|
232
|
+
driftThresholdPct: e,
|
|
233
|
+
status: d.status,
|
|
234
|
+
modelPortfolioId: r
|
|
235
|
+
}
|
|
236
|
+
}, { onSuccess: () => t(!1) }) : c.mutate({
|
|
237
|
+
name: d.name.trim(),
|
|
238
|
+
baseCurrency: d.baseCurrency.trim() || "USD",
|
|
239
|
+
description: d.description.trim() || null,
|
|
240
|
+
driftThresholdPct: e,
|
|
241
|
+
modelPortfolioId: r,
|
|
242
|
+
householdId: i
|
|
243
|
+
}, { onSuccess: () => t(!1) });
|
|
244
|
+
},
|
|
245
|
+
disabled: !_ || g,
|
|
246
|
+
children: g ? "Saving…" : n ? "Save changes" : "Create portfolio"
|
|
247
|
+
})] })
|
|
248
|
+
]
|
|
249
|
+
})
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
function Te() {
|
|
253
|
+
return {
|
|
254
|
+
accountId: "",
|
|
255
|
+
symbol: "",
|
|
256
|
+
name: "",
|
|
257
|
+
assetClass: "EQUITY",
|
|
258
|
+
quantity: "0",
|
|
259
|
+
lastPrice: "0",
|
|
260
|
+
costBasis: "0"
|
|
261
|
+
};
|
|
262
|
+
}
|
|
263
|
+
function Ee({ open: t, onOpenChange: r, portfolioId: i, editing: a }) {
|
|
264
|
+
let { data: o } = e(), s = n(), c = l(), [u, d] = x(Te), [f, p] = x(null), m = a?.id ?? "new";
|
|
265
|
+
t && f !== m && (p(m), d(a ? {
|
|
266
|
+
accountId: a.accountId,
|
|
267
|
+
symbol: a.symbol,
|
|
268
|
+
name: a.name ?? "",
|
|
269
|
+
assetClass: a.assetClass,
|
|
270
|
+
quantity: String(a.quantity),
|
|
271
|
+
lastPrice: String(a.lastPrice),
|
|
272
|
+
costBasis: String(a.costBasis)
|
|
273
|
+
} : Te())), !t && f !== null && p(null);
|
|
274
|
+
let h = s.isPending || c.isPending, g = u.symbol.trim().length > 0, _ = a ? !0 : u.accountId.trim().length > 0, v = g && _ && !h;
|
|
275
|
+
return /* @__PURE__ */ E(P, {
|
|
276
|
+
open: t,
|
|
277
|
+
onOpenChange: r,
|
|
278
|
+
children: /* @__PURE__ */ D(F, {
|
|
279
|
+
className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
|
|
280
|
+
children: [
|
|
281
|
+
/* @__PURE__ */ D(R, { children: [/* @__PURE__ */ E(ae, { children: a ? "Edit holding" : "Add holding" }), /* @__PURE__ */ E(I, { children: a ? "Update the position details for this holding." : "Add a position to this portfolio from one of your accounts." })] }),
|
|
282
|
+
/* @__PURE__ */ D("div", {
|
|
283
|
+
className: "space-y-4 py-2",
|
|
284
|
+
children: [
|
|
285
|
+
a ? null : /* @__PURE__ */ D("div", {
|
|
286
|
+
className: "space-y-1.5",
|
|
287
|
+
children: [
|
|
288
|
+
/* @__PURE__ */ E(H, {
|
|
289
|
+
htmlFor: "h-account",
|
|
290
|
+
children: "Account"
|
|
291
|
+
}),
|
|
292
|
+
/* @__PURE__ */ D(U, {
|
|
293
|
+
value: u.accountId,
|
|
294
|
+
onValueChange: (e) => d((t) => ({
|
|
295
|
+
...t,
|
|
296
|
+
accountId: e
|
|
297
|
+
})),
|
|
298
|
+
children: [/* @__PURE__ */ E(K, {
|
|
299
|
+
id: "h-account",
|
|
300
|
+
"aria-invalid": !_,
|
|
301
|
+
children: /* @__PURE__ */ E(q, { placeholder: "Select account" })
|
|
302
|
+
}), /* @__PURE__ */ E(W, { children: o.map((e) => /* @__PURE__ */ E(G, {
|
|
303
|
+
value: e.id,
|
|
304
|
+
children: e.name
|
|
305
|
+
}, e.id)) })]
|
|
306
|
+
}),
|
|
307
|
+
o.length === 0 ? /* @__PURE__ */ E("p", {
|
|
308
|
+
className: "text-xs text-text-secondary",
|
|
309
|
+
children: "No accounts yet — create an account first."
|
|
310
|
+
}) : null
|
|
311
|
+
]
|
|
312
|
+
}),
|
|
313
|
+
/* @__PURE__ */ D("div", {
|
|
314
|
+
className: "grid grid-cols-2 gap-4",
|
|
315
|
+
children: [/* @__PURE__ */ D("div", {
|
|
316
|
+
className: "space-y-1.5",
|
|
317
|
+
children: [/* @__PURE__ */ E(H, {
|
|
318
|
+
htmlFor: "h-symbol",
|
|
319
|
+
children: "Symbol"
|
|
320
|
+
}), /* @__PURE__ */ E(V, {
|
|
321
|
+
id: "h-symbol",
|
|
322
|
+
value: u.symbol,
|
|
323
|
+
onChange: (e) => d((t) => ({
|
|
324
|
+
...t,
|
|
325
|
+
symbol: e.target.value
|
|
326
|
+
})),
|
|
327
|
+
placeholder: "AAPL",
|
|
328
|
+
disabled: !!a,
|
|
329
|
+
"aria-invalid": !g
|
|
330
|
+
})]
|
|
331
|
+
}), /* @__PURE__ */ D("div", {
|
|
332
|
+
className: "space-y-1.5",
|
|
333
|
+
children: [/* @__PURE__ */ E(H, {
|
|
334
|
+
htmlFor: "h-class",
|
|
335
|
+
children: "Asset class"
|
|
336
|
+
}), /* @__PURE__ */ D(U, {
|
|
337
|
+
value: u.assetClass,
|
|
338
|
+
onValueChange: (e) => d((t) => ({
|
|
339
|
+
...t,
|
|
340
|
+
assetClass: e
|
|
341
|
+
})),
|
|
342
|
+
children: [/* @__PURE__ */ E(K, {
|
|
343
|
+
id: "h-class",
|
|
344
|
+
children: /* @__PURE__ */ E(q, {})
|
|
345
|
+
}), /* @__PURE__ */ E(W, { children: be.map((e) => /* @__PURE__ */ E(G, {
|
|
346
|
+
value: e,
|
|
347
|
+
children: Z(e)
|
|
348
|
+
}, e)) })]
|
|
349
|
+
})]
|
|
350
|
+
})]
|
|
351
|
+
}),
|
|
352
|
+
/* @__PURE__ */ D("div", {
|
|
353
|
+
className: "space-y-1.5",
|
|
354
|
+
children: [/* @__PURE__ */ E(H, {
|
|
355
|
+
htmlFor: "h-name",
|
|
356
|
+
children: "Name"
|
|
357
|
+
}), /* @__PURE__ */ E(V, {
|
|
358
|
+
id: "h-name",
|
|
359
|
+
value: u.name,
|
|
360
|
+
onChange: (e) => d((t) => ({
|
|
361
|
+
...t,
|
|
362
|
+
name: e.target.value
|
|
363
|
+
})),
|
|
364
|
+
placeholder: "Apple Inc."
|
|
365
|
+
})]
|
|
366
|
+
}),
|
|
367
|
+
/* @__PURE__ */ D("div", {
|
|
368
|
+
className: "grid grid-cols-3 gap-4",
|
|
369
|
+
children: [
|
|
370
|
+
/* @__PURE__ */ D("div", {
|
|
371
|
+
className: "space-y-1.5",
|
|
372
|
+
children: [/* @__PURE__ */ E(H, {
|
|
373
|
+
htmlFor: "h-qty",
|
|
374
|
+
children: "Quantity"
|
|
375
|
+
}), /* @__PURE__ */ E(V, {
|
|
376
|
+
id: "h-qty",
|
|
377
|
+
type: "number",
|
|
378
|
+
step: "any",
|
|
379
|
+
value: u.quantity,
|
|
380
|
+
onChange: (e) => d((t) => ({
|
|
381
|
+
...t,
|
|
382
|
+
quantity: e.target.value
|
|
383
|
+
}))
|
|
384
|
+
})]
|
|
385
|
+
}),
|
|
386
|
+
/* @__PURE__ */ D("div", {
|
|
387
|
+
className: "space-y-1.5",
|
|
388
|
+
children: [/* @__PURE__ */ E(H, {
|
|
389
|
+
htmlFor: "h-price",
|
|
390
|
+
children: "Last price"
|
|
391
|
+
}), /* @__PURE__ */ E(V, {
|
|
392
|
+
id: "h-price",
|
|
393
|
+
type: "number",
|
|
394
|
+
step: "any",
|
|
395
|
+
value: u.lastPrice,
|
|
396
|
+
onChange: (e) => d((t) => ({
|
|
397
|
+
...t,
|
|
398
|
+
lastPrice: e.target.value
|
|
399
|
+
}))
|
|
400
|
+
})]
|
|
401
|
+
}),
|
|
402
|
+
/* @__PURE__ */ D("div", {
|
|
403
|
+
className: "space-y-1.5",
|
|
404
|
+
children: [/* @__PURE__ */ E(H, {
|
|
405
|
+
htmlFor: "h-cost",
|
|
406
|
+
children: "Cost basis"
|
|
407
|
+
}), /* @__PURE__ */ E(V, {
|
|
408
|
+
id: "h-cost",
|
|
409
|
+
type: "number",
|
|
410
|
+
step: "any",
|
|
411
|
+
value: u.costBasis,
|
|
412
|
+
onChange: (e) => d((t) => ({
|
|
413
|
+
...t,
|
|
414
|
+
costBasis: e.target.value
|
|
415
|
+
}))
|
|
416
|
+
})]
|
|
417
|
+
})
|
|
418
|
+
]
|
|
419
|
+
})
|
|
420
|
+
]
|
|
421
|
+
}),
|
|
422
|
+
/* @__PURE__ */ D(L, { children: [/* @__PURE__ */ E(k, {
|
|
423
|
+
variant: "outline",
|
|
424
|
+
onClick: () => r(!1),
|
|
425
|
+
disabled: h,
|
|
426
|
+
children: "Cancel"
|
|
427
|
+
}), /* @__PURE__ */ E(k, {
|
|
428
|
+
onClick: () => {
|
|
429
|
+
!g || !_ || (a ? c.mutate({
|
|
430
|
+
id: a.id,
|
|
431
|
+
input: {
|
|
432
|
+
name: u.name.trim() || null,
|
|
433
|
+
assetClass: u.assetClass,
|
|
434
|
+
quantity: Q(u.quantity),
|
|
435
|
+
lastPrice: Q(u.lastPrice),
|
|
436
|
+
costBasis: Q(u.costBasis)
|
|
437
|
+
}
|
|
438
|
+
}, { onSuccess: () => r(!1) }) : s.mutate({
|
|
439
|
+
accountId: u.accountId,
|
|
440
|
+
portfolioId: i,
|
|
441
|
+
symbol: u.symbol.trim().toUpperCase(),
|
|
442
|
+
name: u.name.trim() || null,
|
|
443
|
+
assetClass: u.assetClass,
|
|
444
|
+
quantity: Q(u.quantity),
|
|
445
|
+
lastPrice: Q(u.lastPrice),
|
|
446
|
+
costBasis: Q(u.costBasis)
|
|
447
|
+
}, { onSuccess: () => r(!1) }));
|
|
448
|
+
},
|
|
449
|
+
disabled: !v,
|
|
450
|
+
children: h ? "Saving…" : a ? "Save changes" : "Add holding"
|
|
451
|
+
})] })
|
|
452
|
+
]
|
|
453
|
+
})
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
function De({ portfolioId: e, onOpenChange: t }) {
|
|
457
|
+
let { data: n, isLoading: r, isError: a, refetch: o } = s(e ?? void 0), c = i(), [l, u] = x(!1), [m, g] = x(null), S = n?.holdings ?? [], C = n?.baseCurrency ?? "USD", P = S.reduce((e, t) => e + t.marketValue, 0), F = b(() => {
|
|
458
|
+
if (S.length === 0 || P <= 0) return [];
|
|
459
|
+
let e = /* @__PURE__ */ new Map();
|
|
460
|
+
return S.forEach((t) => e.set(t.assetClass, (e.get(t.assetClass) ?? 0) + t.marketValue)), Array.from(e.entries()).map(([e, t]) => ({
|
|
461
|
+
label: Z(e),
|
|
462
|
+
value: t / P * 100,
|
|
463
|
+
caption: _(t, C),
|
|
464
|
+
tone: "default"
|
|
465
|
+
})).sort((e, t) => t.value - e.value);
|
|
466
|
+
}, [
|
|
467
|
+
S,
|
|
468
|
+
P,
|
|
469
|
+
C
|
|
470
|
+
]), I = b(() => Se(n?.targetAllocation), [n?.targetAllocation]), L = () => {
|
|
471
|
+
g(null), u(!0);
|
|
472
|
+
}, R = (e) => {
|
|
473
|
+
g(e), u(!0);
|
|
474
|
+
};
|
|
475
|
+
return /* @__PURE__ */ E(ue, {
|
|
476
|
+
open: e !== null,
|
|
477
|
+
onOpenChange: t,
|
|
478
|
+
children: /* @__PURE__ */ E(de, {
|
|
479
|
+
className: "flex w-full flex-col gap-0 overflow-y-auto p-0 sm:max-w-2xl",
|
|
480
|
+
children: r ? /* @__PURE__ */ E("div", {
|
|
481
|
+
className: "p-6",
|
|
482
|
+
children: /* @__PURE__ */ E(h, { rows: 5 })
|
|
483
|
+
}) : a ? /* @__PURE__ */ E("div", {
|
|
484
|
+
className: "p-6",
|
|
485
|
+
children: /* @__PURE__ */ E(p, { onRetry: () => o() })
|
|
486
|
+
}) : n ? /* @__PURE__ */ D(re, { children: [
|
|
487
|
+
/* @__PURE__ */ D(pe, {
|
|
488
|
+
className: "border-b border-border-subtle p-6",
|
|
489
|
+
children: [/* @__PURE__ */ D("div", {
|
|
490
|
+
className: "flex items-center gap-2",
|
|
491
|
+
children: [/* @__PURE__ */ E(me, {
|
|
492
|
+
className: "text-xl",
|
|
493
|
+
children: n.name
|
|
494
|
+
}), /* @__PURE__ */ E(O, {
|
|
495
|
+
variant: y(n.status),
|
|
496
|
+
children: Z(n.status)
|
|
497
|
+
})]
|
|
498
|
+
}), /* @__PURE__ */ E(fe, { children: n.description?.trim() ? n.description : `${n.baseCurrency} · Drift threshold ${v(n.driftThresholdPct)}` })]
|
|
499
|
+
}),
|
|
500
|
+
/* @__PURE__ */ D("div", {
|
|
501
|
+
className: "space-y-6 p-6",
|
|
502
|
+
children: [
|
|
503
|
+
/* @__PURE__ */ D("div", {
|
|
504
|
+
className: "grid grid-cols-2 gap-4",
|
|
505
|
+
children: [/* @__PURE__ */ E(A, { children: /* @__PURE__ */ D(j, {
|
|
506
|
+
className: "space-y-1 p-4",
|
|
507
|
+
children: [/* @__PURE__ */ E("p", {
|
|
508
|
+
className: "text-xs text-text-secondary",
|
|
509
|
+
children: "Market value"
|
|
510
|
+
}), /* @__PURE__ */ E("p", {
|
|
511
|
+
className: "text-2xl font-semibold text-text-primary",
|
|
512
|
+
children: _(P, C)
|
|
513
|
+
})]
|
|
514
|
+
}) }), /* @__PURE__ */ E(A, { children: /* @__PURE__ */ D(j, {
|
|
515
|
+
className: "space-y-1 p-4",
|
|
516
|
+
children: [/* @__PURE__ */ E("p", {
|
|
517
|
+
className: "text-xs text-text-secondary",
|
|
518
|
+
children: "Holdings"
|
|
519
|
+
}), /* @__PURE__ */ E("p", {
|
|
520
|
+
className: "text-2xl font-semibold text-text-primary",
|
|
521
|
+
children: S.length
|
|
522
|
+
})]
|
|
523
|
+
}) })]
|
|
524
|
+
}),
|
|
525
|
+
/* @__PURE__ */ D("div", {
|
|
526
|
+
className: "grid gap-4 md:grid-cols-2",
|
|
527
|
+
children: [/* @__PURE__ */ D(A, { children: [/* @__PURE__ */ E(M, {
|
|
528
|
+
className: "pb-3",
|
|
529
|
+
children: /* @__PURE__ */ E(N, {
|
|
530
|
+
className: "text-sm",
|
|
531
|
+
children: "Target allocation"
|
|
532
|
+
})
|
|
533
|
+
}), /* @__PURE__ */ E(j, { children: I.length > 0 ? /* @__PURE__ */ E(d, { data: I }) : /* @__PURE__ */ E("p", {
|
|
534
|
+
className: "text-sm text-text-secondary",
|
|
535
|
+
children: "No target allocation set for this portfolio."
|
|
536
|
+
}) })] }), /* @__PURE__ */ D(A, { children: [/* @__PURE__ */ E(M, {
|
|
537
|
+
className: "pb-3",
|
|
538
|
+
children: /* @__PURE__ */ E(N, {
|
|
539
|
+
className: "text-sm",
|
|
540
|
+
children: "Actual allocation"
|
|
541
|
+
})
|
|
542
|
+
}), /* @__PURE__ */ E(j, { children: F.length > 0 ? /* @__PURE__ */ E(d, { data: F }) : /* @__PURE__ */ E("p", {
|
|
543
|
+
className: "text-sm text-text-secondary",
|
|
544
|
+
children: "Add holdings to see the live allocation."
|
|
545
|
+
}) })] })]
|
|
546
|
+
}),
|
|
547
|
+
/* @__PURE__ */ D(A, { children: [/* @__PURE__ */ D(M, {
|
|
548
|
+
className: "flex flex-row items-center justify-between",
|
|
549
|
+
children: [/* @__PURE__ */ D("div", { children: [/* @__PURE__ */ E(N, {
|
|
550
|
+
className: "text-base",
|
|
551
|
+
children: "Holdings"
|
|
552
|
+
}), /* @__PURE__ */ E(ie, { children: "Positions held in this portfolio" })] }), /* @__PURE__ */ D(k, {
|
|
553
|
+
size: "sm",
|
|
554
|
+
onClick: L,
|
|
555
|
+
children: [/* @__PURE__ */ E(T, {
|
|
556
|
+
className: "size-4",
|
|
557
|
+
"aria-hidden": "true"
|
|
558
|
+
}), "Add holding"]
|
|
559
|
+
})]
|
|
560
|
+
}), /* @__PURE__ */ E(j, { children: S.length === 0 ? /* @__PURE__ */ E(f, {
|
|
561
|
+
icon: /* @__PURE__ */ E(w, {
|
|
562
|
+
className: "size-6",
|
|
563
|
+
"aria-hidden": "true"
|
|
564
|
+
}),
|
|
565
|
+
title: "No holdings yet",
|
|
566
|
+
description: "Add positions to start tracking this portfolio.",
|
|
567
|
+
action: /* @__PURE__ */ D(k, {
|
|
568
|
+
size: "sm",
|
|
569
|
+
onClick: L,
|
|
570
|
+
children: [/* @__PURE__ */ E(T, {
|
|
571
|
+
className: "size-4",
|
|
572
|
+
"aria-hidden": "true"
|
|
573
|
+
}), "Add holding"]
|
|
574
|
+
})
|
|
575
|
+
}) : /* @__PURE__ */ E("div", {
|
|
576
|
+
className: "overflow-x-auto",
|
|
577
|
+
children: /* @__PURE__ */ D(he, { children: [/* @__PURE__ */ E(_e, { children: /* @__PURE__ */ D(ve, { children: [
|
|
578
|
+
/* @__PURE__ */ E(Y, { children: "Symbol" }),
|
|
579
|
+
/* @__PURE__ */ E(Y, { children: "Class" }),
|
|
580
|
+
/* @__PURE__ */ E(Y, {
|
|
581
|
+
className: "text-right",
|
|
582
|
+
children: "Qty"
|
|
583
|
+
}),
|
|
584
|
+
/* @__PURE__ */ E(Y, {
|
|
585
|
+
className: "text-right",
|
|
586
|
+
children: "Price"
|
|
587
|
+
}),
|
|
588
|
+
/* @__PURE__ */ E(Y, {
|
|
589
|
+
className: "text-right",
|
|
590
|
+
children: "Market value"
|
|
591
|
+
}),
|
|
592
|
+
/* @__PURE__ */ E(Y, {
|
|
593
|
+
className: "text-right",
|
|
594
|
+
children: "Gain"
|
|
595
|
+
}),
|
|
596
|
+
/* @__PURE__ */ E(Y, { className: "w-10" })
|
|
597
|
+
] }) }), /* @__PURE__ */ E(ge, { children: S.map((e) => {
|
|
598
|
+
let t = e.marketValue - e.costBasis;
|
|
599
|
+
return /* @__PURE__ */ D(ve, { children: [
|
|
600
|
+
/* @__PURE__ */ D(J, { children: [/* @__PURE__ */ E("div", {
|
|
601
|
+
className: "font-semibold text-text-primary",
|
|
602
|
+
children: e.symbol
|
|
603
|
+
}), e.name ? /* @__PURE__ */ E("div", {
|
|
604
|
+
className: "text-xs text-text-secondary",
|
|
605
|
+
children: e.name
|
|
606
|
+
}) : null] }),
|
|
607
|
+
/* @__PURE__ */ E(J, { children: /* @__PURE__ */ E(O, {
|
|
608
|
+
variant: "outline",
|
|
609
|
+
children: Z(e.assetClass)
|
|
610
|
+
}) }),
|
|
611
|
+
/* @__PURE__ */ E(J, {
|
|
612
|
+
className: "text-right tabular-nums",
|
|
613
|
+
children: e.quantity
|
|
614
|
+
}),
|
|
615
|
+
/* @__PURE__ */ E(J, {
|
|
616
|
+
className: "text-right tabular-nums",
|
|
617
|
+
children: _(e.lastPrice, e.currency)
|
|
618
|
+
}),
|
|
619
|
+
/* @__PURE__ */ E(J, {
|
|
620
|
+
className: "text-right font-medium tabular-nums",
|
|
621
|
+
children: _(e.marketValue, e.currency)
|
|
622
|
+
}),
|
|
623
|
+
/* @__PURE__ */ E(J, {
|
|
624
|
+
className: "text-right tabular-nums",
|
|
625
|
+
children: /* @__PURE__ */ E(Ce, {
|
|
626
|
+
value: t,
|
|
627
|
+
currency: e.currency
|
|
628
|
+
})
|
|
629
|
+
}),
|
|
630
|
+
/* @__PURE__ */ E(J, {
|
|
631
|
+
className: "text-right",
|
|
632
|
+
children: /* @__PURE__ */ D(z, { children: [/* @__PURE__ */ E(le, {
|
|
633
|
+
asChild: !0,
|
|
634
|
+
children: /* @__PURE__ */ E(k, {
|
|
635
|
+
variant: "ghost",
|
|
636
|
+
size: "icon",
|
|
637
|
+
className: "size-10",
|
|
638
|
+
"aria-label": `Actions for ${e.symbol}`,
|
|
639
|
+
children: /* @__PURE__ */ E(ee, {
|
|
640
|
+
className: "size-4",
|
|
641
|
+
"aria-hidden": "true"
|
|
642
|
+
})
|
|
643
|
+
})
|
|
644
|
+
}), /* @__PURE__ */ D(oe, {
|
|
645
|
+
align: "end",
|
|
646
|
+
children: [
|
|
647
|
+
/* @__PURE__ */ E(se, { children: e.symbol }),
|
|
648
|
+
/* @__PURE__ */ E(ce, {}),
|
|
649
|
+
/* @__PURE__ */ D(B, {
|
|
650
|
+
className: "gap-2",
|
|
651
|
+
onClick: () => R(e),
|
|
652
|
+
children: [/* @__PURE__ */ E(te, {
|
|
653
|
+
className: "size-4",
|
|
654
|
+
"aria-hidden": "true"
|
|
655
|
+
}), "Edit"]
|
|
656
|
+
}),
|
|
657
|
+
/* @__PURE__ */ D(B, {
|
|
658
|
+
className: "gap-2 text-status-error-text focus:text-status-error-text",
|
|
659
|
+
disabled: c.isPending,
|
|
660
|
+
onClick: () => c.mutate(e.id),
|
|
661
|
+
children: [/* @__PURE__ */ E(ne, {
|
|
662
|
+
className: "size-4",
|
|
663
|
+
"aria-hidden": "true"
|
|
664
|
+
}), "Delete"]
|
|
665
|
+
})
|
|
666
|
+
]
|
|
667
|
+
})] })
|
|
668
|
+
})
|
|
669
|
+
] }, e.id);
|
|
670
|
+
}) })] })
|
|
671
|
+
}) })] })
|
|
672
|
+
]
|
|
673
|
+
}),
|
|
674
|
+
/* @__PURE__ */ E(Ee, {
|
|
675
|
+
open: l,
|
|
676
|
+
onOpenChange: u,
|
|
677
|
+
portfolioId: n.id,
|
|
678
|
+
editing: m
|
|
679
|
+
})
|
|
680
|
+
] }) : /* @__PURE__ */ E("div", {
|
|
681
|
+
className: "p-6",
|
|
682
|
+
children: /* @__PURE__ */ E(f, {
|
|
683
|
+
icon: /* @__PURE__ */ E(w, {
|
|
684
|
+
className: "size-6",
|
|
685
|
+
"aria-hidden": "true"
|
|
686
|
+
}),
|
|
687
|
+
title: "Portfolio not found",
|
|
688
|
+
description: "This portfolio may have been archived or removed."
|
|
689
|
+
})
|
|
690
|
+
})
|
|
691
|
+
})
|
|
692
|
+
});
|
|
693
|
+
}
|
|
694
|
+
function Oe() {
|
|
695
|
+
let { data: e, isLoading: n, isError: r, refetch: i } = c(), a = t(), [o, s] = x(!1), [l, u] = x(null), [d, _] = x(null), b = e.filter((e) => e.status === "ACTIVE").length, S = e.filter((e) => e.status === "DRAFT").length, C = e.length > 0 ? e.reduce((e, t) => e + t.driftThresholdPct, 0) / e.length : 0, P = () => {
|
|
696
|
+
u(null), s(!0);
|
|
697
|
+
}, F = (e) => {
|
|
698
|
+
u(e), s(!0);
|
|
699
|
+
};
|
|
700
|
+
return /* @__PURE__ */ D(g, {
|
|
701
|
+
title: "Portfolios",
|
|
702
|
+
description: "Organize holdings into strategies and keep allocations on target.",
|
|
703
|
+
badges: e.length > 0 ? [`${e.length} total`] : [],
|
|
704
|
+
actions: /* @__PURE__ */ D(k, {
|
|
705
|
+
size: "sm",
|
|
706
|
+
onClick: P,
|
|
707
|
+
children: [/* @__PURE__ */ E(T, {
|
|
708
|
+
className: "size-4",
|
|
709
|
+
"aria-hidden": "true"
|
|
710
|
+
}), "New portfolio"]
|
|
711
|
+
}),
|
|
712
|
+
children: [
|
|
713
|
+
n ? /* @__PURE__ */ E(h, { rows: 4 }) : r ? /* @__PURE__ */ E(p, { onRetry: () => i() }) : e.length === 0 ? /* @__PURE__ */ E(f, {
|
|
714
|
+
icon: /* @__PURE__ */ E(w, {
|
|
715
|
+
className: "size-6",
|
|
716
|
+
"aria-hidden": "true"
|
|
717
|
+
}),
|
|
718
|
+
title: "No portfolios yet",
|
|
719
|
+
description: "Create your first portfolio to start organizing holdings and tracking drift.",
|
|
720
|
+
action: /* @__PURE__ */ D(k, {
|
|
721
|
+
size: "sm",
|
|
722
|
+
onClick: P,
|
|
723
|
+
children: [/* @__PURE__ */ E(T, {
|
|
724
|
+
className: "size-4",
|
|
725
|
+
"aria-hidden": "true"
|
|
726
|
+
}), "New portfolio"]
|
|
727
|
+
})
|
|
728
|
+
}) : /* @__PURE__ */ D(re, { children: [/* @__PURE__ */ E(m, { items: [
|
|
16
729
|
{
|
|
17
|
-
label: "
|
|
18
|
-
value:
|
|
19
|
-
trend: "+9.8% overall"
|
|
730
|
+
label: "Portfolios",
|
|
731
|
+
value: String(e.length)
|
|
20
732
|
},
|
|
21
733
|
{
|
|
22
|
-
label: "Active
|
|
23
|
-
value: String(
|
|
734
|
+
label: "Active",
|
|
735
|
+
value: String(b)
|
|
24
736
|
},
|
|
25
737
|
{
|
|
26
|
-
label: "
|
|
27
|
-
value:
|
|
28
|
-
trend: "Above benchmark"
|
|
738
|
+
label: "Drafts",
|
|
739
|
+
value: String(S)
|
|
29
740
|
},
|
|
30
741
|
{
|
|
31
|
-
label: "
|
|
32
|
-
value:
|
|
33
|
-
trend: "Across all strategies"
|
|
742
|
+
label: "Avg drift threshold",
|
|
743
|
+
value: v(C)
|
|
34
744
|
}
|
|
35
|
-
] }),
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return /* @__PURE__ */ u(p, { children: [/* @__PURE__ */ l(g, {
|
|
745
|
+
] }), /* @__PURE__ */ E("div", {
|
|
746
|
+
className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
747
|
+
children: e.map((e) => /* @__PURE__ */ D(A, {
|
|
748
|
+
className: "flex flex-col",
|
|
749
|
+
children: [/* @__PURE__ */ D(M, {
|
|
41
750
|
className: "pb-3",
|
|
42
|
-
children: /* @__PURE__ */
|
|
43
|
-
className: "flex items-
|
|
44
|
-
children: [/* @__PURE__ */
|
|
45
|
-
className: "
|
|
46
|
-
children: [/* @__PURE__ */
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
})
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
751
|
+
children: [/* @__PURE__ */ D("div", {
|
|
752
|
+
className: "flex items-start justify-between gap-2",
|
|
753
|
+
children: [/* @__PURE__ */ D(N, {
|
|
754
|
+
className: "flex items-center gap-2 text-base",
|
|
755
|
+
children: [/* @__PURE__ */ E(w, {
|
|
756
|
+
className: "size-4 text-text-secondary",
|
|
757
|
+
"aria-hidden": "true"
|
|
758
|
+
}), e.name]
|
|
759
|
+
}), /* @__PURE__ */ D(z, { children: [/* @__PURE__ */ E(le, {
|
|
760
|
+
asChild: !0,
|
|
761
|
+
children: /* @__PURE__ */ E(k, {
|
|
762
|
+
variant: "ghost",
|
|
763
|
+
size: "icon",
|
|
764
|
+
className: "size-10",
|
|
765
|
+
"aria-label": `Actions for ${e.name}`,
|
|
766
|
+
children: /* @__PURE__ */ E(ee, {
|
|
767
|
+
className: "size-4",
|
|
768
|
+
"aria-hidden": "true"
|
|
769
|
+
})
|
|
770
|
+
})
|
|
771
|
+
}), /* @__PURE__ */ D(oe, {
|
|
772
|
+
align: "end",
|
|
60
773
|
children: [
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
774
|
+
/* @__PURE__ */ E(se, { children: e.name }),
|
|
775
|
+
/* @__PURE__ */ E(ce, {}),
|
|
776
|
+
/* @__PURE__ */ D(B, {
|
|
777
|
+
className: "gap-2",
|
|
778
|
+
onClick: () => F(e),
|
|
779
|
+
children: [/* @__PURE__ */ E(te, {
|
|
780
|
+
className: "size-4",
|
|
781
|
+
"aria-hidden": "true"
|
|
782
|
+
}), "Edit"]
|
|
783
|
+
}),
|
|
784
|
+
/* @__PURE__ */ D(B, {
|
|
785
|
+
className: "gap-2 text-status-error-text focus:text-status-error-text",
|
|
786
|
+
disabled: a.isPending || e.status === "ARCHIVED",
|
|
787
|
+
onClick: () => a.mutate(e.id),
|
|
788
|
+
children: [/* @__PURE__ */ E(ne, {
|
|
789
|
+
className: "size-4",
|
|
790
|
+
"aria-hidden": "true"
|
|
791
|
+
}), "Archive"]
|
|
76
792
|
})
|
|
77
|
-
|
|
78
|
-
})
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
793
|
+
]
|
|
794
|
+
})] })]
|
|
795
|
+
}), e.description?.trim() ? /* @__PURE__ */ E(ie, {
|
|
796
|
+
className: "line-clamp-2",
|
|
797
|
+
children: e.description
|
|
798
|
+
}) : null]
|
|
799
|
+
}), /* @__PURE__ */ D(j, {
|
|
800
|
+
className: "flex flex-1 flex-col justify-between gap-4",
|
|
801
|
+
children: [/* @__PURE__ */ D("div", {
|
|
802
|
+
className: "flex flex-wrap items-center gap-2",
|
|
803
|
+
children: [
|
|
804
|
+
/* @__PURE__ */ E(O, {
|
|
805
|
+
variant: y(e.status),
|
|
806
|
+
children: Z(e.status)
|
|
807
|
+
}),
|
|
808
|
+
/* @__PURE__ */ E(O, {
|
|
87
809
|
variant: "outline",
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
810
|
+
children: e.baseCurrency
|
|
811
|
+
}),
|
|
812
|
+
/* @__PURE__ */ D(O, {
|
|
813
|
+
variant: "secondary",
|
|
814
|
+
children: ["Drift ", v(e.driftThresholdPct)]
|
|
815
|
+
})
|
|
816
|
+
]
|
|
817
|
+
}), /* @__PURE__ */ E(k, {
|
|
818
|
+
variant: "outline",
|
|
819
|
+
size: "sm",
|
|
820
|
+
className: "w-full",
|
|
821
|
+
onClick: () => _(e.id),
|
|
822
|
+
children: "View holdings"
|
|
823
|
+
})]
|
|
824
|
+
})]
|
|
825
|
+
}, e.id))
|
|
826
|
+
})] }),
|
|
827
|
+
/* @__PURE__ */ E(we, {
|
|
828
|
+
open: o,
|
|
829
|
+
onOpenChange: s,
|
|
830
|
+
editing: l
|
|
96
831
|
}),
|
|
97
|
-
/* @__PURE__ */
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
let n = [
|
|
104
|
-
"bg-blue-500",
|
|
105
|
-
"bg-purple-500",
|
|
106
|
-
"bg-emerald-500"
|
|
107
|
-
], r = e.value / E * 100;
|
|
108
|
-
return /* @__PURE__ */ u("div", {
|
|
109
|
-
className: `${n[t % n.length]} flex items-center justify-center text-[10px] font-medium text-white`,
|
|
110
|
-
style: { width: `${r}%` },
|
|
111
|
-
children: [r.toFixed(0), "%"]
|
|
112
|
-
}, e.id);
|
|
113
|
-
})
|
|
114
|
-
}), /* @__PURE__ */ l("div", {
|
|
115
|
-
className: "mt-3 flex flex-wrap gap-4",
|
|
116
|
-
children: w.map((e, t) => {
|
|
117
|
-
let n = [
|
|
118
|
-
"bg-blue-500",
|
|
119
|
-
"bg-purple-500",
|
|
120
|
-
"bg-emerald-500"
|
|
121
|
-
];
|
|
122
|
-
return /* @__PURE__ */ u("div", {
|
|
123
|
-
className: "flex items-center gap-2 text-sm",
|
|
124
|
-
children: [/* @__PURE__ */ l("div", { className: `h-3 w-3 rounded-full ${n[t % n.length]}` }), e.name]
|
|
125
|
-
}, e.id);
|
|
126
|
-
})
|
|
127
|
-
})] })] }),
|
|
128
|
-
/* @__PURE__ */ u(p, { children: [/* @__PURE__ */ u(g, {
|
|
129
|
-
className: "flex flex-row items-center justify-between",
|
|
130
|
-
children: [/* @__PURE__ */ u("div", { children: [/* @__PURE__ */ l(_, { children: "Holdings" }), /* @__PURE__ */ l(h, { children: "All securities across every portfolio" })] }), /* @__PURE__ */ u(f, {
|
|
131
|
-
size: "sm",
|
|
132
|
-
children: [/* @__PURE__ */ l(o, { className: "mr-1 h-4 w-4" }), "Add Position"]
|
|
133
|
-
})]
|
|
134
|
-
}), /* @__PURE__ */ l(m, { children: /* @__PURE__ */ u(v, { children: [/* @__PURE__ */ l(S, { children: /* @__PURE__ */ u(C, { children: [
|
|
135
|
-
/* @__PURE__ */ l(x, { children: "Symbol" }),
|
|
136
|
-
/* @__PURE__ */ l(x, { children: "Name" }),
|
|
137
|
-
/* @__PURE__ */ l(x, { children: "Sector" }),
|
|
138
|
-
/* @__PURE__ */ l(x, {
|
|
139
|
-
className: "text-right",
|
|
140
|
-
children: "Market Value"
|
|
141
|
-
}),
|
|
142
|
-
/* @__PURE__ */ l(x, {
|
|
143
|
-
className: "text-right",
|
|
144
|
-
children: "Change %"
|
|
145
|
-
})
|
|
146
|
-
] }) }), /* @__PURE__ */ l(y, { children: T.map((e) => /* @__PURE__ */ u(C, { children: [
|
|
147
|
-
/* @__PURE__ */ l(b, {
|
|
148
|
-
className: "font-semibold",
|
|
149
|
-
children: e.symbol
|
|
150
|
-
}),
|
|
151
|
-
/* @__PURE__ */ l(b, { children: e.name }),
|
|
152
|
-
/* @__PURE__ */ l(b, { children: /* @__PURE__ */ l(d, {
|
|
153
|
-
variant: "outline",
|
|
154
|
-
children: e.sector
|
|
155
|
-
}) }),
|
|
156
|
-
/* @__PURE__ */ l(b, {
|
|
157
|
-
className: "text-right",
|
|
158
|
-
children: r(e.marketValue)
|
|
159
|
-
}),
|
|
160
|
-
/* @__PURE__ */ u(b, {
|
|
161
|
-
className: `text-right ${e.changePct >= 0 ? "text-emerald-600" : "text-red-600"}`,
|
|
162
|
-
children: [
|
|
163
|
-
e.changePct >= 0 ? "+" : "",
|
|
164
|
-
e.changePct,
|
|
165
|
-
"%"
|
|
166
|
-
]
|
|
167
|
-
})
|
|
168
|
-
] }, e.symbol)) })] }) })] })
|
|
832
|
+
/* @__PURE__ */ E(De, {
|
|
833
|
+
portfolioId: d,
|
|
834
|
+
onOpenChange: (e) => {
|
|
835
|
+
e || _(null);
|
|
836
|
+
}
|
|
837
|
+
})
|
|
169
838
|
]
|
|
170
839
|
});
|
|
171
840
|
}
|
|
172
841
|
//#endregion
|
|
173
|
-
export {
|
|
842
|
+
export { Oe as PortfoliosPage };
|
|
174
843
|
|
|
175
844
|
//# sourceMappingURL=PortfoliosPage.js.map
|