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