@burdenoff/microfe-brainyrich 2026.512.1 → 2026.705.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/brainyrich/BrainyRichRoot.js +53 -88
  2. package/dist/brainyrich/BrainyRichRoot.js.map +1 -1
  3. package/dist/brainyrich/BrainyRichRoutes.js +15 -35
  4. package/dist/brainyrich/BrainyRichRoutes.js.map +1 -1
  5. package/dist/brainyrich/hooks/useBrainyRichApi.js +543 -0
  6. package/dist/brainyrich/hooks/useBrainyRichApi.js.map +1 -0
  7. package/dist/brainyrich/index.js +0 -1
  8. package/dist/brainyrich/pages/AccountsPage.js +690 -160
  9. package/dist/brainyrich/pages/AccountsPage.js.map +1 -1
  10. package/dist/brainyrich/pages/AiAssistantPage.js +537 -363
  11. package/dist/brainyrich/pages/AiAssistantPage.js.map +1 -1
  12. package/dist/brainyrich/pages/AnalyticsPage.js +587 -268
  13. package/dist/brainyrich/pages/AnalyticsPage.js.map +1 -1
  14. package/dist/brainyrich/pages/DashboardPage.js +350 -232
  15. package/dist/brainyrich/pages/DashboardPage.js.map +1 -1
  16. package/dist/brainyrich/pages/FamilyPage.js +550 -337
  17. package/dist/brainyrich/pages/FamilyPage.js.map +1 -1
  18. package/dist/brainyrich/pages/GoalsPage.js +775 -142
  19. package/dist/brainyrich/pages/GoalsPage.js.map +1 -1
  20. package/dist/brainyrich/pages/InvestmentsPage.js +410 -311
  21. package/dist/brainyrich/pages/InvestmentsPage.js.map +1 -1
  22. package/dist/brainyrich/pages/PortfoliosPage.js +823 -154
  23. package/dist/brainyrich/pages/PortfoliosPage.js.map +1 -1
  24. package/dist/brainyrich/pages/ReportsPage.js +388 -251
  25. package/dist/brainyrich/pages/ReportsPage.js.map +1 -1
  26. package/dist/brainyrich/pages/RiskPage.js +411 -196
  27. package/dist/brainyrich/pages/RiskPage.js.map +1 -1
  28. package/dist/brainyrich/pages/TaxPage.js +622 -221
  29. package/dist/brainyrich/pages/TaxPage.js.map +1 -1
  30. package/dist/brainyrich/pages/_shared.js +222 -41
  31. package/dist/brainyrich/pages/_shared.js.map +1 -1
  32. package/dist/index.js +2 -3
  33. package/package.json +1 -1
  34. package/dist/brainyrich/BrainyRichRoot.d.ts +0 -5
  35. package/dist/brainyrich/BrainyRichRoot.d.ts.map +0 -1
  36. package/dist/brainyrich/BrainyRichRoutes.d.ts +0 -2
  37. package/dist/brainyrich/BrainyRichRoutes.d.ts.map +0 -1
  38. package/dist/brainyrich/index.d.ts +0 -5
  39. package/dist/brainyrich/index.d.ts.map +0 -1
  40. package/dist/brainyrich/pages/AccountsPage.d.ts +0 -2
  41. package/dist/brainyrich/pages/AccountsPage.d.ts.map +0 -1
  42. package/dist/brainyrich/pages/AdvisorsPage.d.ts +0 -2
  43. package/dist/brainyrich/pages/AdvisorsPage.d.ts.map +0 -1
  44. package/dist/brainyrich/pages/AdvisorsPage.js +0 -375
  45. package/dist/brainyrich/pages/AdvisorsPage.js.map +0 -1
  46. package/dist/brainyrich/pages/AiAssistantPage.d.ts +0 -2
  47. package/dist/brainyrich/pages/AiAssistantPage.d.ts.map +0 -1
  48. package/dist/brainyrich/pages/AnalyticsPage.d.ts +0 -2
  49. package/dist/brainyrich/pages/AnalyticsPage.d.ts.map +0 -1
  50. package/dist/brainyrich/pages/AssistantPage.d.ts +0 -2
  51. package/dist/brainyrich/pages/AssistantPage.d.ts.map +0 -1
  52. package/dist/brainyrich/pages/AssistantPage.js +0 -332
  53. package/dist/brainyrich/pages/AssistantPage.js.map +0 -1
  54. package/dist/brainyrich/pages/DashboardPage.d.ts +0 -2
  55. package/dist/brainyrich/pages/DashboardPage.d.ts.map +0 -1
  56. package/dist/brainyrich/pages/EstatePage.d.ts +0 -2
  57. package/dist/brainyrich/pages/EstatePage.d.ts.map +0 -1
  58. package/dist/brainyrich/pages/EstatePage.js +0 -269
  59. package/dist/brainyrich/pages/EstatePage.js.map +0 -1
  60. package/dist/brainyrich/pages/FamilyPage.d.ts +0 -2
  61. package/dist/brainyrich/pages/FamilyPage.d.ts.map +0 -1
  62. package/dist/brainyrich/pages/GoalsPage.d.ts +0 -2
  63. package/dist/brainyrich/pages/GoalsPage.d.ts.map +0 -1
  64. package/dist/brainyrich/pages/InsurancePage.d.ts +0 -2
  65. package/dist/brainyrich/pages/InsurancePage.d.ts.map +0 -1
  66. package/dist/brainyrich/pages/InsurancePage.js +0 -181
  67. package/dist/brainyrich/pages/InsurancePage.js.map +0 -1
  68. package/dist/brainyrich/pages/InvestmentsPage.d.ts +0 -2
  69. package/dist/brainyrich/pages/InvestmentsPage.d.ts.map +0 -1
  70. package/dist/brainyrich/pages/MarketplacePage.d.ts +0 -2
  71. package/dist/brainyrich/pages/MarketplacePage.d.ts.map +0 -1
  72. package/dist/brainyrich/pages/MarketplacePage.js +0 -450
  73. package/dist/brainyrich/pages/MarketplacePage.js.map +0 -1
  74. package/dist/brainyrich/pages/PortfoliosPage.d.ts +0 -2
  75. package/dist/brainyrich/pages/PortfoliosPage.d.ts.map +0 -1
  76. package/dist/brainyrich/pages/ReportsPage.d.ts +0 -2
  77. package/dist/brainyrich/pages/ReportsPage.d.ts.map +0 -1
  78. package/dist/brainyrich/pages/RiskPage.d.ts +0 -2
  79. package/dist/brainyrich/pages/RiskPage.d.ts.map +0 -1
  80. package/dist/brainyrich/pages/TaxPage.d.ts +0 -2
  81. package/dist/brainyrich/pages/TaxPage.d.ts.map +0 -1
  82. package/dist/brainyrich/pages/_shared.d.ts +0 -21
  83. package/dist/brainyrich/pages/_shared.d.ts.map +0 -1
  84. package/dist/brainyrich/providers/BrainyRichProvider.d.ts +0 -6
  85. package/dist/brainyrich/providers/BrainyRichProvider.d.ts.map +0 -1
  86. package/dist/brainyrich/store/brainyrichStore.d.ts +0 -19
  87. package/dist/brainyrich/store/brainyrichStore.d.ts.map +0 -1
  88. package/dist/brainyrich/store/brainyrichStore.js +0 -272
  89. package/dist/brainyrich/store/brainyrichStore.js.map +0 -1
  90. package/dist/brainyrich/types/index.d.ts +0 -116
  91. package/dist/brainyrich/types/index.d.ts.map +0 -1
  92. package/dist/brainyrich/utils/cn.d.ts +0 -4
  93. package/dist/brainyrich/utils/cn.d.ts.map +0 -1
  94. package/dist/brainyrich/utils/i18n.d.ts +0 -6
  95. package/dist/brainyrich/utils/i18n.d.ts.map +0 -1
  96. package/dist/brainyrich/utils/navigation.d.ts +0 -2
  97. package/dist/brainyrich/utils/navigation.d.ts.map +0 -1
  98. package/dist/dev/main.d.ts +0 -2
  99. package/dist/dev/main.d.ts.map +0 -1
  100. package/dist/generated/global-operations.d.ts +0 -2
  101. package/dist/generated/global-operations.d.ts.map +0 -1
  102. package/dist/generated/global-types.d.ts +0 -18199
  103. package/dist/generated/global-types.d.ts.map +0 -1
  104. package/dist/generated/wspace-operations.d.ts +0 -2
  105. package/dist/generated/wspace-operations.d.ts.map +0 -1
  106. package/dist/generated/wspace-types.d.ts +0 -43046
  107. package/dist/generated/wspace-types.d.ts.map +0 -1
  108. package/dist/index.d.ts +0 -2
  109. package/dist/index.d.ts.map +0 -1
