@burdenoff/microfe-brainyrich 2026.827.1 → 2026.828.2
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.d.ts.map +1 -1
- package/dist/brainyrich/BrainyRichRoot.js +59 -59
- package/dist/brainyrich/BrainyRichRoot.js.map +1 -1
- package/dist/brainyrich/components/viz.d.ts.map +1 -1
- package/dist/brainyrich/components/viz.js +1 -1
- package/dist/brainyrich/components/viz.js.map +1 -1
- package/dist/brainyrich/hooks/useBrainyRichApi.d.ts +3 -1
- package/dist/brainyrich/hooks/useBrainyRichApi.d.ts.map +1 -1
- package/dist/brainyrich/hooks/useBrainyRichApi.js +6 -2
- package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -1
- package/dist/brainyrich/pages/AccountsPage.d.ts.map +1 -1
- package/dist/brainyrich/pages/AccountsPage.js +159 -148
- package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
- package/dist/brainyrich/pages/AiAssistantPage.js +192 -192
- package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
- package/dist/brainyrich/pages/AnalyticsPage.js +9 -9
- package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
- package/dist/brainyrich/pages/DashboardPage.js +115 -115
- package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
- package/dist/brainyrich/pages/FamilyPage.js +59 -59
- package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
- package/dist/brainyrich/pages/GoalsPage.js +285 -285
- package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
- package/dist/brainyrich/pages/InvestmentsPage.js +18 -18
- package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
- package/dist/brainyrich/pages/PortfoliosPage.d.ts.map +1 -1
- package/dist/brainyrich/pages/PortfoliosPage.js +322 -322
- package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
- package/dist/brainyrich/pages/ReportsPage.js +17 -17
- package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
- package/dist/brainyrich/pages/RiskPage.js +16 -16
- package/dist/brainyrich/pages/RiskPage.js.map +1 -1
- package/dist/brainyrich/pages/TaxPage.d.ts.map +1 -1
- package/dist/brainyrich/pages/TaxPage.js +14 -14
- package/dist/brainyrich/pages/TaxPage.js.map +1 -1
- package/dist/brainyrich/types/bra.d.ts.map +1 -1
- package/dist/generated/global-operations.d.ts +31 -1
- package/dist/generated/global-operations.d.ts.map +1 -1
- package/dist/generated/wspace-operations.d.ts +31 -1
- package/dist/generated/wspace-operations.d.ts.map +1 -1
- package/dist/test/setup.d.ts +1 -0
- package/dist/test/setup.d.ts.map +1 -0
- package/package.json +11 -2
|
@@ -4,15 +4,15 @@ import { ConfirmDialog as f } from "../components/ConfirmDialog.js";
|
|
|
4
4
|
import { DonutChart as p, FadeIn as m, GlassCard as h, StatTile as g } from "../components/viz.js";
|
|
5
5
|
import { AccountPicker as _ } from "../components/pickers.js";
|
|
6
6
|
import "../components/index.js";
|
|
7
|
-
import { AllocationBars as ee, EmptyState as te, ErrorState as ne, LoadingState as re, SectionShell as ie, deltaToneClass as v, formatCompact as
|
|
8
|
-
import { hapticSuccess as
|
|
9
|
-
import { useTrackBrainyRichPageView as
|
|
10
|
-
import { TagField as
|
|
11
|
-
import { CommentThread as
|
|
12
|
-
import { useMemo as
|
|
13
|
-
import { ArrowDownRight as
|
|
14
|
-
import { Fragment as
|
|
15
|
-
import { Badge as
|
|
7
|
+
import { AllocationBars as ee, EmptyState as te, ErrorState as ne, LoadingState as re, SectionShell as ie, deltaToneClass as v, formatCompact as ae, formatMoney as y, formatPct as b, statusBadgeVariant as oe } from "./_shared.js";
|
|
8
|
+
import { hapticSuccess as x, showToast as S } from "../utils/nativeControls.js";
|
|
9
|
+
import { useTrackBrainyRichPageView as C } from "../hooks/useBrainyRichAnalytics.js";
|
|
10
|
+
import { TagField as se } from "../components/reuse/TagField.js";
|
|
11
|
+
import { CommentThread as ce } from "../components/reuse/CommentThread.js";
|
|
12
|
+
import { useMemo as w, useState as T } from "react";
|
|
13
|
+
import { ArrowDownRight as E, ArrowUpRight as D, Briefcase as le, MoreHorizontal as ue, Pencil as de, Plus as O, Trash2 as k } from "lucide-react";
|
|
14
|
+
import { Fragment as fe, jsx as A, jsxs as j } from "react/jsx-runtime";
|
|
15
|
+
import { Badge as M, Button as N, Card as P, CardContent as F, CardDescription as pe, CardHeader as I, CardTitle as L, DropdownMenu as me, DropdownMenuContent as he, DropdownMenuItem as R, DropdownMenuLabel as ge, DropdownMenuSeparator as _e, DropdownMenuTrigger as ve, Input as z, Label as B, ResponsiveDialog as ye, ResponsiveDialogContent as V, ResponsiveDialogDescription as H, ResponsiveDialogFooter as U, ResponsiveDialogHeader as W, ResponsiveDialogTitle as be, Select as G, SelectContent as K, SelectItem as q, SelectTrigger as xe, SelectValue as J, Sheet as Se, SheetContent as Ce, SheetDescription as we, SheetHeader as Te, SheetTitle as Ee, Table as De, TableBody as Oe, TableCell as Y, TableHead as X, TableHeader as ke, TableRow as Ae, Textarea as je } from "@burdenoff/fe-libs/ui";
|
|
16
16
|
//#region src/brainyrich/pages/PortfoliosPage.tsx
|
|
17
17
|
var Me = [
|
|
18
18
|
"EQUITY",
|
|
@@ -103,16 +103,16 @@ function Be(e, t) {
|
|
|
103
103
|
};
|
|
104
104
|
}
|
|
105
105
|
function Ve({ value: e, currency: t }) {
|
|
106
|
-
let n = e > 0, r = e < 0, i = n ? "text-status-success-text" : r ? "text-status-error-text" : "text-text-secondary", a = n ?
|
|
107
|
-
return /* @__PURE__ */
|
|
106
|
+
let n = e > 0, r = e < 0, i = n ? "text-status-success-text" : r ? "text-status-error-text" : "text-text-secondary", a = n ? D : r ? E : null;
|
|
107
|
+
return /* @__PURE__ */ j("span", {
|
|
108
108
|
className: `inline-flex items-center justify-end gap-1 font-medium ${i}`,
|
|
109
109
|
children: [
|
|
110
|
-
a ? /* @__PURE__ */
|
|
110
|
+
a ? /* @__PURE__ */ A(a, {
|
|
111
111
|
className: "size-3.5",
|
|
112
112
|
"aria-hidden": "true"
|
|
113
113
|
}) : null,
|
|
114
114
|
n ? "+" : "",
|
|
115
|
-
|
|
115
|
+
y(e, t)
|
|
116
116
|
]
|
|
117
117
|
});
|
|
118
118
|
}
|
|
@@ -128,7 +128,7 @@ function He() {
|
|
|
128
128
|
};
|
|
129
129
|
}
|
|
130
130
|
function Ue({ open: e, onOpenChange: t, editing: n }) {
|
|
131
|
-
let { data: i } = o(), { data: s } = a(), c = r(), l = u(), [d, f] =
|
|
131
|
+
let { data: i } = o(), { data: s } = a(), c = r(), l = u(), [d, f] = T(He), [p, m] = T(null), h = n?.id ?? "new";
|
|
132
132
|
e && p !== h && (m(h), f(n ? {
|
|
133
133
|
name: n.name,
|
|
134
134
|
baseCurrency: n.baseCurrency,
|
|
@@ -139,22 +139,22 @@ function Ue({ open: e, onOpenChange: t, editing: n }) {
|
|
|
139
139
|
householdId: n.householdId ?? Z
|
|
140
140
|
} : He())), !e && p !== null && m(null);
|
|
141
141
|
let g = c.isPending || l.isPending, _ = d.name.trim().length > 0;
|
|
142
|
-
return /* @__PURE__ */
|
|
142
|
+
return /* @__PURE__ */ A(ye, {
|
|
143
143
|
open: e,
|
|
144
144
|
onOpenChange: t,
|
|
145
|
-
children: /* @__PURE__ */
|
|
145
|
+
children: /* @__PURE__ */ j(V, {
|
|
146
146
|
className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
|
|
147
147
|
children: [
|
|
148
|
-
/* @__PURE__ */
|
|
149
|
-
/* @__PURE__ */
|
|
148
|
+
/* @__PURE__ */ j(W, { children: [/* @__PURE__ */ A(be, { children: n ? "Edit portfolio" : "New portfolio" }), /* @__PURE__ */ A(H, { children: n ? "Update this portfolio’s strategy settings." : "Create an investment portfolio to organize and rebalance holdings." })] }),
|
|
149
|
+
/* @__PURE__ */ j("div", {
|
|
150
150
|
className: "space-y-4 py-2",
|
|
151
151
|
children: [
|
|
152
|
-
/* @__PURE__ */
|
|
152
|
+
/* @__PURE__ */ j("div", {
|
|
153
153
|
className: "space-y-1.5",
|
|
154
|
-
children: [/* @__PURE__ */
|
|
154
|
+
children: [/* @__PURE__ */ A(B, {
|
|
155
155
|
htmlFor: "pf-name",
|
|
156
156
|
children: "Name"
|
|
157
|
-
}), /* @__PURE__ */
|
|
157
|
+
}), /* @__PURE__ */ A(z, {
|
|
158
158
|
id: "pf-name",
|
|
159
159
|
value: d.name,
|
|
160
160
|
onChange: (e) => f((t) => ({
|
|
@@ -165,14 +165,14 @@ function Ue({ open: e, onOpenChange: t, editing: n }) {
|
|
|
165
165
|
"aria-invalid": !_
|
|
166
166
|
})]
|
|
167
167
|
}),
|
|
168
|
-
/* @__PURE__ */
|
|
168
|
+
/* @__PURE__ */ j("div", {
|
|
169
169
|
className: "grid grid-cols-2 gap-4",
|
|
170
|
-
children: [/* @__PURE__ */
|
|
170
|
+
children: [/* @__PURE__ */ j("div", {
|
|
171
171
|
className: "space-y-1.5",
|
|
172
|
-
children: [/* @__PURE__ */
|
|
172
|
+
children: [/* @__PURE__ */ A(B, {
|
|
173
173
|
htmlFor: "pf-currency",
|
|
174
174
|
children: "Base currency"
|
|
175
|
-
}), /* @__PURE__ */
|
|
175
|
+
}), /* @__PURE__ */ A(z, {
|
|
176
176
|
id: "pf-currency",
|
|
177
177
|
value: d.baseCurrency,
|
|
178
178
|
onChange: (e) => f((t) => ({
|
|
@@ -182,12 +182,12 @@ function Ue({ open: e, onOpenChange: t, editing: n }) {
|
|
|
182
182
|
placeholder: "USD",
|
|
183
183
|
maxLength: 3
|
|
184
184
|
})]
|
|
185
|
-
}), /* @__PURE__ */
|
|
185
|
+
}), /* @__PURE__ */ j("div", {
|
|
186
186
|
className: "space-y-1.5",
|
|
187
|
-
children: [/* @__PURE__ */
|
|
187
|
+
children: [/* @__PURE__ */ A(B, {
|
|
188
188
|
htmlFor: "pf-drift",
|
|
189
189
|
children: "Drift threshold %"
|
|
190
|
-
}), /* @__PURE__ */
|
|
190
|
+
}), /* @__PURE__ */ A(z, {
|
|
191
191
|
id: "pf-drift",
|
|
192
192
|
type: "number",
|
|
193
193
|
min: 0,
|
|
@@ -200,78 +200,78 @@ function Ue({ open: e, onOpenChange: t, editing: n }) {
|
|
|
200
200
|
})]
|
|
201
201
|
})]
|
|
202
202
|
}),
|
|
203
|
-
n ? /* @__PURE__ */
|
|
203
|
+
n ? /* @__PURE__ */ j("div", {
|
|
204
204
|
className: "space-y-1.5",
|
|
205
|
-
children: [/* @__PURE__ */
|
|
205
|
+
children: [/* @__PURE__ */ A(B, {
|
|
206
206
|
htmlFor: "pf-status",
|
|
207
207
|
children: "Status"
|
|
208
|
-
}), /* @__PURE__ */
|
|
208
|
+
}), /* @__PURE__ */ j(G, {
|
|
209
209
|
value: d.status,
|
|
210
210
|
onValueChange: (e) => f((t) => ({
|
|
211
211
|
...t,
|
|
212
212
|
status: e
|
|
213
213
|
})),
|
|
214
|
-
children: [/* @__PURE__ */
|
|
214
|
+
children: [/* @__PURE__ */ A(xe, {
|
|
215
215
|
id: "pf-status",
|
|
216
|
-
children: /* @__PURE__ */
|
|
217
|
-
}), /* @__PURE__ */
|
|
216
|
+
children: /* @__PURE__ */ A(J, {})
|
|
217
|
+
}), /* @__PURE__ */ A(K, { children: Ne.map((e) => /* @__PURE__ */ A(q, {
|
|
218
218
|
value: e,
|
|
219
219
|
children: Q(e)
|
|
220
220
|
}, e)) })]
|
|
221
221
|
})]
|
|
222
222
|
}) : null,
|
|
223
|
-
/* @__PURE__ */
|
|
223
|
+
/* @__PURE__ */ j("div", {
|
|
224
224
|
className: "space-y-1.5",
|
|
225
|
-
children: [/* @__PURE__ */
|
|
225
|
+
children: [/* @__PURE__ */ A(B, {
|
|
226
226
|
htmlFor: "pf-model",
|
|
227
227
|
children: "Model portfolio"
|
|
228
|
-
}), /* @__PURE__ */
|
|
228
|
+
}), /* @__PURE__ */ j(G, {
|
|
229
229
|
value: d.modelPortfolioId,
|
|
230
230
|
onValueChange: (e) => f((t) => ({
|
|
231
231
|
...t,
|
|
232
232
|
modelPortfolioId: e
|
|
233
233
|
})),
|
|
234
|
-
children: [/* @__PURE__ */
|
|
234
|
+
children: [/* @__PURE__ */ A(xe, {
|
|
235
235
|
id: "pf-model",
|
|
236
|
-
children: /* @__PURE__ */
|
|
237
|
-
}), /* @__PURE__ */
|
|
236
|
+
children: /* @__PURE__ */ A(J, { placeholder: "None" })
|
|
237
|
+
}), /* @__PURE__ */ j(K, { children: [/* @__PURE__ */ A(q, {
|
|
238
238
|
value: Z,
|
|
239
239
|
children: "None"
|
|
240
|
-
}), i.map((e) => /* @__PURE__ */
|
|
240
|
+
}), i.map((e) => /* @__PURE__ */ A(q, {
|
|
241
241
|
value: e.id,
|
|
242
242
|
children: e.name
|
|
243
243
|
}, e.id))] })]
|
|
244
244
|
})]
|
|
245
245
|
}),
|
|
246
|
-
n ? null : /* @__PURE__ */
|
|
246
|
+
n ? null : /* @__PURE__ */ j("div", {
|
|
247
247
|
className: "space-y-1.5",
|
|
248
|
-
children: [/* @__PURE__ */
|
|
248
|
+
children: [/* @__PURE__ */ A(B, {
|
|
249
249
|
htmlFor: "pf-household",
|
|
250
250
|
children: "Household"
|
|
251
|
-
}), /* @__PURE__ */
|
|
251
|
+
}), /* @__PURE__ */ j(G, {
|
|
252
252
|
value: d.householdId,
|
|
253
253
|
onValueChange: (e) => f((t) => ({
|
|
254
254
|
...t,
|
|
255
255
|
householdId: e
|
|
256
256
|
})),
|
|
257
|
-
children: [/* @__PURE__ */
|
|
257
|
+
children: [/* @__PURE__ */ A(xe, {
|
|
258
258
|
id: "pf-household",
|
|
259
|
-
children: /* @__PURE__ */
|
|
260
|
-
}), /* @__PURE__ */
|
|
259
|
+
children: /* @__PURE__ */ A(J, { placeholder: "None" })
|
|
260
|
+
}), /* @__PURE__ */ j(K, { children: [/* @__PURE__ */ A(q, {
|
|
261
261
|
value: Z,
|
|
262
262
|
children: "None"
|
|
263
|
-
}), s.map((e) => /* @__PURE__ */
|
|
263
|
+
}), s.map((e) => /* @__PURE__ */ A(q, {
|
|
264
264
|
value: e.id,
|
|
265
265
|
children: e.name
|
|
266
266
|
}, e.id))] })]
|
|
267
267
|
})]
|
|
268
268
|
}),
|
|
269
|
-
/* @__PURE__ */
|
|
269
|
+
/* @__PURE__ */ j("div", {
|
|
270
270
|
className: "space-y-1.5",
|
|
271
|
-
children: [/* @__PURE__ */
|
|
271
|
+
children: [/* @__PURE__ */ A(B, {
|
|
272
272
|
htmlFor: "pf-desc",
|
|
273
273
|
children: "Description"
|
|
274
|
-
}), /* @__PURE__ */
|
|
274
|
+
}), /* @__PURE__ */ A(je, {
|
|
275
275
|
id: "pf-desc",
|
|
276
276
|
value: d.description,
|
|
277
277
|
onChange: (e) => f((t) => ({
|
|
@@ -284,12 +284,12 @@ function Ue({ open: e, onOpenChange: t, editing: n }) {
|
|
|
284
284
|
})
|
|
285
285
|
]
|
|
286
286
|
}),
|
|
287
|
-
/* @__PURE__ */
|
|
287
|
+
/* @__PURE__ */ j(U, { children: [/* @__PURE__ */ A(N, {
|
|
288
288
|
variant: "outline",
|
|
289
289
|
onClick: () => t(!1),
|
|
290
290
|
disabled: g,
|
|
291
291
|
children: "Cancel"
|
|
292
|
-
}), /* @__PURE__ */
|
|
292
|
+
}), /* @__PURE__ */ A(N, {
|
|
293
293
|
onClick: () => {
|
|
294
294
|
if (!_) return;
|
|
295
295
|
let e = $(d.driftThresholdPct), r = d.modelPortfolioId === Z ? null : d.modelPortfolioId, i = d.householdId === Z ? null : d.householdId;
|
|
@@ -304,7 +304,7 @@ function Ue({ open: e, onOpenChange: t, editing: n }) {
|
|
|
304
304
|
modelPortfolioId: r
|
|
305
305
|
}
|
|
306
306
|
}, { onSuccess: () => {
|
|
307
|
-
|
|
307
|
+
x(), S("Portfolio saved"), t(!1);
|
|
308
308
|
} }) : c.mutate({
|
|
309
309
|
name: d.name.trim(),
|
|
310
310
|
baseCurrency: d.baseCurrency.trim() || "USD",
|
|
@@ -313,7 +313,7 @@ function Ue({ open: e, onOpenChange: t, editing: n }) {
|
|
|
313
313
|
modelPortfolioId: r,
|
|
314
314
|
householdId: i
|
|
315
315
|
}, { onSuccess: () => {
|
|
316
|
-
|
|
316
|
+
x(), S("Portfolio created"), t(!1);
|
|
317
317
|
} });
|
|
318
318
|
},
|
|
319
319
|
disabled: !_ || g,
|
|
@@ -335,7 +335,7 @@ function We() {
|
|
|
335
335
|
};
|
|
336
336
|
}
|
|
337
337
|
function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
338
|
-
let a = n(), o = l(), [s, c] =
|
|
338
|
+
let a = n(), o = l(), [s, c] = T(We), [u, d] = T(null), f = i?.id ?? "new";
|
|
339
339
|
e && u !== f && (d(f), c(i ? {
|
|
340
340
|
accountId: i.accountId,
|
|
341
341
|
symbol: i.symbol,
|
|
@@ -346,17 +346,17 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
346
346
|
costBasis: String(i.costBasis)
|
|
347
347
|
} : We())), !e && u !== null && d(null);
|
|
348
348
|
let p = a.isPending || o.isPending, m = s.symbol.trim().length > 0, h = i ? !0 : s.accountId.trim().length > 0, g = m && h && !p;
|
|
349
|
-
return /* @__PURE__ */
|
|
349
|
+
return /* @__PURE__ */ A(ye, {
|
|
350
350
|
open: e,
|
|
351
351
|
onOpenChange: t,
|
|
352
|
-
children: /* @__PURE__ */
|
|
352
|
+
children: /* @__PURE__ */ j(V, {
|
|
353
353
|
className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
|
|
354
354
|
children: [
|
|
355
|
-
/* @__PURE__ */
|
|
356
|
-
/* @__PURE__ */
|
|
355
|
+
/* @__PURE__ */ j(W, { children: [/* @__PURE__ */ A(be, { children: i ? "Edit holding" : "Add holding" }), /* @__PURE__ */ A(H, { children: i ? "Update the position details for this holding." : "Add a position to this portfolio from one of your accounts." })] }),
|
|
356
|
+
/* @__PURE__ */ j("div", {
|
|
357
357
|
className: "space-y-4 py-2",
|
|
358
358
|
children: [
|
|
359
|
-
i ? null : /* @__PURE__ */
|
|
359
|
+
i ? null : /* @__PURE__ */ A(_, {
|
|
360
360
|
id: "h-account",
|
|
361
361
|
value: s.accountId,
|
|
362
362
|
onChange: (e) => c((t) => ({
|
|
@@ -365,14 +365,14 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
365
365
|
})),
|
|
366
366
|
placeholder: "Select account"
|
|
367
367
|
}),
|
|
368
|
-
/* @__PURE__ */
|
|
368
|
+
/* @__PURE__ */ j("div", {
|
|
369
369
|
className: "grid grid-cols-2 gap-4",
|
|
370
|
-
children: [/* @__PURE__ */
|
|
370
|
+
children: [/* @__PURE__ */ j("div", {
|
|
371
371
|
className: "space-y-1.5",
|
|
372
|
-
children: [/* @__PURE__ */
|
|
372
|
+
children: [/* @__PURE__ */ A(B, {
|
|
373
373
|
htmlFor: "h-symbol",
|
|
374
374
|
children: "Symbol"
|
|
375
|
-
}), /* @__PURE__ */
|
|
375
|
+
}), /* @__PURE__ */ A(z, {
|
|
376
376
|
id: "h-symbol",
|
|
377
377
|
value: s.symbol,
|
|
378
378
|
onChange: (e) => c((t) => ({
|
|
@@ -383,33 +383,33 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
383
383
|
disabled: !!i,
|
|
384
384
|
"aria-invalid": !m
|
|
385
385
|
})]
|
|
386
|
-
}), /* @__PURE__ */
|
|
386
|
+
}), /* @__PURE__ */ j("div", {
|
|
387
387
|
className: "space-y-1.5",
|
|
388
|
-
children: [/* @__PURE__ */
|
|
388
|
+
children: [/* @__PURE__ */ A(B, {
|
|
389
389
|
htmlFor: "h-class",
|
|
390
390
|
children: "Asset class"
|
|
391
|
-
}), /* @__PURE__ */
|
|
391
|
+
}), /* @__PURE__ */ j(G, {
|
|
392
392
|
value: s.assetClass,
|
|
393
393
|
onValueChange: (e) => c((t) => ({
|
|
394
394
|
...t,
|
|
395
395
|
assetClass: e
|
|
396
396
|
})),
|
|
397
|
-
children: [/* @__PURE__ */
|
|
397
|
+
children: [/* @__PURE__ */ A(xe, {
|
|
398
398
|
id: "h-class",
|
|
399
|
-
children: /* @__PURE__ */
|
|
400
|
-
}), /* @__PURE__ */
|
|
399
|
+
children: /* @__PURE__ */ A(J, {})
|
|
400
|
+
}), /* @__PURE__ */ A(K, { children: Me.map((e) => /* @__PURE__ */ A(q, {
|
|
401
401
|
value: e,
|
|
402
402
|
children: Q(e)
|
|
403
403
|
}, e)) })]
|
|
404
404
|
})]
|
|
405
405
|
})]
|
|
406
406
|
}),
|
|
407
|
-
/* @__PURE__ */
|
|
407
|
+
/* @__PURE__ */ j("div", {
|
|
408
408
|
className: "space-y-1.5",
|
|
409
|
-
children: [/* @__PURE__ */
|
|
409
|
+
children: [/* @__PURE__ */ A(B, {
|
|
410
410
|
htmlFor: "h-name",
|
|
411
411
|
children: "Name"
|
|
412
|
-
}), /* @__PURE__ */
|
|
412
|
+
}), /* @__PURE__ */ A(z, {
|
|
413
413
|
id: "h-name",
|
|
414
414
|
value: s.name,
|
|
415
415
|
onChange: (e) => c((t) => ({
|
|
@@ -419,15 +419,15 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
419
419
|
placeholder: "Apple Inc."
|
|
420
420
|
})]
|
|
421
421
|
}),
|
|
422
|
-
/* @__PURE__ */
|
|
422
|
+
/* @__PURE__ */ j("div", {
|
|
423
423
|
className: "grid grid-cols-3 gap-4",
|
|
424
424
|
children: [
|
|
425
|
-
/* @__PURE__ */
|
|
425
|
+
/* @__PURE__ */ j("div", {
|
|
426
426
|
className: "space-y-1.5",
|
|
427
|
-
children: [/* @__PURE__ */
|
|
427
|
+
children: [/* @__PURE__ */ A(B, {
|
|
428
428
|
htmlFor: "h-qty",
|
|
429
429
|
children: "Quantity"
|
|
430
|
-
}), /* @__PURE__ */
|
|
430
|
+
}), /* @__PURE__ */ A(z, {
|
|
431
431
|
id: "h-qty",
|
|
432
432
|
type: "number",
|
|
433
433
|
step: "any",
|
|
@@ -438,12 +438,12 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
438
438
|
}))
|
|
439
439
|
})]
|
|
440
440
|
}),
|
|
441
|
-
/* @__PURE__ */
|
|
441
|
+
/* @__PURE__ */ j("div", {
|
|
442
442
|
className: "space-y-1.5",
|
|
443
|
-
children: [/* @__PURE__ */
|
|
443
|
+
children: [/* @__PURE__ */ A(B, {
|
|
444
444
|
htmlFor: "h-price",
|
|
445
445
|
children: "Last price"
|
|
446
|
-
}), /* @__PURE__ */
|
|
446
|
+
}), /* @__PURE__ */ A(z, {
|
|
447
447
|
id: "h-price",
|
|
448
448
|
type: "number",
|
|
449
449
|
step: "any",
|
|
@@ -454,12 +454,12 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
454
454
|
}))
|
|
455
455
|
})]
|
|
456
456
|
}),
|
|
457
|
-
/* @__PURE__ */
|
|
457
|
+
/* @__PURE__ */ j("div", {
|
|
458
458
|
className: "space-y-1.5",
|
|
459
|
-
children: [/* @__PURE__ */
|
|
459
|
+
children: [/* @__PURE__ */ A(B, {
|
|
460
460
|
htmlFor: "h-cost",
|
|
461
461
|
children: "Cost basis"
|
|
462
|
-
}), /* @__PURE__ */
|
|
462
|
+
}), /* @__PURE__ */ A(z, {
|
|
463
463
|
id: "h-cost",
|
|
464
464
|
type: "number",
|
|
465
465
|
step: "any",
|
|
@@ -474,12 +474,12 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
474
474
|
})
|
|
475
475
|
]
|
|
476
476
|
}),
|
|
477
|
-
/* @__PURE__ */
|
|
477
|
+
/* @__PURE__ */ j(U, { children: [/* @__PURE__ */ A(N, {
|
|
478
478
|
variant: "outline",
|
|
479
479
|
onClick: () => t(!1),
|
|
480
480
|
disabled: p,
|
|
481
481
|
children: "Cancel"
|
|
482
|
-
}), /* @__PURE__ */
|
|
482
|
+
}), /* @__PURE__ */ A(N, {
|
|
483
483
|
onClick: () => {
|
|
484
484
|
!m || !h || (i ? o.mutate({
|
|
485
485
|
id: i.id,
|
|
@@ -491,7 +491,7 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
491
491
|
costBasis: $(s.costBasis)
|
|
492
492
|
}
|
|
493
493
|
}, { onSuccess: () => {
|
|
494
|
-
|
|
494
|
+
x(), S("Holding saved"), t(!1);
|
|
495
495
|
} }) : a.mutate({
|
|
496
496
|
accountId: s.accountId,
|
|
497
497
|
portfolioId: r,
|
|
@@ -502,7 +502,7 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
502
502
|
lastPrice: $(s.lastPrice),
|
|
503
503
|
costBasis: $(s.costBasis)
|
|
504
504
|
}, { onSuccess: () => {
|
|
505
|
-
|
|
505
|
+
x(), S("Holding added"), t(!1);
|
|
506
506
|
} }));
|
|
507
507
|
},
|
|
508
508
|
disabled: !g,
|
|
@@ -513,120 +513,120 @@ function Ge({ open: e, onOpenChange: t, portfolioId: r, editing: i }) {
|
|
|
513
513
|
});
|
|
514
514
|
}
|
|
515
515
|
function Ke({ portfolioId: t, onOpenChange: n }) {
|
|
516
|
-
let { data: r, isLoading: a, isError: o, refetch: s } = c(t ?? void 0), l = e({ portfolioId: t ?? void 0 }, { enabled: t !== null }), u = i(), [d, _] =
|
|
517
|
-
if (
|
|
516
|
+
let { data: r, isLoading: a, isError: o, refetch: s } = c(t ?? void 0), l = e({ portfolioId: t ?? void 0 }, { enabled: t !== null }), u = i(), [d, _] = T(!1), [ie, v] = T(null), [x, S] = T(null), C = w(() => t ? l.data : [], [t, l.data]), E = r?.baseCurrency ?? "USD", D = C.reduce((e, t) => e + t.marketValue, 0), z = C.reduce((e, t) => e + t.costBasis, 0), B = D - z, ye = z > 0 ? B / z * 100 : 0, V = w(() => {
|
|
517
|
+
if (C.length === 0 || D <= 0) return [];
|
|
518
518
|
let e = /* @__PURE__ */ new Map();
|
|
519
|
-
return
|
|
519
|
+
return C.forEach((t) => e.set(t.assetClass, (e.get(t.assetClass) ?? 0) + t.marketValue)), Array.from(e.entries()).map(([e, t]) => ({
|
|
520
520
|
label: Q(e),
|
|
521
521
|
value: t,
|
|
522
522
|
tone: Fe(e)
|
|
523
523
|
})).sort((e, t) => t.value - e.value);
|
|
524
|
-
}, [
|
|
524
|
+
}, [C, D]), H = w(() => {
|
|
525
525
|
let e = /* @__PURE__ */ new Map();
|
|
526
|
-
return
|
|
527
|
-
}, [
|
|
528
|
-
let t =
|
|
526
|
+
return D <= 0 || C.forEach((t) => e.set(Q(t.assetClass), (e.get(Q(t.assetClass)) ?? 0) + t.marketValue / D * 100)), e;
|
|
527
|
+
}, [C, D]), U = w(() => Le(r?.targetAllocation).map((e) => {
|
|
528
|
+
let t = H.get(e.label) ?? 0;
|
|
529
529
|
return {
|
|
530
530
|
label: e.label,
|
|
531
531
|
value: e.value,
|
|
532
532
|
tone: "accent",
|
|
533
|
-
caption: `${
|
|
533
|
+
caption: `${b(e.value, 0)} target · ${b(t, 0)} actual`
|
|
534
534
|
};
|
|
535
|
-
}), [r?.targetAllocation,
|
|
535
|
+
}), [r?.targetAllocation, H]), W = () => {
|
|
536
536
|
v(null), _(!0);
|
|
537
|
-
},
|
|
537
|
+
}, be = (e) => {
|
|
538
538
|
v(e), _(!0);
|
|
539
539
|
};
|
|
540
|
-
return /* @__PURE__ */
|
|
540
|
+
return /* @__PURE__ */ A(Se, {
|
|
541
541
|
open: t !== null,
|
|
542
542
|
onOpenChange: n,
|
|
543
|
-
children: /* @__PURE__ */
|
|
543
|
+
children: /* @__PURE__ */ A(Ce, {
|
|
544
544
|
className: "flex w-full flex-col gap-0 overflow-y-auto p-0 sm:max-w-2xl",
|
|
545
|
-
children: a || t !== null && l.isPending ? /* @__PURE__ */
|
|
545
|
+
children: a || t !== null && l.isPending ? /* @__PURE__ */ A("div", {
|
|
546
546
|
className: "p-6",
|
|
547
|
-
children: /* @__PURE__ */
|
|
548
|
-
}) : o || l.isError ? /* @__PURE__ */
|
|
547
|
+
children: /* @__PURE__ */ A(re, { rows: 5 })
|
|
548
|
+
}) : o || l.isError ? /* @__PURE__ */ A("div", {
|
|
549
549
|
className: "p-6",
|
|
550
|
-
children: /* @__PURE__ */
|
|
550
|
+
children: /* @__PURE__ */ A(ne, { onRetry: () => {
|
|
551
551
|
s(), l.refetch();
|
|
552
552
|
} })
|
|
553
|
-
}) : r ? /* @__PURE__ */
|
|
554
|
-
/* @__PURE__ */
|
|
553
|
+
}) : r ? /* @__PURE__ */ j(fe, { children: [
|
|
554
|
+
/* @__PURE__ */ j(Te, {
|
|
555
555
|
className: "border-b border-border-subtle p-6",
|
|
556
|
-
children: [/* @__PURE__ */
|
|
556
|
+
children: [/* @__PURE__ */ j("div", {
|
|
557
557
|
className: "flex items-center gap-2",
|
|
558
|
-
children: [/* @__PURE__ */
|
|
558
|
+
children: [/* @__PURE__ */ A(Ee, {
|
|
559
559
|
className: "text-xl",
|
|
560
560
|
children: r.name
|
|
561
|
-
}), /* @__PURE__ */
|
|
562
|
-
variant:
|
|
561
|
+
}), /* @__PURE__ */ A(M, {
|
|
562
|
+
variant: oe(r.status),
|
|
563
563
|
children: Q(r.status)
|
|
564
564
|
})]
|
|
565
|
-
}), /* @__PURE__ */
|
|
565
|
+
}), /* @__PURE__ */ A(we, { children: r.description?.trim() ? r.description : `${r.baseCurrency} · Drift threshold ${b(r.driftThresholdPct)}` })]
|
|
566
566
|
}),
|
|
567
|
-
/* @__PURE__ */
|
|
567
|
+
/* @__PURE__ */ j("div", {
|
|
568
568
|
className: "space-y-6 p-6",
|
|
569
569
|
children: [
|
|
570
|
-
/* @__PURE__ */
|
|
570
|
+
/* @__PURE__ */ j(m, {
|
|
571
571
|
className: "grid grid-cols-2 gap-3 lg:grid-cols-4",
|
|
572
572
|
children: [
|
|
573
|
-
/* @__PURE__ */
|
|
573
|
+
/* @__PURE__ */ A(g, {
|
|
574
574
|
label: "Market value",
|
|
575
|
-
value:
|
|
575
|
+
value: y(D, E),
|
|
576
576
|
glow: !0
|
|
577
577
|
}),
|
|
578
|
-
/* @__PURE__ */
|
|
578
|
+
/* @__PURE__ */ A(g, {
|
|
579
579
|
label: "Unrealized gain",
|
|
580
|
-
value:
|
|
581
|
-
delta:
|
|
582
|
-
deltaTone:
|
|
580
|
+
value: y(B, E),
|
|
581
|
+
delta: z > 0 ? ye : void 0,
|
|
582
|
+
deltaTone: B > 0 ? "positive" : B < 0 ? "negative" : "neutral"
|
|
583
583
|
}),
|
|
584
|
-
/* @__PURE__ */
|
|
584
|
+
/* @__PURE__ */ A(g, {
|
|
585
585
|
label: "Holdings",
|
|
586
|
-
value: String(
|
|
586
|
+
value: String(C.length)
|
|
587
587
|
}),
|
|
588
|
-
/* @__PURE__ */
|
|
588
|
+
/* @__PURE__ */ A(g, {
|
|
589
589
|
label: "Drift threshold",
|
|
590
|
-
value:
|
|
590
|
+
value: b(r.driftThresholdPct)
|
|
591
591
|
})
|
|
592
592
|
]
|
|
593
593
|
}),
|
|
594
|
-
/* @__PURE__ */
|
|
594
|
+
/* @__PURE__ */ A(m, {
|
|
595
595
|
index: 1,
|
|
596
|
-
children: /* @__PURE__ */
|
|
596
|
+
children: /* @__PURE__ */ j(h, {
|
|
597
597
|
glow: !0,
|
|
598
598
|
className: "space-y-5",
|
|
599
|
-
children: [/* @__PURE__ */
|
|
599
|
+
children: [/* @__PURE__ */ j("div", {
|
|
600
600
|
className: "flex items-center justify-between gap-2",
|
|
601
|
-
children: [/* @__PURE__ */
|
|
601
|
+
children: [/* @__PURE__ */ A("h3", {
|
|
602
602
|
className: "text-sm font-semibold text-text-primary",
|
|
603
603
|
children: "Target vs actual allocation"
|
|
604
|
-
}), /* @__PURE__ */
|
|
604
|
+
}), /* @__PURE__ */ A(M, {
|
|
605
605
|
variant: "outline",
|
|
606
|
-
children:
|
|
606
|
+
children: E
|
|
607
607
|
})]
|
|
608
|
-
}), /* @__PURE__ */
|
|
608
|
+
}), /* @__PURE__ */ j("div", {
|
|
609
609
|
className: "grid gap-6 md:grid-cols-2",
|
|
610
|
-
children: [/* @__PURE__ */
|
|
610
|
+
children: [/* @__PURE__ */ j("div", {
|
|
611
611
|
className: "space-y-2",
|
|
612
|
-
children: [/* @__PURE__ */
|
|
612
|
+
children: [/* @__PURE__ */ A("p", {
|
|
613
613
|
className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
|
|
614
614
|
children: "Actual — by market value"
|
|
615
|
-
}),
|
|
616
|
-
data:
|
|
617
|
-
centerValue:
|
|
615
|
+
}), V.length > 0 ? /* @__PURE__ */ A(p, {
|
|
616
|
+
data: V,
|
|
617
|
+
centerValue: ae(D, E),
|
|
618
618
|
centerLabel: "Market value",
|
|
619
|
-
valueFormatter: (e) =>
|
|
620
|
-
}) : /* @__PURE__ */
|
|
619
|
+
valueFormatter: (e) => y(e, E)
|
|
620
|
+
}) : /* @__PURE__ */ A("p", {
|
|
621
621
|
className: "py-8 text-center text-sm text-text-secondary",
|
|
622
622
|
children: "Add holdings to see the live allocation."
|
|
623
623
|
})]
|
|
624
|
-
}), /* @__PURE__ */
|
|
624
|
+
}), /* @__PURE__ */ j("div", {
|
|
625
625
|
className: "space-y-2",
|
|
626
|
-
children: [/* @__PURE__ */
|
|
626
|
+
children: [/* @__PURE__ */ A("p", {
|
|
627
627
|
className: "text-xs font-medium uppercase tracking-wide text-text-secondary",
|
|
628
628
|
children: "Target — vs live actual"
|
|
629
|
-
}),
|
|
629
|
+
}), U.length > 0 ? /* @__PURE__ */ A(ee, { data: U }) : /* @__PURE__ */ A("p", {
|
|
630
630
|
className: "py-8 text-center text-sm text-text-secondary",
|
|
631
631
|
children: "No target allocation set for this portfolio."
|
|
632
632
|
})]
|
|
@@ -634,132 +634,132 @@ function Ke({ portfolioId: t, onOpenChange: n }) {
|
|
|
634
634
|
})]
|
|
635
635
|
})
|
|
636
636
|
}),
|
|
637
|
-
/* @__PURE__ */
|
|
637
|
+
/* @__PURE__ */ A(P, { children: /* @__PURE__ */ A(F, {
|
|
638
638
|
className: "p-4",
|
|
639
|
-
children: /* @__PURE__ */
|
|
639
|
+
children: /* @__PURE__ */ A(se, {
|
|
640
640
|
entityType: "brainyrich-portfolio",
|
|
641
641
|
entityId: r.id
|
|
642
642
|
})
|
|
643
643
|
}) }),
|
|
644
|
-
/* @__PURE__ */
|
|
644
|
+
/* @__PURE__ */ j(P, { children: [/* @__PURE__ */ j(I, {
|
|
645
645
|
className: "flex flex-row items-center justify-between",
|
|
646
|
-
children: [/* @__PURE__ */
|
|
646
|
+
children: [/* @__PURE__ */ j("div", { children: [/* @__PURE__ */ A(L, {
|
|
647
647
|
className: "text-base",
|
|
648
648
|
children: "Holdings"
|
|
649
|
-
}), /* @__PURE__ */
|
|
649
|
+
}), /* @__PURE__ */ A(pe, { children: "Positions held in this portfolio" })] }), /* @__PURE__ */ j(N, {
|
|
650
650
|
size: "sm",
|
|
651
|
-
onClick:
|
|
652
|
-
children: [/* @__PURE__ */
|
|
651
|
+
onClick: W,
|
|
652
|
+
children: [/* @__PURE__ */ A(O, {
|
|
653
653
|
className: "size-4",
|
|
654
654
|
"aria-hidden": "true"
|
|
655
655
|
}), "Add holding"]
|
|
656
656
|
})]
|
|
657
|
-
}), /* @__PURE__ */
|
|
658
|
-
icon: /* @__PURE__ */
|
|
657
|
+
}), /* @__PURE__ */ A(F, { children: C.length === 0 ? /* @__PURE__ */ A(te, {
|
|
658
|
+
icon: /* @__PURE__ */ A(le, {
|
|
659
659
|
className: "size-6",
|
|
660
660
|
"aria-hidden": "true"
|
|
661
661
|
}),
|
|
662
662
|
title: "No holdings yet",
|
|
663
663
|
description: "Add positions to start tracking this portfolio.",
|
|
664
|
-
action: /* @__PURE__ */
|
|
664
|
+
action: /* @__PURE__ */ j(N, {
|
|
665
665
|
size: "sm",
|
|
666
|
-
onClick:
|
|
667
|
-
children: [/* @__PURE__ */
|
|
666
|
+
onClick: W,
|
|
667
|
+
children: [/* @__PURE__ */ A(O, {
|
|
668
668
|
className: "size-4",
|
|
669
669
|
"aria-hidden": "true"
|
|
670
670
|
}), "Add holding"]
|
|
671
671
|
})
|
|
672
|
-
}) : /* @__PURE__ */
|
|
672
|
+
}) : /* @__PURE__ */ A("div", {
|
|
673
673
|
className: "overflow-x-auto",
|
|
674
|
-
children: /* @__PURE__ */
|
|
675
|
-
/* @__PURE__ */
|
|
676
|
-
/* @__PURE__ */
|
|
677
|
-
/* @__PURE__ */
|
|
674
|
+
children: /* @__PURE__ */ j(De, { children: [/* @__PURE__ */ A(ke, { children: /* @__PURE__ */ j(Ae, { children: [
|
|
675
|
+
/* @__PURE__ */ A(X, { children: "Symbol" }),
|
|
676
|
+
/* @__PURE__ */ A(X, { children: "Class" }),
|
|
677
|
+
/* @__PURE__ */ A(X, {
|
|
678
678
|
className: "text-right",
|
|
679
679
|
children: "Qty"
|
|
680
680
|
}),
|
|
681
|
-
/* @__PURE__ */
|
|
681
|
+
/* @__PURE__ */ A(X, {
|
|
682
682
|
className: "text-right",
|
|
683
683
|
children: "Price"
|
|
684
684
|
}),
|
|
685
|
-
/* @__PURE__ */
|
|
685
|
+
/* @__PURE__ */ A(X, {
|
|
686
686
|
className: "text-right",
|
|
687
687
|
children: "Market value"
|
|
688
688
|
}),
|
|
689
|
-
/* @__PURE__ */
|
|
689
|
+
/* @__PURE__ */ A(X, {
|
|
690
690
|
className: "text-right",
|
|
691
691
|
children: "Gain"
|
|
692
692
|
}),
|
|
693
|
-
/* @__PURE__ */
|
|
694
|
-
] }) }), /* @__PURE__ */
|
|
693
|
+
/* @__PURE__ */ A(X, { className: "w-10" })
|
|
694
|
+
] }) }), /* @__PURE__ */ A(Oe, { children: C.map((e) => {
|
|
695
695
|
let t = e.marketValue - e.costBasis, n = e.costBasis > 0 ? t / e.costBasis * 100 : 0;
|
|
696
|
-
return /* @__PURE__ */
|
|
696
|
+
return /* @__PURE__ */ j(Ae, {
|
|
697
697
|
className: "transition-colors motion-safe:hover:bg-bg-sunken/60",
|
|
698
698
|
children: [
|
|
699
|
-
/* @__PURE__ */
|
|
699
|
+
/* @__PURE__ */ j(Y, { children: [/* @__PURE__ */ A("div", {
|
|
700
700
|
className: "font-semibold text-text-primary",
|
|
701
701
|
children: e.symbol
|
|
702
|
-
}), e.name ? /* @__PURE__ */
|
|
702
|
+
}), e.name ? /* @__PURE__ */ A("div", {
|
|
703
703
|
className: "text-xs text-text-secondary",
|
|
704
704
|
children: e.name
|
|
705
705
|
}) : null] }),
|
|
706
|
-
/* @__PURE__ */
|
|
706
|
+
/* @__PURE__ */ A(Y, { children: /* @__PURE__ */ A(M, {
|
|
707
707
|
variant: "outline",
|
|
708
708
|
children: Q(e.assetClass)
|
|
709
709
|
}) }),
|
|
710
|
-
/* @__PURE__ */
|
|
710
|
+
/* @__PURE__ */ A(Y, {
|
|
711
711
|
className: "text-right tabular-nums",
|
|
712
712
|
children: e.quantity
|
|
713
713
|
}),
|
|
714
|
-
/* @__PURE__ */
|
|
714
|
+
/* @__PURE__ */ A(Y, {
|
|
715
715
|
className: "text-right tabular-nums",
|
|
716
|
-
children:
|
|
716
|
+
children: y(e.lastPrice, e.currency)
|
|
717
717
|
}),
|
|
718
|
-
/* @__PURE__ */
|
|
718
|
+
/* @__PURE__ */ A(Y, {
|
|
719
719
|
className: "text-right font-medium tabular-nums",
|
|
720
|
-
children:
|
|
720
|
+
children: y(e.marketValue, e.currency)
|
|
721
721
|
}),
|
|
722
|
-
/* @__PURE__ */
|
|
722
|
+
/* @__PURE__ */ j(Y, {
|
|
723
723
|
className: "text-right tabular-nums",
|
|
724
|
-
children: [/* @__PURE__ */
|
|
724
|
+
children: [/* @__PURE__ */ A(Ve, {
|
|
725
725
|
value: t,
|
|
726
726
|
currency: e.currency
|
|
727
|
-
}), e.costBasis > 0 ? /* @__PURE__ */
|
|
727
|
+
}), e.costBasis > 0 ? /* @__PURE__ */ j("div", {
|
|
728
728
|
className: "text-xs text-text-secondary",
|
|
729
|
-
children: [t > 0 ? "+" : "",
|
|
729
|
+
children: [t > 0 ? "+" : "", b(n)]
|
|
730
730
|
}) : null]
|
|
731
731
|
}),
|
|
732
|
-
/* @__PURE__ */
|
|
732
|
+
/* @__PURE__ */ A(Y, {
|
|
733
733
|
className: "text-right",
|
|
734
|
-
children: /* @__PURE__ */
|
|
734
|
+
children: /* @__PURE__ */ j(me, { children: [/* @__PURE__ */ A(ve, {
|
|
735
735
|
asChild: !0,
|
|
736
|
-
children: /* @__PURE__ */
|
|
736
|
+
children: /* @__PURE__ */ A(N, {
|
|
737
737
|
variant: "ghost",
|
|
738
738
|
size: "icon",
|
|
739
739
|
className: "size-10",
|
|
740
740
|
"aria-label": `Actions for ${e.symbol}`,
|
|
741
|
-
children: /* @__PURE__ */
|
|
741
|
+
children: /* @__PURE__ */ A(ue, {
|
|
742
742
|
className: "size-4",
|
|
743
743
|
"aria-hidden": "true"
|
|
744
744
|
})
|
|
745
745
|
})
|
|
746
|
-
}), /* @__PURE__ */
|
|
746
|
+
}), /* @__PURE__ */ j(he, {
|
|
747
747
|
align: "end",
|
|
748
748
|
children: [
|
|
749
|
-
/* @__PURE__ */
|
|
750
|
-
/* @__PURE__ */
|
|
751
|
-
/* @__PURE__ */
|
|
749
|
+
/* @__PURE__ */ A(ge, { children: e.symbol }),
|
|
750
|
+
/* @__PURE__ */ A(_e, {}),
|
|
751
|
+
/* @__PURE__ */ j(R, {
|
|
752
752
|
className: "gap-2",
|
|
753
|
-
onClick: () =>
|
|
754
|
-
children: [/* @__PURE__ */
|
|
753
|
+
onClick: () => be(e),
|
|
754
|
+
children: [/* @__PURE__ */ A(de, {
|
|
755
755
|
className: "size-4",
|
|
756
756
|
"aria-hidden": "true"
|
|
757
757
|
}), "Edit"]
|
|
758
758
|
}),
|
|
759
|
-
/* @__PURE__ */
|
|
759
|
+
/* @__PURE__ */ j(R, {
|
|
760
760
|
className: "gap-2 text-status-error-text focus:text-status-error-text",
|
|
761
|
-
onClick: () =>
|
|
762
|
-
children: [/* @__PURE__ */
|
|
761
|
+
onClick: () => S(e),
|
|
762
|
+
children: [/* @__PURE__ */ A(k, {
|
|
763
763
|
className: "size-4",
|
|
764
764
|
"aria-hidden": "true"
|
|
765
765
|
}), "Delete"]
|
|
@@ -771,51 +771,51 @@ function Ke({ portfolioId: t, onOpenChange: n }) {
|
|
|
771
771
|
}, e.id);
|
|
772
772
|
}) })] })
|
|
773
773
|
}) })] }),
|
|
774
|
-
/* @__PURE__ */
|
|
774
|
+
/* @__PURE__ */ j(P, { children: [/* @__PURE__ */ j(I, {
|
|
775
775
|
className: "pb-3",
|
|
776
|
-
children: [/* @__PURE__ */
|
|
776
|
+
children: [/* @__PURE__ */ A(L, {
|
|
777
777
|
className: "text-sm",
|
|
778
778
|
children: "Tags"
|
|
779
|
-
}), /* @__PURE__ */
|
|
780
|
-
}), /* @__PURE__ */
|
|
779
|
+
}), /* @__PURE__ */ A(pe, { children: "Organize and filter this portfolio." })]
|
|
780
|
+
}), /* @__PURE__ */ A(F, { children: /* @__PURE__ */ A(se, {
|
|
781
781
|
entityType: "brainyrich-portfolio",
|
|
782
782
|
entityId: r.id,
|
|
783
783
|
hideLabel: !0
|
|
784
784
|
}) })] }),
|
|
785
|
-
/* @__PURE__ */
|
|
785
|
+
/* @__PURE__ */ A(P, { children: /* @__PURE__ */ A(F, {
|
|
786
786
|
className: "pt-6",
|
|
787
|
-
children: /* @__PURE__ */
|
|
787
|
+
children: /* @__PURE__ */ A(ce, {
|
|
788
788
|
entityType: "brainyrich-portfolio",
|
|
789
789
|
entityId: r.id
|
|
790
790
|
})
|
|
791
791
|
}) })
|
|
792
792
|
]
|
|
793
793
|
}),
|
|
794
|
-
/* @__PURE__ */
|
|
794
|
+
/* @__PURE__ */ A(Ge, {
|
|
795
795
|
open: d,
|
|
796
796
|
onOpenChange: _,
|
|
797
797
|
portfolioId: r.id,
|
|
798
798
|
editing: ie
|
|
799
799
|
}),
|
|
800
|
-
/* @__PURE__ */
|
|
801
|
-
open:
|
|
800
|
+
/* @__PURE__ */ A(f, {
|
|
801
|
+
open: x !== null,
|
|
802
802
|
onOpenChange: (e) => {
|
|
803
|
-
e ||
|
|
803
|
+
e || S(null);
|
|
804
804
|
},
|
|
805
805
|
title: "Delete holding?",
|
|
806
|
-
description:
|
|
806
|
+
description: x ? `Remove ${x.symbol} from this portfolio. This cannot be undone.` : void 0,
|
|
807
807
|
confirmLabel: "Delete",
|
|
808
808
|
pendingLabel: "Deleting…",
|
|
809
809
|
destructive: !0,
|
|
810
810
|
pending: u.isPending,
|
|
811
811
|
onConfirm: () => {
|
|
812
|
-
|
|
812
|
+
x && u.mutate(x.id, { onSuccess: () => S(null) });
|
|
813
813
|
}
|
|
814
814
|
})
|
|
815
|
-
] }) : /* @__PURE__ */
|
|
815
|
+
] }) : /* @__PURE__ */ A("div", {
|
|
816
816
|
className: "p-6",
|
|
817
|
-
children: /* @__PURE__ */
|
|
818
|
-
icon: /* @__PURE__ */
|
|
817
|
+
children: /* @__PURE__ */ A(te, {
|
|
818
|
+
icon: /* @__PURE__ */ A(le, {
|
|
819
819
|
className: "size-6",
|
|
820
820
|
"aria-hidden": "true"
|
|
821
821
|
}),
|
|
@@ -827,23 +827,23 @@ function Ke({ portfolioId: t, onOpenChange: n }) {
|
|
|
827
827
|
});
|
|
828
828
|
}
|
|
829
829
|
function qe({ driftPct: e, thresholdPct: t, assetClass: n }) {
|
|
830
|
-
let r = Math.abs(e), i = t > 0 && r > t, a = !i && t > 0 && r >= t * .75, o = t > 0 ? Math.min(100, r / t * 100) : 0, s = i ? "bg-status-error-bg" : a ? "bg-status-warning-bg" : "bg-accent-teal", c = i ? "text-status-error-text" : a ? "text-status-warning-text" : "text-text-secondary", l = n ? `Widest drift: ${Q(n)} ${e > 0 ? "over" : "under"}-weight by ${
|
|
831
|
-
return /* @__PURE__ */
|
|
830
|
+
let r = Math.abs(e), i = t > 0 && r > t, a = !i && t > 0 && r >= t * .75, o = t > 0 ? Math.min(100, r / t * 100) : 0, s = i ? "bg-status-error-bg" : a ? "bg-status-warning-bg" : "bg-accent-teal", c = i ? "text-status-error-text" : a ? "text-status-warning-text" : "text-text-secondary", l = n ? `Widest drift: ${Q(n)} ${e > 0 ? "over" : "under"}-weight by ${b(r)}` : `Widest drift ${b(r)}`;
|
|
831
|
+
return /* @__PURE__ */ j("div", {
|
|
832
832
|
className: "space-y-1",
|
|
833
|
-
children: [/* @__PURE__ */
|
|
833
|
+
children: [/* @__PURE__ */ j("div", {
|
|
834
834
|
className: "flex items-center justify-between gap-2 text-xs",
|
|
835
|
-
children: [/* @__PURE__ */
|
|
835
|
+
children: [/* @__PURE__ */ A("span", {
|
|
836
836
|
className: "text-text-secondary",
|
|
837
837
|
children: "Drift"
|
|
838
|
-
}), /* @__PURE__ */
|
|
838
|
+
}), /* @__PURE__ */ j("span", {
|
|
839
839
|
className: `font-medium tabular-nums ${c}`,
|
|
840
840
|
children: [
|
|
841
841
|
i ? "⚠ " : "",
|
|
842
842
|
e > 0 ? "+" : "",
|
|
843
|
-
|
|
843
|
+
b(e)
|
|
844
844
|
]
|
|
845
845
|
})]
|
|
846
|
-
}), /* @__PURE__ */
|
|
846
|
+
}), /* @__PURE__ */ A("div", {
|
|
847
847
|
className: "h-1.5 w-full overflow-hidden rounded-full bg-bg-sunken",
|
|
848
848
|
role: "progressbar",
|
|
849
849
|
"aria-valuenow": Math.round(o),
|
|
@@ -851,7 +851,7 @@ function qe({ driftPct: e, thresholdPct: t, assetClass: n }) {
|
|
|
851
851
|
"aria-valuemax": 100,
|
|
852
852
|
"aria-label": l,
|
|
853
853
|
title: l,
|
|
854
|
-
children: /* @__PURE__ */
|
|
854
|
+
children: /* @__PURE__ */ A("div", {
|
|
855
855
|
className: `h-full rounded-full ${s}`,
|
|
856
856
|
style: { width: `${o}%` }
|
|
857
857
|
})
|
|
@@ -859,106 +859,106 @@ function qe({ driftPct: e, thresholdPct: t, assetClass: n }) {
|
|
|
859
859
|
});
|
|
860
860
|
}
|
|
861
861
|
function Je({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i, onEdit: a, onArchive: o }) {
|
|
862
|
-
let s =
|
|
863
|
-
return /* @__PURE__ */
|
|
862
|
+
let s = w(() => Re(e.targetAllocation), [e.targetAllocation]), c = s[0], l = e.tags ?? [];
|
|
863
|
+
return /* @__PURE__ */ A(m, {
|
|
864
864
|
index: r,
|
|
865
865
|
as: "div",
|
|
866
866
|
className: "h-full",
|
|
867
|
-
children: /* @__PURE__ */
|
|
867
|
+
children: /* @__PURE__ */ j(P, {
|
|
868
868
|
className: "flex h-full flex-col transition-shadow motion-safe:hover:shadow-[var(--shadow-pop-hover,var(--shadow-elevation-2))]",
|
|
869
|
-
children: [/* @__PURE__ */
|
|
869
|
+
children: [/* @__PURE__ */ j(I, {
|
|
870
870
|
className: "pb-3",
|
|
871
|
-
children: [/* @__PURE__ */
|
|
871
|
+
children: [/* @__PURE__ */ j("div", {
|
|
872
872
|
className: "flex items-start justify-between gap-2",
|
|
873
|
-
children: [/* @__PURE__ */
|
|
873
|
+
children: [/* @__PURE__ */ j("div", {
|
|
874
874
|
className: "flex min-w-0 items-center gap-2",
|
|
875
875
|
children: [
|
|
876
|
-
/* @__PURE__ */
|
|
876
|
+
/* @__PURE__ */ A("span", {
|
|
877
877
|
className: "flex size-8 shrink-0 items-center justify-center rounded-lg bg-[var(--color-action-primary-bg)]/12 text-[var(--color-action-primary-text)]",
|
|
878
|
-
children: /* @__PURE__ */
|
|
878
|
+
children: /* @__PURE__ */ A(le, {
|
|
879
879
|
className: "size-4",
|
|
880
880
|
"aria-hidden": "true"
|
|
881
881
|
})
|
|
882
882
|
}),
|
|
883
|
-
/* @__PURE__ */
|
|
883
|
+
/* @__PURE__ */ A(L, {
|
|
884
884
|
className: "truncate text-base",
|
|
885
885
|
children: e.name
|
|
886
886
|
}),
|
|
887
|
-
/* @__PURE__ */
|
|
888
|
-
variant:
|
|
887
|
+
/* @__PURE__ */ A(M, {
|
|
888
|
+
variant: oe(e.status),
|
|
889
889
|
children: Q(e.status)
|
|
890
890
|
})
|
|
891
891
|
]
|
|
892
|
-
}), /* @__PURE__ */
|
|
892
|
+
}), /* @__PURE__ */ j(me, { children: [/* @__PURE__ */ A(ve, {
|
|
893
893
|
asChild: !0,
|
|
894
|
-
children: /* @__PURE__ */
|
|
894
|
+
children: /* @__PURE__ */ A(N, {
|
|
895
895
|
variant: "ghost",
|
|
896
896
|
size: "icon",
|
|
897
897
|
className: "size-9 shrink-0",
|
|
898
898
|
"aria-label": `Actions for ${e.name}`,
|
|
899
|
-
children: /* @__PURE__ */
|
|
899
|
+
children: /* @__PURE__ */ A(ue, {
|
|
900
900
|
className: "size-4",
|
|
901
901
|
"aria-hidden": "true"
|
|
902
902
|
})
|
|
903
903
|
})
|
|
904
|
-
}), /* @__PURE__ */
|
|
904
|
+
}), /* @__PURE__ */ j(he, {
|
|
905
905
|
align: "end",
|
|
906
906
|
children: [
|
|
907
|
-
/* @__PURE__ */
|
|
908
|
-
/* @__PURE__ */
|
|
909
|
-
/* @__PURE__ */
|
|
907
|
+
/* @__PURE__ */ A(ge, { children: e.name }),
|
|
908
|
+
/* @__PURE__ */ A(_e, {}),
|
|
909
|
+
/* @__PURE__ */ j(R, {
|
|
910
910
|
className: "gap-2",
|
|
911
911
|
onClick: a,
|
|
912
|
-
children: [/* @__PURE__ */
|
|
912
|
+
children: [/* @__PURE__ */ A(de, {
|
|
913
913
|
className: "size-4",
|
|
914
914
|
"aria-hidden": "true"
|
|
915
915
|
}), "Edit"]
|
|
916
916
|
}),
|
|
917
|
-
/* @__PURE__ */
|
|
917
|
+
/* @__PURE__ */ j(R, {
|
|
918
918
|
className: "gap-2 text-status-error-text focus:text-status-error-text",
|
|
919
919
|
disabled: e.status === "ARCHIVED",
|
|
920
920
|
onClick: o,
|
|
921
|
-
children: [/* @__PURE__ */
|
|
921
|
+
children: [/* @__PURE__ */ A(k, {
|
|
922
922
|
className: "size-4",
|
|
923
923
|
"aria-hidden": "true"
|
|
924
924
|
}), "Archive"]
|
|
925
925
|
})
|
|
926
926
|
]
|
|
927
927
|
})] })]
|
|
928
|
-
}), e.description?.trim() ? /* @__PURE__ */
|
|
928
|
+
}), e.description?.trim() ? /* @__PURE__ */ A(pe, {
|
|
929
929
|
className: "line-clamp-2",
|
|
930
930
|
children: e.description
|
|
931
931
|
}) : null]
|
|
932
|
-
}), /* @__PURE__ */
|
|
932
|
+
}), /* @__PURE__ */ j(F, {
|
|
933
933
|
className: "flex flex-1 flex-col justify-between gap-4",
|
|
934
934
|
children: [
|
|
935
|
-
n ? /* @__PURE__ */
|
|
935
|
+
n ? /* @__PURE__ */ A("p", {
|
|
936
936
|
className: "text-sm text-text-secondary",
|
|
937
937
|
children: "Valuation unavailable — positions could not be loaded."
|
|
938
|
-
}) : t ? t.holdingCount > 0 ? /* @__PURE__ */
|
|
938
|
+
}) : t ? t.holdingCount > 0 ? /* @__PURE__ */ j("div", {
|
|
939
939
|
className: "space-y-2",
|
|
940
|
-
children: [/* @__PURE__ */
|
|
940
|
+
children: [/* @__PURE__ */ j("div", {
|
|
941
941
|
className: "flex flex-wrap items-baseline gap-x-3 gap-y-1",
|
|
942
942
|
children: [
|
|
943
|
-
/* @__PURE__ */
|
|
943
|
+
/* @__PURE__ */ A("span", {
|
|
944
944
|
className: "text-2xl font-semibold tabular-nums text-text-primary",
|
|
945
|
-
children:
|
|
945
|
+
children: ae(t.marketValue, e.baseCurrency)
|
|
946
946
|
}),
|
|
947
|
-
t.gainPct === null ? null : /* @__PURE__ */
|
|
947
|
+
t.gainPct === null ? null : /* @__PURE__ */ j("span", {
|
|
948
948
|
className: `inline-flex items-center gap-1 text-sm font-medium tabular-nums ${v(t.unrealizedGain)}`,
|
|
949
949
|
children: [
|
|
950
|
-
t.unrealizedGain > 0 ? /* @__PURE__ */
|
|
950
|
+
t.unrealizedGain > 0 ? /* @__PURE__ */ A(D, {
|
|
951
951
|
className: "size-3.5",
|
|
952
952
|
"aria-hidden": "true"
|
|
953
|
-
}) : t.unrealizedGain < 0 ? /* @__PURE__ */
|
|
953
|
+
}) : t.unrealizedGain < 0 ? /* @__PURE__ */ A(E, {
|
|
954
954
|
className: "size-3.5",
|
|
955
955
|
"aria-hidden": "true"
|
|
956
956
|
}) : null,
|
|
957
957
|
t.unrealizedGain > 0 ? "+" : "",
|
|
958
|
-
|
|
958
|
+
b(t.gainPct)
|
|
959
959
|
]
|
|
960
960
|
}),
|
|
961
|
-
/* @__PURE__ */
|
|
961
|
+
/* @__PURE__ */ j("span", {
|
|
962
962
|
className: "text-xs text-text-secondary",
|
|
963
963
|
children: [
|
|
964
964
|
t.holdingCount,
|
|
@@ -967,71 +967,71 @@ function Je({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i
|
|
|
967
967
|
]
|
|
968
968
|
})
|
|
969
969
|
]
|
|
970
|
-
}), t.maxDriftPct === null ? /* @__PURE__ */
|
|
970
|
+
}), t.maxDriftPct === null ? /* @__PURE__ */ A("p", {
|
|
971
971
|
className: "text-xs text-text-secondary",
|
|
972
972
|
children: "Drift needs a target allocation on this portfolio."
|
|
973
|
-
}) : /* @__PURE__ */
|
|
973
|
+
}) : /* @__PURE__ */ A(qe, {
|
|
974
974
|
driftPct: t.maxDriftPct,
|
|
975
975
|
thresholdPct: e.driftThresholdPct,
|
|
976
976
|
assetClass: t.driftAssetClass
|
|
977
977
|
})]
|
|
978
|
-
}) : /* @__PURE__ */
|
|
978
|
+
}) : /* @__PURE__ */ A("p", {
|
|
979
979
|
className: "text-sm text-text-secondary",
|
|
980
980
|
children: "No holdings yet — add positions to value this portfolio."
|
|
981
|
-
}) : /* @__PURE__ */
|
|
981
|
+
}) : /* @__PURE__ */ j("div", {
|
|
982
982
|
className: "space-y-2",
|
|
983
983
|
"aria-busy": "true",
|
|
984
|
-
children: [/* @__PURE__ */
|
|
984
|
+
children: [/* @__PURE__ */ A("div", { className: "h-7 w-32 animate-pulse rounded bg-bg-sunken" }), /* @__PURE__ */ A("div", { className: "h-1.5 w-full animate-pulse rounded-full bg-bg-sunken" })]
|
|
985
985
|
}),
|
|
986
|
-
/* @__PURE__ */
|
|
986
|
+
/* @__PURE__ */ j("div", {
|
|
987
987
|
className: "grid grid-cols-[auto_1fr] items-center gap-4",
|
|
988
|
-
children: [s.length > 0 ? /* @__PURE__ */
|
|
988
|
+
children: [s.length > 0 ? /* @__PURE__ */ A("div", {
|
|
989
989
|
className: "w-28 shrink-0",
|
|
990
|
-
children: /* @__PURE__ */
|
|
990
|
+
children: /* @__PURE__ */ A(p, {
|
|
991
991
|
data: s,
|
|
992
992
|
legend: !1,
|
|
993
993
|
height: 112,
|
|
994
|
-
centerValue: c ?
|
|
994
|
+
centerValue: c ? b(c.value, 0) : void 0,
|
|
995
995
|
centerLabel: c?.label,
|
|
996
|
-
valueFormatter: (e) =>
|
|
996
|
+
valueFormatter: (e) => b(e, 0)
|
|
997
997
|
})
|
|
998
|
-
}) : /* @__PURE__ */
|
|
998
|
+
}) : /* @__PURE__ */ j("div", {
|
|
999
999
|
className: "flex size-28 shrink-0 items-center justify-center rounded-full border border-dashed border-border-subtle text-center text-[10px] leading-tight text-text-secondary",
|
|
1000
1000
|
children: [
|
|
1001
1001
|
"No target",
|
|
1002
|
-
/* @__PURE__ */
|
|
1002
|
+
/* @__PURE__ */ A("br", {}),
|
|
1003
1003
|
"allocation"
|
|
1004
1004
|
]
|
|
1005
|
-
}), /* @__PURE__ */
|
|
1005
|
+
}), /* @__PURE__ */ j("div", {
|
|
1006
1006
|
className: "min-w-0 space-y-2",
|
|
1007
1007
|
children: [
|
|
1008
|
-
/* @__PURE__ */
|
|
1008
|
+
/* @__PURE__ */ j("div", {
|
|
1009
1009
|
className: "flex flex-wrap items-center gap-1.5",
|
|
1010
|
-
children: [/* @__PURE__ */
|
|
1010
|
+
children: [/* @__PURE__ */ A(M, {
|
|
1011
1011
|
variant: "outline",
|
|
1012
1012
|
children: e.baseCurrency
|
|
1013
|
-
}), /* @__PURE__ */ M
|
|
1013
|
+
}), /* @__PURE__ */ j(M, {
|
|
1014
1014
|
variant: "secondary",
|
|
1015
|
-
children: ["Drift ≤ ",
|
|
1015
|
+
children: ["Drift ≤ ", b(e.driftThresholdPct)]
|
|
1016
1016
|
})]
|
|
1017
1017
|
}),
|
|
1018
|
-
s.length > 0 ? /* @__PURE__ */
|
|
1018
|
+
s.length > 0 ? /* @__PURE__ */ A("ul", {
|
|
1019
1019
|
className: "space-y-1",
|
|
1020
1020
|
"aria-label": "Target allocation",
|
|
1021
|
-
children: s.slice(0, 3).map((e) => /* @__PURE__ */
|
|
1021
|
+
children: s.slice(0, 3).map((e) => /* @__PURE__ */ j("li", {
|
|
1022
1022
|
className: "flex items-center gap-1.5 text-xs",
|
|
1023
|
-
children: [/* @__PURE__ */
|
|
1023
|
+
children: [/* @__PURE__ */ A("span", {
|
|
1024
1024
|
className: "truncate text-text-secondary",
|
|
1025
1025
|
children: e.label
|
|
1026
|
-
}), /* @__PURE__ */
|
|
1026
|
+
}), /* @__PURE__ */ A("span", {
|
|
1027
1027
|
className: "ml-auto font-medium tabular-nums text-text-primary",
|
|
1028
|
-
children:
|
|
1028
|
+
children: b(e.value, 0)
|
|
1029
1029
|
})]
|
|
1030
1030
|
}, e.label))
|
|
1031
1031
|
}) : null,
|
|
1032
|
-
l.length > 0 ? /* @__PURE__ */
|
|
1032
|
+
l.length > 0 ? /* @__PURE__ */ A("div", {
|
|
1033
1033
|
className: "flex flex-wrap gap-1",
|
|
1034
|
-
children: l.slice(0, 3).map((e) => /* @__PURE__ */
|
|
1034
|
+
children: l.slice(0, 3).map((e) => /* @__PURE__ */ A(M, {
|
|
1035
1035
|
variant: "outline",
|
|
1036
1036
|
className: "text-[10px]",
|
|
1037
1037
|
children: e
|
|
@@ -1040,7 +1040,7 @@ function Je({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i
|
|
|
1040
1040
|
]
|
|
1041
1041
|
})]
|
|
1042
1042
|
}),
|
|
1043
|
-
/* @__PURE__ */
|
|
1043
|
+
/* @__PURE__ */ A(N, {
|
|
1044
1044
|
variant: "outline",
|
|
1045
1045
|
size: "sm",
|
|
1046
1046
|
className: "w-full",
|
|
@@ -1053,8 +1053,8 @@ function Je({ portfolio: e, valuation: t, valuationError: n, index: r, onView: i
|
|
|
1053
1053
|
});
|
|
1054
1054
|
}
|
|
1055
1055
|
function Ye() {
|
|
1056
|
-
|
|
1057
|
-
let { items: n, hasMore: r, loadMore: i, isLoading: a, isFetchingNextPage: o, isError: c, refetch: l } = s(), u = t(), p = e(), h =
|
|
1056
|
+
C("brainyrich.portfolios.viewed");
|
|
1057
|
+
let { items: n, hasMore: r, loadMore: i, isLoading: a, isFetchingNextPage: o, isError: c, refetch: l } = s(), u = t(), p = e(), h = w(() => {
|
|
1058
1058
|
let e = /* @__PURE__ */ new Map();
|
|
1059
1059
|
for (let t of p.data) {
|
|
1060
1060
|
if (!t.portfolioId) continue;
|
|
@@ -1062,144 +1062,144 @@ function Ye() {
|
|
|
1062
1062
|
n ? n.push(t) : e.set(t.portfolioId, [t]);
|
|
1063
1063
|
}
|
|
1064
1064
|
return e;
|
|
1065
|
-
}, [p.data]), _ =
|
|
1065
|
+
}, [p.data]), _ = w(() => {
|
|
1066
1066
|
let e = /* @__PURE__ */ new Map();
|
|
1067
1067
|
for (let t of n) e.set(t.id, Be(h.get(t.id) ?? [], t.targetAllocation));
|
|
1068
1068
|
return e;
|
|
1069
|
-
}, [n, h]), [ee, v] =
|
|
1069
|
+
}, [n, h]), [ee, v] = T(!1), [y, oe] = T(null), [se, ce] = T(null), [E, D] = T(null), ue = n.filter((e) => e.status === "ACTIVE").length, de = n.filter((e) => e.status === "DRAFT").length, k = n.length > 0 ? n.reduce((e, t) => e + t.driftThresholdPct, 0) / n.length : 0, M = w(() => {
|
|
1070
1070
|
let e = /* @__PURE__ */ new Map();
|
|
1071
1071
|
for (let t of n) {
|
|
1072
1072
|
let n = _.get(t.id);
|
|
1073
1073
|
!n || n.holdingCount === 0 || e.set(t.baseCurrency, (e.get(t.baseCurrency) ?? 0) + n.marketValue);
|
|
1074
1074
|
}
|
|
1075
1075
|
return e;
|
|
1076
|
-
}, [n, _]),
|
|
1076
|
+
}, [n, _]), P = Array.from(M.keys()).sort(), F = P.length === 1 ? P[0] : void 0, pe = n.filter((e) => {
|
|
1077
1077
|
let t = _.get(e.id)?.maxDriftPct;
|
|
1078
1078
|
return t == null || e.driftThresholdPct <= 0 ? !1 : Math.abs(t) > e.driftThresholdPct;
|
|
1079
|
-
}).length,
|
|
1080
|
-
|
|
1081
|
-
},
|
|
1082
|
-
|
|
1079
|
+
}).length, I = () => {
|
|
1080
|
+
oe(null), v(!0);
|
|
1081
|
+
}, L = (e) => {
|
|
1082
|
+
oe(e), v(!0);
|
|
1083
1083
|
};
|
|
1084
|
-
return /* @__PURE__ */
|
|
1084
|
+
return /* @__PURE__ */ A("div", {
|
|
1085
1085
|
"data-tour": "brainyrich-page-portfolios",
|
|
1086
1086
|
className: "contents",
|
|
1087
|
-
children: /* @__PURE__ */
|
|
1087
|
+
children: /* @__PURE__ */ j(ie, {
|
|
1088
1088
|
title: "Portfolios",
|
|
1089
1089
|
description: "Organize holdings into strategies and keep allocations on target.",
|
|
1090
1090
|
badges: n.length > 0 ? [`${n.length} total`] : [],
|
|
1091
|
-
actions: /* @__PURE__ */
|
|
1091
|
+
actions: /* @__PURE__ */ j(N, {
|
|
1092
1092
|
size: "sm",
|
|
1093
|
-
onClick:
|
|
1094
|
-
children: [/* @__PURE__ */
|
|
1093
|
+
onClick: I,
|
|
1094
|
+
children: [/* @__PURE__ */ A(O, {
|
|
1095
1095
|
className: "size-4",
|
|
1096
1096
|
"aria-hidden": "true"
|
|
1097
1097
|
}), "New portfolio"]
|
|
1098
1098
|
}),
|
|
1099
1099
|
children: [
|
|
1100
|
-
a ? /* @__PURE__ */
|
|
1101
|
-
icon: /* @__PURE__ */
|
|
1100
|
+
a ? /* @__PURE__ */ A(re, { rows: 4 }) : c ? /* @__PURE__ */ A(ne, { onRetry: () => l() }) : n.length === 0 ? /* @__PURE__ */ A(te, {
|
|
1101
|
+
icon: /* @__PURE__ */ A(le, {
|
|
1102
1102
|
className: "size-6",
|
|
1103
1103
|
"aria-hidden": "true"
|
|
1104
1104
|
}),
|
|
1105
1105
|
title: "No portfolios yet",
|
|
1106
1106
|
description: "Create your first portfolio to start organizing holdings and tracking drift.",
|
|
1107
|
-
action: /* @__PURE__ */
|
|
1107
|
+
action: /* @__PURE__ */ j(N, {
|
|
1108
1108
|
size: "sm",
|
|
1109
|
-
onClick:
|
|
1110
|
-
children: [/* @__PURE__ */
|
|
1109
|
+
onClick: I,
|
|
1110
|
+
children: [/* @__PURE__ */ A(O, {
|
|
1111
1111
|
className: "size-4",
|
|
1112
1112
|
"aria-hidden": "true"
|
|
1113
1113
|
}), "New portfolio"]
|
|
1114
1114
|
})
|
|
1115
|
-
}) : /* @__PURE__ */
|
|
1116
|
-
/* @__PURE__ */
|
|
1115
|
+
}) : /* @__PURE__ */ j(fe, { children: [
|
|
1116
|
+
/* @__PURE__ */ j(m, {
|
|
1117
1117
|
className: "grid grid-cols-2 gap-3 lg:grid-cols-5",
|
|
1118
1118
|
children: [
|
|
1119
|
-
/* @__PURE__ */
|
|
1119
|
+
/* @__PURE__ */ A(g, {
|
|
1120
1120
|
label: "Portfolios",
|
|
1121
1121
|
value: String(n.length),
|
|
1122
1122
|
glow: !0
|
|
1123
1123
|
}),
|
|
1124
|
-
/* @__PURE__ */
|
|
1125
|
-
label:
|
|
1126
|
-
value: p.isPending ? "…" : p.isError ? "—" :
|
|
1124
|
+
/* @__PURE__ */ A(g, {
|
|
1125
|
+
label: F ? `Total value (${F})` : "Total value",
|
|
1126
|
+
value: p.isPending ? "…" : p.isError ? "—" : F ? ae(M.get(F) ?? 0, F) : P.length === 0 ? "—" : `${P.length} currencies`
|
|
1127
1127
|
}),
|
|
1128
|
-
/* @__PURE__ */
|
|
1128
|
+
/* @__PURE__ */ A(g, {
|
|
1129
1129
|
label: "Active",
|
|
1130
|
-
value: String(
|
|
1130
|
+
value: String(ue)
|
|
1131
1131
|
}),
|
|
1132
|
-
/* @__PURE__ */
|
|
1132
|
+
/* @__PURE__ */ A(g, {
|
|
1133
1133
|
label: "Drafts",
|
|
1134
|
-
value: String(
|
|
1134
|
+
value: String(de)
|
|
1135
1135
|
}),
|
|
1136
|
-
/* @__PURE__ */
|
|
1136
|
+
/* @__PURE__ */ A(g, {
|
|
1137
1137
|
label: "Past drift threshold",
|
|
1138
|
-
value: p.isPending ? "…" : p.isError ? "—" : String(
|
|
1138
|
+
value: p.isPending ? "…" : p.isError ? "—" : String(pe)
|
|
1139
1139
|
})
|
|
1140
1140
|
]
|
|
1141
1141
|
}),
|
|
1142
|
-
!p.isPending && !p.isError &&
|
|
1142
|
+
!p.isPending && !p.isError && P.length > 1 ? /* @__PURE__ */ j("p", {
|
|
1143
1143
|
className: "text-xs text-text-secondary",
|
|
1144
1144
|
children: [
|
|
1145
1145
|
"Market value is not FX-converted:",
|
|
1146
1146
|
" ",
|
|
1147
|
-
|
|
1147
|
+
P.map((e) => ae(M.get(e) ?? 0, e)).join(" · "),
|
|
1148
1148
|
". Average drift threshold ",
|
|
1149
|
-
|
|
1149
|
+
b(k),
|
|
1150
1150
|
"."
|
|
1151
1151
|
]
|
|
1152
|
-
}) : /* @__PURE__ */
|
|
1152
|
+
}) : /* @__PURE__ */ j("p", {
|
|
1153
1153
|
className: "text-xs text-text-secondary",
|
|
1154
1154
|
children: [
|
|
1155
1155
|
"Average drift threshold across these portfolios: ",
|
|
1156
|
-
|
|
1156
|
+
b(k),
|
|
1157
1157
|
"."
|
|
1158
1158
|
]
|
|
1159
1159
|
}),
|
|
1160
|
-
/* @__PURE__ */
|
|
1160
|
+
/* @__PURE__ */ A("div", {
|
|
1161
1161
|
className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
|
|
1162
|
-
children: n.map((e, t) => /* @__PURE__ */
|
|
1162
|
+
children: n.map((e, t) => /* @__PURE__ */ A(Je, {
|
|
1163
1163
|
portfolio: e,
|
|
1164
1164
|
valuation: p.isPending ? void 0 : _.get(e.id),
|
|
1165
1165
|
valuationError: p.isError,
|
|
1166
1166
|
index: t,
|
|
1167
|
-
onView: () =>
|
|
1168
|
-
onEdit: () =>
|
|
1169
|
-
onArchive: () =>
|
|
1167
|
+
onView: () => ce(e.id),
|
|
1168
|
+
onEdit: () => L(e),
|
|
1169
|
+
onArchive: () => D(e)
|
|
1170
1170
|
}, e.id))
|
|
1171
1171
|
}),
|
|
1172
|
-
/* @__PURE__ */
|
|
1172
|
+
/* @__PURE__ */ A(d, {
|
|
1173
1173
|
hasMore: r,
|
|
1174
1174
|
onClick: i,
|
|
1175
1175
|
loading: o
|
|
1176
1176
|
})
|
|
1177
1177
|
] }),
|
|
1178
|
-
/* @__PURE__ */
|
|
1178
|
+
/* @__PURE__ */ A(Ue, {
|
|
1179
1179
|
open: ee,
|
|
1180
1180
|
onOpenChange: v,
|
|
1181
|
-
editing:
|
|
1181
|
+
editing: y
|
|
1182
1182
|
}),
|
|
1183
|
-
/* @__PURE__ */
|
|
1184
|
-
portfolioId:
|
|
1183
|
+
/* @__PURE__ */ A(Ke, {
|
|
1184
|
+
portfolioId: se,
|
|
1185
1185
|
onOpenChange: (e) => {
|
|
1186
|
-
e ||
|
|
1186
|
+
e || ce(null);
|
|
1187
1187
|
}
|
|
1188
1188
|
}),
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
open:
|
|
1189
|
+
/* @__PURE__ */ A(f, {
|
|
1190
|
+
open: E !== null,
|
|
1191
1191
|
onOpenChange: (e) => {
|
|
1192
|
-
e ||
|
|
1192
|
+
e || D(null);
|
|
1193
1193
|
},
|
|
1194
1194
|
title: "Archive portfolio?",
|
|
1195
|
-
description:
|
|
1195
|
+
description: E ? `Archive “${E.name}”. It will move to archived status and stop appearing in active views.` : void 0,
|
|
1196
1196
|
confirmLabel: "Archive",
|
|
1197
1197
|
pendingLabel: "Archiving…",
|
|
1198
1198
|
destructive: !0,
|
|
1199
1199
|
pending: u.isPending,
|
|
1200
1200
|
onConfirm: () => {
|
|
1201
|
-
|
|
1202
|
-
|
|
1201
|
+
E && u.mutate(E.id, { onSuccess: () => {
|
|
1202
|
+
x(), S("Portfolio archived"), D(null);
|
|
1203
1203
|
} });
|
|
1204
1204
|
}
|
|
1205
1205
|
})
|