@mx-cartographer/experiences 7.0.52-alpha.mega6 → 7.0.52-alpha.mega8
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 +401 -402
- 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,15 +2,15 @@ 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 ve } from "../hooks-CE2TKk4a.mjs";
|
|
12
12
|
import { f as T } from "../NumberFormatting-CtWHhyBX.mjs";
|
|
13
|
-
import
|
|
13
|
+
import Ae from "@mui/material/Button";
|
|
14
14
|
import ae from "@mui/material/Divider";
|
|
15
15
|
import K from "@mui/material/ListItem";
|
|
16
16
|
import re from "@mui/material/ListItemAvatar";
|
|
@@ -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(
|
|
88
|
-
/* @__PURE__ */ e(
|
|
87
|
+
/* @__PURE__ */ e(Ae, { 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
|
-
|
|
284
|
-
let
|
|
285
|
-
|
|
281
|
+
} = t, h = o < 400 ? -8 : -12;
|
|
282
|
+
let x = h, v = h;
|
|
283
|
+
p > P ? (x = -14, v = -45) : p > de && (v = -32);
|
|
284
|
+
let A = 32;
|
|
285
|
+
p <= P && (A = o < 400 ? 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:
|
|
318
|
-
|
|
319
|
-
|
|
317
|
+
/* @__PURE__ */ e("svg", { x, y: v, children: /* @__PURE__ */ e(N, { name: g, size: A, 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,
|
|
392
|
-
|
|
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)) });
|
|
395
|
+
}, vt = I(xt), At = ({
|
|
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, svg: { height: 32, width: 32 } }
|
|
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,25 +438,24 @@ 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
|
-
padding: t ? 5 : 0
|
|
447
|
+
padding: t ? 5 : 0,
|
|
448
|
+
...n && { svg: { height: 32, width: 32 } }
|
|
449
449
|
}
|
|
450
450
|
}
|
|
451
451
|
) : /* @__PURE__ */ e(
|
|
452
452
|
le,
|
|
453
453
|
{
|
|
454
|
-
buttonStyles: {
|
|
455
|
-
...a && { mt: 24 }
|
|
456
|
-
},
|
|
457
454
|
header: c.create_budgets_title,
|
|
458
455
|
icon: "bubble_chart",
|
|
459
456
|
iconColor: "#1A1A1A",
|
|
460
|
-
onClick: (
|
|
461
|
-
|
|
457
|
+
onClick: (h) => {
|
|
458
|
+
h === "primary" ? S() : i();
|
|
462
459
|
},
|
|
463
460
|
primaryButton: c.empty_state_primary_button,
|
|
464
461
|
secondaryButton: t ? void 0 : c.empty_state_secondary_button,
|
|
@@ -466,12 +463,14 @@ const xt = ({
|
|
|
466
463
|
sx: {
|
|
467
464
|
width: t ? "100%" : { sm: 432 },
|
|
468
465
|
height: t ? "100%" : { sm: 468 },
|
|
469
|
-
mt:
|
|
466
|
+
mt: n ? 0 : 50,
|
|
470
467
|
".buttons-footer": {
|
|
471
468
|
width: 208,
|
|
472
|
-
height: 100
|
|
469
|
+
height: 100,
|
|
470
|
+
...n && { mt: 24, button: { height: "max-content" } }
|
|
473
471
|
},
|
|
474
|
-
padding: t ? 4 : 0
|
|
472
|
+
padding: t ? 4 : 0,
|
|
473
|
+
...n && { svg: { height: 32, width: 32 } }
|
|
475
474
|
}
|
|
476
475
|
}
|
|
477
476
|
) });
|
|
@@ -479,61 +478,61 @@ const xt = ({
|
|
|
479
478
|
({
|
|
480
479
|
createBudgetOnClick: t = () => {
|
|
481
480
|
},
|
|
482
|
-
height:
|
|
481
|
+
height: a,
|
|
483
482
|
isDraggable: i = !1,
|
|
484
483
|
isMiniWidget: s = !1,
|
|
485
|
-
shouldShowZeroState:
|
|
486
|
-
unavailableWidth:
|
|
484
|
+
shouldShowZeroState: n,
|
|
485
|
+
unavailableWidth: o = 24
|
|
487
486
|
}) => {
|
|
488
|
-
const { onEvent: r } = X(), { setSelectedBudget: c } = D(), { isLoadingCategoryTotals: m } = j(), { isInitialized:
|
|
489
|
-
c(
|
|
490
|
-
budget_category:
|
|
487
|
+
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 = (v) => {
|
|
488
|
+
c(v), r(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
489
|
+
budget_category: v.category.name,
|
|
491
490
|
click_type: "bubble"
|
|
492
491
|
});
|
|
493
492
|
}, x = () => {
|
|
494
|
-
|
|
493
|
+
b(!0), r(L.ACCOUNTS_CLICK_CONNECT);
|
|
495
494
|
};
|
|
496
|
-
return m ? /* @__PURE__ */ e(C, { alignItems: "center", height:
|
|
497
|
-
|
|
498
|
-
|
|
495
|
+
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: [
|
|
496
|
+
n || !g ? /* @__PURE__ */ e(
|
|
497
|
+
At,
|
|
499
498
|
{
|
|
500
499
|
createBudgetOnClick: t,
|
|
501
500
|
isMiniWidget: s,
|
|
502
501
|
onConnectAccountsClick: x
|
|
503
502
|
}
|
|
504
503
|
) : /* @__PURE__ */ e(
|
|
505
|
-
|
|
504
|
+
vt,
|
|
506
505
|
{
|
|
507
|
-
height:
|
|
506
|
+
height: a,
|
|
508
507
|
isDraggable: i,
|
|
509
|
-
onClick:
|
|
508
|
+
onClick: h,
|
|
510
509
|
width: S
|
|
511
510
|
}
|
|
512
511
|
),
|
|
513
512
|
/* @__PURE__ */ e(
|
|
514
513
|
We,
|
|
515
514
|
{
|
|
516
|
-
onClose: () =>
|
|
517
|
-
showConnectionsWidget:
|
|
518
|
-
title:
|
|
515
|
+
onClose: () => b(!1),
|
|
516
|
+
showConnectionsWidget: p,
|
|
517
|
+
title: d.manage_connections
|
|
519
518
|
}
|
|
520
519
|
)
|
|
521
520
|
] });
|
|
522
521
|
}
|
|
523
522
|
), Tt = ({
|
|
524
523
|
budgetsCopy: t,
|
|
525
|
-
difference:
|
|
524
|
+
difference: a,
|
|
526
525
|
handleAddClick: i,
|
|
527
526
|
shouldShowZeroState: s
|
|
528
527
|
}) => {
|
|
529
|
-
const { availableHeight:
|
|
528
|
+
const { availableHeight: n = 0 } = te(), o = l.useRef(null);
|
|
530
529
|
l.useEffect(() => {
|
|
531
|
-
|
|
532
|
-
}, [
|
|
530
|
+
n > 0 && o.current === null && (o.current = n);
|
|
531
|
+
}, [n]);
|
|
533
532
|
const r = l.useMemo(() => {
|
|
534
|
-
const c =
|
|
535
|
-
return c > 0 ? Math.round(Math.max(
|
|
536
|
-
}, [
|
|
533
|
+
const c = o.current ?? n;
|
|
534
|
+
return c > 0 ? Math.round(Math.max(120, Math.min(450, c * 0.8))) - 40 : 450;
|
|
535
|
+
}, [n]);
|
|
537
536
|
return /* @__PURE__ */ u(C, { sx: { height: "100%", justifyContent: "space-between" }, children: [
|
|
538
537
|
/* @__PURE__ */ e(
|
|
539
538
|
Me,
|
|
@@ -545,38 +544,38 @@ const xt = ({
|
|
|
545
544
|
}
|
|
546
545
|
),
|
|
547
546
|
!s && /* @__PURE__ */ u(F, { ml: 16, children: [
|
|
548
|
-
/* @__PURE__ */ e(
|
|
549
|
-
/* @__PURE__ */ e(
|
|
547
|
+
/* @__PURE__ */ e(y, { bold: !0, color: a < 0 ? "error.main" : "success.main", children: T(Math.abs(a), "0,0") }),
|
|
548
|
+
/* @__PURE__ */ e(y, { children: a < 0 ? t.overspent_in_budgets : t.left_in_budgets })
|
|
550
549
|
] })
|
|
551
550
|
] });
|
|
552
551
|
}, wt = (t) => {
|
|
553
|
-
const
|
|
554
|
-
|
|
555
|
-
},
|
|
552
|
+
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 = () => {
|
|
553
|
+
h(!0), i(L.BUDGETS_CLICK_ADD);
|
|
554
|
+
}, v = () => h(!1);
|
|
556
555
|
return l.useEffect(() => {
|
|
557
|
-
r(
|
|
558
|
-
}, [
|
|
559
|
-
|
|
556
|
+
r(a);
|
|
557
|
+
}, [a]), l.useEffect(() => {
|
|
558
|
+
d && !n && _(f, q(/* @__PURE__ */ new Date()), ue(/* @__PURE__ */ new Date())).then(
|
|
560
559
|
() => {
|
|
561
|
-
|
|
560
|
+
o().finally();
|
|
562
561
|
}
|
|
563
562
|
);
|
|
564
|
-
}, [
|
|
563
|
+
}, [d, f]), g ? /* @__PURE__ */ u(
|
|
565
564
|
Ye,
|
|
566
565
|
{
|
|
567
|
-
contentStyles: { height: "calc(100% - 52px)" },
|
|
568
|
-
primaryCtaLabel:
|
|
566
|
+
contentStyles: { height: "calc(100% - 52px)", ":last-child": { pb: 16 } },
|
|
567
|
+
primaryCtaLabel: b ? c.get_started_cta : c.details_cta,
|
|
569
568
|
sx: { height: "100%" },
|
|
570
569
|
title: c.budgets_title,
|
|
571
570
|
...t,
|
|
572
571
|
children: [
|
|
573
|
-
|
|
572
|
+
n ? /* @__PURE__ */ e(
|
|
574
573
|
Tt,
|
|
575
574
|
{
|
|
576
575
|
budgetsCopy: c,
|
|
577
|
-
difference:
|
|
576
|
+
difference: p,
|
|
578
577
|
handleAddClick: x,
|
|
579
|
-
shouldShowZeroState:
|
|
578
|
+
shouldShowZeroState: b
|
|
580
579
|
}
|
|
581
580
|
) : /* @__PURE__ */ e(G, {}),
|
|
582
581
|
/* @__PURE__ */ e(
|
|
@@ -584,9 +583,9 @@ const xt = ({
|
|
|
584
583
|
{
|
|
585
584
|
ariaLabelClose: m.close_aria,
|
|
586
585
|
isOpen: S,
|
|
587
|
-
onClose: () =>
|
|
586
|
+
onClose: () => h(!1),
|
|
588
587
|
title: c.add_new_title,
|
|
589
|
-
children: /* @__PURE__ */ e(Ie, { onRecalculateBudgets:
|
|
588
|
+
children: /* @__PURE__ */ e(Ie, { onRecalculateBudgets: v })
|
|
590
589
|
}
|
|
591
590
|
)
|
|
592
591
|
]
|
|
@@ -594,70 +593,70 @@ const xt = ({
|
|
|
594
593
|
) : /* @__PURE__ */ e(G, {});
|
|
595
594
|
}, Mn = I(wt), Re = ({ budget: t }) => {
|
|
596
595
|
const {
|
|
597
|
-
amount:
|
|
596
|
+
amount: a,
|
|
598
597
|
budgetColors: { background: i },
|
|
599
598
|
category: { name: s },
|
|
600
|
-
category_guid:
|
|
601
|
-
percentage:
|
|
599
|
+
category_guid: n,
|
|
600
|
+
percentage: o,
|
|
602
601
|
transaction_total: r
|
|
603
602
|
} = t, c = [
|
|
604
603
|
{
|
|
605
604
|
color: i,
|
|
606
|
-
percentage: `${
|
|
605
|
+
percentage: `${o}%`
|
|
607
606
|
}
|
|
608
607
|
];
|
|
609
|
-
return /* @__PURE__ */ e(
|
|
610
|
-
/* @__PURE__ */ e(H, { categoryGuid:
|
|
611
|
-
/* @__PURE__ */ e(ze, { children: `${T(r, "0,0")} / ${T(
|
|
612
|
-
/* @__PURE__ */ e(
|
|
608
|
+
return /* @__PURE__ */ e(pe, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(he, { children: /* @__PURE__ */ u(C, { alignItems: "center", gap: 16, children: [
|
|
609
|
+
/* @__PURE__ */ e(H, { categoryGuid: n, size: 56 }),
|
|
610
|
+
/* @__PURE__ */ e(ze, { children: `${T(r, "0,0")} / ${T(a, "0,0")}` }),
|
|
611
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "XSmall", children: s }),
|
|
613
612
|
/* @__PURE__ */ e(me, { data: c, height: 10 })
|
|
614
613
|
] }) }) });
|
|
615
614
|
}, Dt = I(() => {
|
|
616
615
|
const { budgets: t } = w();
|
|
617
616
|
return /* @__PURE__ */ u(C, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
|
|
618
617
|
/* @__PURE__ */ e(N, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
|
|
619
|
-
/* @__PURE__ */ e(
|
|
620
|
-
/* @__PURE__ */ e(
|
|
618
|
+
/* @__PURE__ */ e(y, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
|
|
619
|
+
/* @__PURE__ */ e(y, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
|
|
621
620
|
] });
|
|
622
621
|
}), It = I(({ budget: t }) => {
|
|
623
622
|
const {
|
|
624
|
-
amount:
|
|
623
|
+
amount: a,
|
|
625
624
|
budgetColors: { background: i },
|
|
626
625
|
category: s,
|
|
627
|
-
percentage:
|
|
628
|
-
transaction_total:
|
|
626
|
+
percentage: n,
|
|
627
|
+
transaction_total: o
|
|
629
628
|
} = t, { setSelectedSubBudget: r } = D();
|
|
630
629
|
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:
|
|
630
|
+
/* @__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
631
|
/* @__PURE__ */ e(
|
|
633
632
|
Y,
|
|
634
633
|
{
|
|
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(
|
|
634
|
+
primary: /* @__PURE__ */ e(C, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t.category.name }) }),
|
|
635
|
+
secondary: /* @__PURE__ */ e(C, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(y, { fontWeight: 400, variant: "Body", children: `
|
|
636
|
+
${T(o, "0,0")} /
|
|
637
|
+
${T(a, "0,0")}
|
|
639
638
|
` }) })
|
|
640
639
|
}
|
|
641
640
|
)
|
|
642
641
|
] }) });
|
|
643
|
-
}), Et = I(({ category: t, parentBudget:
|
|
644
|
-
const { budgets: i, common: s } = w(), { setExpandedGuid:
|
|
642
|
+
}), Et = I(({ category: t, parentBudget: a }) => {
|
|
643
|
+
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
644
|
l.useEffect(() => {
|
|
646
|
-
|
|
647
|
-
const
|
|
648
|
-
|
|
645
|
+
o((x) => {
|
|
646
|
+
const v = t.subCategories.find((A) => A.guid === x);
|
|
647
|
+
v && (b(v), _(`${v.currentAmount === 0 ? "" : v.currentAmount}`), d(!0));
|
|
649
648
|
});
|
|
650
649
|
}, []);
|
|
651
650
|
const S = () => {
|
|
652
|
-
|
|
653
|
-
},
|
|
654
|
-
|
|
651
|
+
n(t.guid), m(!0);
|
|
652
|
+
}, h = async () => {
|
|
653
|
+
p && Number(f) > 0 && (await r(p, Number(f), a.guid), d(!1), m(!1), b(void 0));
|
|
655
654
|
};
|
|
656
655
|
return /* @__PURE__ */ u(F, { children: [
|
|
657
656
|
/* @__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
657
|
/* @__PURE__ */ u(C, { alignItems: "center", direction: "row", gap: 8, children: [
|
|
659
658
|
/* @__PURE__ */ e(N, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
|
|
660
|
-
/* @__PURE__ */ e(
|
|
659
|
+
/* @__PURE__ */ e(y, { bold: !0, sx: { color: "primary.light" }, variant: "Body", children: i.add_sub_budget_button })
|
|
661
660
|
] }),
|
|
662
661
|
/* @__PURE__ */ e(N, { name: "chevron_right", size: 24, sx: { color: "primary.light" } })
|
|
663
662
|
] }) }) }) }),
|
|
@@ -676,16 +675,16 @@ const xt = ({
|
|
|
676
675
|
$,
|
|
677
676
|
{
|
|
678
677
|
copy: { close_aria: s.close_aria, title: i.add_title },
|
|
679
|
-
disablePrimaryButton: Number(
|
|
680
|
-
isOpen:
|
|
681
|
-
onClose: () =>
|
|
682
|
-
onPrimaryAction:
|
|
678
|
+
disablePrimaryButton: Number(f) <= 0,
|
|
679
|
+
isOpen: g,
|
|
680
|
+
onClose: () => d(!1),
|
|
681
|
+
onPrimaryAction: h,
|
|
683
682
|
primaryText: i.add_save_button,
|
|
684
683
|
children: /* @__PURE__ */ e(
|
|
685
684
|
se,
|
|
686
685
|
{
|
|
687
|
-
amount:
|
|
688
|
-
categoryName:
|
|
686
|
+
amount: f,
|
|
687
|
+
categoryName: p?.name || "",
|
|
689
688
|
onAmountChanged: _
|
|
690
689
|
}
|
|
691
690
|
)
|
|
@@ -693,10 +692,10 @@ const xt = ({
|
|
|
693
692
|
)
|
|
694
693
|
] });
|
|
695
694
|
}), Ot = I(({ budget: t }) => {
|
|
696
|
-
const { category:
|
|
695
|
+
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
696
|
l.useEffect(() => {
|
|
698
|
-
r && (
|
|
699
|
-
...
|
|
697
|
+
r && (h(`${r.amount}`), d({
|
|
698
|
+
...g,
|
|
700
699
|
custom: (B) => B.category_guid === r.category_guid
|
|
701
700
|
}));
|
|
702
701
|
}, [r]);
|
|
@@ -705,11 +704,11 @@ const xt = ({
|
|
|
705
704
|
...r,
|
|
706
705
|
amount: Number(S)
|
|
707
706
|
});
|
|
708
|
-
},
|
|
709
|
-
r && await
|
|
710
|
-
},
|
|
711
|
-
|
|
712
|
-
...
|
|
707
|
+
}, v = async () => {
|
|
708
|
+
r && await o(r.guid), b(!1), A();
|
|
709
|
+
}, A = () => {
|
|
710
|
+
d({
|
|
711
|
+
...g,
|
|
713
712
|
custom: (B) => B.category_guid === t.category_guid || B.top_level_category_guid === t.category_guid
|
|
714
713
|
}), c(void 0);
|
|
715
714
|
};
|
|
@@ -719,16 +718,16 @@ const xt = ({
|
|
|
719
718
|
/* @__PURE__ */ e(It, { budget: B }),
|
|
720
719
|
/* @__PURE__ */ e(ae, {})
|
|
721
720
|
] }, B.guid)),
|
|
722
|
-
/* @__PURE__ */ e(Et, { category:
|
|
721
|
+
/* @__PURE__ */ e(Et, { category: a, parentBudget: t })
|
|
723
722
|
] }),
|
|
724
723
|
/* @__PURE__ */ e(
|
|
725
724
|
k,
|
|
726
725
|
{
|
|
727
|
-
ariaLabelClose:
|
|
726
|
+
ariaLabelClose: n.close_aria,
|
|
728
727
|
isOpen: !!r,
|
|
729
|
-
onClose:
|
|
728
|
+
onClose: A,
|
|
730
729
|
onPrimaryAction: () => _(!0),
|
|
731
|
-
onSecondaryAction: () =>
|
|
730
|
+
onSecondaryAction: () => b(!0),
|
|
732
731
|
primaryText: s.details_edit_button,
|
|
733
732
|
secondaryText: s.details_delete_button,
|
|
734
733
|
title: s.details_title,
|
|
@@ -742,9 +741,9 @@ const xt = ({
|
|
|
742
741
|
/* @__PURE__ */ e(
|
|
743
742
|
$,
|
|
744
743
|
{
|
|
745
|
-
copy: { close_aria:
|
|
744
|
+
copy: { close_aria: n.close_aria, title: s.details_edit_title },
|
|
746
745
|
disablePrimaryButton: Number(S) <= 0,
|
|
747
|
-
isOpen:
|
|
746
|
+
isOpen: f,
|
|
748
747
|
onClose: () => _(!1),
|
|
749
748
|
onPrimaryAction: x,
|
|
750
749
|
primaryText: s.edit_save_button,
|
|
@@ -753,7 +752,7 @@ const xt = ({
|
|
|
753
752
|
{
|
|
754
753
|
amount: S,
|
|
755
754
|
categoryName: r.category.name,
|
|
756
|
-
onAmountChanged:
|
|
755
|
+
onAmountChanged: h
|
|
757
756
|
}
|
|
758
757
|
)
|
|
759
758
|
}
|
|
@@ -761,31 +760,31 @@ const xt = ({
|
|
|
761
760
|
/* @__PURE__ */ e(
|
|
762
761
|
$,
|
|
763
762
|
{
|
|
764
|
-
copy: { close_aria:
|
|
765
|
-
isOpen:
|
|
766
|
-
onClose: () =>
|
|
767
|
-
onPrimaryAction:
|
|
763
|
+
copy: { close_aria: n.close_aria, title: s.delete_title },
|
|
764
|
+
isOpen: p,
|
|
765
|
+
onClose: () => b(!1),
|
|
766
|
+
onPrimaryAction: v,
|
|
768
767
|
primaryColor: "error",
|
|
769
768
|
primaryText: "Delete",
|
|
770
769
|
secondaryColor: "secondary",
|
|
771
|
-
children: /* @__PURE__ */ e(
|
|
770
|
+
children: /* @__PURE__ */ e(y, { variant: "Paragraph", children: M(s.delete_description, r.category.name) })
|
|
772
771
|
}
|
|
773
772
|
)
|
|
774
773
|
] })
|
|
775
774
|
] });
|
|
776
775
|
}), Mt = I(({ budget: t }) => {
|
|
777
|
-
const { is_mobile_webview:
|
|
778
|
-
sortedTransactions:
|
|
779
|
-
sortedTransactionsWithSplits:
|
|
780
|
-
tags:
|
|
781
|
-
} = oe(), [_,
|
|
782
|
-
() =>
|
|
783
|
-
[
|
|
776
|
+
const { is_mobile_webview: a } = Ue(), { setAlert: i } = D(), { budgets: s, common: n, transactions: o } = w(), { isDesktop: r, isSmallTablet: c, isTablet: m } = ge(), {
|
|
777
|
+
sortedTransactions: g,
|
|
778
|
+
sortedTransactionsWithSplits: d,
|
|
779
|
+
tags: f
|
|
780
|
+
} = oe(), [_, p] = l.useState(0), [b, S] = l.useState(""), h = l.useMemo(
|
|
781
|
+
() => g.find((B) => B.guid === b),
|
|
782
|
+
[b, g]
|
|
784
783
|
), x = (B, E) => {
|
|
785
|
-
|
|
786
|
-
},
|
|
787
|
-
et(
|
|
788
|
-
},
|
|
784
|
+
p(E);
|
|
785
|
+
}, v = () => {
|
|
786
|
+
et(d, f), i(s.alert_csv_downloaded);
|
|
787
|
+
}, A = g.length > 0 && !a && (r || m && !c);
|
|
789
788
|
return /* @__PURE__ */ u(C, { gap: 24, children: [
|
|
790
789
|
/* @__PURE__ */ e(Re, { budget: t }),
|
|
791
790
|
/* @__PURE__ */ u(C, { children: [
|
|
@@ -798,19 +797,19 @@ const xt = ({
|
|
|
798
797
|
value: _,
|
|
799
798
|
variant: "fullWidth",
|
|
800
799
|
children: [
|
|
801
|
-
/* @__PURE__ */ e(
|
|
802
|
-
/* @__PURE__ */ e(
|
|
800
|
+
/* @__PURE__ */ e(ye, { label: s.details_transactions_tab }),
|
|
801
|
+
/* @__PURE__ */ e(ye, { label: s.details_subbudgets_tab })
|
|
803
802
|
]
|
|
804
803
|
}
|
|
805
804
|
),
|
|
806
805
|
_ === 0 && /* @__PURE__ */ u(C, { children: [
|
|
807
|
-
|
|
808
|
-
|
|
806
|
+
A && /* @__PURE__ */ e(C, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
|
|
807
|
+
Ae,
|
|
809
808
|
{
|
|
810
|
-
onClick:
|
|
809
|
+
onClick: v,
|
|
811
810
|
startIcon: /* @__PURE__ */ e(N, { name: "ios_share" }),
|
|
812
811
|
variant: "text",
|
|
813
|
-
children:
|
|
812
|
+
children: o.export_csv_btn
|
|
814
813
|
}
|
|
815
814
|
) }),
|
|
816
815
|
/* @__PURE__ */ e(Te, { height: "100%", onClick: S })
|
|
@@ -819,78 +818,78 @@ const xt = ({
|
|
|
819
818
|
/* @__PURE__ */ e(
|
|
820
819
|
k,
|
|
821
820
|
{
|
|
822
|
-
ariaLabelClose:
|
|
823
|
-
isOpen: !!
|
|
821
|
+
ariaLabelClose: n.close_aria,
|
|
822
|
+
isOpen: !!h,
|
|
824
823
|
onClose: () => S(""),
|
|
825
824
|
title: s.details_transaction_drawer,
|
|
826
|
-
children:
|
|
825
|
+
children: h && /* @__PURE__ */ e(tt, { transaction: h })
|
|
827
826
|
}
|
|
828
827
|
)
|
|
829
828
|
] })
|
|
830
829
|
] });
|
|
831
830
|
}), Rt = I(() => {
|
|
832
|
-
const { selectedAccountGuids: t } = ne(), { budgets:
|
|
831
|
+
const { selectedAccountGuids: t } = ne(), { budgets: a, common: i } = w(), {
|
|
833
832
|
dateRange: s,
|
|
834
|
-
deleteBudget:
|
|
835
|
-
selectedBudget:
|
|
833
|
+
deleteBudget: n,
|
|
834
|
+
selectedBudget: o,
|
|
836
835
|
selectedSubBudget: r,
|
|
837
836
|
setAlert: c,
|
|
838
837
|
setSelectedBudget: m,
|
|
839
|
-
updateBudget:
|
|
840
|
-
} = D(), { setFilter:
|
|
838
|
+
updateBudget: g
|
|
839
|
+
} = D(), { setFilter: d } = oe(), [f, _] = l.useState(!1), [p, b] = l.useState(!1), [S, h] = l.useState(!1), [x, v] = l.useState("");
|
|
841
840
|
l.useEffect(() => {
|
|
842
|
-
|
|
841
|
+
o && !r && (v(`${o.amount}`), _(!0), d({
|
|
843
842
|
accounts: t,
|
|
844
843
|
dateRange: s,
|
|
845
|
-
custom: (R) => R.category_guid ===
|
|
844
|
+
custom: (R) => R.category_guid === o.category_guid || R.top_level_category_guid === o.category_guid,
|
|
846
845
|
showSplits: !0
|
|
847
846
|
}));
|
|
848
|
-
}, [
|
|
849
|
-
const
|
|
850
|
-
|
|
851
|
-
...
|
|
847
|
+
}, [o]);
|
|
848
|
+
const A = async () => {
|
|
849
|
+
o && (await g({
|
|
850
|
+
...o,
|
|
852
851
|
amount: Number(x),
|
|
853
|
-
percentage:
|
|
854
|
-
}), c(M(
|
|
852
|
+
percentage: o.category.totalAmount / Number(x) * 100
|
|
853
|
+
}), c(M(a.alert_budget_updated, o.category.name)));
|
|
855
854
|
}, B = async () => {
|
|
856
|
-
|
|
855
|
+
o && (await n(o.guid), c(M(a.alert_budget_deleted, o.category.name))), h(!1), E();
|
|
857
856
|
}, E = () => {
|
|
858
857
|
_(!1), setTimeout(() => {
|
|
859
858
|
m(void 0);
|
|
860
859
|
}, 250);
|
|
861
860
|
};
|
|
862
|
-
if (
|
|
861
|
+
if (o)
|
|
863
862
|
return /* @__PURE__ */ u(l.Fragment, { children: [
|
|
864
863
|
/* @__PURE__ */ e(
|
|
865
864
|
k,
|
|
866
865
|
{
|
|
867
866
|
ariaLabelClose: i.close_aria,
|
|
868
|
-
isOpen:
|
|
867
|
+
isOpen: f,
|
|
869
868
|
onClose: E,
|
|
870
|
-
onPrimaryAction: () =>
|
|
871
|
-
onSecondaryAction: () =>
|
|
872
|
-
primaryText:
|
|
869
|
+
onPrimaryAction: () => b(!0),
|
|
870
|
+
onSecondaryAction: () => h(!0),
|
|
871
|
+
primaryText: a.details_edit_button,
|
|
873
872
|
secondaryColor: "error",
|
|
874
|
-
secondaryText:
|
|
875
|
-
title:
|
|
876
|
-
children: /* @__PURE__ */ e(Mt, { budget:
|
|
873
|
+
secondaryText: a.details_delete_button,
|
|
874
|
+
title: a.details_title,
|
|
875
|
+
children: /* @__PURE__ */ e(Mt, { budget: o })
|
|
877
876
|
}
|
|
878
877
|
),
|
|
879
878
|
/* @__PURE__ */ e(
|
|
880
879
|
$,
|
|
881
880
|
{
|
|
882
|
-
copy: { close_aria: i.close_aria, title:
|
|
881
|
+
copy: { close_aria: i.close_aria, title: a.details_edit_title },
|
|
883
882
|
disablePrimaryButton: Number(x) <= 0,
|
|
884
|
-
isOpen:
|
|
885
|
-
onClose: () =>
|
|
886
|
-
onPrimaryAction:
|
|
887
|
-
primaryText:
|
|
883
|
+
isOpen: p,
|
|
884
|
+
onClose: () => b(!1),
|
|
885
|
+
onPrimaryAction: A,
|
|
886
|
+
primaryText: a.edit_save_button,
|
|
888
887
|
children: /* @__PURE__ */ e(
|
|
889
888
|
se,
|
|
890
889
|
{
|
|
891
890
|
amount: x,
|
|
892
|
-
categoryName:
|
|
893
|
-
onAmountChanged:
|
|
891
|
+
categoryName: o.category.name,
|
|
892
|
+
onAmountChanged: v
|
|
894
893
|
}
|
|
895
894
|
)
|
|
896
895
|
}
|
|
@@ -898,64 +897,64 @@ const xt = ({
|
|
|
898
897
|
/* @__PURE__ */ e(
|
|
899
898
|
$,
|
|
900
899
|
{
|
|
901
|
-
copy: { close_aria: i.close_aria, title:
|
|
900
|
+
copy: { close_aria: i.close_aria, title: a.delete_title },
|
|
902
901
|
isOpen: S,
|
|
903
|
-
onClose: () =>
|
|
902
|
+
onClose: () => h(!1),
|
|
904
903
|
onPrimaryAction: B,
|
|
905
904
|
primaryColor: "error",
|
|
906
|
-
primaryText:
|
|
905
|
+
primaryText: a.details_delete_button,
|
|
907
906
|
secondaryColor: "secondary",
|
|
908
|
-
children: /* @__PURE__ */ e(
|
|
907
|
+
children: /* @__PURE__ */ e(y, { variant: "Paragraph", children: M(a.delete_description, o.category.name) })
|
|
909
908
|
}
|
|
910
909
|
)
|
|
911
910
|
] });
|
|
912
|
-
}), Lt = ({ budget: t, onClick:
|
|
911
|
+
}), Lt = ({ budget: t, onClick: a }) => {
|
|
913
912
|
const {
|
|
914
913
|
amount: i,
|
|
915
|
-
budgetColors: { background: s, description:
|
|
916
|
-
category_guid:
|
|
914
|
+
budgetColors: { background: s, description: n },
|
|
915
|
+
category_guid: o,
|
|
917
916
|
description: r,
|
|
918
917
|
percentage: c,
|
|
919
918
|
subBudgets: m,
|
|
920
|
-
transaction_total:
|
|
919
|
+
transaction_total: g
|
|
921
920
|
} = 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:
|
|
921
|
+
return /* @__PURE__ */ e(K, { children: /* @__PURE__ */ u(V, { onClick: () => a?.(t), children: [
|
|
922
|
+
/* @__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
923
|
/* @__PURE__ */ e(
|
|
925
924
|
Y,
|
|
926
925
|
{
|
|
927
926
|
primary: /* @__PURE__ */ u(C, { component: "span", direction: "row", justifyContent: "space-between", children: [
|
|
928
|
-
/* @__PURE__ */ e(
|
|
929
|
-
/* @__PURE__ */ e(
|
|
930
|
-
${T(
|
|
927
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t.category.name }),
|
|
928
|
+
/* @__PURE__ */ e(y, { fontWeight: 400, variant: "Body", children: `
|
|
929
|
+
${T(g, "0,0")} /
|
|
931
930
|
${T(i, "0,0")}
|
|
932
931
|
` })
|
|
933
932
|
] }),
|
|
934
933
|
secondary: /* @__PURE__ */ u(C, { component: "span", direction: "row", justifyContent: "space-between", children: [
|
|
935
|
-
/* @__PURE__ */ e(
|
|
936
|
-
/* @__PURE__ */ e(
|
|
934
|
+
/* @__PURE__ */ e(y, { variant: "XSmall", children: `${m.length} Sub-budgets` }),
|
|
935
|
+
/* @__PURE__ */ e(y, { bold: c > 100, color: n, variant: "XSmall", children: r })
|
|
937
936
|
] })
|
|
938
937
|
}
|
|
939
938
|
)
|
|
940
939
|
] }) });
|
|
941
940
|
}, kt = I(() => {
|
|
942
|
-
const { onEvent: t } = X(), { budgets:
|
|
943
|
-
s(
|
|
944
|
-
budget_category:
|
|
941
|
+
const { onEvent: t } = X(), { budgets: a } = w(), { detailedBudgets: i, setSelectedBudget: s } = D(), n = (o) => {
|
|
942
|
+
s(o), t(L.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
943
|
+
budget_category: o.category.name,
|
|
945
944
|
click_type: "list"
|
|
946
945
|
});
|
|
947
946
|
};
|
|
948
|
-
return /* @__PURE__ */ u(
|
|
949
|
-
/* @__PURE__ */ e(De, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(
|
|
950
|
-
/* @__PURE__ */ e(
|
|
951
|
-
/* @__PURE__ */ e(Lt, { budget:
|
|
947
|
+
return /* @__PURE__ */ u(pe, { elevation: 2, children: [
|
|
948
|
+
/* @__PURE__ */ e(De, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(xe, { children: a.budget_categories_title }) }),
|
|
949
|
+
/* @__PURE__ */ e(he, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(W, { children: i.map((o) => /* @__PURE__ */ u(l.Fragment, { children: [
|
|
950
|
+
/* @__PURE__ */ e(Lt, { budget: o, onClick: n }),
|
|
952
951
|
/* @__PURE__ */ e(ae, {})
|
|
953
|
-
] },
|
|
952
|
+
] }, o.guid)) }) })
|
|
954
953
|
] });
|
|
955
954
|
}), Nt = I(() => {
|
|
956
|
-
const t =
|
|
957
|
-
const
|
|
958
|
-
let B =
|
|
955
|
+
const t = Q(), { onEvent: a } = X(), { visibleAccounts: i } = ve(), { 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(() => {
|
|
956
|
+
const A = c.reduce((z, ie) => z + ie.totalAmount, 0);
|
|
957
|
+
let B = A / g;
|
|
959
958
|
B > 1 && (B = 1);
|
|
960
959
|
let E = t.palette.success.main;
|
|
961
960
|
B > 0.8 && B < 1 ? E = t.palette.warning.main : B >= 1 && (E = t.palette.error.main);
|
|
@@ -965,12 +964,12 @@ const xt = ({
|
|
|
965
964
|
percentage: `${B}`
|
|
966
965
|
}
|
|
967
966
|
];
|
|
968
|
-
return [
|
|
969
|
-
}, [m, c]), [
|
|
970
|
-
const
|
|
967
|
+
return [A, R];
|
|
968
|
+
}, [m, c]), [h, x] = l.useMemo(() => {
|
|
969
|
+
const A = Math.abs(
|
|
971
970
|
r.reduce((R, z) => R + z.totalAmount, 0)
|
|
972
971
|
);
|
|
973
|
-
let B =
|
|
972
|
+
let B = A / d;
|
|
974
973
|
B > 1 && (B = 1);
|
|
975
974
|
const E = [
|
|
976
975
|
{
|
|
@@ -978,96 +977,96 @@ const xt = ({
|
|
|
978
977
|
percentage: `${B}`
|
|
979
978
|
}
|
|
980
979
|
];
|
|
981
|
-
return [
|
|
982
|
-
}, [r,
|
|
983
|
-
|
|
984
|
-
accounts: i.map((
|
|
980
|
+
return [A, E];
|
|
981
|
+
}, [r, d]), v = () => {
|
|
982
|
+
f({
|
|
983
|
+
accounts: i.map((A) => A.guid),
|
|
985
984
|
dateRange: {
|
|
986
985
|
start: at(/* @__PURE__ */ new Date(), 90),
|
|
987
986
|
end: /* @__PURE__ */ new Date()
|
|
988
987
|
}
|
|
989
|
-
}),
|
|
988
|
+
}), p(!0), a(L.BUDGETS_CLICK_EDIT_INCOME);
|
|
990
989
|
};
|
|
991
|
-
return /* @__PURE__ */ u(
|
|
992
|
-
/* @__PURE__ */ e(De, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(
|
|
993
|
-
/* @__PURE__ */ e(
|
|
990
|
+
return /* @__PURE__ */ u(pe, { elevation: 2, sx: { overflow: "visible" }, children: [
|
|
991
|
+
/* @__PURE__ */ e(De, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(xe, { children: s.overview_title }) }),
|
|
992
|
+
/* @__PURE__ */ e(he, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ u(C, { gap: 24, children: [
|
|
994
993
|
/* @__PURE__ */ u(C, { gap: 8, children: [
|
|
995
|
-
/* @__PURE__ */ e(
|
|
994
|
+
/* @__PURE__ */ e(y, { bold: !0, sx: { mb: 8 }, variant: "Body", children: s.spending_title }),
|
|
996
995
|
/* @__PURE__ */ e(me, { data: S, height: 16 }),
|
|
997
|
-
/* @__PURE__ */ e(
|
|
996
|
+
/* @__PURE__ */ e(y, { variant: "Small", children: M(
|
|
998
997
|
s.spending_description,
|
|
999
|
-
T(
|
|
1000
|
-
T(
|
|
998
|
+
T(b, "0,0"),
|
|
999
|
+
T(g, "0,0")
|
|
1001
1000
|
) })
|
|
1002
1001
|
] }),
|
|
1003
1002
|
/* @__PURE__ */ u(C, { gap: 8, children: [
|
|
1004
1003
|
/* @__PURE__ */ u(C, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
|
|
1005
|
-
/* @__PURE__ */ e(
|
|
1004
|
+
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: s.income_title }),
|
|
1006
1005
|
/* @__PURE__ */ e(
|
|
1007
1006
|
rt,
|
|
1008
1007
|
{
|
|
1009
|
-
"aria-label":
|
|
1010
|
-
onClick:
|
|
1008
|
+
"aria-label": o.manage_income,
|
|
1009
|
+
onClick: v,
|
|
1011
1010
|
sx: { p: 0 },
|
|
1012
1011
|
children: /* @__PURE__ */ e(N, { color: "primary", name: "edit" })
|
|
1013
1012
|
}
|
|
1014
1013
|
)
|
|
1015
1014
|
] }),
|
|
1016
1015
|
/* @__PURE__ */ e(me, { data: x, height: 16 }),
|
|
1017
|
-
/* @__PURE__ */ e(
|
|
1016
|
+
/* @__PURE__ */ e(y, { variant: "Small", children: M(
|
|
1018
1017
|
s.income_description,
|
|
1019
|
-
T(
|
|
1020
|
-
T(
|
|
1018
|
+
T(h, "0,0"),
|
|
1019
|
+
T(d, "0,0")
|
|
1021
1020
|
) })
|
|
1022
1021
|
] })
|
|
1023
1022
|
] }) }),
|
|
1024
1023
|
/* @__PURE__ */ e(
|
|
1025
1024
|
k,
|
|
1026
1025
|
{
|
|
1027
|
-
ariaLabelClose:
|
|
1026
|
+
ariaLabelClose: n.close_aria,
|
|
1028
1027
|
isOpen: _,
|
|
1029
|
-
onClose: () =>
|
|
1030
|
-
title:
|
|
1028
|
+
onClose: () => p(!1),
|
|
1029
|
+
title: o.manage_income,
|
|
1031
1030
|
children: /* @__PURE__ */ e(st, { forOverview: !0 })
|
|
1032
1031
|
}
|
|
1033
1032
|
)
|
|
1034
1033
|
] });
|
|
1035
|
-
}),
|
|
1036
|
-
const i =
|
|
1034
|
+
}), Be = 480, Rn = I(({ onBackClick: t, sx: a }) => {
|
|
1035
|
+
const i = Q(), { onEvent: s } = X(), { visibleAccounts: n } = ve(), { budgets: o, common: r } = w(), { isCopyLoaded: c, isInitialized: m, selectedAccounts: g, setDisplayedDate: d, setSelectedAccounts: f } = ne(), {
|
|
1037
1036
|
alert: _,
|
|
1038
|
-
dateRange:
|
|
1039
|
-
isDataLoaded:
|
|
1037
|
+
dateRange: p,
|
|
1038
|
+
isDataLoaded: b,
|
|
1040
1039
|
loadBudgetData: S,
|
|
1041
|
-
setDateRange:
|
|
1040
|
+
setDateRange: h,
|
|
1042
1041
|
setAlert: x,
|
|
1043
|
-
setTheme:
|
|
1044
|
-
detailedBudgets:
|
|
1045
|
-
} = D(), { loadRepeatingTransactions: B, setDateRange: E } =
|
|
1046
|
-
l.useEffect(() => (
|
|
1047
|
-
|
|
1042
|
+
setTheme: v,
|
|
1043
|
+
detailedBudgets: A
|
|
1044
|
+
} = 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);
|
|
1045
|
+
l.useEffect(() => (v(i), f(n), h({ start: q(Z()), end: ue(Z()) }), s(L.BUDGETS_VIEW), () => {
|
|
1046
|
+
h({ start: q(Z()), end: ue(Z()) });
|
|
1048
1047
|
}), []), l.useEffect(() => {
|
|
1049
|
-
|
|
1050
|
-
}, [
|
|
1051
|
-
m && (p
|
|
1052
|
-
}, [m,
|
|
1053
|
-
const Ne = (
|
|
1054
|
-
|
|
1048
|
+
f(n);
|
|
1049
|
+
}, [n]), l.useEffect(() => {
|
|
1050
|
+
m && (d(p.start, p.end), R(g, p.start, p.end).finally(), E(p), b || (B().finally(), S().finally()));
|
|
1051
|
+
}, [m, g, p]);
|
|
1052
|
+
const Ne = (_e) => {
|
|
1053
|
+
h({ start: _e[0] || /* @__PURE__ */ new Date(), end: _e[1] || /* @__PURE__ */ new Date() });
|
|
1055
1054
|
}, Pe = () => {
|
|
1056
1055
|
s(L.BUDGETS_CLICK_FILTER);
|
|
1057
|
-
},
|
|
1056
|
+
}, fe = () => {
|
|
1058
1057
|
ce(!0), s(L.BUDGETS_CLICK_ADD);
|
|
1059
1058
|
}, $e = () => {
|
|
1060
1059
|
ce(!1);
|
|
1061
|
-
}, Ge = Ze(
|
|
1062
|
-
return !c || !m || !
|
|
1060
|
+
}, Ge = Ze(p.end, q(/* @__PURE__ */ new Date()));
|
|
1061
|
+
return !c || !m || !b ? /* @__PURE__ */ e(G, {}) : /* @__PURE__ */ u(
|
|
1063
1062
|
Ke,
|
|
1064
1063
|
{
|
|
1065
|
-
accountOptions:
|
|
1064
|
+
accountOptions: n,
|
|
1066
1065
|
actions: [
|
|
1067
1066
|
{
|
|
1068
1067
|
iconName: "add",
|
|
1069
|
-
label:
|
|
1070
|
-
onClick:
|
|
1068
|
+
label: o.add_title,
|
|
1069
|
+
onClick: fe
|
|
1071
1070
|
}
|
|
1072
1071
|
],
|
|
1073
1072
|
calendarActions: {
|
|
@@ -1077,11 +1076,11 @@ const xt = ({
|
|
|
1077
1076
|
},
|
|
1078
1077
|
onAccountsFilterClick: Pe,
|
|
1079
1078
|
onBackClick: t,
|
|
1080
|
-
sx:
|
|
1081
|
-
title:
|
|
1079
|
+
sx: a,
|
|
1080
|
+
title: o.budgets_title,
|
|
1082
1081
|
children: [
|
|
1083
|
-
(!m || !
|
|
1084
|
-
m &&
|
|
1082
|
+
(!m || !b) && /* @__PURE__ */ e(G, {}),
|
|
1083
|
+
m && b && /* @__PURE__ */ u(
|
|
1085
1084
|
C,
|
|
1086
1085
|
{
|
|
1087
1086
|
direction: U ? "column" : "row",
|
|
@@ -1092,20 +1091,20 @@ const xt = ({
|
|
|
1092
1091
|
/* @__PURE__ */ e(C, { height: U ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
|
|
1093
1092
|
Me,
|
|
1094
1093
|
{
|
|
1095
|
-
createBudgetOnClick:
|
|
1094
|
+
createBudgetOnClick: fe,
|
|
1096
1095
|
height: U ? 450 : 800,
|
|
1097
1096
|
isDraggable: !0,
|
|
1098
|
-
shouldShowZeroState:
|
|
1099
|
-
unavailableWidth: U ? 0 :
|
|
1097
|
+
shouldShowZeroState: A.length === 0,
|
|
1098
|
+
unavailableWidth: U ? 0 : Be
|
|
1100
1099
|
}
|
|
1101
1100
|
) }),
|
|
1102
|
-
|
|
1101
|
+
A.length !== 0 && /* @__PURE__ */ u(
|
|
1103
1102
|
C,
|
|
1104
1103
|
{
|
|
1105
1104
|
gap: 24,
|
|
1106
1105
|
height: "100%",
|
|
1107
1106
|
sx: { mr: 24, mt: 48 },
|
|
1108
|
-
width: U ? "100%" :
|
|
1107
|
+
width: U ? "100%" : Be,
|
|
1109
1108
|
children: [
|
|
1110
1109
|
/* @__PURE__ */ e(Nt, {}),
|
|
1111
1110
|
/* @__PURE__ */ e(kt, {})
|
|
@@ -1122,7 +1121,7 @@ const xt = ({
|
|
|
1122
1121
|
ariaLabelClose: r.close_aria,
|
|
1123
1122
|
isOpen: ke,
|
|
1124
1123
|
onClose: () => ce(!1),
|
|
1125
|
-
title:
|
|
1124
|
+
title: o.add_new_title,
|
|
1126
1125
|
children: /* @__PURE__ */ e(Ie, { onRecalculateBudgets: $e })
|
|
1127
1126
|
}
|
|
1128
1127
|
),
|