@@ -1,160 +1,793 @@
1
1
  import { tWithFallback as e } from "../utils/i18n.js";
2
- import { useBrainyRichStore as t } from "../store/brainyrichStore.js";
3
- import { KpiGrid as n, SectionShell as r, formatMoney as i } from "./_shared.js";
4
- import { Clock as a, Plus as o, Target as s, TrendingUp as c } from "lucide-react";
5
- import { useI18n as l } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
6
- import { jsx as u, jsxs as d } from "react/jsx-runtime";
7
- import { Badge as f, Button as p, Card as m, CardContent as h, CardDescription as g, CardHeader as _, CardTitle as v } from "@burdenoff/fe-libs/ui";
2
+ import { useAccounts as t, useArchiveGoal as n, useCreateGoal as r, useGoal as i, useGoalFundings as a, useGoals as o, useHouseholds as s, useLinkGoalFunding as c, useRecalcGoalProjection as l, useUnlinkGoalFunding as u, useUpdateGoal as ee } from "../hooks/useBrainyRichApi.js";
3
+ import { EmptyState as d, ErrorState as f, KpiGrid as te, LoadingState as ne, SectionShell as p, formatDate as re, formatMoney as m, statusBadgeVariant as h } from "./_shared.js";
4
+ import { useMemo as g, useState as _ } from "react";
5
+ import { AlertTriangle as v, CalendarClock as y, Link2 as ie, MoreHorizontal as b, Plus as x, RefreshCw as ae, Target as S, Trash2 as C, TrendingDown as w, TrendingUp as T, Unlink as E } from "lucide-react";
6
+ import { useI18n as D } from "@burdenoff/fe-libs/shared/providers/shell/I18nProvider";
7
+ import { Fragment as O, jsx as k, jsxs as A } from "react/jsx-runtime";
8
+ import { Badge as j, Button as M, Card as N, CardContent as P, CardDescription as F, CardHeader as oe, CardTitle as I, Dialog as L, DialogContent as R, DialogDescription as z, DialogFooter as B, DialogHeader as se, DialogTitle as V, DropdownMenu as ce, DropdownMenuContent as le, DropdownMenuItem as H, DropdownMenuSeparator as ue, DropdownMenuTrigger as de, Input as U, Label as W, Select as G, SelectContent as K, SelectItem as q, SelectTrigger as J, SelectValue as Y, Sheet as X, SheetContent as fe, SheetDescription as pe, SheetHeader as me, SheetTitle as he, Textarea as ge } from "@burdenoff/fe-libs/ui";
8
9
  //#region src/brainyrich/pages/GoalsPage.tsx
