@mx-cartographer/experiences 7.0.52-alpha.mega6 → 7.0.52-alpha.mega7
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/{EmptyState-BYvgSeMz.mjs → EmptyState-Cu00ZWJL.mjs} +17 -19
- package/dist/budgets/index.es.js +368 -370
- package/dist/common/components/EmptyState.d.ts +0 -1
- package/dist/common/index.es.js +1 -1
- package/dist/goals/index.es.js +1 -1
- package/dist/investments/index.es.js +1 -1
- package/dist/networth/index.es.js +1 -1
- package/dist/trends/index.es.js +1 -1
- package/package.json +1 -1
package/dist/budgets/index.es.js
CHANGED
|
@@ -2,13 +2,13 @@ import { jsxs as u, jsx as e, Fragment as je } from "react/jsx-runtime";
|
|
|
2
2
|
import l from "react";
|
|
3
3
|
import { observer as I } from "mobx-react-lite";
|
|
4
4
|
import { endOfMonth as ue } from "date-fns/endOfMonth";
|
|
5
|
-
import { startOfMonth as
|
|
5
|
+
import { startOfMonth as q } from "date-fns/startOfMonth";
|
|
6
6
|
import F from "@mui/material/Box";
|
|
7
7
|
import C from "@mui/material/Stack";
|
|
8
|
-
import
|
|
9
|
-
import { Text as
|
|
8
|
+
import Q from "@mui/material/styles/useTheme";
|
|
9
|
+
import { Text as y, CategoryIcon as H, Icon as N, H1 as ze, H3 as xe } from "@mxenabled/mxui";
|
|
10
10
|
import W from "@mui/material/List";
|
|
11
|
-
import { u as w, i as D, j as
|
|
11
|
+
import { u as w, i as D, j as ee, m as j, p as te, g as X, b as ne, h as oe, a as Ue, d as Ae } from "../hooks-CE2TKk4a.mjs";
|
|
12
12
|
import { f as T } from "../NumberFormatting-CtWHhyBX.mjs";
|
|
13
13
|
import ve from "@mui/material/Button";
|
|
14
14
|
import ae from "@mui/material/Divider";
|
|
@@ -24,22 +24,22 @@ import { a as $ } from "../Dialog-CWW597AF.mjs";
|
|
|
24
24
|
import { C as We } from "../ConnectionsDrawer-BprLSCBH.mjs";
|
|
25
25
|
import * as O from "d3";
|
|
26
26
|
import Xe from "@mui/material/Tooltip";
|
|
27
|
-
import { u as Z } from "../useScreenSize-B6JyS_Lj.mjs";
|
|
28
27
|
import { L as G } from "../Loader-DUaFpDGv.mjs";
|
|
29
|
-
import { E as le } from "../EmptyState-
|
|
28
|
+
import { E as le } from "../EmptyState-Cu00ZWJL.mjs";
|
|
29
|
+
import { u as ge } from "../useScreenSize-B6JyS_Lj.mjs";
|
|
30
30
|
import { A as L, W as Ke } from "../WidgetContainer-hsbxZmZB.mjs";
|
|
31
31
|
import { u as Ve } from "../BudgetUtil-2EncZLBQ.mjs";
|
|
32
32
|
import { M as Ye } from "../MiniWidgetContainer-DTQdRK-3.mjs";
|
|
33
33
|
import { isAfter as Ze } from "date-fns/isAfter";
|
|
34
|
-
import { startOfToday as
|
|
34
|
+
import { startOfToday as Z } from "date-fns/startOfToday";
|
|
35
35
|
import qe from "@mui/material/Alert";
|
|
36
36
|
import Je from "@mui/material/Snackbar";
|
|
37
|
-
import
|
|
37
|
+
import ye from "@mui/material/Tab";
|
|
38
38
|
import Qe from "@mui/material/Tabs";
|
|
39
39
|
import { e as et } from "../exportTransactionsToCSV-D8TTNrrE.mjs";
|
|
40
40
|
import { T as Te, a as tt } from "../TransactionDetails-Cl8xcpbh.mjs";
|
|
41
|
-
import
|
|
42
|
-
import
|
|
41
|
+
import pe from "@mui/material/Card";
|
|
42
|
+
import he from "@mui/material/CardContent";
|
|
43
43
|
import { S as me } from "../StatusBar-BK_uYHAB.mjs";
|
|
44
44
|
import { S as we } from "../SingleSegmentDonut-BgbLgwHi.mjs";
|
|
45
45
|
import { u as nt, b as ot } from "../CategorySelectorDrawer-BmenK5bu.mjs";
|
|
@@ -48,29 +48,29 @@ import { subDays as at } from "date-fns/subDays";
|
|
|
48
48
|
import rt from "@mui/material/IconButton";
|
|
49
49
|
import { M as st } from "../ManageIncome-clecqBHm.mjs";
|
|
50
50
|
const it = I(() => {
|
|
51
|
-
const { budgets: t } = w(), { totalBudgeted:
|
|
51
|
+
const { budgets: t } = w(), { totalBudgeted: a } = D(), { incomeTotal: i } = ee(), s = i - a;
|
|
52
52
|
return /* @__PURE__ */ u(C, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
|
|
53
53
|
/* @__PURE__ */ u(C, { alignItems: "center", children: [
|
|
54
|
-
/* @__PURE__ */ e(
|
|
55
|
-
/* @__PURE__ */ e(
|
|
54
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: T(i, "0,0") }),
|
|
55
|
+
/* @__PURE__ */ e(y, { color: "secondary", variant: "Small", children: t.projected_income })
|
|
56
56
|
] }),
|
|
57
|
-
/* @__PURE__ */ e(
|
|
57
|
+
/* @__PURE__ */ e(y, { bold: !0, justifyContent: "center", variant: "Body", children: "-" }),
|
|
58
58
|
/* @__PURE__ */ u(C, { alignItems: "center", children: [
|
|
59
|
-
/* @__PURE__ */ e(
|
|
60
|
-
/* @__PURE__ */ e(
|
|
59
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: T(a, "0,0") }),
|
|
60
|
+
/* @__PURE__ */ e(y, { color: "secondary", variant: "Small", children: t.budgeted })
|
|
61
61
|
] }),
|
|
62
|
-
/* @__PURE__ */ e(
|
|
62
|
+
/* @__PURE__ */ e(y, { bold: !0, justifyContent: "center", variant: "Body", children: "=" }),
|
|
63
63
|
/* @__PURE__ */ u(C, { alignItems: "center", children: [
|
|
64
|
-
/* @__PURE__ */ e(
|
|
65
|
-
/* @__PURE__ */ e(
|
|
64
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: T(s, "0,0") }),
|
|
65
|
+
/* @__PURE__ */ e(y, { color: "secondary", variant: "Small", children: t.remaining })
|
|
66
66
|
] })
|
|
67
67
|
] });
|
|
68
68
|
}), ct = I(
|
|
69
69
|
({ category: t }) => {
|
|
70
|
-
const { budgets:
|
|
71
|
-
const
|
|
72
|
-
return `${
|
|
73
|
-
}, [
|
|
70
|
+
const { budgets: a } = w(), { budgets: i } = D(), s = l.useMemo(() => {
|
|
71
|
+
const n = i.find((c) => c.category_guid === t.guid), o = T(t.totalAverageAmount, "0,0"), r = n ? M(a.recalculate_previous_budget, T(n.amount, "0,0")) : a.recalculate_new_budget;
|
|
72
|
+
return `${o} - ${r}`;
|
|
73
|
+
}, [a, i]);
|
|
74
74
|
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
75
75
|
/* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { children: [
|
|
76
76
|
/* @__PURE__ */ e(re, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid, variant: "filled" }) }),
|
|
@@ -80,43 +80,43 @@ const it = I(() => {
|
|
|
80
80
|
] }, t.guid);
|
|
81
81
|
}
|
|
82
82
|
), lt = ({ onRecalculateBudgets: t }) => {
|
|
83
|
-
const { budgets:
|
|
84
|
-
await
|
|
83
|
+
const { budgets: a, common: i } = w(), { spendCategories: s } = j(), { recalculateBudgets: n, setAlert: o } = D(), [r, c] = l.useState(!1), m = s.filter((d) => d.totalAverageAmount > 0), g = async () => {
|
|
84
|
+
await n(m), c(!1), o(a.alert_recalculated_budgets), t?.();
|
|
85
85
|
};
|
|
86
86
|
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
87
|
-
/* @__PURE__ */ e(ve, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children:
|
|
88
|
-
/* @__PURE__ */ e(
|
|
87
|
+
/* @__PURE__ */ e(ve, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: a.recalculate_button }),
|
|
88
|
+
/* @__PURE__ */ e(y, { sx: { mx: 24, my: 16, textAlign: "center", whiteSpace: "wrap" }, variant: "Paragraph", children: a.recalculate_help }),
|
|
89
89
|
/* @__PURE__ */ e(
|
|
90
90
|
k,
|
|
91
91
|
{
|
|
92
92
|
ariaLabelClose: i.close_aria,
|
|
93
93
|
isOpen: r,
|
|
94
94
|
onClose: () => c(!1),
|
|
95
|
-
onPrimaryAction:
|
|
96
|
-
title:
|
|
95
|
+
onPrimaryAction: g,
|
|
96
|
+
title: a.recalculate_title,
|
|
97
97
|
children: /* @__PURE__ */ u(C, { children: [
|
|
98
98
|
/* @__PURE__ */ u(C, { mx: 24, my: 16, children: [
|
|
99
|
-
/* @__PURE__ */ e(
|
|
100
|
-
/* @__PURE__ */ e(
|
|
99
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: a.recalculate_description_top }),
|
|
100
|
+
/* @__PURE__ */ e(y, { variant: "ParagraphSmall", children: a.recalculate_description_bottom })
|
|
101
101
|
] }),
|
|
102
|
-
/* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(W, { children: m.map((
|
|
102
|
+
/* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(W, { children: m.map((d) => /* @__PURE__ */ e(ct, { category: d }, d.guid)) }) })
|
|
103
103
|
] })
|
|
104
104
|
}
|
|
105
105
|
)
|
|
106
106
|
] });
|
|
107
107
|
}, se = ({
|
|
108
108
|
amount: t,
|
|
109
|
-
categoryName:
|
|
109
|
+
categoryName: a,
|
|
110
110
|
onAmountChanged: i
|
|
111
111
|
}) => {
|
|
112
|
-
const { budgets: s } = w(), { totalBudgeted:
|
|
112
|
+
const { budgets: s } = w(), { totalBudgeted: n } = D(), { incomeTotal: o } = ee(), r = o - n;
|
|
113
113
|
return /* @__PURE__ */ u(C, { gap: 16, children: [
|
|
114
114
|
/* @__PURE__ */ u(C, { children: [
|
|
115
|
-
/* @__PURE__ */ e(
|
|
115
|
+
/* @__PURE__ */ e(y, { children: M(
|
|
116
116
|
s.add_description_top,
|
|
117
117
|
T(r, "0,0")
|
|
118
118
|
) }),
|
|
119
|
-
/* @__PURE__ */ e(
|
|
119
|
+
/* @__PURE__ */ e(y, { children: M(s.add_description_bottom, a) })
|
|
120
120
|
] }),
|
|
121
121
|
/* @__PURE__ */ e(
|
|
122
122
|
He,
|
|
@@ -130,12 +130,12 @@ const it = I(() => {
|
|
|
130
130
|
}
|
|
131
131
|
)
|
|
132
132
|
] });
|
|
133
|
-
}, dt = I(({ category: t, onAddBudget:
|
|
134
|
-
const { budgets: i, common: s } = w(), [
|
|
133
|
+
}, dt = I(({ category: t, onAddBudget: a }) => {
|
|
134
|
+
const { budgets: i, common: s } = w(), [n, o] = l.useState(!1), [r, c] = l.useState(
|
|
135
135
|
`${t.totalAmount === 0 ? "" : t.totalAmount}`
|
|
136
136
|
);
|
|
137
137
|
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
138
|
-
/* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () =>
|
|
138
|
+
/* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => o(!0), children: [
|
|
139
139
|
/* @__PURE__ */ e(re, { children: /* @__PURE__ */ e(H, { categoryGuid: t.guid }) }),
|
|
140
140
|
/* @__PURE__ */ e(
|
|
141
141
|
Y,
|
|
@@ -151,115 +151,115 @@ const it = I(() => {
|
|
|
151
151
|
{
|
|
152
152
|
copy: { close_aria: s.close_aria, title: i.add_title },
|
|
153
153
|
disablePrimaryButton: Number(r) <= 0,
|
|
154
|
-
isOpen:
|
|
155
|
-
onClose: () =>
|
|
156
|
-
onPrimaryAction: () =>
|
|
154
|
+
isOpen: n,
|
|
155
|
+
onClose: () => o(!1),
|
|
156
|
+
onPrimaryAction: () => a(t, Number(r)),
|
|
157
157
|
primaryText: i.add_save_button,
|
|
158
158
|
children: /* @__PURE__ */ e(se, { amount: r, categoryName: t.name, onAmountChanged: c })
|
|
159
159
|
}
|
|
160
160
|
)
|
|
161
161
|
] });
|
|
162
162
|
}), Ie = I(({ onRecalculateBudgets: t }) => {
|
|
163
|
-
const { budgets:
|
|
164
|
-
await i(r, c), s(M(
|
|
163
|
+
const { budgets: a } = w(), { addBudget: i, setAlert: s, unbudgetedCategories: n } = D(), o = async (r, c) => {
|
|
164
|
+
await i(r, c), s(M(a.alert_budget_created, r.name));
|
|
165
165
|
};
|
|
166
166
|
return /* @__PURE__ */ u(C, { children: [
|
|
167
167
|
/* @__PURE__ */ e(it, {}),
|
|
168
|
-
/* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(W, { children:
|
|
168
|
+
/* @__PURE__ */ e(F, { bgcolor: "background.paper", children: /* @__PURE__ */ e(W, { children: n.map((r) => /* @__PURE__ */ e(
|
|
169
169
|
dt,
|
|
170
170
|
{
|
|
171
171
|
category: r,
|
|
172
|
-
onAddBudget:
|
|
172
|
+
onAddBudget: o
|
|
173
173
|
},
|
|
174
174
|
r.guid
|
|
175
175
|
)) }) }),
|
|
176
176
|
/* @__PURE__ */ e(lt, { onRecalculateBudgets: t })
|
|
177
177
|
] });
|
|
178
|
-
}),
|
|
179
|
-
const
|
|
180
|
-
|
|
181
|
-
}, i = (
|
|
182
|
-
|
|
183
|
-
}, s = (
|
|
184
|
-
|
|
178
|
+
}), be = 5, Ee = 100, J = 25, ut = (t) => {
|
|
179
|
+
const a = (n) => {
|
|
180
|
+
n.active || t.alphaTarget(0.3).restart(), n.subject.fx = n.subject.x, n.subject.fy = n.subject.y;
|
|
181
|
+
}, i = (n) => {
|
|
182
|
+
n.subject.fx = n.x, n.subject.fy = n.y;
|
|
183
|
+
}, s = (n) => {
|
|
184
|
+
n.active || t.alphaTarget(0), n.subject.fx = null, n.subject.fy = null;
|
|
185
185
|
};
|
|
186
|
-
return O.drag().on("start",
|
|
186
|
+
return O.drag().on("start", a).on("drag", i).on("end", s);
|
|
187
187
|
}, mt = (t) => {
|
|
188
|
-
let
|
|
189
|
-
|
|
190
|
-
const i =
|
|
191
|
-
return (
|
|
188
|
+
let a = t.transaction_total / t.amount;
|
|
189
|
+
a < 0 ? a = 0 : a > 1 && (a = 1);
|
|
190
|
+
const i = a * 2 * Math.PI, s = O.interpolate(0, i), n = O.arc().cornerRadius(5).innerRadius(t.radius - be * 2).outerRadius(t.radius - be).startAngle(0).endAngle(0);
|
|
191
|
+
return (o) => (n.endAngle(s(o)), n(t) || "");
|
|
192
192
|
}, gt = (t) => {
|
|
193
193
|
O.selectAll(".bubble").call(ut(t));
|
|
194
|
-
},
|
|
194
|
+
}, Ce = (t, a, i) => Math.min(Math.max(t, a), i), pt = (t, a, i) => {
|
|
195
195
|
t.alpha(1).restart().force(
|
|
196
196
|
"x",
|
|
197
197
|
O.forceX().x(i / 2).strength(0.01)
|
|
198
198
|
).force(
|
|
199
199
|
"y",
|
|
200
|
-
O.forceY().y(
|
|
200
|
+
O.forceY().y(a / 2).strength(0.02)
|
|
201
201
|
).on("tick", () => {
|
|
202
202
|
const s = t.nodes();
|
|
203
|
-
s.forEach((
|
|
204
|
-
const
|
|
205
|
-
|
|
206
|
-
}), O.selectAll(".bubble").data(s).attr("transform", (
|
|
203
|
+
s.forEach((n) => {
|
|
204
|
+
const o = n.radius ?? J;
|
|
205
|
+
n.x = Ce(n.x ?? 0, o, i - o), n.y = Ce(n.y ?? 0, o, a - o);
|
|
206
|
+
}), O.selectAll(".bubble").data(s).attr("transform", (n) => `translate(${n.x},${n.y})`);
|
|
207
207
|
});
|
|
208
|
-
}, Oe = (t,
|
|
209
|
-
const
|
|
208
|
+
}, Oe = (t, a) => O.scaleLinear().domain([t, a]).range([J, Ee]), ht = (t) => {
|
|
209
|
+
const a = t.reduce((o, r) => {
|
|
210
210
|
const c = Math.max(r.transaction_total, r.amount);
|
|
211
|
-
return c >
|
|
212
|
-
}, 0), i = t.reduce((
|
|
211
|
+
return c > o ? c : o;
|
|
212
|
+
}, 0), i = t.reduce((o, r) => {
|
|
213
213
|
const c = Math.max(r.transaction_total, r.amount);
|
|
214
|
-
return c <
|
|
215
|
-
},
|
|
216
|
-
const r = s(Math.max(
|
|
214
|
+
return c < o ? c : o;
|
|
215
|
+
}, a), s = Oe(i, a), n = t.map((o) => {
|
|
216
|
+
const r = s(Math.max(o.transaction_total, o.amount)) || 25;
|
|
217
217
|
return {
|
|
218
|
-
...
|
|
218
|
+
...o,
|
|
219
219
|
radius: r
|
|
220
220
|
};
|
|
221
221
|
});
|
|
222
|
-
return O.forceSimulation(
|
|
223
|
-
}, ft = (t,
|
|
224
|
-
const
|
|
225
|
-
let
|
|
226
|
-
if (
|
|
227
|
-
const _ = Math.sqrt(
|
|
228
|
-
|
|
222
|
+
return O.forceSimulation(n).velocityDecay(0.05).force("collide", O.forceCollide((o) => o.radius + 2).strength(0.7));
|
|
223
|
+
}, ft = (t, a, i) => {
|
|
224
|
+
const n = Math.PI * J ** 2 * t, o = i < 400 || a < 300, r = o ? 40 : 20, c = Math.max(100, i - r), m = Math.max(100, a - r), g = c * m;
|
|
225
|
+
let d = J;
|
|
226
|
+
if (n < g) {
|
|
227
|
+
const _ = Math.sqrt(g / (t * Math.PI)), p = Math.min(c, m) / 4;
|
|
228
|
+
d = Math.min(Ee, _, p);
|
|
229
229
|
}
|
|
230
|
-
return
|
|
231
|
-
}, _t = (t,
|
|
232
|
-
const { maxRadius:
|
|
233
|
-
return O.scaleLinear().domain([s, i]).range([r,
|
|
234
|
-
}, yt = (t,
|
|
235
|
-
const
|
|
236
|
-
return t.map((
|
|
237
|
-
...
|
|
238
|
-
radius: m(Math.max(
|
|
230
|
+
return o && t <= 3 && (d = Math.min(d, 45)), { minRadius: Math.max(20, d * 0.6), maxRadius: d };
|
|
231
|
+
}, _t = (t, a, i, s, n) => {
|
|
232
|
+
const { maxRadius: o, minRadius: r } = ft(t, a, n);
|
|
233
|
+
return O.scaleLinear().domain([s, i]).range([r, o]);
|
|
234
|
+
}, yt = (t, a, i = !1, s, n) => {
|
|
235
|
+
const o = a.map((g) => Math.max(g.transaction_total, g.amount)), r = Math.min(...o), c = Math.max(...o), m = i ? _t(t.length, s, c, r, n) : Oe(r, c);
|
|
236
|
+
return t.map((g) => ({
|
|
237
|
+
...g,
|
|
238
|
+
radius: m(Math.max(g.transaction_total, g.amount))
|
|
239
239
|
}));
|
|
240
|
-
},
|
|
241
|
-
const
|
|
240
|
+
}, Se = 5, bt = 2e3, Ct = ({ bubble: t }) => {
|
|
241
|
+
const a = Q(), {
|
|
242
242
|
amount: i,
|
|
243
243
|
guid: s,
|
|
244
|
-
budgetColors: { mercury:
|
|
245
|
-
radius:
|
|
244
|
+
budgetColors: { mercury: n },
|
|
245
|
+
radius: o,
|
|
246
246
|
transaction_total: r
|
|
247
247
|
} = t, c = `mercury-${s}`;
|
|
248
248
|
l.useEffect(() => {
|
|
249
|
-
O.select(`.${c}`).selectAll(".status").remove(), O.select(`.${c}`).append("path").transition().duration(bt).delay(0).attr("class", "status").attr("style", `fill: ${
|
|
250
|
-
}, [i,
|
|
251
|
-
const m = O.arc().innerRadius((
|
|
249
|
+
O.select(`.${c}`).selectAll(".status").remove(), O.select(`.${c}`).append("path").transition().duration(bt).delay(0).attr("class", "status").attr("style", `fill: ${n}; fill-opacity: 1;`).attrTween("d", () => mt(t));
|
|
250
|
+
}, [i, o, r]);
|
|
251
|
+
const m = O.arc().innerRadius((g) => g - 2 * Se).outerRadius((g) => g - Se).startAngle(0).endAngle(2 * Math.PI);
|
|
252
252
|
return /* @__PURE__ */ e("g", { className: c, children: /* @__PURE__ */ e(
|
|
253
253
|
"path",
|
|
254
254
|
{
|
|
255
|
-
d: m(
|
|
256
|
-
style: { fill:
|
|
255
|
+
d: m(o) || "",
|
|
256
|
+
style: { fill: a.palette.common.white, fillOpacity: 0.35 }
|
|
257
257
|
}
|
|
258
258
|
) });
|
|
259
259
|
}, St = l.memo(Ct), P = 75, de = 50;
|
|
260
|
-
function Bt({ bubble: t, isDraggable:
|
|
260
|
+
function Bt({ bubble: t, isDraggable: a, onClick: i = () => {
|
|
261
261
|
} }) {
|
|
262
|
-
const [s,
|
|
262
|
+
const [s, n] = l.useState(!1), { availableWidth: o } = te(), r = l.useMemo(() => {
|
|
263
263
|
if (t)
|
|
264
264
|
return {
|
|
265
265
|
amount: t.amount,
|
|
@@ -272,17 +272,17 @@ function Bt({ bubble: t, isDraggable: o, onClick: i = () => {
|
|
|
272
272
|
if (!t) return;
|
|
273
273
|
const {
|
|
274
274
|
budgetColors: { background: c, text: m },
|
|
275
|
-
category: { icon:
|
|
276
|
-
guid:
|
|
275
|
+
category: { icon: g, name: d },
|
|
276
|
+
guid: f,
|
|
277
277
|
description: _,
|
|
278
|
-
radius:
|
|
279
|
-
x:
|
|
278
|
+
radius: p,
|
|
279
|
+
x: b,
|
|
280
280
|
y: S
|
|
281
|
-
} = t,
|
|
282
|
-
let x =
|
|
283
|
-
|
|
281
|
+
} = t, h = o < 320 ? -8 : -12;
|
|
282
|
+
let x = h, A = h;
|
|
283
|
+
p > P ? (x = -14, A = -45) : p > de && (A = -32);
|
|
284
284
|
let v = 32;
|
|
285
|
-
|
|
285
|
+
p <= P && (v = o < 320 ? 16 : 24);
|
|
286
286
|
const B = `${t.category.name}: ${_}`, E = {
|
|
287
287
|
modifiers: [
|
|
288
288
|
{
|
|
@@ -295,13 +295,13 @@ function Bt({ bubble: t, isDraggable: o, onClick: i = () => {
|
|
|
295
295
|
"g",
|
|
296
296
|
{
|
|
297
297
|
className: "bubble",
|
|
298
|
-
id: `bubble-${
|
|
298
|
+
id: `bubble-${f}`,
|
|
299
299
|
onClick: () => i(t),
|
|
300
|
-
onMouseEnter: () =>
|
|
301
|
-
onMouseLeave: () =>
|
|
302
|
-
style: { cursor:
|
|
300
|
+
onMouseEnter: () => n(!0),
|
|
301
|
+
onMouseLeave: () => n(!1),
|
|
302
|
+
style: { cursor: a ? "pointer" : "default" },
|
|
303
303
|
textAnchor: "middle",
|
|
304
|
-
x:
|
|
304
|
+
x: b,
|
|
305
305
|
y: S,
|
|
306
306
|
children: [
|
|
307
307
|
/* @__PURE__ */ e(
|
|
@@ -311,39 +311,39 @@ function Bt({ bubble: t, isDraggable: o, onClick: i = () => {
|
|
|
311
311
|
open: s,
|
|
312
312
|
slotProps: { popper: E },
|
|
313
313
|
title: B,
|
|
314
|
-
children: /* @__PURE__ */ e("circle", { fill: c, id: `circle-${
|
|
314
|
+
children: /* @__PURE__ */ e("circle", { fill: c, id: `circle-${f}`, r: p })
|
|
315
315
|
}
|
|
316
316
|
),
|
|
317
|
-
/* @__PURE__ */ e("svg", { x, y: A, children: /* @__PURE__ */ e(N, { name:
|
|
318
|
-
|
|
319
|
-
|
|
317
|
+
/* @__PURE__ */ e("svg", { x, y: A, children: /* @__PURE__ */ e(N, { name: g, size: v, sx: { fill: m } }) }),
|
|
318
|
+
p > P && /* @__PURE__ */ e(
|
|
319
|
+
y,
|
|
320
320
|
{
|
|
321
321
|
bold: !0,
|
|
322
322
|
component: "text",
|
|
323
|
-
id: `budget-category-${
|
|
323
|
+
id: `budget-category-${f}`,
|
|
324
324
|
sx: { fill: m },
|
|
325
325
|
variant: "Small",
|
|
326
326
|
y: 4,
|
|
327
|
-
children:
|
|
327
|
+
children: d
|
|
328
328
|
}
|
|
329
329
|
),
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
p > de && /* @__PURE__ */ e(
|
|
331
|
+
y,
|
|
332
332
|
{
|
|
333
333
|
bold: !0,
|
|
334
334
|
component: "text",
|
|
335
|
-
id: `budget-description-${
|
|
335
|
+
id: `budget-description-${f}-1`,
|
|
336
336
|
sx: { fill: m },
|
|
337
337
|
variant: "Body",
|
|
338
|
-
y:
|
|
339
|
-
children:
|
|
338
|
+
y: p <= P ? 12 : 24,
|
|
339
|
+
children: p <= P ? _.split(" ")[0] : _
|
|
340
340
|
}
|
|
341
341
|
),
|
|
342
|
-
|
|
343
|
-
|
|
342
|
+
p <= P && p > de && /* @__PURE__ */ e(
|
|
343
|
+
y,
|
|
344
344
|
{
|
|
345
345
|
component: "text",
|
|
346
|
-
id: `budget-description-${
|
|
346
|
+
id: `budget-description-${f}-2`,
|
|
347
347
|
sx: { fill: m },
|
|
348
348
|
variant: "XSmall",
|
|
349
349
|
y: 28,
|
|
@@ -353,63 +353,63 @@ function Bt({ bubble: t, isDraggable: o, onClick: i = () => {
|
|
|
353
353
|
/* @__PURE__ */ e(St, { bubble: r })
|
|
354
354
|
]
|
|
355
355
|
},
|
|
356
|
-
|
|
356
|
+
f
|
|
357
357
|
);
|
|
358
358
|
}
|
|
359
359
|
const xt = ({
|
|
360
360
|
height: t,
|
|
361
|
-
width:
|
|
361
|
+
width: a,
|
|
362
362
|
isDraggable: i = !1,
|
|
363
363
|
onClick: s = () => {
|
|
364
364
|
}
|
|
365
365
|
}) => {
|
|
366
|
-
const [
|
|
367
|
-
const d = r.current,
|
|
366
|
+
const [n, o] = l.useState([]), r = l.useRef(null), c = l.useRef(!1), { detailedBudgets: m } = D(), g = l.useCallback(() => {
|
|
367
|
+
const d = r.current, f = ht(m), _ = f.nodes();
|
|
368
368
|
if (d) {
|
|
369
|
-
const
|
|
370
|
-
|
|
371
|
-
const
|
|
372
|
-
|
|
373
|
-
vx:
|
|
374
|
-
vy:
|
|
375
|
-
x:
|
|
376
|
-
y:
|
|
369
|
+
const p = d.nodes(), b = new Map(p.map((S) => [S.guid, S]));
|
|
370
|
+
_.forEach((S) => {
|
|
371
|
+
const h = b.get(S.guid);
|
|
372
|
+
h && Object.assign(S, {
|
|
373
|
+
vx: h.vx,
|
|
374
|
+
vy: h.vy,
|
|
375
|
+
x: h.x,
|
|
376
|
+
y: h.y
|
|
377
377
|
});
|
|
378
378
|
});
|
|
379
379
|
}
|
|
380
|
-
r.current =
|
|
381
|
-
}, [
|
|
380
|
+
r.current = f, c.current = !1, o(_);
|
|
381
|
+
}, [m]);
|
|
382
382
|
return l.useEffect(() => {
|
|
383
|
-
|
|
384
|
-
}, [
|
|
383
|
+
g();
|
|
384
|
+
}, [g]), l.useEffect(() => () => {
|
|
385
385
|
r.current && (r.current.stop(), r.current = null);
|
|
386
386
|
}, []), l.useEffect(() => {
|
|
387
387
|
const d = r.current;
|
|
388
388
|
if (!d) return;
|
|
389
|
-
const
|
|
390
|
-
d.nodes(
|
|
391
|
-
}, [t,
|
|
389
|
+
const f = d.nodes(), _ = a > 0 && a < 450 || t > 0 && t < 300, p = yt(f, m, _, t, a);
|
|
390
|
+
d.nodes(p), pt(d, t, a), o([...p]);
|
|
391
|
+
}, [t, a, m]), l.useLayoutEffect(() => {
|
|
392
|
+
const d = r.current;
|
|
393
|
+
d && (i && !c.current ? (gt(d), c.current = !0) : !i && c.current && (c.current = !1));
|
|
394
|
+
}, [i, n.length]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(a), children: n.map((d) => /* @__PURE__ */ e(Bt, { bubble: d, isDraggable: i, onClick: s }, d.guid)) });
|
|
392
395
|
}, At = I(xt), vt = ({
|
|
393
396
|
isMiniWidget: t = !1,
|
|
394
|
-
onConnectAccountsClick:
|
|
397
|
+
onConnectAccountsClick: a,
|
|
395
398
|
createBudgetOnClick: i
|
|
396
399
|
}) => {
|
|
397
|
-
const {
|
|
398
|
-
|
|
399
|
-
const { data:
|
|
400
|
-
|
|
400
|
+
const { availableWidth: s } = te(), n = s <= 320 && t, { recalculateBudgets: o } = D(), { spendCategories: r } = j(), { budgets: c } = w(), [m, g] = l.useState(!1), [d, f] = l.useState(!1), [_, p] = l.useState(!1), b = l.useMemo(() => [...r.filter((h) => h.totalAverageAmount > 0)], [r]), S = async () => {
|
|
401
|
+
p(!0);
|
|
402
|
+
const { data: h, isSuccess: x } = await o(b);
|
|
403
|
+
p(!1), x ? (h.length === 0 && g(!0), f(!1)) : f(!0);
|
|
401
404
|
};
|
|
402
|
-
return _ ? /* @__PURE__ */ e(G, {}) :
|
|
405
|
+
return _ ? /* @__PURE__ */ e(G, {}) : d ? /* @__PURE__ */ e(
|
|
403
406
|
le,
|
|
404
407
|
{
|
|
405
|
-
buttonStyles: {
|
|
406
|
-
...a && { mt: 16 }
|
|
407
|
-
},
|
|
408
408
|
header: c.autogenerate_budgets_error_header,
|
|
409
409
|
icon: "error",
|
|
410
410
|
iconColor: "#4D4D4D",
|
|
411
|
-
onClick: (
|
|
412
|
-
|
|
411
|
+
onClick: (h) => {
|
|
412
|
+
h === "primary" ? S() : i();
|
|
413
413
|
},
|
|
414
414
|
primaryButton: c.autogenerate_budgets_error_primary_button,
|
|
415
415
|
secondaryButton: c.zero_state_generate_budgets_secondary_button,
|
|
@@ -417,22 +417,20 @@ const xt = ({
|
|
|
417
417
|
sx: {
|
|
418
418
|
width: { sm: 468 },
|
|
419
419
|
".buttons-footer": {
|
|
420
|
-
width: 208
|
|
420
|
+
width: 208,
|
|
421
|
+
...n && { mt: 16, button: { height: "max-content" } }
|
|
421
422
|
},
|
|
422
|
-
...
|
|
423
|
+
...n && { mt: 0 }
|
|
423
424
|
}
|
|
424
425
|
}
|
|
425
426
|
) : /* @__PURE__ */ e(je, { children: m ? /* @__PURE__ */ e(
|
|
426
427
|
le,
|
|
427
428
|
{
|
|
428
|
-
buttonStyles: {
|
|
429
|
-
...a && { mt: 16 }
|
|
430
|
-
},
|
|
431
429
|
header: c.zero_state_generate_budgets_header,
|
|
432
430
|
icon: "error",
|
|
433
431
|
iconColor: "#4D4D4D",
|
|
434
|
-
onClick: (
|
|
435
|
-
|
|
432
|
+
onClick: (h) => {
|
|
433
|
+
h === "primary" ? a() : i();
|
|
436
434
|
},
|
|
437
435
|
primaryButton: c.zero_state_generate_budgets_primary_button,
|
|
438
436
|
secondaryButton: c.zero_state_generate_budgets_secondary_button,
|
|
@@ -440,10 +438,11 @@ const xt = ({
|
|
|
440
438
|
sx: {
|
|
441
439
|
width: t ? "100%" : { sm: 500 },
|
|
442
440
|
height: t ? "100%" : { sm: 468 },
|
|
443
|
-
mt:
|
|
441
|
+
mt: n ? 0 : 50,
|
|
444
442
|
".buttons-footer": {
|
|
445
443
|
width: 208,
|
|
446
|
-
height: 100
|
|
444
|
+
height: 100,
|
|
445
|
+
...n && { mt: 16, button: { height: "max-content" } }
|
|
447
446
|
},
|
|
448
447
|
padding: t ? 5 : 0
|
|
449
448
|
}
|
|
@@ -451,14 +450,11 @@ const xt = ({
|
|
|
451
450
|
) : /* @__PURE__ */ e(
|
|
452
451
|
le,
|
|
453
452
|
{
|
|
454
|
-
buttonStyles: {
|
|
455
|
-
...a && { mt: 24 }
|
|
456
|
-
},
|
|
457
453
|
header: c.create_budgets_title,
|
|
458
454
|
icon: "bubble_chart",
|
|
459
455
|
iconColor: "#1A1A1A",
|
|
460
|
-
onClick: (
|
|
461
|
-
|
|
456
|
+
onClick: (h) => {
|
|
457
|
+
h === "primary" ? S() : i();
|
|
462
458
|
},
|
|
463
459
|
primaryButton: c.empty_state_primary_button,
|
|
464
460
|
secondaryButton: t ? void 0 : c.empty_state_secondary_button,
|
|
@@ -466,12 +462,14 @@ const xt = ({
|
|
|
466
462
|
sx: {
|
|
467
463
|
width: t ? "100%" : { sm: 432 },
|
|
468
464
|
height: t ? "100%" : { sm: 468 },
|
|
469
|
-
mt:
|
|
465
|
+
mt: n ? 0 : 50,
|
|
470
466
|
".buttons-footer": {
|
|
471
467
|
width: 208,
|
|
472
|
-
height: 100
|
|
468
|
+
height: 100,
|
|
469
|
+
...n && { mt: 24, button: { height: "max-content" } }
|
|
473
470
|
},
|
|
474
|
-
padding: t ? 4 : 0
|
|
471
|
+
padding: t ? 4 : 0,
|
|
472
|
+
...n && { svg: { height: 32, width: 32 } }
|
|
475
473
|
}
|
|
476
474
|
}
|
|
477
475
|
) });
|
|
@@ -479,22 +477,22 @@ const xt = ({
|
|
|
479
477
|
({
|
|
480
478
|
createBudgetOnClick: t = () => {
|
|
481
479
|
},
|
|
482
|
-
height:
|
|
480
|
+
height: a,
|
|
483
481
|
isDraggable: i = !1,
|
|
484
482
|
isMiniWidget: s = !1,
|
|
485
|
-
shouldShowZeroState:
|
|
486
|
-
unavailableWidth:
|
|
483
|
+
shouldShowZeroState: n,
|
|
484
|
+
unavailableWidth: o = 24
|
|
487
485
|
}) => {
|
|
488
|
-
const { onEvent: r } = X(), { setSelectedBudget: c } = D(), { isLoadingCategoryTotals: m } = j(), { isInitialized:
|
|
486
|
+
const { onEvent: r } = X(), { setSelectedBudget: c } = D(), { isLoadingCategoryTotals: m } = j(), { isInitialized: g } = ne(), { accounts: d } = w(), { availableWidth: f } = te(), { isMobile: _ } = ge(), [p, b] = l.useState(!1), S = l.useMemo(() => f - o, [f]), h = (A) => {
|
|
489
487
|
c(A), r(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
490
488
|
budget_category: A.category.name,
|
|
491
489
|
click_type: "bubble"
|
|
492
490
|
});
|
|
493
491
|
}, x = () => {
|
|
494
|
-
|
|
492
|
+
b(!0), r(L.ACCOUNTS_CLICK_CONNECT);
|
|
495
493
|
};
|
|
496
|
-
return m ? /* @__PURE__ */ e(C, { alignItems: "center", height:
|
|
497
|
-
|
|
494
|
+
return m ? /* @__PURE__ */ e(C, { alignItems: "center", height: a, justifyContent: "center", width: Math.abs(S), children: /* @__PURE__ */ e(G, {}) }) : /* @__PURE__ */ u(F, { ml: n || _ ? 0 : 24, sx: { alignSelf: "center" }, children: [
|
|
495
|
+
n || !g ? /* @__PURE__ */ e(
|
|
498
496
|
vt,
|
|
499
497
|
{
|
|
500
498
|
createBudgetOnClick: t,
|
|
@@ -504,36 +502,36 @@ const xt = ({
|
|
|
504
502
|
) : /* @__PURE__ */ e(
|
|
505
503
|
At,
|
|
506
504
|
{
|
|
507
|
-
height:
|
|
505
|
+
height: a,
|
|
508
506
|
isDraggable: i,
|
|
509
|
-
onClick:
|
|
507
|
+
onClick: h,
|
|
510
508
|
width: S
|
|
511
509
|
}
|
|
512
510
|
),
|
|
513
511
|
/* @__PURE__ */ e(
|
|
514
512
|
We,
|
|
515
513
|
{
|
|
516
|
-
onClose: () =>
|
|
517
|
-
showConnectionsWidget:
|
|
518
|
-
title:
|
|
514
|
+
onClose: () => b(!1),
|
|
515
|
+
showConnectionsWidget: p,
|
|
516
|
+
title: d.manage_connections
|
|
519
517
|
}
|
|
520
518
|
)
|
|
521
519
|
] });
|
|
522
520
|
}
|
|
523
521
|
), Tt = ({
|
|
524
522
|
budgetsCopy: t,
|
|
525
|
-
difference:
|
|
523
|
+
difference: a,
|
|
526
524
|
handleAddClick: i,
|
|
527
525
|
shouldShowZeroState: s
|
|
528
526
|
}) => {
|
|
529
|
-
const { availableHeight:
|
|
527
|
+
const { availableHeight: n = 0 } = te(), o = l.useRef(null);
|
|
530
528
|
l.useEffect(() => {
|
|
531
|
-
|
|
532
|
-
}, [
|
|
529
|
+
n > 0 && o.current === null && (o.current = n);
|
|
530
|
+
}, [n]);
|
|
533
531
|
const r = l.useMemo(() => {
|
|
534
|
-
const c =
|
|
535
|
-
return c > 0 ? Math.round(Math.max(
|
|
536
|
-
}, [
|
|
532
|
+
const c = o.current ?? n;
|
|
533
|
+
return c > 0 ? Math.round(Math.max(140, Math.min(450, c * 0.8))) - 40 : 450;
|
|
534
|
+
}, [n]);
|
|
537
535
|
return /* @__PURE__ */ u(C, { sx: { height: "100%", justifyContent: "space-between" }, children: [
|
|
538
536
|
/* @__PURE__ */ e(
|
|
539
537
|
Me,
|
|
@@ -545,38 +543,38 @@ const xt = ({
|
|
|
545
543
|
}
|
|
546
544
|
),
|
|
547
545
|
!s && /* @__PURE__ */ u(F, { ml: 16, children: [
|
|
548
|
-
/* @__PURE__ */ e(
|
|
549
|
-
/* @__PURE__ */ e(
|
|
546
|
+
/* @__PURE__ */ e(y, { bold: !0, color: a < 0 ? "error.main" : "success.main", children: T(Math.abs(a), "0,0") }),
|
|
547
|
+
/* @__PURE__ */ e(y, { children: a < 0 ? t.overspent_in_budgets : t.left_in_budgets })
|
|
550
548
|
] })
|
|
551
549
|
] });
|
|
552
550
|
}, wt = (t) => {
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
}, A = () =>
|
|
551
|
+
const a = Q(), { onEvent: i } = X(), { detailedBudgets: s, isDataLoaded: n, loadBudgetData: o, setTheme: r } = D(), { budgets: c, common: m } = w(), { isCopyLoaded: g, isInitialized: d, selectedAccounts: f } = ne(), { reloadCategoryTotals: _ } = j(), p = Ve(), b = s.length === 0, [S, h] = l.useState(!1), x = () => {
|
|
552
|
+
h(!0), i(L.BUDGETS_CLICK_ADD);
|
|
553
|
+
}, A = () => h(!1);
|
|
556
554
|
return l.useEffect(() => {
|
|
557
|
-
r(
|
|
558
|
-
}, [
|
|
559
|
-
|
|
555
|
+
r(a);
|
|
556
|
+
}, [a]), l.useEffect(() => {
|
|
557
|
+
d && !n && _(f, q(/* @__PURE__ */ new Date()), ue(/* @__PURE__ */ new Date())).then(
|
|
560
558
|
() => {
|
|
561
|
-
|
|
559
|
+
o().finally();
|
|
562
560
|
}
|
|
563
561
|
);
|
|
564
|
-
}, [
|
|
562
|
+
}, [d, f]), g ? /* @__PURE__ */ u(
|
|
565
563
|
Ye,
|
|
566
564
|
{
|
|
567
565
|
contentStyles: { height: "calc(100% - 52px)" },
|
|
568
|
-
primaryCtaLabel:
|
|
566
|
+
primaryCtaLabel: b ? c.get_started_cta : c.details_cta,
|
|
569
567
|
sx: { height: "100%" },
|
|
570
568
|
title: c.budgets_title,
|
|
571
569
|
...t,
|
|
572
570
|
children: [
|
|
573
|
-
|
|
571
|
+
n ? /* @__PURE__ */ e(
|
|
574
572
|
Tt,
|
|
575
573
|
{
|
|
576
574
|
budgetsCopy: c,
|
|
577
|
-
difference:
|
|
575
|
+
difference: p,
|
|
578
576
|
handleAddClick: x,
|
|
579
|
-
shouldShowZeroState:
|
|
577
|
+
shouldShowZeroState: b
|
|
580
578
|
}
|
|
581
579
|
) : /* @__PURE__ */ e(G, {}),
|
|
582
580
|
/* @__PURE__ */ e(
|
|
@@ -584,7 +582,7 @@ const xt = ({
|
|
|
584
582
|
{
|
|
585
583
|
ariaLabelClose: m.close_aria,
|
|
586
584
|
isOpen: S,
|
|
587
|
-
onClose: () =>
|
|
585
|
+
onClose: () => h(!1),
|
|
588
586
|
title: c.add_new_title,
|
|
589
587
|
children: /* @__PURE__ */ e(Ie, { onRecalculateBudgets: A })
|
|
590
588
|
}
|
|
@@ -594,70 +592,70 @@ const xt = ({
|
|
|
594
592
|
) : /* @__PURE__ */ e(G, {});
|
|
595
593
|
}, Mn = I(wt), Re = ({ budget: t }) => {
|
|
596
594
|
const {
|
|
597
|
-
amount:
|
|
595
|
+
amount: a,
|
|
598
596
|
budgetColors: { background: i },
|
|
599
597
|
category: { name: s },
|
|
600
|
-
category_guid:
|
|
601
|
-
percentage:
|
|
598
|
+
category_guid: n,
|
|
599
|
+
percentage: o,
|
|
602
600
|
transaction_total: r
|
|
603
601
|
} = t, c = [
|
|
604
602
|
{
|
|
605
603
|
color: i,
|
|
606
|
-
percentage: `${
|
|
604
|
+
percentage: `${o}%`
|
|
607
605
|
}
|
|
608
606
|
];
|
|
609
|
-
return /* @__PURE__ */ e(
|
|
610
|
-
/* @__PURE__ */ e(H, { categoryGuid:
|
|
611
|
-
/* @__PURE__ */ e(ze, { children: `${T(r, "0,0")} / ${T(
|
|
612
|
-
/* @__PURE__ */ e(
|
|
607
|
+
return /* @__PURE__ */ e(pe, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(he, { children: /* @__PURE__ */ u(C, { alignItems: "center", gap: 16, children: [
|
|
608
|
+
/* @__PURE__ */ e(H, { categoryGuid: n, size: 56 }),
|
|
609
|
+
/* @__PURE__ */ e(ze, { children: `${T(r, "0,0")} / ${T(a, "0,0")}` }),
|
|
610
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "XSmall", children: s }),
|
|
613
611
|
/* @__PURE__ */ e(me, { data: c, height: 10 })
|
|
614
612
|
] }) }) });
|
|
615
613
|
}, Dt = I(() => {
|
|
616
614
|
const { budgets: t } = w();
|
|
617
615
|
return /* @__PURE__ */ u(C, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
|
|
618
616
|
/* @__PURE__ */ e(N, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
|
|
619
|
-
/* @__PURE__ */ e(
|
|
620
|
-
/* @__PURE__ */ e(
|
|
617
|
+
/* @__PURE__ */ e(y, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
|
|
618
|
+
/* @__PURE__ */ e(y, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
|
|
621
619
|
] });
|
|
622
620
|
}), It = I(({ budget: t }) => {
|
|
623
621
|
const {
|
|
624
|
-
amount:
|
|
622
|
+
amount: a,
|
|
625
623
|
budgetColors: { background: i },
|
|
626
624
|
category: s,
|
|
627
|
-
percentage:
|
|
628
|
-
transaction_total:
|
|
625
|
+
percentage: n,
|
|
626
|
+
transaction_total: o
|
|
629
627
|
} = t, { setSelectedSubBudget: r } = D();
|
|
630
628
|
return /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => r(t), children: [
|
|
631
|
-
/* @__PURE__ */ e(re, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(we, { color: i, percent:
|
|
629
|
+
/* @__PURE__ */ e(re, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(we, { color: i, percent: n, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: s.parent_guid, variant: "basic" }) }) }),
|
|
632
630
|
/* @__PURE__ */ e(
|
|
633
631
|
Y,
|
|
634
632
|
{
|
|
635
|
-
primary: /* @__PURE__ */ e(C, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(
|
|
636
|
-
secondary: /* @__PURE__ */ e(C, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(
|
|
637
|
-
${T(
|
|
638
|
-
${T(
|
|
633
|
+
primary: /* @__PURE__ */ e(C, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t.category.name }) }),
|
|
634
|
+
secondary: /* @__PURE__ */ e(C, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(y, { fontWeight: 400, variant: "Body", children: `
|
|
635
|
+
${T(o, "0,0")} /
|
|
636
|
+
${T(a, "0,0")}
|
|
639
637
|
` }) })
|
|
640
638
|
}
|
|
641
639
|
)
|
|
642
640
|
] }) });
|
|
643
|
-
}), Et = I(({ category: t, parentBudget:
|
|
644
|
-
const { budgets: i, common: s } = w(), { setExpandedGuid:
|
|
641
|
+
}), Et = I(({ category: t, parentBudget: a }) => {
|
|
642
|
+
const { budgets: i, common: s } = w(), { setExpandedGuid: n, setOnSelect: o } = nt(), { addBudget: r } = D(), [c, m] = l.useState(!1), [g, d] = l.useState(!1), [f, _] = l.useState(""), [p, b] = l.useState(void 0);
|
|
645
643
|
l.useEffect(() => {
|
|
646
|
-
|
|
644
|
+
o((x) => {
|
|
647
645
|
const A = t.subCategories.find((v) => v.guid === x);
|
|
648
|
-
A && (
|
|
646
|
+
A && (b(A), _(`${A.currentAmount === 0 ? "" : A.currentAmount}`), d(!0));
|
|
649
647
|
});
|
|
650
648
|
}, []);
|
|
651
649
|
const S = () => {
|
|
652
|
-
|
|
653
|
-
},
|
|
654
|
-
|
|
650
|
+
n(t.guid), m(!0);
|
|
651
|
+
}, h = async () => {
|
|
652
|
+
p && Number(f) > 0 && (await r(p, Number(f), a.guid), d(!1), m(!1), b(void 0));
|
|
655
653
|
};
|
|
656
654
|
return /* @__PURE__ */ u(F, { children: [
|
|
657
655
|
/* @__PURE__ */ e(K, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(V, { onClick: S, children: /* @__PURE__ */ e(Y, { children: /* @__PURE__ */ u(C, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
|
|
658
656
|
/* @__PURE__ */ u(C, { alignItems: "center", direction: "row", gap: 8, children: [
|
|
659
657
|
/* @__PURE__ */ e(N, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
|
|
660
|
-
/* @__PURE__ */ e(
|
|
658
|
+
/* @__PURE__ */ e(y, { bold: !0, sx: { color: "primary.light" }, variant: "Body", children: i.add_sub_budget_button })
|
|
661
659
|
] }),
|
|
662
660
|
/* @__PURE__ */ e(N, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
|
|
663
661
|
] }) }) }) }),
|
|
@@ -676,16 +674,16 @@ const xt = ({
|
|
|
676
674
|
$,
|
|
677
675
|
{
|
|
678
676
|
copy: { close_aria: s.close_aria, title: i.add_title },
|
|
679
|
-
disablePrimaryButton: Number(
|
|
680
|
-
isOpen:
|
|
681
|
-
onClose: () =>
|
|
682
|
-
onPrimaryAction:
|
|
677
|
+
disablePrimaryButton: Number(f) <= 0,
|
|
678
|
+
isOpen: g,
|
|
679
|
+
onClose: () => d(!1),
|
|
680
|
+
onPrimaryAction: h,
|
|
683
681
|
primaryText: i.add_save_button,
|
|
684
682
|
children: /* @__PURE__ */ e(
|
|
685
683
|
se,
|
|
686
684
|
{
|
|
687
|
-
amount:
|
|
688
|
-
categoryName:
|
|
685
|
+
amount: f,
|
|
686
|
+
categoryName: p?.name || "",
|
|
689
687
|
onAmountChanged: _
|
|
690
688
|
}
|
|
691
689
|
)
|
|
@@ -693,10 +691,10 @@ const xt = ({
|
|
|
693
691
|
)
|
|
694
692
|
] });
|
|
695
693
|
}), Ot = I(({ budget: t }) => {
|
|
696
|
-
const { category:
|
|
694
|
+
const { category: a, subBudgets: i } = t, { budgets: s, common: n } = w(), { deleteBudget: o, selectedSubBudget: r, setSelectedSubBudget: c, updateBudget: m } = D(), { filter: g, setFilter: d } = oe(), [f, _] = l.useState(!1), [p, b] = l.useState(!1), [S, h] = l.useState("");
|
|
697
695
|
l.useEffect(() => {
|
|
698
|
-
r && (
|
|
699
|
-
...
|
|
696
|
+
r && (h(`${r.amount}`), d({
|
|
697
|
+
...g,
|
|
700
698
|
custom: (B) => B.category_guid === r.category_guid
|
|
701
699
|
}));
|
|
702
700
|
}, [r]);
|
|
@@ -706,10 +704,10 @@ const xt = ({
|
|
|
706
704
|
amount: Number(S)
|
|
707
705
|
});
|
|
708
706
|
}, A = async () => {
|
|
709
|
-
r && await
|
|
707
|
+
r && await o(r.guid), b(!1), v();
|
|
710
708
|
}, v = () => {
|
|
711
|
-
|
|
712
|
-
...
|
|
709
|
+
d({
|
|
710
|
+
...g,
|
|
713
711
|
custom: (B) => B.category_guid === t.category_guid || B.top_level_category_guid === t.category_guid
|
|
714
712
|
}), c(void 0);
|
|
715
713
|
};
|
|
@@ -719,16 +717,16 @@ const xt = ({
|
|
|
719
717
|
/* @__PURE__ */ e(It, { budget: B }),
|
|
720
718
|
/* @__PURE__ */ e(ae, {})
|
|
721
719
|
] }, B.guid)),
|
|
722
|
-
/* @__PURE__ */ e(Et, { category:
|
|
720
|
+
/* @__PURE__ */ e(Et, { category: a, parentBudget: t })
|
|
723
721
|
] }),
|
|
724
722
|
/* @__PURE__ */ e(
|
|
725
723
|
k,
|
|
726
724
|
{
|
|
727
|
-
ariaLabelClose:
|
|
725
|
+
ariaLabelClose: n.close_aria,
|
|
728
726
|
isOpen: !!r,
|
|
729
727
|
onClose: v,
|
|
730
728
|
onPrimaryAction: () => _(!0),
|
|
731
|
-
onSecondaryAction: () =>
|
|
729
|
+
onSecondaryAction: () => b(!0),
|
|
732
730
|
primaryText: s.details_edit_button,
|
|
733
731
|
secondaryText: s.details_delete_button,
|
|
734
732
|
title: s.details_title,
|
|
@@ -742,9 +740,9 @@ const xt = ({
|
|
|
742
740
|
/* @__PURE__ */ e(
|
|
743
741
|
$,
|
|
744
742
|
{
|
|
745
|
-
copy: { close_aria:
|
|
743
|
+
copy: { close_aria: n.close_aria, title: s.details_edit_title },
|
|
746
744
|
disablePrimaryButton: Number(S) <= 0,
|
|
747
|
-
isOpen:
|
|
745
|
+
isOpen: f,
|
|
748
746
|
onClose: () => _(!1),
|
|
749
747
|
onPrimaryAction: x,
|
|
750
748
|
primaryText: s.edit_save_button,
|
|
@@ -753,7 +751,7 @@ const xt = ({
|
|
|
753
751
|
{
|
|
754
752
|
amount: S,
|
|
755
753
|
categoryName: r.category.name,
|
|
756
|
-
onAmountChanged:
|
|
754
|
+
onAmountChanged: h
|
|
757
755
|
}
|
|
758
756
|
)
|
|
759
757
|
}
|
|
@@ -761,31 +759,31 @@ const xt = ({
|
|
|
761
759
|
/* @__PURE__ */ e(
|
|
762
760
|
$,
|
|
763
761
|
{
|
|
764
|
-
copy: { close_aria:
|
|
765
|
-
isOpen:
|
|
766
|
-
onClose: () =>
|
|
762
|
+
copy: { close_aria: n.close_aria, title: s.delete_title },
|
|
763
|
+
isOpen: p,
|
|
764
|
+
onClose: () => b(!1),
|
|
767
765
|
onPrimaryAction: A,
|
|
768
766
|
primaryColor: "error",
|
|
769
767
|
primaryText: "Delete",
|
|
770
768
|
secondaryColor: "secondary",
|
|
771
|
-
children: /* @__PURE__ */ e(
|
|
769
|
+
children: /* @__PURE__ */ e(y, { variant: "Paragraph", children: M(s.delete_description, r.category.name) })
|
|
772
770
|
}
|
|
773
771
|
)
|
|
774
772
|
] })
|
|
775
773
|
] });
|
|
776
774
|
}), Mt = I(({ budget: t }) => {
|
|
777
|
-
const { is_mobile_webview:
|
|
778
|
-
sortedTransactions:
|
|
779
|
-
sortedTransactionsWithSplits:
|
|
780
|
-
tags:
|
|
781
|
-
} = oe(), [_,
|
|
782
|
-
() =>
|
|
783
|
-
[
|
|
775
|
+
const { is_mobile_webview: a } = Ue(), { setAlert: i } = D(), { budgets: s, common: n, transactions: o } = w(), { isDesktop: r, isSmallTablet: c, isTablet: m } = ge(), {
|
|
776
|
+
sortedTransactions: g,
|
|
777
|
+
sortedTransactionsWithSplits: d,
|
|
778
|
+
tags: f
|
|
779
|
+
} = oe(), [_, p] = l.useState(0), [b, S] = l.useState(""), h = l.useMemo(
|
|
780
|
+
() => g.find((B) => B.guid === b),
|
|
781
|
+
[b, g]
|
|
784
782
|
), x = (B, E) => {
|
|
785
|
-
|
|
783
|
+
p(E);
|
|
786
784
|
}, A = () => {
|
|
787
|
-
et(
|
|
788
|
-
}, v =
|
|
785
|
+
et(d, f), i(s.alert_csv_downloaded);
|
|
786
|
+
}, v = g.length > 0 && !a && (r || m && !c);
|
|
789
787
|
return /* @__PURE__ */ u(C, { gap: 24, children: [
|
|
790
788
|
/* @__PURE__ */ e(Re, { budget: t }),
|
|
791
789
|
/* @__PURE__ */ u(C, { children: [
|
|
@@ -798,8 +796,8 @@ const xt = ({
|
|
|
798
796
|
value: _,
|
|
799
797
|
variant: "fullWidth",
|
|
800
798
|
children: [
|
|
801
|
-
/* @__PURE__ */ e(
|
|
802
|
-
/* @__PURE__ */ e(
|
|
799
|
+
/* @__PURE__ */ e(ye, { label: s.details_transactions_tab }),
|
|
800
|
+
/* @__PURE__ */ e(ye, { label: s.details_subbudgets_tab })
|
|
803
801
|
]
|
|
804
802
|
}
|
|
805
803
|
),
|
|
@@ -810,7 +808,7 @@ const xt = ({
|
|
|
810
808
|
onClick: A,
|
|
811
809
|
startIcon: /* @__PURE__ */ e(N, { name: "ios_share" }),
|
|
812
810
|
variant: "text",
|
|
813
|
-
children:
|
|
811
|
+
children: o.export_csv_btn
|
|
814
812
|
}
|
|
815
813
|
) }),
|
|
816
814
|
/* @__PURE__ */ e(Te, { height: "100%", onClick: S })
|
|
@@ -819,77 +817,77 @@ const xt = ({
|
|
|
819
817
|
/* @__PURE__ */ e(
|
|
820
818
|
k,
|
|
821
819
|
{
|
|
822
|
-
ariaLabelClose:
|
|
823
|
-
isOpen: !!
|
|
820
|
+
ariaLabelClose: n.close_aria,
|
|
821
|
+
isOpen: !!h,
|
|
824
822
|
onClose: () => S(""),
|
|
825
823
|
title: s.details_transaction_drawer,
|
|
826
|
-
children:
|
|
824
|
+
children: h && /* @__PURE__ */ e(tt, { transaction: h })
|
|
827
825
|
}
|
|
828
826
|
)
|
|
829
827
|
] })
|
|
830
828
|
] });
|
|
831
829
|
}), Rt = I(() => {
|
|
832
|
-
const { selectedAccountGuids: t } = ne(), { budgets:
|
|
830
|
+
const { selectedAccountGuids: t } = ne(), { budgets: a, common: i } = w(), {
|
|
833
831
|
dateRange: s,
|
|
834
|
-
deleteBudget:
|
|
835
|
-
selectedBudget:
|
|
832
|
+
deleteBudget: n,
|
|
833
|
+
selectedBudget: o,
|
|
836
834
|
selectedSubBudget: r,
|
|
837
835
|
setAlert: c,
|
|
838
836
|
setSelectedBudget: m,
|
|
839
|
-
updateBudget:
|
|
840
|
-
} = D(), { setFilter:
|
|
837
|
+
updateBudget: g
|
|
838
|
+
} = D(), { setFilter: d } = oe(), [f, _] = l.useState(!1), [p, b] = l.useState(!1), [S, h] = l.useState(!1), [x, A] = l.useState("");
|
|
841
839
|
l.useEffect(() => {
|
|
842
|
-
|
|
840
|
+
o && !r && (A(`${o.amount}`), _(!0), d({
|
|
843
841
|
accounts: t,
|
|
844
842
|
dateRange: s,
|
|
845
|
-
custom: (R) => R.category_guid ===
|
|
843
|
+
custom: (R) => R.category_guid === o.category_guid || R.top_level_category_guid === o.category_guid,
|
|
846
844
|
showSplits: !0
|
|
847
845
|
}));
|
|
848
|
-
}, [
|
|
846
|
+
}, [o]);
|
|
849
847
|
const v = async () => {
|
|
850
|
-
|
|
851
|
-
...
|
|
848
|
+
o && (await g({
|
|
849
|
+
...o,
|
|
852
850
|
amount: Number(x),
|
|
853
|
-
percentage:
|
|
854
|
-
}), c(M(
|
|
851
|
+
percentage: o.category.totalAmount / Number(x) * 100
|
|
852
|
+
}), c(M(a.alert_budget_updated, o.category.name)));
|
|
855
853
|
}, B = async () => {
|
|
856
|
-
|
|
854
|
+
o && (await n(o.guid), c(M(a.alert_budget_deleted, o.category.name))), h(!1), E();
|
|
857
855
|
}, E = () => {
|
|
858
856
|
_(!1), setTimeout(() => {
|
|
859
857
|
m(void 0);
|
|
860
858
|
}, 250);
|
|
861
859
|
};
|
|
862
|
-
if (
|
|
860
|
+
if (o)
|
|
863
861
|
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
864
862
|
/* @__PURE__ */ e(
|
|
865
863
|
k,
|
|
866
864
|
{
|
|
867
865
|
ariaLabelClose: i.close_aria,
|
|
868
|
-
isOpen:
|
|
866
|
+
isOpen: f,
|
|
869
867
|
onClose: E,
|
|
870
|
-
onPrimaryAction: () =>
|
|
871
|
-
onSecondaryAction: () =>
|
|
872
|
-
primaryText:
|
|
868
|
+
onPrimaryAction: () => b(!0),
|
|
869
|
+
onSecondaryAction: () => h(!0),
|
|
870
|
+
primaryText: a.details_edit_button,
|
|
873
871
|
secondaryColor: "error",
|
|
874
|
-
secondaryText:
|
|
875
|
-
title:
|
|
876
|
-
children: /* @__PURE__ */ e(Mt, { budget:
|
|
872
|
+
secondaryText: a.details_delete_button,
|
|
873
|
+
title: a.details_title,
|
|
874
|
+
children: /* @__PURE__ */ e(Mt, { budget: o })
|
|
877
875
|
}
|
|
878
876
|
),
|
|
879
877
|
/* @__PURE__ */ e(
|
|
880
878
|
$,
|
|
881
879
|
{
|
|
882
|
-
copy: { close_aria: i.close_aria, title:
|
|
880
|
+
copy: { close_aria: i.close_aria, title: a.details_edit_title },
|
|
883
881
|
disablePrimaryButton: Number(x) <= 0,
|
|
884
|
-
isOpen:
|
|
885
|
-
onClose: () =>
|
|
882
|
+
isOpen: p,
|
|
883
|
+
onClose: () => b(!1),
|
|
886
884
|
onPrimaryAction: v,
|
|
887
|
-
primaryText:
|
|
885
|
+
primaryText: a.edit_save_button,
|
|
888
886
|
children: /* @__PURE__ */ e(
|
|
889
887
|
se,
|
|
890
888
|
{
|
|
891
889
|
amount: x,
|
|
892
|
-
categoryName:
|
|
890
|
+
categoryName: o.category.name,
|
|
893
891
|
onAmountChanged: A
|
|
894
892
|
}
|
|
895
893
|
)
|
|
@@ -898,64 +896,64 @@ const xt = ({
|
|
|
898
896
|
/* @__PURE__ */ e(
|
|
899
897
|
$,
|
|
900
898
|
{
|
|
901
|
-
copy: { close_aria: i.close_aria, title:
|
|
899
|
+
copy: { close_aria: i.close_aria, title: a.delete_title },
|
|
902
900
|
isOpen: S,
|
|
903
|
-
onClose: () =>
|
|
901
|
+
onClose: () => h(!1),
|
|
904
902
|
onPrimaryAction: B,
|
|
905
903
|
primaryColor: "error",
|
|
906
|
-
primaryText:
|
|
904
|
+
primaryText: a.details_delete_button,
|
|
907
905
|
secondaryColor: "secondary",
|
|
908
|
-
children: /* @__PURE__ */ e(
|
|
906
|
+
children: /* @__PURE__ */ e(y, { variant: "Paragraph", children: M(a.delete_description, o.category.name) })
|
|
909
907
|
}
|
|
910
908
|
)
|
|
911
909
|
] });
|
|
912
|
-
}), Lt = ({ budget: t, onClick:
|
|
910
|
+
}), Lt = ({ budget: t, onClick: a }) => {
|
|
913
911
|
const {
|
|
914
912
|
amount: i,
|
|
915
|
-
budgetColors: { background: s, description:
|
|
916
|
-
category_guid:
|
|
913
|
+
budgetColors: { background: s, description: n },
|
|
914
|
+
category_guid: o,
|
|
917
915
|
description: r,
|
|
918
916
|
percentage: c,
|
|
919
917
|
subBudgets: m,
|
|
920
|
-
transaction_total:
|
|
918
|
+
transaction_total: g
|
|
921
919
|
} = t;
|
|
922
|
-
return /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () =>
|
|
923
|
-
/* @__PURE__ */ e(re, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(we, { color: s, percent: c, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid:
|
|
920
|
+
return /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => a?.(t), children: [
|
|
921
|
+
/* @__PURE__ */ e(re, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(we, { color: s, percent: c, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: o, variant: "basic" }) }) }),
|
|
924
922
|
/* @__PURE__ */ e(
|
|
925
923
|
Y,
|
|
926
924
|
{
|
|
927
925
|
primary: /* @__PURE__ */ u(C, { component: "span", direction: "row", justifyContent: "space-between", children: [
|
|
928
|
-
/* @__PURE__ */ e(
|
|
929
|
-
/* @__PURE__ */ e(
|
|
930
|
-
${T(
|
|
926
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t.category.name }),
|
|
927
|
+
/* @__PURE__ */ e(y, { fontWeight: 400, variant: "Body", children: `
|
|
928
|
+
${T(g, "0,0")} /
|
|
931
929
|
${T(i, "0,0")}
|
|
932
930
|
` })
|
|
933
931
|
] }),
|
|
934
932
|
secondary: /* @__PURE__ */ u(C, { component: "span", direction: "row", justifyContent: "space-between", children: [
|
|
935
|
-
/* @__PURE__ */ e(
|
|
936
|
-
/* @__PURE__ */ e(
|
|
933
|
+
/* @__PURE__ */ e(y, { variant: "XSmall", children: `${m.length} Sub-budgets` }),
|
|
934
|
+
/* @__PURE__ */ e(y, { bold: c > 100, color: n, variant: "XSmall", children: r })
|
|
937
935
|
] })
|
|
938
936
|
}
|
|
939
937
|
)
|
|
940
938
|
] }) });
|
|
941
939
|
}, kt = I(() => {
|
|
942
|
-
const { onEvent: t } = X(), { budgets:
|
|
943
|
-
s(
|
|
944
|
-
budget_category:
|
|
940
|
+
const { onEvent: t } = X(), { budgets: a } = w(), { detailedBudgets: i, setSelectedBudget: s } = D(), n = (o) => {
|
|
941
|
+
s(o), t(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
942
|
+
budget_category: o.category.name,
|
|
945
943
|
click_type: "list"
|
|
946
944
|
});
|
|
947
945
|
};
|
|
948
|
-
return /* @__PURE__ */ u(
|
|
949
|
-
/* @__PURE__ */ e(De, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(
|
|
950
|
-
/* @__PURE__ */ e(
|
|
951
|
-
/* @__PURE__ */ e(Lt, { budget:
|
|
946
|
+
return /* @__PURE__ */ u(pe, { elevation: 2, children: [
|
|
947
|
+
/* @__PURE__ */ e(De, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(xe, { children: a.budget_categories_title }) }),
|
|
948
|
+
/* @__PURE__ */ e(he, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(W, { children: i.map((o) => /* @__PURE__ */ u(l.Fragment, { children: [
|
|
949
|
+
/* @__PURE__ */ e(Lt, { budget: o, onClick: n }),
|
|
952
950
|
/* @__PURE__ */ e(ae, {})
|
|
953
|
-
] },
|
|
951
|
+
] }, o.guid)) }) })
|
|
954
952
|
] });
|
|
955
953
|
}), Nt = I(() => {
|
|
956
|
-
const t =
|
|
954
|
+
const t = Q(), { onEvent: a } = X(), { visibleAccounts: i } = Ae(), { budgets: s, common: n, recurring: o } = w(), { incomeCategories: r, spendCategories: c } = j(), { detailedBudgets: m, totalBudgeted: g } = D(), { incomeTotal: d } = ee(), { setFilter: f } = oe(), [_, p] = l.useState(!1), [b, S] = l.useMemo(() => {
|
|
957
955
|
const v = c.reduce((z, ie) => z + ie.totalAmount, 0);
|
|
958
|
-
let B = v /
|
|
956
|
+
let B = v / g;
|
|
959
957
|
B > 1 && (B = 1);
|
|
960
958
|
let E = t.palette.success.main;
|
|
961
959
|
B > 0.8 && B < 1 ? E = t.palette.warning.main : B >= 1 && (E = t.palette.error.main);
|
|
@@ -966,11 +964,11 @@ const xt = ({
|
|
|
966
964
|
}
|
|
967
965
|
];
|
|
968
966
|
return [v, R];
|
|
969
|
-
}, [m, c]), [
|
|
967
|
+
}, [m, c]), [h, x] = l.useMemo(() => {
|
|
970
968
|
const v = Math.abs(
|
|
971
969
|
r.reduce((R, z) => R + z.totalAmount, 0)
|
|
972
970
|
);
|
|
973
|
-
let B = v /
|
|
971
|
+
let B = v / d;
|
|
974
972
|
B > 1 && (B = 1);
|
|
975
973
|
const E = [
|
|
976
974
|
{
|
|
@@ -979,34 +977,34 @@ const xt = ({
|
|
|
979
977
|
}
|
|
980
978
|
];
|
|
981
979
|
return [v, E];
|
|
982
|
-
}, [r,
|
|
983
|
-
|
|
980
|
+
}, [r, d]), A = () => {
|
|
981
|
+
f({
|
|
984
982
|
accounts: i.map((v) => v.guid),
|
|
985
983
|
dateRange: {
|
|
986
984
|
start: at(/* @__PURE__ */ new Date(), 90),
|
|
987
985
|
end: /* @__PURE__ */ new Date()
|
|
988
986
|
}
|
|
989
|
-
}),
|
|
987
|
+
}), p(!0), a(L.BUDGETS_CLICK_EDIT_INCOME);
|
|
990
988
|
};
|
|
991
|
-
return /* @__PURE__ */ u(
|
|
992
|
-
/* @__PURE__ */ e(De, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(
|
|
993
|
-
/* @__PURE__ */ e(
|
|
989
|
+
return /* @__PURE__ */ u(pe, { elevation: 2, sx: { overflow: "visible" }, children: [
|
|
990
|
+
/* @__PURE__ */ e(De, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(xe, { children: s.overview_title }) }),
|
|
991
|
+
/* @__PURE__ */ e(he, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ u(C, { gap: 24, children: [
|
|
994
992
|
/* @__PURE__ */ u(C, { gap: 8, children: [
|
|
995
|
-
/* @__PURE__ */ e(
|
|
993
|
+
/* @__PURE__ */ e(y, { bold: !0, sx: { mb: 8 }, variant: "Body", children: s.spending_title }),
|
|
996
994
|
/* @__PURE__ */ e(me, { data: S, height: 16 }),
|
|
997
|
-
/* @__PURE__ */ e(
|
|
995
|
+
/* @__PURE__ */ e(y, { variant: "Small", children: M(
|
|
998
996
|
s.spending_description,
|
|
999
|
-
T(
|
|
1000
|
-
T(
|
|
997
|
+
T(b, "0,0"),
|
|
998
|
+
T(g, "0,0")
|
|
1001
999
|
) })
|
|
1002
1000
|
] }),
|
|
1003
1001
|
/* @__PURE__ */ u(C, { gap: 8, children: [
|
|
1004
1002
|
/* @__PURE__ */ u(C, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
|
|
1005
|
-
/* @__PURE__ */ e(
|
|
1003
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: s.income_title }),
|
|
1006
1004
|
/* @__PURE__ */ e(
|
|
1007
1005
|
rt,
|
|
1008
1006
|
{
|
|
1009
|
-
"aria-label":
|
|
1007
|
+
"aria-label": o.manage_income,
|
|
1010
1008
|
onClick: A,
|
|
1011
1009
|
sx: { p: 0 },
|
|
1012
1010
|
children: /* @__PURE__ */ e(N, { color: "primary", name: "edit" })
|
|
@@ -1014,60 +1012,60 @@ const xt = ({
|
|
|
1014
1012
|
)
|
|
1015
1013
|
] }),
|
|
1016
1014
|
/* @__PURE__ */ e(me, { data: x, height: 16 }),
|
|
1017
|
-
/* @__PURE__ */ e(
|
|
1015
|
+
/* @__PURE__ */ e(y, { variant: "Small", children: M(
|
|
1018
1016
|
s.income_description,
|
|
1019
|
-
T(
|
|
1020
|
-
T(
|
|
1017
|
+
T(h, "0,0"),
|
|
1018
|
+
T(d, "0,0")
|
|
1021
1019
|
) })
|
|
1022
1020
|
] })
|
|
1023
1021
|
] }) }),
|
|
1024
1022
|
/* @__PURE__ */ e(
|
|
1025
1023
|
k,
|
|
1026
1024
|
{
|
|
1027
|
-
ariaLabelClose:
|
|
1025
|
+
ariaLabelClose: n.close_aria,
|
|
1028
1026
|
isOpen: _,
|
|
1029
|
-
onClose: () =>
|
|
1030
|
-
title:
|
|
1027
|
+
onClose: () => p(!1),
|
|
1028
|
+
title: o.manage_income,
|
|
1031
1029
|
children: /* @__PURE__ */ e(st, { forOverview: !0 })
|
|
1032
1030
|
}
|
|
1033
1031
|
)
|
|
1034
1032
|
] });
|
|
1035
|
-
}),
|
|
1036
|
-
const i =
|
|
1033
|
+
}), Be = 480, Rn = I(({ onBackClick: t, sx: a }) => {
|
|
1034
|
+
const i = Q(), { onEvent: s } = X(), { visibleAccounts: n } = Ae(), { budgets: o, common: r } = w(), { isCopyLoaded: c, isInitialized: m, selectedAccounts: g, setDisplayedDate: d, setSelectedAccounts: f } = ne(), {
|
|
1037
1035
|
alert: _,
|
|
1038
|
-
dateRange:
|
|
1039
|
-
isDataLoaded:
|
|
1036
|
+
dateRange: p,
|
|
1037
|
+
isDataLoaded: b,
|
|
1040
1038
|
loadBudgetData: S,
|
|
1041
|
-
setDateRange:
|
|
1039
|
+
setDateRange: h,
|
|
1042
1040
|
setAlert: x,
|
|
1043
1041
|
setTheme: A,
|
|
1044
1042
|
detailedBudgets: v
|
|
1045
|
-
} = D(), { loadRepeatingTransactions: B, setDateRange: E } =
|
|
1046
|
-
l.useEffect(() => (A(i),
|
|
1047
|
-
|
|
1043
|
+
} = D(), { loadRepeatingTransactions: B, setDateRange: E } = ee(), { reloadCategoryTotals: R } = j(), { isSmallTablet: z, isMobile: ie, isSmallMobile: Le } = ge(), U = z || ie || Le, [ke, ce] = l.useState(!1);
|
|
1044
|
+
l.useEffect(() => (A(i), f(n), h({ start: q(Z()), end: ue(Z()) }), s(L.BUDGETS_VIEW), () => {
|
|
1045
|
+
h({ start: q(Z()), end: ue(Z()) });
|
|
1048
1046
|
}), []), l.useEffect(() => {
|
|
1049
|
-
|
|
1050
|
-
}, [
|
|
1051
|
-
m && (p
|
|
1052
|
-
}, [m,
|
|
1053
|
-
const Ne = (
|
|
1054
|
-
|
|
1047
|
+
f(n);
|
|
1048
|
+
}, [n]), l.useEffect(() => {
|
|
1049
|
+
m && (d(p.start, p.end), R(g, p.start, p.end).finally(), E(p), b || (B().finally(), S().finally()));
|
|
1050
|
+
}, [m, g, p]);
|
|
1051
|
+
const Ne = (_e) => {
|
|
1052
|
+
h({ start: _e[0] || /* @__PURE__ */ new Date(), end: _e[1] || /* @__PURE__ */ new Date() });
|
|
1055
1053
|
}, Pe = () => {
|
|
1056
1054
|
s(L.BUDGETS_CLICK_FILTER);
|
|
1057
|
-
},
|
|
1055
|
+
}, fe = () => {
|
|
1058
1056
|
ce(!0), s(L.BUDGETS_CLICK_ADD);
|
|
1059
1057
|
}, $e = () => {
|
|
1060
1058
|
ce(!1);
|
|
1061
|
-
}, Ge = Ze(
|
|
1062
|
-
return !c || !m || !
|
|
1059
|
+
}, Ge = Ze(p.end, q(/* @__PURE__ */ new Date()));
|
|
1060
|
+
return !c || !m || !b ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ u(
|
|
1063
1061
|
Ke,
|
|
1064
1062
|
{
|
|
1065
|
-
accountOptions:
|
|
1063
|
+
accountOptions: n,
|
|
1066
1064
|
actions: [
|
|
1067
1065
|
{
|
|
1068
1066
|
iconName: "add",
|
|
1069
|
-
label:
|
|
1070
|
-
onClick:
|
|
1067
|
+
label: o.add_title,
|
|
1068
|
+
onClick: fe
|
|
1071
1069
|
}
|
|
1072
1070
|
],
|
|
1073
1071
|
calendarActions: {
|
|
@@ -1077,11 +1075,11 @@ const xt = ({
|
|
|
1077
1075
|
},
|
|
1078
1076
|
onAccountsFilterClick: Pe,
|
|
1079
1077
|
onBackClick: t,
|
|
1080
|
-
sx:
|
|
1081
|
-
title:
|
|
1078
|
+
sx: a,
|
|
1079
|
+
title: o.budgets_title,
|
|
1082
1080
|
children: [
|
|
1083
|
-
(!m || !
|
|
1084
|
-
m &&
|
|
1081
|
+
(!m || !b) && /* @__PURE__ */ e(G, {}),
|
|
1082
|
+
m && b && /* @__PURE__ */ u(
|
|
1085
1083
|
C,
|
|
1086
1084
|
{
|
|
1087
1085
|
direction: U ? "column" : "row",
|
|
@@ -1092,11 +1090,11 @@ const xt = ({
|
|
|
1092
1090
|
/* @__PURE__ */ e(C, { height: U ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
|
|
1093
1091
|
Me,
|
|
1094
1092
|
{
|
|
1095
|
-
createBudgetOnClick:
|
|
1093
|
+
createBudgetOnClick: fe,
|
|
1096
1094
|
height: U ? 450 : 800,
|
|
1097
1095
|
isDraggable: !0,
|
|
1098
1096
|
shouldShowZeroState: v.length === 0,
|
|
1099
|
-
unavailableWidth: U ? 0 :
|
|
1097
|
+
unavailableWidth: U ? 0 : Be
|
|
1100
1098
|
}
|
|
1101
1099
|
) }),
|
|
1102
1100
|
v.length !== 0 && /* @__PURE__ */ u(
|
|
@@ -1105,7 +1103,7 @@ const xt = ({
|
|
|
1105
1103
|
gap: 24,
|
|
1106
1104
|
height: "100%",
|
|
1107
1105
|
sx: { mr: 24, mt: 48 },
|
|
1108
|
-
width: U ? "100%" :
|
|
1106
|
+
width: U ? "100%" : Be,
|
|
1109
1107
|
children: [
|
|
1110
1108
|
/* @__PURE__ */ e(Nt, {}),
|
|
1111
1109
|
/* @__PURE__ */ e(kt, {})
|
|
@@ -1122,7 +1120,7 @@ const xt = ({
|
|
|
1122
1120
|
ariaLabelClose: r.close_aria,
|
|
1123
1121
|
isOpen: ke,
|
|
1124
1122
|
onClose: () => ce(!1),
|
|
1125
|
-
title:
|
|
1123
|
+
title: o.add_new_title,
|
|
1126
1124
|
children: /* @__PURE__ */ e(Ie, { onRecalculateBudgets: $e })
|
|
1127
1125
|
}
|
|
1128
1126
|
),
|