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