9
- var y = (/* @__PURE__ */ new Date(0)).getTime();
10
- function b() {
11
- let { t: b } = l(), { goals: x } = t(), S = (t, n, r) => e(b, t, n, r), C = x.reduce((e, t) => e + t.targetAmount, 0), w = x.reduce((e, t) => e + t.currentAmount, 0), T = C > 0 ? Math.round(w / C * 100) : 0, E = C - w;
12
- return /* @__PURE__ */ d(r, {
13
- title: S("brainyrich.goals.title", "Financial Goals"),
14
- description: S("brainyrich.goals.description", "Track progress toward your wealth milestones and life objectives"),
15
- actionLabel: S("brainyrich.goals.actions.createGoal", "Create Goal"),
16
- badges: [S("brainyrich.goals.badges.activeGoals", "{count} Active Goals", { count: x.length })],
17
- children: [/* @__PURE__ */ u(n, { items: [
18
- {
19
- label: S("brainyrich.goals.metrics.totalSaved", "Total Saved"),
20
- value: i(w),
21
- trend: S("brainyrich.goals.metrics.totalSavedTrend", "Across all goals")
10
+ var _e = [
11
+ "RETIREMENT",
12
+ "EDUCATION",
13
+ "HOME",
14
+ "EMERGENCY_FUND",
15
+ "MAJOR_PURCHASE",
16
+ "WEALTH_GROWTH",
17
+ "CUSTOM"
18
+ ], ve = [
19
+ "ACTIVE",
20
+ "ACHIEVED",
21
+ "ON_HOLD",
22
+ "ABANDONED"
23
+ ];
24
+ function ye(e) {
25
+ switch (e) {
26
+ case "AHEAD":
27
+ case "ON_TRACK": return {
28
+ icon: T,
29
+ tone: "text-status-success-text"
30
+ };
31
+ case "BEHIND": return {
32
+ icon: w,
33
+ tone: "text-status-warning-text"
34
+ };
35
+ default: return {
36
+ icon: v,
37
+ tone: "text-status-error-text"
38
+ };
39
+ }
40
+ }
41
+ function Z(e) {
42
+ return e.toLowerCase().split("_").map((e) => e.charAt(0).toUpperCase() + e.slice(1)).join(" ");
43
+ }
44
+ function be(e) {
45
+ if (!e) return "";
46
+ let t = new Date(e);
47
+ return Number.isNaN(t.getTime()) ? "" : t.toISOString().slice(0, 10);
48
+ }
49
+ function xe() {
50
+ return {
51
+ name: "",
52
+ type: "CUSTOM",
53
+ status: "ACTIVE",
54
+ targetAmount: "",
55
+ targetDate: "",
56
+ monthlyContribution: "",
57
+ priority: "1",
58
+ currency: "USD",
59
+ householdId: "",
60
+ notes: "",
61
+ tags: ""
62
+ };
63
+ }
64
+ function Se(e) {
65
+ return {
66
+ name: e.name,
67
+ type: e.type,
68
+ status: e.status,
69
+ targetAmount: String(e.targetAmount),
70
+ targetDate: be(e.targetDate),
71
+ monthlyContribution: String(e.monthlyContribution),
72
+ priority: String(e.priority),
73
+ currency: e.currency,
74
+ householdId: e.householdId ?? "",
75
+ notes: e.notes ?? "",
76
+ tags: e.tags.join(", ")
77
+ };
78
+ }
79
+ function Ce(e) {
80
+ return e.split(",").map((e) => e.trim()).filter(Boolean);
81
+ }
82
+ var Q = "__none__";
83
+ function we() {
84
+ let { t } = D(), i = (n, r, i) => e(t, n, r, i), { data: a, isLoading: c, isError: l, refetch: u } = o(), { data: v } = s(), w = r(), T = ee(), E = n(), [L, R] = _(!1), [z, B] = _(null), [se, V] = _(null), [U, W] = _(xe), G = (e, t) => W((n) => ({
85
+ ...n,
86
+ [e]: t
87
+ })), K = g(() => ({
88
+ totalTarget: a.reduce((e, t) => e + t.targetAmount, 0),
89
+ totalMonthly: a.reduce((e, t) => e + t.monthlyContribution, 0),
90
+ atRisk: a.filter((e) => e.projection === "AT_RISK" || e.projection === "BEHIND").length
91
+ }), [a]), q = a[0]?.currency ?? "USD", J = () => {
92
+ W(xe()), R(!0);
93
+ }, Y = (e) => {
94
+ W(Se(e)), B(e);
95
+ }, X = U.name.trim().length > 0 && Number(U.targetAmount) > 0 && U.targetDate.length > 0;
96
+ return /* @__PURE__ */ A(O, { children: [
97
+ /* @__PURE__ */ k(p, {
98
+ title: i("brainyrich.goals.title", "Financial Goals"),
99
+ description: i("brainyrich.goals.description", "Track progress toward your wealth milestones and life objectives"),
100
+ actionLabel: i("brainyrich.goals.actions.createGoal", "New goal"),
101
+ onAction: J,
102
+ children: c ? /* @__PURE__ */ k(ne, { rows: 4 }) : l ? /* @__PURE__ */ k(f, {
103
+ title: i("brainyrich.goals.error.title", "Could not load goals"),
104
+ description: i("brainyrich.goals.error.description", "We could not reach the goals service. Please try again."),
105
+ onRetry: () => u()
106
+ }) : a.length === 0 ? /* @__PURE__ */ k(d, {
107
+ icon: /* @__PURE__ */ k(S, {
108
+ className: "size-6",
109
+ "aria-hidden": "true"
110
+ }),
111
+ title: i("brainyrich.goals.empty.title", "No financial goals yet"),
112
+ description: i("brainyrich.goals.empty.description", "Create your first goal to start tracking progress toward a milestone."),
113
+ action: /* @__PURE__ */ A(M, {
114
+ size: "sm",
115
+ onClick: J,
116
+ children: [/* @__PURE__ */ k(x, {
117
+ className: "size-4",
118
+ "aria-hidden": "true"
119
+ }), i("brainyrich.goals.actions.createGoal", "New goal")]
120
+ })
121
+ }) : /* @__PURE__ */ A(O, { children: [/* @__PURE__ */ k(te, { items: [
122
+ {
123
+ label: i("brainyrich.goals.metrics.activeGoals", "Goals"),
124
+ value: String(a.length),
125
+ trend: i("brainyrich.goals.metrics.activeGoalsTrend", "Being tracked")
126
+ },
127
+ {
128
+ label: i("brainyrich.goals.metrics.totalTarget", "Total target"),
129
+ value: m(K.totalTarget, q)
130
+ },
131
+ {
132
+ label: i("brainyrich.goals.metrics.monthly", "Monthly contributions"),
133
+ value: m(K.totalMonthly, q),
134
+ trend: i("brainyrich.goals.metrics.monthlyTrend", "Across all goals")
135
+ },
136
+ {
137
+ label: i("brainyrich.goals.metrics.atRisk", "Needs attention"),
138
+ value: String(K.atRisk),
139
+ trend: i("brainyrich.goals.metrics.atRiskTrend", "Behind or at risk"),
140
+ deltaTone: K.atRisk > 0 ? "negative" : "positive"
141
+ }
142
+ ] }), /* @__PURE__ */ k("div", {
143
+ className: "grid gap-4 md:grid-cols-2 xl:grid-cols-3",
144
+ children: a.map((e) => {
145
+ let t = ye(e.projection), n = t.icon;
146
+ return /* @__PURE__ */ A(N, {
147
+ className: "flex flex-col",
148
+ children: [/* @__PURE__ */ k(oe, {
149
+ className: "pb-3",
150
+ children: /* @__PURE__ */ A("div", {
151
+ className: "flex items-start justify-between gap-2",
152
+ children: [/* @__PURE__ */ A("div", {
153
+ className: "min-w-0",
154
+ children: [/* @__PURE__ */ A(I, {
155
+ className: "flex items-center gap-2 text-base",
156
+ children: [/* @__PURE__ */ k(S, {
157
+ className: "size-4 shrink-0 text-text-secondary",
158
+ "aria-hidden": "true"
159
+ }), /* @__PURE__ */ k("span", {
160
+ className: "truncate",
161
+ children: e.name
162
+ })]
163
+ }), /* @__PURE__ */ A(F, {
164
+ className: "mt-1 flex flex-wrap items-center gap-2",
165
+ children: [/* @__PURE__ */ k(j, {
166
+ variant: "outline",
167
+ children: Z(e.type)
168
+ }), /* @__PURE__ */ k(j, {
169
+ variant: h(e.status),
170
+ children: Z(e.status)
171
+ })]
172
+ })]
173
+ }), /* @__PURE__ */ A(ce, { children: [/* @__PURE__ */ k(de, {
174
+ asChild: !0,
175
+ children: /* @__PURE__ */ k(M, {
176
+ variant: "ghost",
177
+ size: "icon",
178
+ "aria-label": i("brainyrich.goals.actions.menu", "Goal actions"),
179
+ children: /* @__PURE__ */ k(b, {
180
+ className: "size-4",
181
+ "aria-hidden": "true"
182
+ })
183
+ })
184
+ }), /* @__PURE__ */ A(le, {
185
+ align: "end",
186
+ children: [
187
+ /* @__PURE__ */ A(H, {
188
+ onSelect: () => V(e.id),
189
+ children: [/* @__PURE__ */ k(ie, {
190
+ className: "size-4",
191
+ "aria-hidden": "true"
192
+ }), i("brainyrich.goals.actions.manageFunding", "Manage funding")]
193
+ }),
194
+ /* @__PURE__ */ A(H, {
195
+ onSelect: () => Y(e),
196
+ children: [/* @__PURE__ */ k(ae, {
197
+ className: "size-4",
198
+ "aria-hidden": "true"
199
+ }), i("brainyrich.goals.actions.editGoal", "Edit goal")]
200
+ }),
201
+ /* @__PURE__ */ k(ue, {}),
202
+ /* @__PURE__ */ A(H, {
203
+ className: "text-status-error-text focus:text-status-error-text",
204
+ disabled: E.isPending,
205
+ onSelect: () => E.mutate(e.id),
206
+ children: [/* @__PURE__ */ k(C, {
207
+ className: "size-4",
208
+ "aria-hidden": "true"
209
+ }), i("brainyrich.goals.actions.archive", "Archive goal")]
210
+ })
211
+ ]
212
+ })] })]
213
+ })
214
+ }), /* @__PURE__ */ A(P, {
215
+ className: "flex flex-1 flex-col gap-4",
216
+ children: [
217
+ /* @__PURE__ */ A("div", { children: [
218
+ /* @__PURE__ */ k("p", {
219
+ className: "text-xs text-text-secondary",
220
+ children: i("brainyrich.goals.card.target", "Target amount")
221
+ }),
222
+ /* @__PURE__ */ k("p", {
223
+ className: "text-2xl font-semibold text-text-primary",
224
+ children: m(e.targetAmount, e.currency)
225
+ }),
226
+ /* @__PURE__ */ A("span", {
227
+ className: `mt-1 inline-flex items-center gap-1 text-xs font-medium ${t.tone}`,
228
+ children: [/* @__PURE__ */ k(n, {
229
+ className: "size-3.5",
230
+ "aria-hidden": "true"
231
+ }), Z(e.projection)]
232
+ })
233
+ ] }),
234
+ /* @__PURE__ */ A("dl", {
235
+ className: "grid grid-cols-2 gap-3 rounded-lg bg-bg-sunken p-3 text-sm",
236
+ children: [
237
+ /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", {
238
+ className: "text-xs text-text-secondary",
239
+ children: i("brainyrich.goals.card.targetDate", "Target date")
240
+ }), /* @__PURE__ */ A("dd", {
241
+ className: "flex items-center gap-1 font-medium text-text-primary",
242
+ children: [/* @__PURE__ */ k(y, {
243
+ className: "size-3.5 text-text-secondary",
244
+ "aria-hidden": "true"
245
+ }), re(e.targetDate)]
246
+ })] }),
247
+ /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", {
248
+ className: "text-xs text-text-secondary",
249
+ children: i("brainyrich.goals.card.monthly", "Monthly")
250
+ }), /* @__PURE__ */ k("dd", {
251
+ className: "font-medium text-text-primary",
252
+ children: m(e.monthlyContribution, e.currency)
253
+ })] }),
254
+ /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", {
255
+ className: "text-xs text-text-secondary",
256
+ children: i("brainyrich.goals.card.priority", "Priority")
257
+ }), /* @__PURE__ */ k("dd", {
258
+ className: "font-medium text-text-primary",
259
+ children: e.priority
260
+ })] }),
261
+ /* @__PURE__ */ A("div", { children: [/* @__PURE__ */ k("dt", {
262
+ className: "text-xs text-text-secondary",
263
+ children: i("brainyrich.goals.card.fundings", "Funding links")
264
+ }), /* @__PURE__ */ k("dd", {
265
+ className: "font-medium text-text-primary",
266
+ children: e.fundings.length
267
+ })] })
268
+ ]
269
+ }),
270
+ /* @__PURE__ */ k("div", {
271
+ className: "mt-auto",
272
+ children: /* @__PURE__ */ k(M, {
273
+ variant: "outline",
274
+ size: "sm",
275
+ className: "w-full",
276
+ onClick: () => V(e.id),
277
+ children: i("brainyrich.goals.actions.viewDetails", "View details & funding")
278
+ })
279
+ })
280
+ ]
281
+ })]
282
+ }, e.id);
283
+ })
284
+ })] })
285
+ }),
286
+ /* @__PURE__ */ k(Te, {
287
+ open: L,
288
+ mode: "create",
289
+ form: U,
290
+ setField: G,
291
+ households: v.map((e) => ({
292
+ id: e.id,
293
+ name: e.name
294
+ })),
295
+ valid: X,
296
+ pending: w.isPending,
297
+ onSubmit: () => {
298
+ if (!X) return;
299
+ let e = {
300
+ name: U.name.trim(),
301
+ type: U.type,
302
+ targetAmount: Number(U.targetAmount),
303
+ targetDate: new Date(U.targetDate).toISOString(),
304
+ monthlyContribution: Number(U.monthlyContribution) || 0,
305
+ priority: Number(U.priority) || 1,
306
+ currency: U.currency.trim() || "USD",
307
+ notes: U.notes.trim() || null,
308
+ tags: Ce(U.tags),
309
+ ...U.householdId ? { householdId: U.householdId } : {}
310
+ };
311
+ w.mutate(e, { onSuccess: () => R(!1) });
22
312
  },
23
- {
24
- label: S("brainyrich.goals.metrics.totalTarget", "Total Target"),
25
- value: i(C)
313
+ onOpenChange: (e) => R(e),
314
+ translate: i
315
+ }),
316
+ /* @__PURE__ */ k(Te, {
317
+ open: !!z,
318
+ mode: "edit",
319
+ form: U,
320
+ setField: G,
321
+ households: v.map((e) => ({
322
+ id: e.id,
323
+ name: e.name
324
+ })),
325
+ valid: X,
326
+ pending: T.isPending,
327
+ onSubmit: () => {
328
+ if (!z || !X) return;
329
+ let e = {
330
+ name: U.name.trim(),
331
+ type: U.type,
332
+ status: U.status,
333
+ targetAmount: Number(U.targetAmount),
334
+ targetDate: new Date(U.targetDate).toISOString(),
335
+ monthlyContribution: Number(U.monthlyContribution) || 0,
336
+ priority: Number(U.priority) || 1,
337
+ currency: U.currency.trim() || "USD",
338
+ notes: U.notes.trim() || null,
339
+ tags: Ce(U.tags)
340
+ };
341
+ T.mutate({
342
+ id: z.id,
343
+ input: e
344
+ }, { onSuccess: () => B(null) });
26
345
  },
27
- {
28
- label: S("brainyrich.goals.metrics.overallProgress", "Overall Progress"),
29
- value: `${T}%`,
30
- trend: S("brainyrich.goals.metrics.overallProgressTrend", "{amount} remaining", { amount: i(E) })
346
+ onOpenChange: (e) => {
347
+ e || B(null);
31
348
  },
32
- {
33
- label: S("brainyrich.goals.metrics.activeGoals", "Active Goals"),
34
- value: String(x.length),
35
- trend: S("brainyrich.goals.metrics.activeGoalsTrend", "In progress")
36
- }
37
- ] }), /* @__PURE__ */ u("div", {
38
- className: "space-y-4",
39
- children: x.map((e) => {
40
- let t = Math.round(e.currentAmount / e.targetAmount * 100), n = e.targetAmount - e.currentAmount, r = new Date(e.deadline), l = Math.max(0, Math.round((r.getTime() - y) / (1e3 * 60 * 60 * 24 * 30))), b = l > 0 ? n / l : n;
41
- return /* @__PURE__ */ d(m, { children: [/* @__PURE__ */ u(_, {
42
- className: "pb-3",
43
- children: /* @__PURE__ */ d("div", {
44
- className: "flex items-start justify-between",
45
- children: [/* @__PURE__ */ d("div", { children: [/* @__PURE__ */ d(v, {
46
- className: "flex items-center gap-2 text-lg",
47
- children: [/* @__PURE__ */ u(s, { className: "h-5 w-5" }), e.title]
48
- }), /* @__PURE__ */ d(g, {
49
- className: "flex items-center gap-3 mt-1",
50
- children: [/* @__PURE__ */ d("span", {
51
- className: "flex items-center gap-1",
52
- children: [
53
- /* @__PURE__ */ u(a, { className: "h-3 w-3" }),
54
- S("brainyrich.goals.deadlineLabel", "Deadline:"),
55
- " ",
56
- r.toLocaleDateString("en-US", {
57
- month: "short",
58
- year: "numeric"
59
- })
60
- ]
61
- }), /* @__PURE__ */ u("span", { children: S("brainyrich.goals.monthsRemaining", "{count} months remaining", { count: l }) })]
62
- })] }), /* @__PURE__ */ u(f, {
63
- variant: t >= 75 ? "default" : t >= 40 ? "secondary" : "destructive",
64
- children: S("brainyrich.goals.progressComplete", "{pct}% complete", { pct: t })
349
+ translate: i
350
+ }),
351
+ /* @__PURE__ */ k(Ee, {
352
+ goalId: se,
353
+ onClose: () => V(null),
354
+ translate: i
355
+ })
356
+ ] });
357
+ }
358
+ function Te({ open: e, mode: t, form: n, setField: r, households: i, valid: a, pending: o, onSubmit: s, onOpenChange: c, translate: l }) {
359
+ return /* @__PURE__ */ k(L, {
360
+ open: e,
361
+ onOpenChange: c,
362
+ children: /* @__PURE__ */ A(R, {
363
+ className: "max-h-[90vh] overflow-y-auto sm:max-w-lg",
364
+ children: [/* @__PURE__ */ A(se, { children: [/* @__PURE__ */ k(V, { children: t === "create" ? l("brainyrich.goals.form.createTitle", "New goal") : l("brainyrich.goals.form.editTitle", "Edit goal") }), /* @__PURE__ */ k(z, { children: l("brainyrich.goals.form.subtitle", "Define the milestone, target and contribution plan.") })] }), /* @__PURE__ */ A("form", {
365
+ className: "space-y-4",
366
+ onSubmit: (e) => {
367
+ e.preventDefault(), s();
368
+ },
369
+ children: [
370
+ /* @__PURE__ */ A("div", {
371
+ className: "space-y-1.5",
372
+ children: [/* @__PURE__ */ k(W, {
373
+ htmlFor: "goal-name",
374
+ children: l("brainyrich.goals.form.name", "Name")
375
+ }), /* @__PURE__ */ k(U, {
376
+ id: "goal-name",
377
+ value: n.name,
378
+ onChange: (e) => r("name", e.target.value),
379
+ placeholder: l("brainyrich.goals.form.namePlaceholder", "e.g. Retirement fund"),
380
+ required: !0
65
381
  })]
66
- })
67
- }), /* @__PURE__ */ d(h, {
68
- className: "space-y-4",
69
- children: [
70
- /* @__PURE__ */ d("div", { children: [
71
- /* @__PURE__ */ d("div", {
72
- className: "flex items-center justify-between text-sm mb-2",
73
- children: [/* @__PURE__ */ u("span", {
74
- className: "font-medium",
75
- children: i(e.currentAmount)
76
- }), /* @__PURE__ */ u("span", {
77
- className: "text-muted-foreground",
78
- children: i(e.targetAmount)
79
- })]
382
+ }),
383
+ /* @__PURE__ */ A("div", {
384
+ className: "grid grid-cols-2 gap-3",
385
+ children: [/* @__PURE__ */ A("div", {
386
+ className: "space-y-1.5",
387
+ children: [/* @__PURE__ */ k(W, {
388
+ htmlFor: "goal-type",
389
+ children: l("brainyrich.goals.form.type", "Type")
390
+ }), /* @__PURE__ */ A(G, {
391
+ value: n.type,
392
+ onValueChange: (e) => r("type", e),
393
+ children: [/* @__PURE__ */ k(J, {
394
+ id: "goal-type",
395
+ children: /* @__PURE__ */ k(Y, {})
396
+ }), /* @__PURE__ */ k(K, { children: _e.map((e) => /* @__PURE__ */ k(q, {
397
+ value: e,
398
+ children: Z(e)
399
+ }, e)) })]
400
+ })]
401
+ }), t === "edit" ? /* @__PURE__ */ A("div", {
402
+ className: "space-y-1.5",
403
+ children: [/* @__PURE__ */ k(W, {
404
+ htmlFor: "goal-status",
405
+ children: l("brainyrich.goals.form.status", "Status")
406
+ }), /* @__PURE__ */ A(G, {
407
+ value: n.status,
408
+ onValueChange: (e) => r("status", e),
409
+ children: [/* @__PURE__ */ k(J, {
410
+ id: "goal-status",
411
+ children: /* @__PURE__ */ k(Y, {})
412
+ }), /* @__PURE__ */ k(K, { children: ve.map((e) => /* @__PURE__ */ k(q, {
413
+ value: e,
414
+ children: Z(e)
415
+ }, e)) })]
416
+ })]
417
+ }) : /* @__PURE__ */ A("div", {
418
+ className: "space-y-1.5",
419
+ children: [/* @__PURE__ */ k(W, {
420
+ htmlFor: "goal-priority",
421
+ children: l("brainyrich.goals.form.priority", "Priority")
422
+ }), /* @__PURE__ */ k(U, {
423
+ id: "goal-priority",
424
+ type: "number",
425
+ min: 1,
426
+ value: n.priority,
427
+ onChange: (e) => r("priority", e.target.value)
428
+ })]
429
+ })]
430
+ }),
431
+ /* @__PURE__ */ A("div", {
432
+ className: "grid grid-cols-2 gap-3",
433
+ children: [/* @__PURE__ */ A("div", {
434
+ className: "space-y-1.5",
435
+ children: [/* @__PURE__ */ k(W, {
436
+ htmlFor: "goal-target",
437
+ children: l("brainyrich.goals.form.targetAmount", "Target amount")
438
+ }), /* @__PURE__ */ k(U, {
439
+ id: "goal-target",
440
+ type: "number",
441
+ min: 0,
442
+ step: "0.01",
443
+ value: n.targetAmount,
444
+ onChange: (e) => r("targetAmount", e.target.value),
445
+ required: !0
446
+ })]
447
+ }), /* @__PURE__ */ A("div", {
448
+ className: "space-y-1.5",
449
+ children: [/* @__PURE__ */ k(W, {
450
+ htmlFor: "goal-date",
451
+ children: l("brainyrich.goals.form.targetDate", "Target date")
452
+ }), /* @__PURE__ */ k(U, {
453
+ id: "goal-date",
454
+ type: "date",
455
+ value: n.targetDate,
456
+ onChange: (e) => r("targetDate", e.target.value),
457
+ required: !0
458
+ })]
459
+ })]
460
+ }),
461
+ /* @__PURE__ */ A("div", {
462
+ className: "grid grid-cols-2 gap-3",
463
+ children: [/* @__PURE__ */ A("div", {
464
+ className: "space-y-1.5",
465
+ children: [/* @__PURE__ */ k(W, {
466
+ htmlFor: "goal-monthly",
467
+ children: l("brainyrich.goals.form.monthly", "Monthly contribution")
468
+ }), /* @__PURE__ */ k(U, {
469
+ id: "goal-monthly",
470
+ type: "number",
471
+ min: 0,
472
+ step: "0.01",
473
+ value: n.monthlyContribution,
474
+ onChange: (e) => r("monthlyContribution", e.target.value)
475
+ })]
476
+ }), /* @__PURE__ */ A("div", {
477
+ className: "space-y-1.5",
478
+ children: [/* @__PURE__ */ k(W, {
479
+ htmlFor: "goal-currency",
480
+ children: l("brainyrich.goals.form.currency", "Currency")
481
+ }), /* @__PURE__ */ k(U, {
482
+ id: "goal-currency",
483
+ value: n.currency,
484
+ onChange: (e) => r("currency", e.target.value.toUpperCase()),
485
+ maxLength: 3
486
+ })]
487
+ })]
488
+ }),
489
+ t === "edit" ? /* @__PURE__ */ A("div", {
490
+ className: "space-y-1.5",
491
+ children: [/* @__PURE__ */ k(W, {
492
+ htmlFor: "goal-priority-edit",
493
+ children: l("brainyrich.goals.form.priority", "Priority")
494
+ }), /* @__PURE__ */ k(U, {
495
+ id: "goal-priority-edit",
496
+ type: "number",
497
+ min: 1,
498
+ value: n.priority,
499
+ onChange: (e) => r("priority", e.target.value)
500
+ })]
501
+ }) : null,
502
+ /* @__PURE__ */ A("div", {
503
+ className: "space-y-1.5",
504
+ children: [/* @__PURE__ */ k(W, {
505
+ htmlFor: "goal-household",
506
+ children: l("brainyrich.goals.form.household", "Household (optional)")
507
+ }), /* @__PURE__ */ A(G, {
508
+ value: n.householdId || Q,
509
+ onValueChange: (e) => r("householdId", e === Q ? "" : e),
510
+ children: [/* @__PURE__ */ k(J, {
511
+ id: "goal-household",
512
+ children: /* @__PURE__ */ k(Y, { placeholder: l("brainyrich.goals.form.householdNone", "None") })
513
+ }), /* @__PURE__ */ A(K, { children: [/* @__PURE__ */ k(q, {
514
+ value: Q,
515
+ children: l("brainyrich.goals.form.householdNone", "None")
516
+ }), i.map((e) => /* @__PURE__ */ k(q, {
517
+ value: e.id,
518
+ children: e.name
519
+ }, e.id))] })]
520
+ })]
521
+ }),
522
+ /* @__PURE__ */ A("div", {
523
+ className: "space-y-1.5",
524
+ children: [/* @__PURE__ */ k(W, {
525
+ htmlFor: "goal-tags",
526
+ children: l("brainyrich.goals.form.tags", "Tags (comma separated)")
527
+ }), /* @__PURE__ */ k(U, {
528
+ id: "goal-tags",
529
+ value: n.tags,
530
+ onChange: (e) => r("tags", e.target.value),
531
+ placeholder: l("brainyrich.goals.form.tagsPlaceholder", "e.g. long-term, family")
532
+ })]
533
+ }),
534
+ /* @__PURE__ */ A("div", {
535
+ className: "space-y-1.5",
536
+ children: [/* @__PURE__ */ k(W, {
537
+ htmlFor: "goal-notes",
538
+ children: l("brainyrich.goals.form.notes", "Notes")
539
+ }), /* @__PURE__ */ k(ge, {
540
+ id: "goal-notes",
541
+ value: n.notes,
542
+ onChange: (e) => r("notes", e.target.value),
543
+ rows: 3
544
+ })]
545
+ }),
546
+ /* @__PURE__ */ A(B, { children: [/* @__PURE__ */ k(M, {
547
+ type: "button",
548
+ variant: "outline",
549
+ onClick: () => c(!1),
550
+ disabled: o,
551
+ children: l("brainyrich.goals.form.cancel", "Cancel")
552
+ }), /* @__PURE__ */ k(M, {
553
+ type: "submit",
554
+ disabled: !a || o,
555
+ children: o ? l("brainyrich.goals.form.saving", "Saving…") : t === "create" ? l("brainyrich.goals.form.create", "Create goal") : l("brainyrich.goals.form.save", "Save changes")
556
+ })] })
557
+ ]
558
+ })]
559
+ })
560
+ });
561
+ }
562
+ function Ee({ goalId: e, onClose: n, translate: r }) {
563
+ let { data: o, isLoading: s, isError: ee, refetch: te } = i(e ?? void 0), { data: p } = a(e ?? void 0), { data: h } = t(), g = c(), v = u(), y = l(), [b, x] = _(""), [C, w] = _("PERCENT"), [T, D] = _(""), [j, N] = _(""), P = p.reduce((e, t) => e + (t.fixedAmount ?? 0), 0), F = o?.currency ?? "USD", oe = (e) => h.find((t) => t.id === e)?.name ?? e, I = () => {
564
+ if (!e || !b) return;
565
+ let t = Number(T);
566
+ !Number.isFinite(t) || t <= 0 || g.mutate({
567
+ goalId: e,
568
+ accountId: b,
569
+ ...C === "PERCENT" ? { allocationPct: t } : { fixedAmount: t }
570
+ }, { onSuccess: () => {
571
+ x(""), D("");
572
+ } });
573
+ }, L = () => {
574
+ if (!e) return;
575
+ let t = j === "" ? P : Number(j);
576
+ Number.isFinite(t) && y.mutate({
577
+ id: e,
578
+ fundedAmount: t
579
+ });
580
+ }, R = !!b && Number(T) > 0;
581
+ return /* @__PURE__ */ k(X, {
582
+ open: !!e,
583
+ onOpenChange: (e) => {
584
+ e || n();
585
+ },
586
+ children: /* @__PURE__ */ A(fe, {
587
+ className: "flex w-full flex-col gap-0 overflow-y-auto sm:max-w-md",
588
+ children: [/* @__PURE__ */ A(me, { children: [/* @__PURE__ */ k(he, { children: o?.name ?? r("brainyrich.goals.detail.title", "Goal") }), /* @__PURE__ */ k(pe, { children: r("brainyrich.goals.detail.subtitle", "Manage funding links and projection.") })] }), /* @__PURE__ */ k("div", {
589
+ className: "space-y-6 p-4",
590
+ children: s ? /* @__PURE__ */ k(ne, { rows: 3 }) : ee ? /* @__PURE__ */ k(f, {
591
+ title: r("brainyrich.goals.detail.error", "Could not load goal"),
592
+ onRetry: () => te()
593
+ }) : o ? /* @__PURE__ */ A(O, { children: [
594
+ /* @__PURE__ */ A("div", {
595
+ className: "grid grid-cols-2 gap-3",
596
+ children: [
597
+ /* @__PURE__ */ k($, {
598
+ label: r("brainyrich.goals.detail.target", "Target"),
599
+ value: m(o.targetAmount, F)
80
600
  }),
81
- /* @__PURE__ */ u("div", {
82
- className: "h-3 rounded-full bg-muted overflow-hidden",
83
- children: /* @__PURE__ */ u("div", {
84
- className: "h-3 rounded-full bg-emerald-500 transition-all",
85
- style: { width: `${Math.min(t, 100)}%` }
86
- })
601
+ /* @__PURE__ */ k($, {
602
+ label: r("brainyrich.goals.detail.funded", "Funded (fixed)"),
603
+ value: m(P, F)
87
604
  }),
88
- /* @__PURE__ */ d("div", {
89
- className: "flex items-center justify-between text-xs text-muted-foreground mt-1",
90
- children: [/* @__PURE__ */ d("span", {
91
- className: "text-emerald-600 font-medium",
92
- children: [t, "%"]
93
- }), /* @__PURE__ */ u("span", { children: S("brainyrich.goals.remainingAmount", "{amount} remaining", { amount: i(n) }) })]
605
+ /* @__PURE__ */ k($, {
606
+ label: r("brainyrich.goals.detail.projection", "Projection"),
607
+ value: Z(o.projection),
608
+ tone: ye(o.projection).tone
609
+ }),
610
+ /* @__PURE__ */ k($, {
611
+ label: r("brainyrich.goals.detail.targetDate", "Target date"),
612
+ value: re(o.targetDate)
94
613
  })
95
- ] }),
96
- /* @__PURE__ */ d("div", {
97
- className: "grid grid-cols-3 gap-4 rounded-lg bg-muted/50 p-3",
98
- children: [
99
- /* @__PURE__ */ d("div", {
100
- className: "text-center",
101
- children: [/* @__PURE__ */ u("p", {
102
- className: "text-xs text-muted-foreground",
103
- children: S("brainyrich.goals.cards.monthlySipNeeded", "Monthly SIP Needed")
104
- }), /* @__PURE__ */ u("p", {
105
- className: "text-sm font-semibold",
106
- children: i(b)
614
+ ]
615
+ }),
616
+ /* @__PURE__ */ A("section", {
617
+ className: "space-y-3",
618
+ children: [/* @__PURE__ */ k("h3", {
619
+ className: "text-sm font-semibold text-text-primary",
620
+ children: r("brainyrich.goals.detail.fundingLinks", "Funding links")
621
+ }), p.length === 0 ? /* @__PURE__ */ k("p", {
622
+ className: "rounded-lg border border-dashed border-border-subtle bg-bg-surface px-4 py-6 text-center text-sm text-text-secondary",
623
+ children: r("brainyrich.goals.detail.noFundings", "No accounts linked to fund this goal yet.")
624
+ }) : /* @__PURE__ */ k("ul", {
625
+ className: "space-y-2",
626
+ children: p.map((e) => /* @__PURE__ */ A("li", {
627
+ className: "flex items-center justify-between gap-2 rounded-lg border border-border-subtle bg-bg-surface px-3 py-2",
628
+ children: [/* @__PURE__ */ A("div", {
629
+ className: "min-w-0",
630
+ children: [/* @__PURE__ */ k("p", {
631
+ className: "truncate text-sm font-medium text-text-primary",
632
+ children: oe(e.accountId)
633
+ }), /* @__PURE__ */ k("p", {
634
+ className: "text-xs text-text-secondary",
635
+ children: e.fixedAmount == null ? r("brainyrich.goals.detail.pctOfAccount", "{pct}% of account", { pct: e.allocationPct }) : m(e.fixedAmount, F)
107
636
  })]
108
- }),
109
- /* @__PURE__ */ d("div", {
110
- className: "text-center",
111
- children: [/* @__PURE__ */ u("p", {
112
- className: "text-xs text-muted-foreground",
113
- children: S("brainyrich.goals.cards.gapAmount", "Gap Amount")
114
- }), /* @__PURE__ */ u("p", {
115
- className: "text-sm font-semibold",
116
- children: i(n)
637
+ }), /* @__PURE__ */ k(M, {
638
+ variant: "ghost",
639
+ size: "icon",
640
+ "aria-label": r("brainyrich.goals.detail.unlink", "Unlink funding"),
641
+ disabled: v.isPending,
642
+ onClick: () => v.mutate(e.id),
643
+ children: /* @__PURE__ */ k(E, {
644
+ className: "size-4",
645
+ "aria-hidden": "true"
646
+ })
647
+ })]
648
+ }, e.id))
649
+ })]
650
+ }),
651
+ /* @__PURE__ */ A("section", {
652
+ className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
653
+ children: [/* @__PURE__ */ k("h3", {
654
+ className: "text-sm font-semibold text-text-primary",
655
+ children: r("brainyrich.goals.detail.linkTitle", "Link an account")
656
+ }), h.length === 0 ? /* @__PURE__ */ k("p", {
657
+ className: "text-sm text-text-secondary",
658
+ children: r("brainyrich.goals.detail.noAccounts", "No accounts available to link.")
659
+ }) : /* @__PURE__ */ A(O, { children: [
660
+ /* @__PURE__ */ A("div", {
661
+ className: "space-y-1.5",
662
+ children: [/* @__PURE__ */ k(W, {
663
+ htmlFor: "funding-account",
664
+ children: r("brainyrich.goals.detail.account", "Account")
665
+ }), /* @__PURE__ */ A(G, {
666
+ value: b,
667
+ onValueChange: x,
668
+ children: [/* @__PURE__ */ k(J, {
669
+ id: "funding-account",
670
+ children: /* @__PURE__ */ k(Y, { placeholder: r("brainyrich.goals.detail.selectAccount", "Select account") })
671
+ }), /* @__PURE__ */ k(K, { children: h.map((e) => /* @__PURE__ */ k(q, {
672
+ value: e.id,
673
+ children: e.name
674
+ }, e.id)) })]
675
+ })]
676
+ }),
677
+ /* @__PURE__ */ A("div", {
678
+ className: "grid grid-cols-2 gap-3",
679
+ children: [/* @__PURE__ */ A("div", {
680
+ className: "space-y-1.5",
681
+ children: [/* @__PURE__ */ k(W, {
682
+ htmlFor: "funding-mode",
683
+ children: r("brainyrich.goals.detail.mode", "Method")
684
+ }), /* @__PURE__ */ A(G, {
685
+ value: C,
686
+ onValueChange: (e) => w(e),
687
+ children: [/* @__PURE__ */ k(J, {
688
+ id: "funding-mode",
689
+ children: /* @__PURE__ */ k(Y, {})
690
+ }), /* @__PURE__ */ A(K, { children: [/* @__PURE__ */ k(q, {
691
+ value: "PERCENT",
692
+ children: r("brainyrich.goals.detail.percent", "Percentage")
693
+ }), /* @__PURE__ */ k(q, {
694
+ value: "FIXED",
695
+ children: r("brainyrich.goals.detail.fixed", "Fixed amount")
696
+ })] })]
117
697
  })]
118
- }),
119
- /* @__PURE__ */ d("div", {
120
- className: "text-center",
121
- children: [/* @__PURE__ */ u("p", {
122
- className: "text-xs text-muted-foreground",
123
- children: S("brainyrich.goals.cards.onTrackStatus", "On-Track Status")
124
- }), /* @__PURE__ */ d("p", {
125
- className: "text-sm font-semibold flex items-center justify-center gap-1",
126
- children: [/* @__PURE__ */ u(c, { className: "h-3 w-3 text-emerald-600" }), t >= 50 ? S("brainyrich.goals.status.onTrack", "On Track") : S("brainyrich.goals.status.behind", "Behind")]
698
+ }), /* @__PURE__ */ A("div", {
699
+ className: "space-y-1.5",
700
+ children: [/* @__PURE__ */ k(W, {
701
+ htmlFor: "funding-value",
702
+ children: C === "PERCENT" ? r("brainyrich.goals.detail.pct", "Percent") : r("brainyrich.goals.detail.amount", "Amount")
703
+ }), /* @__PURE__ */ k(U, {
704
+ id: "funding-value",
705
+ type: "number",
706
+ min: 0,
707
+ step: "0.01",
708
+ value: T,
709
+ onChange: (e) => D(e.target.value)
127
710
  })]
128
- })
129
- ]
130
- }),
131
- /* @__PURE__ */ d("div", {
132
- className: "flex gap-2",
133
- children: [
134
- /* @__PURE__ */ u(p, {
135
- variant: "outline",
136
- size: "sm",
137
- children: S("brainyrich.goals.actions.viewDetails", "View Details")
138
- }),
139
- /* @__PURE__ */ d(p, {
140
- variant: "outline",
141
- size: "sm",
142
- children: [/* @__PURE__ */ u(o, { className: "mr-1 h-3 w-3" }), S("brainyrich.goals.actions.addFunds", "Add Funds")]
143
- }),
144
- /* @__PURE__ */ u(p, {
145
- variant: "outline",
146
- size: "sm",
147
- children: S("brainyrich.goals.actions.editGoal", "Edit Goal")
148
- })
149
- ]
150
- })
151
- ]
152
- })] }, e.id);
153
- })
711
+ })]
712
+ }),
713
+ /* @__PURE__ */ A(M, {
714
+ size: "sm",
715
+ className: "w-full",
716
+ disabled: !R || g.isPending,
717
+ onClick: I,
718
+ children: [/* @__PURE__ */ k(ie, {
719
+ className: "size-4",
720
+ "aria-hidden": "true"
721
+ }), g.isPending ? r("brainyrich.goals.detail.linking", "Linking…") : r("brainyrich.goals.detail.link", "Link funding")]
722
+ })
723
+ ] })]
724
+ }),
725
+ /* @__PURE__ */ A("section", {
726
+ className: "space-y-3 rounded-lg border border-border-subtle bg-bg-surface p-4",
727
+ children: [
728
+ /* @__PURE__ */ k("h3", {
729
+ className: "text-sm font-semibold text-text-primary",
730
+ children: r("brainyrich.goals.detail.recalcTitle", "Recalculate projection")
731
+ }),
732
+ /* @__PURE__ */ A("div", {
733
+ className: "space-y-1.5",
734
+ children: [
735
+ /* @__PURE__ */ k(W, {
736
+ htmlFor: "recalc-funded",
737
+ children: r("brainyrich.goals.detail.fundedAmount", "Funded amount")
738
+ }),
739
+ /* @__PURE__ */ k(U, {
740
+ id: "recalc-funded",
741
+ type: "number",
742
+ min: 0,
743
+ step: "0.01",
744
+ value: j,
745
+ placeholder: String(P),
746
+ onChange: (e) => N(e.target.value)
747
+ }),
748
+ /* @__PURE__ */ k("p", {
749
+ className: "text-xs text-text-secondary",
750
+ children: r("brainyrich.goals.detail.recalcHint", "Defaults to the sum of fixed fundings when left blank.")
751
+ })
752
+ ]
753
+ }),
754
+ /* @__PURE__ */ A(M, {
755
+ size: "sm",
756
+ variant: "outline",
757
+ className: "w-full",
758
+ disabled: y.isPending,
759
+ onClick: L,
760
+ children: [/* @__PURE__ */ k(ae, {
761
+ className: "size-4",
762
+ "aria-hidden": "true"
763
+ }), y.isPending ? r("brainyrich.goals.detail.recalculating", "Recalculating…") : r("brainyrich.goals.detail.recalc", "Recalculate")]
764
+ })
765
+ ]
766
+ })
767
+ ] }) : /* @__PURE__ */ k(d, {
768
+ icon: /* @__PURE__ */ k(S, {
769
+ className: "size-6",
770
+ "aria-hidden": "true"
771
+ }),
772
+ title: r("brainyrich.goals.detail.notFound", "Goal not found")
773
+ })
774
+ })]
775
+ })
776
+ });
777
+ }
778
+ function $({ label: e, value: t, tone: n }) {
779
+ return /* @__PURE__ */ A("div", {
780
+ className: "rounded-lg bg-bg-sunken p-3",
781
+ children: [/* @__PURE__ */ k("p", {
782
+ className: "text-xs text-text-secondary",
783
+ children: e
784
+ }), /* @__PURE__ */ k("p", {
785
+ className: `text-sm font-semibold ${n ?? "text-text-primary"}`,
786
+ children: t
154
787
  })]
155
788
  });
156
789
  }
157
790
  //#endregion
158
- export { b as GoalsPage };
791
+ export { we as GoalsPage };
159
792
 
160
793
  //# sourceMappingURL=GoalsPage.js.map