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