@mx-cartographer/experiences 7.6.25 → 7.6.26
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/CHANGELOG.md +4 -0
- package/dist/budgets/index.es.js +213 -213
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
package/dist/budgets/index.es.js
CHANGED
|
@@ -4,7 +4,7 @@ import { observer as I } from "mobx-react-lite";
|
|
|
4
4
|
import { endOfMonth as ge } from "date-fns/endOfMonth";
|
|
5
5
|
import { startOfMonth as Q } from "date-fns/startOfMonth";
|
|
6
6
|
import W from "@mui/material/Box";
|
|
7
|
-
import
|
|
7
|
+
import B from "@mui/material/Stack";
|
|
8
8
|
import te from "@mui/material/styles/useTheme";
|
|
9
9
|
import { Text as y, CategoryIcon as H, Icon as G, H1 as He, H3 as Ae } from "@mxenabled/mxui";
|
|
10
10
|
import K from "@mui/material/List";
|
|
@@ -51,18 +51,18 @@ import ct from "@mui/material/IconButton";
|
|
|
51
51
|
import { M as lt } from "../ManageIncome-D8TIpSqE.mjs";
|
|
52
52
|
const dt = I(() => {
|
|
53
53
|
const { budgets: t } = w(), { totalBudgeted: n } = D(), { incomeTotal: i } = ne(), s = i - n;
|
|
54
|
-
return /* @__PURE__ */ m(
|
|
55
|
-
/* @__PURE__ */ m(
|
|
54
|
+
return /* @__PURE__ */ m(B, { direction: "row", justifyContent: "center", my: 16, spacing: 20, children: [
|
|
55
|
+
/* @__PURE__ */ m(B, { alignItems: "center", children: [
|
|
56
56
|
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: T(i, "0,0") }),
|
|
57
57
|
/* @__PURE__ */ e(y, { color: "secondary", variant: "Small", children: t.projected_income })
|
|
58
58
|
] }),
|
|
59
59
|
/* @__PURE__ */ e(y, { bold: !0, justifyContent: "center", variant: "Body", children: "-" }),
|
|
60
|
-
/* @__PURE__ */ m(
|
|
60
|
+
/* @__PURE__ */ m(B, { alignItems: "center", children: [
|
|
61
61
|
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: T(n, "0,0") }),
|
|
62
62
|
/* @__PURE__ */ e(y, { color: "secondary", variant: "Small", children: t.budgeted })
|
|
63
63
|
] }),
|
|
64
64
|
/* @__PURE__ */ e(y, { bold: !0, justifyContent: "center", variant: "Body", children: "=" }),
|
|
65
|
-
/* @__PURE__ */ m(
|
|
65
|
+
/* @__PURE__ */ m(B, { alignItems: "center", children: [
|
|
66
66
|
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: T(s, "0,0") }),
|
|
67
67
|
/* @__PURE__ */ e(y, { color: "secondary", variant: "Small", children: t.remaining })
|
|
68
68
|
] })
|
|
@@ -70,8 +70,8 @@ const dt = I(() => {
|
|
|
70
70
|
}), ut = I(
|
|
71
71
|
({ category: t }) => {
|
|
72
72
|
const { budgets: n } = w(), { budgets: i } = D(), s = l.useMemo(() => {
|
|
73
|
-
const
|
|
74
|
-
return `${r} - ${
|
|
73
|
+
const a = i.find((c) => c.category_guid === t.guid), r = T(t.totalAverageAmount, "0,0"), o = a ? L(n.recalculate_previous_budget, T(a.amount, "0,0")) : n.recalculate_new_budget;
|
|
74
|
+
return `${r} - ${o}`;
|
|
75
75
|
}, [n, i]);
|
|
76
76
|
return /* @__PURE__ */ m(l.Fragment, { children: [
|
|
77
77
|
/* @__PURE__ */ e(V, { children: /* @__PURE__ */ m(Y, { children: [
|
|
@@ -82,8 +82,8 @@ const dt = I(() => {
|
|
|
82
82
|
] }, t.guid);
|
|
83
83
|
}
|
|
84
84
|
), mt = ({ onRecalculateBudgets: t }) => {
|
|
85
|
-
const { budgets: n, common: i } = w(), { spendCategories: s } = F(), { recalculateBudgets:
|
|
86
|
-
await
|
|
85
|
+
const { budgets: n, common: i } = w(), { spendCategories: s } = F(), { recalculateBudgets: a, setAlert: r } = D(), [o, c] = l.useState(!1), d = s.filter((u) => u.totalAverageAmount > 0), g = async () => {
|
|
86
|
+
await a(d), c(!1), r(n.alert_recalculated_budgets), t?.();
|
|
87
87
|
};
|
|
88
88
|
return /* @__PURE__ */ m(l.Fragment, { children: [
|
|
89
89
|
/* @__PURE__ */ e(Te, { onClick: () => c(!0), sx: { mt: 24, mx: 24 }, variant: "text", children: n.recalculate_button }),
|
|
@@ -92,12 +92,12 @@ const dt = I(() => {
|
|
|
92
92
|
P,
|
|
93
93
|
{
|
|
94
94
|
ariaLabelClose: i.close_aria,
|
|
95
|
-
isOpen:
|
|
95
|
+
isOpen: o,
|
|
96
96
|
onClose: () => c(!1),
|
|
97
97
|
onPrimaryAction: g,
|
|
98
98
|
title: n.recalculate_title,
|
|
99
|
-
children: /* @__PURE__ */ m(
|
|
100
|
-
/* @__PURE__ */ m(
|
|
99
|
+
children: /* @__PURE__ */ m(B, { children: [
|
|
100
|
+
/* @__PURE__ */ m(B, { mx: 24, my: 16, children: [
|
|
101
101
|
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: n.recalculate_description_top }),
|
|
102
102
|
/* @__PURE__ */ e(y, { variant: "ParagraphSmall", children: n.recalculate_description_bottom })
|
|
103
103
|
] }),
|
|
@@ -111,12 +111,12 @@ const dt = I(() => {
|
|
|
111
111
|
categoryName: n,
|
|
112
112
|
onAmountChanged: i
|
|
113
113
|
}) => {
|
|
114
|
-
const { budgets: s } = w(), { totalBudgeted:
|
|
115
|
-
return /* @__PURE__ */ m(
|
|
116
|
-
/* @__PURE__ */ m(
|
|
114
|
+
const { budgets: s } = w(), { totalBudgeted: a } = D(), { incomeTotal: r } = ne(), o = r - a;
|
|
115
|
+
return /* @__PURE__ */ m(B, { gap: 16, children: [
|
|
116
|
+
/* @__PURE__ */ m(B, { children: [
|
|
117
117
|
/* @__PURE__ */ e(y, { children: L(
|
|
118
118
|
s.add_description_top,
|
|
119
|
-
T(
|
|
119
|
+
T(o, "0,0")
|
|
120
120
|
) }),
|
|
121
121
|
/* @__PURE__ */ e(y, { children: L(s.add_description_bottom, n) })
|
|
122
122
|
] }),
|
|
@@ -133,7 +133,7 @@ const dt = I(() => {
|
|
|
133
133
|
)
|
|
134
134
|
] });
|
|
135
135
|
}, gt = I(({ category: t, onAddBudget: n }) => {
|
|
136
|
-
const { budgets: i, common: s } = w(), [
|
|
136
|
+
const { budgets: i, common: s } = w(), [a, r] = l.useState(!1), [o, c] = l.useState(
|
|
137
137
|
`${t.totalAmount === 0 ? "" : t.totalAmount}`
|
|
138
138
|
);
|
|
139
139
|
return /* @__PURE__ */ m(l.Fragment, { children: [
|
|
@@ -152,45 +152,45 @@ const dt = I(() => {
|
|
|
152
152
|
z,
|
|
153
153
|
{
|
|
154
154
|
copy: { close_aria: s.close_aria, title: i.add_title },
|
|
155
|
-
disablePrimaryButton: Number(
|
|
156
|
-
isOpen:
|
|
155
|
+
disablePrimaryButton: Number(o) <= 0,
|
|
156
|
+
isOpen: a,
|
|
157
157
|
onClose: () => r(!1),
|
|
158
|
-
onPrimaryAction: () => n(t, Number(
|
|
158
|
+
onPrimaryAction: () => n(t, Number(o)),
|
|
159
159
|
primaryText: i.add_save_button,
|
|
160
|
-
children: /* @__PURE__ */ e(le, { amount:
|
|
160
|
+
children: /* @__PURE__ */ e(le, { amount: o, categoryName: t.name, onAmountChanged: c })
|
|
161
161
|
}
|
|
162
162
|
)
|
|
163
163
|
] });
|
|
164
164
|
}), Re = I(({ onAddBudget: t, onRecalculateBudgets: n }) => {
|
|
165
|
-
const { budgets: i } = w(), { addBudget: s, setAlert:
|
|
166
|
-
await s(c, d), t?.(),
|
|
165
|
+
const { budgets: i } = w(), { addBudget: s, setAlert: a, unbudgetedCategories: r } = D(), o = async (c, d) => {
|
|
166
|
+
await s(c, d), t?.(), a(L(i.alert_budget_created, c.name));
|
|
167
167
|
};
|
|
168
|
-
return /* @__PURE__ */ m(
|
|
168
|
+
return /* @__PURE__ */ m(B, { children: [
|
|
169
169
|
/* @__PURE__ */ e(dt, {}),
|
|
170
170
|
/* @__PURE__ */ e(W, { bgcolor: "background.paper", children: /* @__PURE__ */ e(K, { children: r.map((c) => /* @__PURE__ */ e(
|
|
171
171
|
gt,
|
|
172
172
|
{
|
|
173
173
|
category: c,
|
|
174
|
-
onAddBudget:
|
|
174
|
+
onAddBudget: o
|
|
175
175
|
},
|
|
176
176
|
c.guid
|
|
177
177
|
)) }) }),
|
|
178
178
|
/* @__PURE__ */ e(mt, { onRecalculateBudgets: n })
|
|
179
179
|
] });
|
|
180
180
|
}), Ce = 5, Le = 100, ee = 25, pt = (t) => {
|
|
181
|
-
const n = (
|
|
182
|
-
|
|
183
|
-
}, i = (
|
|
184
|
-
|
|
185
|
-
}, s = (
|
|
186
|
-
|
|
181
|
+
const n = (a) => {
|
|
182
|
+
a.active || t.alphaTarget(0.3).restart(), a.subject.fx = a.subject.x, a.subject.fy = a.subject.y;
|
|
183
|
+
}, i = (a) => {
|
|
184
|
+
a.subject.fx = a.x, a.subject.fy = a.y;
|
|
185
|
+
}, s = (a) => {
|
|
186
|
+
a.active || t.alphaTarget(0), a.subject.fx = null, a.subject.fy = null;
|
|
187
187
|
};
|
|
188
188
|
return E.drag().on("start", n).on("drag", i).on("end", s);
|
|
189
189
|
}, ht = (t) => {
|
|
190
190
|
let n = t.transaction_total / t.amount;
|
|
191
191
|
n < 0 ? n = 0 : n > 1 && (n = 1);
|
|
192
|
-
const i = n * 2 * Math.PI, s = E.interpolate(0, i),
|
|
193
|
-
return (r) => (
|
|
192
|
+
const i = n * 2 * Math.PI, s = E.interpolate(0, i), a = E.arc().cornerRadius(5).innerRadius(t.radius - Ce * 2).outerRadius(t.radius - Ce).startAngle(0).endAngle(0);
|
|
193
|
+
return (r) => (a.endAngle(s(r)), a(t) || "");
|
|
194
194
|
}, ft = (t) => {
|
|
195
195
|
E.selectAll(".bubble").call(pt(t));
|
|
196
196
|
}, Be = (t, n, i) => Math.min(Math.max(t, n), i), bt = (t, n, i) => {
|
|
@@ -202,39 +202,39 @@ const dt = I(() => {
|
|
|
202
202
|
E.forceY().y(n / 2).strength(0.02)
|
|
203
203
|
).on("tick", () => {
|
|
204
204
|
const s = t.nodes();
|
|
205
|
-
s.forEach((
|
|
206
|
-
const r =
|
|
207
|
-
|
|
208
|
-
}), E.selectAll(".bubble").data(s).attr("transform", (
|
|
205
|
+
s.forEach((a) => {
|
|
206
|
+
const r = a.radius ?? ee;
|
|
207
|
+
a.x = Be(a.x ?? 0, r, i - r), a.y = Be(a.y ?? 0, r, n - r);
|
|
208
|
+
}), E.selectAll(".bubble").data(s).attr("transform", (a) => `translate(${a.x},${a.y})`);
|
|
209
209
|
});
|
|
210
210
|
}, ke = (t, n) => E.scaleLinear().domain([t, n]).range([ee, Le]), yt = (t) => {
|
|
211
|
-
const n = t.reduce((r,
|
|
212
|
-
const c = Math.max(
|
|
211
|
+
const n = t.reduce((r, o) => {
|
|
212
|
+
const c = Math.max(o.transaction_total, o.amount);
|
|
213
213
|
return c > r ? c : r;
|
|
214
|
-
}, 0), i = t.reduce((r,
|
|
215
|
-
const c = Math.max(
|
|
214
|
+
}, 0), i = t.reduce((r, o) => {
|
|
215
|
+
const c = Math.max(o.transaction_total, o.amount);
|
|
216
216
|
return c < r ? c : r;
|
|
217
|
-
}, n), s = ke(i, n),
|
|
218
|
-
const
|
|
217
|
+
}, n), s = ke(i, n), a = t.map((r) => {
|
|
218
|
+
const o = s(Math.max(r.transaction_total, r.amount)) || 25;
|
|
219
219
|
return {
|
|
220
220
|
...r,
|
|
221
|
-
radius:
|
|
221
|
+
radius: o
|
|
222
222
|
};
|
|
223
223
|
});
|
|
224
|
-
return E.forceSimulation(
|
|
224
|
+
return E.forceSimulation(a).velocityDecay(0.05).force("collide", E.forceCollide((r) => r.radius + 2).strength(0.7));
|
|
225
225
|
}, _t = (t, n, i) => {
|
|
226
|
-
const
|
|
226
|
+
const a = Math.PI * ee ** 2 * t, r = i < 400 || n < 300, o = r ? 40 : 20, c = Math.max(100, i - o), d = Math.max(100, n - o), g = c * d;
|
|
227
227
|
let u = ee;
|
|
228
|
-
if (
|
|
228
|
+
if (a < g) {
|
|
229
229
|
const f = Math.sqrt(g / (t * Math.PI)), h = Math.min(c, d) / 4;
|
|
230
230
|
u = Math.min(Le, f, h);
|
|
231
231
|
}
|
|
232
232
|
return r && t <= 3 && (u = Math.min(u, 45)), { minRadius: Math.max(20, u * 0.6), maxRadius: u };
|
|
233
|
-
}, Ct = (t, n, i, s,
|
|
234
|
-
const { maxRadius: r, minRadius:
|
|
235
|
-
return E.scaleLinear().domain([s, i]).range([
|
|
236
|
-
}, Bt = (t, n, i = !1, s,
|
|
237
|
-
const r = n.map((g) => Math.max(g.transaction_total, g.amount)),
|
|
233
|
+
}, Ct = (t, n, i, s, a) => {
|
|
234
|
+
const { maxRadius: r, minRadius: o } = _t(t, n, a);
|
|
235
|
+
return E.scaleLinear().domain([s, i]).range([o, r]);
|
|
236
|
+
}, Bt = (t, n, i = !1, s, a) => {
|
|
237
|
+
const r = n.map((g) => Math.max(g.transaction_total, g.amount)), o = Math.min(...r), c = Math.max(...r), d = i ? Ct(t.length, s, c, o, a) : ke(o, c);
|
|
238
238
|
return t.map((g) => ({
|
|
239
239
|
...g,
|
|
240
240
|
radius: d(Math.max(g.transaction_total, g.amount))
|
|
@@ -243,13 +243,13 @@ const dt = I(() => {
|
|
|
243
243
|
const n = te(), {
|
|
244
244
|
amount: i,
|
|
245
245
|
guid: s,
|
|
246
|
-
budgetColors: { mercury:
|
|
246
|
+
budgetColors: { mercury: a },
|
|
247
247
|
radius: r,
|
|
248
|
-
transaction_total:
|
|
248
|
+
transaction_total: o
|
|
249
249
|
} = t, c = `mercury-${s}`;
|
|
250
250
|
l.useEffect(() => {
|
|
251
|
-
E.select(`.${c}`).selectAll(".status").remove(), E.select(`.${c}`).append("path").transition().duration(St).delay(0).attr("class", "status").attr("style", `fill: ${
|
|
252
|
-
}, [i, r,
|
|
251
|
+
E.select(`.${c}`).selectAll(".status").remove(), E.select(`.${c}`).append("path").transition().duration(St).delay(0).attr("class", "status").attr("style", `fill: ${a}; fill-opacity: 1;`).attrTween("d", () => ht(t));
|
|
252
|
+
}, [i, r, o]);
|
|
253
253
|
const d = E.arc().innerRadius((g) => g - 2 * Se).outerRadius((g) => g - Se).startAngle(0).endAngle(2 * Math.PI);
|
|
254
254
|
return /* @__PURE__ */ e("g", { className: c, children: /* @__PURE__ */ e(
|
|
255
255
|
"path",
|
|
@@ -261,7 +261,7 @@ const dt = I(() => {
|
|
|
261
261
|
}, At = l.memo(xt), j = 75, me = 50;
|
|
262
262
|
function vt({ bubble: t, isDraggable: n, onClick: i = () => {
|
|
263
263
|
} }) {
|
|
264
|
-
const [s,
|
|
264
|
+
const [s, a] = l.useState(!1), r = qe(), { availableWidth: o } = oe(), c = l.useMemo(() => {
|
|
265
265
|
if (t)
|
|
266
266
|
return {
|
|
267
267
|
amount: t.amount,
|
|
@@ -278,13 +278,13 @@ function vt({ bubble: t, isDraggable: n, onClick: i = () => {
|
|
|
278
278
|
guid: f,
|
|
279
279
|
description: h,
|
|
280
280
|
radius: p,
|
|
281
|
-
x:
|
|
281
|
+
x: C,
|
|
282
282
|
y: b
|
|
283
|
-
} = t, S =
|
|
283
|
+
} = t, S = o < 400 ? -8 : -12;
|
|
284
284
|
let A = S, v = S;
|
|
285
285
|
p > j ? (A = -14, v = -45) : p > me && (v = -32);
|
|
286
286
|
let x = 32;
|
|
287
|
-
p <= j && (x =
|
|
287
|
+
p <= j && (x = o < 400 ? 16 : 24);
|
|
288
288
|
const O = `${t.category.name}: ${h}`, M = {
|
|
289
289
|
modifiers: [
|
|
290
290
|
{
|
|
@@ -295,9 +295,9 @@ function vt({ bubble: t, isDraggable: n, onClick: i = () => {
|
|
|
295
295
|
}, R = (k) => {
|
|
296
296
|
(k.key === "Enter" || k.key === " ") && (k.preventDefault(), i(t));
|
|
297
297
|
}, N = () => {
|
|
298
|
-
|
|
298
|
+
a(!0);
|
|
299
299
|
}, de = () => {
|
|
300
|
-
|
|
300
|
+
a(!1);
|
|
301
301
|
};
|
|
302
302
|
return /* @__PURE__ */ m(
|
|
303
303
|
"g",
|
|
@@ -309,13 +309,13 @@ function vt({ bubble: t, isDraggable: n, onClick: i = () => {
|
|
|
309
309
|
onClick: () => i(t),
|
|
310
310
|
onFocus: N,
|
|
311
311
|
onKeyDown: R,
|
|
312
|
-
onMouseEnter: () =>
|
|
313
|
-
onMouseLeave: () =>
|
|
312
|
+
onMouseEnter: () => a(!0),
|
|
313
|
+
onMouseLeave: () => a(!1),
|
|
314
314
|
role: "button",
|
|
315
315
|
style: { cursor: n ? "pointer" : "default" },
|
|
316
316
|
tabIndex: 0,
|
|
317
317
|
textAnchor: "middle",
|
|
318
|
-
x:
|
|
318
|
+
x: C,
|
|
319
319
|
y: b,
|
|
320
320
|
children: [
|
|
321
321
|
/* @__PURE__ */ e("style", { children: `
|
|
@@ -380,13 +380,13 @@ const Tt = ({
|
|
|
380
380
|
onClick: s = () => {
|
|
381
381
|
}
|
|
382
382
|
}) => {
|
|
383
|
-
const [
|
|
384
|
-
const u =
|
|
383
|
+
const [a, r] = l.useState([]), o = l.useRef(null), c = l.useRef(!1), { detailedBudgets: d } = D(), g = l.useCallback(() => {
|
|
384
|
+
const u = o.current, _ = yt(d), f = _.nodes();
|
|
385
385
|
if (u) {
|
|
386
|
-
const h = u.nodes(), p = new Map(h.map((
|
|
387
|
-
f.forEach((
|
|
388
|
-
const b = p.get(
|
|
389
|
-
b && Object.assign(
|
|
386
|
+
const h = u.nodes(), p = new Map(h.map((C) => [C.guid, C]));
|
|
387
|
+
f.forEach((C) => {
|
|
388
|
+
const b = p.get(C.guid);
|
|
389
|
+
b && Object.assign(C, {
|
|
390
390
|
vx: b.vx,
|
|
391
391
|
vy: b.vy,
|
|
392
392
|
x: b.x,
|
|
@@ -394,28 +394,28 @@ const Tt = ({
|
|
|
394
394
|
});
|
|
395
395
|
});
|
|
396
396
|
}
|
|
397
|
-
|
|
397
|
+
o.current = _, c.current = !1, r(f);
|
|
398
398
|
}, [d]);
|
|
399
399
|
return l.useEffect(() => {
|
|
400
400
|
g();
|
|
401
401
|
}, [g]), l.useEffect(() => () => {
|
|
402
|
-
|
|
402
|
+
o.current && (o.current.stop(), o.current = null);
|
|
403
403
|
}, []), l.useEffect(() => {
|
|
404
|
-
const u =
|
|
404
|
+
const u = o.current;
|
|
405
405
|
if (!u) return;
|
|
406
406
|
const _ = u.nodes(), f = n > 0 && n < 450 || t > 0 && t < 300, h = Bt(_, d, f, t, n);
|
|
407
407
|
u.nodes(h), bt(u, t, n), i && setTimeout(() => {
|
|
408
408
|
ft(u);
|
|
409
409
|
}, 0), r([...h]);
|
|
410
|
-
}, [t, n, i, d]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(n), children:
|
|
410
|
+
}, [t, n, i, d]), /* @__PURE__ */ e("svg", { height: t, style: { overflow: "visible" }, width: Math.abs(n), children: a.map((u) => /* @__PURE__ */ e(vt, { bubble: u, isDraggable: i, onClick: s }, u.guid)) });
|
|
411
411
|
}, wt = I(Tt), Dt = ({
|
|
412
412
|
isMiniWidget: t = !1,
|
|
413
413
|
onConnectAccountsClick: n,
|
|
414
414
|
createBudgetOnClick: i
|
|
415
415
|
}) => {
|
|
416
|
-
const { recalculateBudgets: s } = D(), { spendCategories:
|
|
416
|
+
const { recalculateBudgets: s } = D(), { spendCategories: a } = F(), { budgets: r } = w(), { availableWidth: o } = oe(), { isMobile: c } = ce(o), d = t && c, [g, u] = l.useState(!1), [_, f] = l.useState(!1), [h, p] = l.useState(!1), C = l.useMemo(() => [...a.filter((S) => S.totalAverageAmount > 0)], [a]), b = async () => {
|
|
417
417
|
p(!0);
|
|
418
|
-
const { data: S, isSuccess: A } = await s(
|
|
418
|
+
const { data: S, isSuccess: A } = await s(C);
|
|
419
419
|
p(!1), A ? (S.length === 0 && f(!0), u(!1)) : u(!0);
|
|
420
420
|
};
|
|
421
421
|
return h ? /* @__PURE__ */ e(U, {}) : g ? /* @__PURE__ */ e(
|
|
@@ -497,24 +497,24 @@ const Tt = ({
|
|
|
497
497
|
height: n,
|
|
498
498
|
isDraggable: i = !1,
|
|
499
499
|
isMiniWidget: s = !1,
|
|
500
|
-
shouldShowZeroState:
|
|
500
|
+
shouldShowZeroState: a,
|
|
501
501
|
unavailableWidth: r = 24
|
|
502
502
|
}) => {
|
|
503
|
-
const { onEvent:
|
|
504
|
-
c(A),
|
|
503
|
+
const { onEvent: o } = X(), { setSelectedBudget: c } = D(), { isLoadingCategoryTotals: d } = F(), { isInitialized: g } = ae(), { accounts: u } = w(), { availableWidth: _ } = oe(), { isMobile: f } = ce(), [h, p] = l.useState(!1), C = l.useMemo(() => _ - r, [_]), b = (A) => {
|
|
504
|
+
c(A), o($.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
505
505
|
budget_category: A.category.name,
|
|
506
506
|
click_type: "bubble"
|
|
507
507
|
});
|
|
508
508
|
}, S = () => {
|
|
509
|
-
p(!0),
|
|
509
|
+
p(!0), o($.ACCOUNTS_CLICK_CONNECT);
|
|
510
510
|
};
|
|
511
|
-
return d ? /* @__PURE__ */ e(
|
|
511
|
+
return d ? /* @__PURE__ */ e(B, { alignItems: "center", height: n, justifyContent: "center", width: Math.abs(C), children: /* @__PURE__ */ e(U, {}) }) : /* @__PURE__ */ m(
|
|
512
512
|
W,
|
|
513
513
|
{
|
|
514
|
-
ml:
|
|
514
|
+
ml: a || f ? 0 : 24,
|
|
515
515
|
sx: { alignSelf: "center", ...s && { height: "100%" } },
|
|
516
516
|
children: [
|
|
517
|
-
|
|
517
|
+
a || !g ? /* @__PURE__ */ e(
|
|
518
518
|
Dt,
|
|
519
519
|
{
|
|
520
520
|
createBudgetOnClick: t,
|
|
@@ -527,7 +527,7 @@ const Tt = ({
|
|
|
527
527
|
height: n,
|
|
528
528
|
isDraggable: i,
|
|
529
529
|
onClick: b,
|
|
530
|
-
width:
|
|
530
|
+
width: C
|
|
531
531
|
}
|
|
532
532
|
),
|
|
533
533
|
/* @__PURE__ */ e(
|
|
@@ -548,20 +548,20 @@ const Tt = ({
|
|
|
548
548
|
handleAddClick: i,
|
|
549
549
|
shouldShowZeroState: s
|
|
550
550
|
}) => {
|
|
551
|
-
const { availableHeight:
|
|
551
|
+
const { availableHeight: a = 0 } = oe(), r = l.useRef(null);
|
|
552
552
|
l.useEffect(() => {
|
|
553
|
-
|
|
554
|
-
}, [
|
|
555
|
-
const
|
|
556
|
-
const c = r.current ??
|
|
553
|
+
a > 0 && r.current === null && (r.current = a);
|
|
554
|
+
}, [a]);
|
|
555
|
+
const o = l.useMemo(() => {
|
|
556
|
+
const c = r.current ?? a;
|
|
557
557
|
return c > 0 ? Math.round(Math.max(120, Math.min(450, c * 0.8))) - 40 : 450;
|
|
558
|
-
}, [
|
|
559
|
-
return /* @__PURE__ */ m(
|
|
558
|
+
}, [a]);
|
|
559
|
+
return /* @__PURE__ */ m(B, { sx: { height: "100%", justifyContent: "space-between" }, children: [
|
|
560
560
|
/* @__PURE__ */ e(
|
|
561
561
|
Ne,
|
|
562
562
|
{
|
|
563
563
|
createBudgetOnClick: i,
|
|
564
|
-
height:
|
|
564
|
+
height: o,
|
|
565
565
|
isMiniWidget: !0,
|
|
566
566
|
shouldShowZeroState: s
|
|
567
567
|
}
|
|
@@ -572,18 +572,18 @@ const Tt = ({
|
|
|
572
572
|
] })
|
|
573
573
|
] });
|
|
574
574
|
}, Et = (t) => {
|
|
575
|
-
const n = te(), { onEvent: i } = X(), { detailedBudgets: s, isDataLoaded:
|
|
575
|
+
const n = te(), { onEvent: i } = X(), { detailedBudgets: s, isDataLoaded: a, loadBudgetData: r, setTheme: o } = D(), { budgets: c, common: d } = w(), { isCopyLoaded: g, isInitialized: u, selectedAccounts: _ } = ae(), { reloadCategoryTotals: f } = F(), h = Qe(), p = s.length === 0, [C, b] = l.useState(!1), S = () => {
|
|
576
576
|
b(!0), i($.BUDGETS_CLICK_ADD);
|
|
577
577
|
}, A = () => {
|
|
578
578
|
b(!1);
|
|
579
579
|
}, v = () => b(!1);
|
|
580
580
|
return we({
|
|
581
581
|
widgetName: "BubbleBudgetsMiniWidget",
|
|
582
|
-
isLoaded:
|
|
582
|
+
isLoaded: a
|
|
583
583
|
}), l.useEffect(() => {
|
|
584
|
-
|
|
584
|
+
o(n);
|
|
585
585
|
}, [n]), l.useEffect(() => {
|
|
586
|
-
u && !
|
|
586
|
+
u && !a && f(_, Q(/* @__PURE__ */ new Date()), ge(/* @__PURE__ */ new Date())).then(
|
|
587
587
|
() => {
|
|
588
588
|
r().finally();
|
|
589
589
|
}
|
|
@@ -597,7 +597,7 @@ const Tt = ({
|
|
|
597
597
|
title: c.budgets_title,
|
|
598
598
|
...t,
|
|
599
599
|
children: [
|
|
600
|
-
|
|
600
|
+
a ? /* @__PURE__ */ e(
|
|
601
601
|
It,
|
|
602
602
|
{
|
|
603
603
|
budgetsCopy: c,
|
|
@@ -610,7 +610,7 @@ const Tt = ({
|
|
|
610
610
|
P,
|
|
611
611
|
{
|
|
612
612
|
ariaLabelClose: d.close_aria,
|
|
613
|
-
isOpen:
|
|
613
|
+
isOpen: C,
|
|
614
614
|
onClose: () => b(!1),
|
|
615
615
|
title: c.add_new_title,
|
|
616
616
|
children: /* @__PURE__ */ e(
|
|
@@ -630,24 +630,24 @@ const Tt = ({
|
|
|
630
630
|
amount: n,
|
|
631
631
|
budgetColors: { background: i },
|
|
632
632
|
category: { name: s },
|
|
633
|
-
category_guid:
|
|
633
|
+
category_guid: a,
|
|
634
634
|
percentage: r,
|
|
635
|
-
transaction_total:
|
|
635
|
+
transaction_total: o
|
|
636
636
|
} = t, c = [
|
|
637
637
|
{
|
|
638
638
|
color: i,
|
|
639
639
|
percentage: `${r}%`
|
|
640
640
|
}
|
|
641
641
|
];
|
|
642
|
-
return /* @__PURE__ */ e(he, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(fe, { children: /* @__PURE__ */ m(
|
|
643
|
-
/* @__PURE__ */ e(H, { categoryGuid:
|
|
644
|
-
/* @__PURE__ */ e(He, { children: `${T(
|
|
642
|
+
return /* @__PURE__ */ e(he, { sx: { mt: 24, mx: 24 }, children: /* @__PURE__ */ e(fe, { children: /* @__PURE__ */ m(B, { alignItems: "center", gap: 16, children: [
|
|
643
|
+
/* @__PURE__ */ e(H, { categoryGuid: a, size: 56 }),
|
|
644
|
+
/* @__PURE__ */ e(He, { children: `${T(o, "0,0")} / ${T(n, "0,0")}` }),
|
|
645
645
|
/* @__PURE__ */ e(y, { bold: !0, variant: "XSmall", children: s }),
|
|
646
646
|
/* @__PURE__ */ e(pe, { data: c, height: 10 })
|
|
647
647
|
] }) }) });
|
|
648
648
|
}, Ot = I(() => {
|
|
649
649
|
const { budgets: t } = w();
|
|
650
|
-
return /* @__PURE__ */ m(
|
|
650
|
+
return /* @__PURE__ */ m(B, { alignItems: "center", gap: 12, height: "auto", mb: 24, mt: 24, children: [
|
|
651
651
|
/* @__PURE__ */ e(G, { color: "secondary", name: "bubble_chart", sx: { fontSize: 32 } }),
|
|
652
652
|
/* @__PURE__ */ e(y, { bold: !0, color: "secondary", variant: "Small", children: t.zero_state_no_sub_budgets }),
|
|
653
653
|
/* @__PURE__ */ e(y, { color: "text.secondary", variant: "XSmall", children: t.zero_state_no_sub_budgets_description })
|
|
@@ -657,16 +657,16 @@ const Tt = ({
|
|
|
657
657
|
amount: n,
|
|
658
658
|
budgetColors: { background: i },
|
|
659
659
|
category: s,
|
|
660
|
-
percentage:
|
|
660
|
+
percentage: a,
|
|
661
661
|
transaction_total: r
|
|
662
|
-
} = t, { setSelectedSubBudget:
|
|
663
|
-
return /* @__PURE__ */ e(V, { children: /* @__PURE__ */ m(Y, { onClick: () =>
|
|
664
|
-
/* @__PURE__ */ e(ie, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Oe, { color: i, percent:
|
|
662
|
+
} = t, { setSelectedSubBudget: o } = D();
|
|
663
|
+
return /* @__PURE__ */ e(V, { children: /* @__PURE__ */ m(Y, { onClick: () => o(t), children: [
|
|
664
|
+
/* @__PURE__ */ e(ie, { sx: { mb: -8, mr: 16 }, children: /* @__PURE__ */ e(Oe, { color: i, percent: a, size: 40, children: /* @__PURE__ */ e(H, { categoryGuid: s.parent_guid, variant: "basic" }) }) }),
|
|
665
665
|
/* @__PURE__ */ e(
|
|
666
666
|
Z,
|
|
667
667
|
{
|
|
668
|
-
primary: /* @__PURE__ */ e(
|
|
669
|
-
secondary: /* @__PURE__ */ e(
|
|
668
|
+
primary: /* @__PURE__ */ e(B, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t.category.name }) }),
|
|
669
|
+
secondary: /* @__PURE__ */ e(B, { component: "span", direction: "row", justifyContent: "space-between", children: /* @__PURE__ */ e(y, { fontWeight: 400, variant: "Body", children: `
|
|
670
670
|
${T(r, "0,0")} /
|
|
671
671
|
${T(n, "0,0")}
|
|
672
672
|
` }) })
|
|
@@ -674,21 +674,21 @@ const Tt = ({
|
|
|
674
674
|
)
|
|
675
675
|
] }) });
|
|
676
676
|
}), Rt = I(({ category: t, parentBudget: n }) => {
|
|
677
|
-
const { budgets: i, common: s } = w(), { setExpandedGuid:
|
|
677
|
+
const { budgets: i, common: s } = w(), { setExpandedGuid: a, setOnSelect: r } = rt(), { addBudget: o } = D(), [c, d] = l.useState(!1), [g, u] = l.useState(!1), [_, f] = l.useState(""), [h, p] = l.useState(void 0);
|
|
678
678
|
l.useEffect(() => {
|
|
679
679
|
r((S) => {
|
|
680
680
|
const A = t.subCategories.find((v) => v.guid === S);
|
|
681
681
|
A && (p(A), f(`${A.currentAmount === 0 ? "" : A.currentAmount}`), u(!0));
|
|
682
682
|
});
|
|
683
683
|
}, []);
|
|
684
|
-
const
|
|
685
|
-
|
|
684
|
+
const C = () => {
|
|
685
|
+
a(t.guid), d(!0);
|
|
686
686
|
}, b = async () => {
|
|
687
|
-
h && Number(_) > 0 && (await
|
|
687
|
+
h && Number(_) > 0 && (await o(h, Number(_), n.guid), u(!1), d(!1), p(void 0));
|
|
688
688
|
};
|
|
689
689
|
return /* @__PURE__ */ m(W, { children: [
|
|
690
|
-
/* @__PURE__ */ e(V, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Y, { onClick:
|
|
691
|
-
/* @__PURE__ */ m(
|
|
690
|
+
/* @__PURE__ */ e(V, { disableGutters: !0, disablePadding: !0, sx: { bgcolor: "background.paper" }, children: /* @__PURE__ */ e(Y, { onClick: C, children: /* @__PURE__ */ e(Z, { children: /* @__PURE__ */ m(B, { alignItems: "center", direction: "row", justifyContent: "space-between", children: [
|
|
691
|
+
/* @__PURE__ */ m(B, { alignItems: "center", direction: "row", gap: 8, children: [
|
|
692
692
|
/* @__PURE__ */ e(G, { fill: !0, name: "add_box", size: 24, sx: { color: "primary.light" } }),
|
|
693
693
|
/* @__PURE__ */ e(y, { bold: !0, sx: { color: "primary.light" }, variant: "Body", children: i.add_sub_budget_button })
|
|
694
694
|
] }),
|
|
@@ -726,20 +726,20 @@ const Tt = ({
|
|
|
726
726
|
)
|
|
727
727
|
] });
|
|
728
728
|
}), Lt = I(({ budget: t }) => {
|
|
729
|
-
const { category: n, subBudgets: i } = t, { budgets: s, common:
|
|
729
|
+
const { category: n, subBudgets: i } = t, { budgets: s, common: a } = w(), { deleteBudget: r, selectedSubBudget: o, setSelectedSubBudget: c, updateBudget: d } = D(), { filter: g, setFilter: u } = re(), [_, f] = l.useState(!1), [h, p] = l.useState(!1), [C, b] = l.useState("");
|
|
730
730
|
l.useEffect(() => {
|
|
731
|
-
|
|
731
|
+
o && (b(`${o.amount}`), u({
|
|
732
732
|
...g,
|
|
733
|
-
custom: (x) => x.category_guid ===
|
|
733
|
+
custom: (x) => x.category_guid === o.category_guid
|
|
734
734
|
}));
|
|
735
|
-
}, [
|
|
735
|
+
}, [o]);
|
|
736
736
|
const S = async () => {
|
|
737
|
-
|
|
738
|
-
...
|
|
739
|
-
amount: Number(
|
|
737
|
+
o && await d({
|
|
738
|
+
...o,
|
|
739
|
+
amount: Number(C)
|
|
740
740
|
});
|
|
741
741
|
}, A = async () => {
|
|
742
|
-
|
|
742
|
+
o && await r(o.guid), p(!1), v();
|
|
743
743
|
}, v = () => {
|
|
744
744
|
u({
|
|
745
745
|
...g,
|
|
@@ -757,26 +757,26 @@ const Tt = ({
|
|
|
757
757
|
/* @__PURE__ */ e(
|
|
758
758
|
P,
|
|
759
759
|
{
|
|
760
|
-
ariaLabelClose:
|
|
761
|
-
isOpen: !!
|
|
760
|
+
ariaLabelClose: a.close_aria,
|
|
761
|
+
isOpen: !!o,
|
|
762
762
|
onClose: v,
|
|
763
763
|
onPrimaryAction: () => f(!0),
|
|
764
764
|
onSecondaryAction: () => p(!0),
|
|
765
765
|
primaryText: s.details_edit_button,
|
|
766
766
|
secondaryText: s.details_delete_button,
|
|
767
767
|
title: s.details_title,
|
|
768
|
-
children:
|
|
769
|
-
/* @__PURE__ */ e($e, { budget:
|
|
768
|
+
children: o && /* @__PURE__ */ m(B, { gap: 24, children: [
|
|
769
|
+
/* @__PURE__ */ e($e, { budget: o }),
|
|
770
770
|
/* @__PURE__ */ e(Ee, { height: "100%" })
|
|
771
771
|
] })
|
|
772
772
|
}
|
|
773
773
|
),
|
|
774
|
-
|
|
774
|
+
o && /* @__PURE__ */ m(l.Fragment, { children: [
|
|
775
775
|
/* @__PURE__ */ e(
|
|
776
776
|
z,
|
|
777
777
|
{
|
|
778
|
-
copy: { close_aria:
|
|
779
|
-
disablePrimaryButton: Number(
|
|
778
|
+
copy: { close_aria: a.close_aria, title: s.details_edit_title },
|
|
779
|
+
disablePrimaryButton: Number(C) <= 0,
|
|
780
780
|
isOpen: _,
|
|
781
781
|
onClose: () => f(!1),
|
|
782
782
|
onPrimaryAction: S,
|
|
@@ -784,8 +784,8 @@ const Tt = ({
|
|
|
784
784
|
children: /* @__PURE__ */ e(
|
|
785
785
|
le,
|
|
786
786
|
{
|
|
787
|
-
amount:
|
|
788
|
-
categoryName:
|
|
787
|
+
amount: C,
|
|
788
|
+
categoryName: o.category.name,
|
|
789
789
|
onAmountChanged: b
|
|
790
790
|
}
|
|
791
791
|
)
|
|
@@ -794,34 +794,34 @@ const Tt = ({
|
|
|
794
794
|
/* @__PURE__ */ e(
|
|
795
795
|
z,
|
|
796
796
|
{
|
|
797
|
-
copy: { close_aria:
|
|
797
|
+
copy: { close_aria: a.close_aria, title: s.delete_title },
|
|
798
798
|
isOpen: h,
|
|
799
799
|
onClose: () => p(!1),
|
|
800
800
|
onPrimaryAction: A,
|
|
801
801
|
primaryColor: "error",
|
|
802
802
|
primaryText: "Delete",
|
|
803
803
|
secondaryColor: "secondary",
|
|
804
|
-
children: /* @__PURE__ */ e(y, { variant: "Paragraph", children: L(s.delete_description,
|
|
804
|
+
children: /* @__PURE__ */ e(y, { variant: "Paragraph", children: L(s.delete_description, o.category.name) })
|
|
805
805
|
}
|
|
806
806
|
)
|
|
807
807
|
] })
|
|
808
808
|
] });
|
|
809
809
|
}), kt = I(({ budget: t }) => {
|
|
810
|
-
const { is_mobile_webview: n } = Ke(), { setAlert: i } = D(), { budgets: s, common:
|
|
810
|
+
const { is_mobile_webview: n } = Ke(), { setAlert: i } = D(), { budgets: s, common: a, transactions: r } = w(), { isDesktop: o, isSmallTablet: c, isTablet: d } = ce(), {
|
|
811
811
|
sortedTransactions: g,
|
|
812
812
|
sortedTransactionsWithSplits: u,
|
|
813
813
|
tags: _
|
|
814
|
-
} = re(), [f, h] = l.useState(0), [p,
|
|
814
|
+
} = re(), [f, h] = l.useState(0), [p, C] = l.useState(""), b = l.useMemo(
|
|
815
815
|
() => g.find((x) => x.guid === p),
|
|
816
816
|
[p, g]
|
|
817
817
|
), S = (x, O) => {
|
|
818
818
|
h(O);
|
|
819
819
|
}, A = () => {
|
|
820
820
|
ot(u, _), i(s.alert_csv_downloaded);
|
|
821
|
-
}, v = g.length > 0 && !n && (
|
|
822
|
-
return /* @__PURE__ */ m(
|
|
821
|
+
}, v = g.length > 0 && !n && (o || d && !c);
|
|
822
|
+
return /* @__PURE__ */ m(B, { gap: 24, children: [
|
|
823
823
|
/* @__PURE__ */ e($e, { budget: t }),
|
|
824
|
-
/* @__PURE__ */ m(
|
|
824
|
+
/* @__PURE__ */ m(B, { children: [
|
|
825
825
|
/* @__PURE__ */ m(
|
|
826
826
|
nt,
|
|
827
827
|
{
|
|
@@ -836,8 +836,8 @@ const Tt = ({
|
|
|
836
836
|
]
|
|
837
837
|
}
|
|
838
838
|
),
|
|
839
|
-
f === 0 && /* @__PURE__ */ m(
|
|
840
|
-
v && /* @__PURE__ */ e(
|
|
839
|
+
f === 0 && /* @__PURE__ */ m(B, { children: [
|
|
840
|
+
v && /* @__PURE__ */ e(B, { direction: "row", justifyContent: "right", mb: -24, mr: 8, mt: 8, zIndex: 1, children: /* @__PURE__ */ e(
|
|
841
841
|
Te,
|
|
842
842
|
{
|
|
843
843
|
onClick: A,
|
|
@@ -846,15 +846,15 @@ const Tt = ({
|
|
|
846
846
|
children: r.export_csv_btn
|
|
847
847
|
}
|
|
848
848
|
) }),
|
|
849
|
-
/* @__PURE__ */ e(Ee, { height: "100%", onClick:
|
|
849
|
+
/* @__PURE__ */ e(Ee, { height: "100%", onClick: C })
|
|
850
850
|
] }),
|
|
851
851
|
f === 1 && /* @__PURE__ */ e(Lt, { budget: t }),
|
|
852
852
|
/* @__PURE__ */ e(
|
|
853
853
|
P,
|
|
854
854
|
{
|
|
855
|
-
ariaLabelClose:
|
|
855
|
+
ariaLabelClose: a.close_aria,
|
|
856
856
|
isOpen: !!b,
|
|
857
|
-
onClose: () =>
|
|
857
|
+
onClose: () => C(""),
|
|
858
858
|
title: s.details_transaction_drawer,
|
|
859
859
|
children: b && /* @__PURE__ */ e(at, { transaction: b })
|
|
860
860
|
}
|
|
@@ -864,86 +864,86 @@ const Tt = ({
|
|
|
864
864
|
}), Nt = I(() => {
|
|
865
865
|
const { selectedAccountGuids: t } = ae(), { budgets: n, common: i } = w(), {
|
|
866
866
|
alert: s,
|
|
867
|
-
dateRange:
|
|
867
|
+
dateRange: a,
|
|
868
868
|
deleteBudget: r,
|
|
869
|
-
selectedBudget:
|
|
869
|
+
selectedBudget: o,
|
|
870
870
|
selectedSubBudget: c,
|
|
871
871
|
setAlert: d,
|
|
872
872
|
setSelectedBudget: g,
|
|
873
873
|
updateBudget: u
|
|
874
|
-
} = D(), { setFilter: _ } = re(), [f, h] = l.useState(!1), [p,
|
|
874
|
+
} = D(), { setFilter: _ } = re(), [f, h] = l.useState(!1), [p, C] = l.useState(!1), [b, S] = l.useState(!1), [A, v] = l.useState("");
|
|
875
875
|
l.useEffect(() => {
|
|
876
|
-
|
|
876
|
+
o && !c && (v(`${o.amount}`), h(!0), _({
|
|
877
877
|
accounts: t,
|
|
878
|
-
dateRange:
|
|
879
|
-
custom: (N) => N.category_guid ===
|
|
878
|
+
dateRange: a,
|
|
879
|
+
custom: (N) => N.category_guid === o.category_guid || N.top_level_category_guid === o.category_guid,
|
|
880
880
|
showSplits: !0
|
|
881
881
|
}));
|
|
882
|
-
}, [
|
|
882
|
+
}, [o]);
|
|
883
883
|
const x = async () => {
|
|
884
|
-
|
|
885
|
-
...
|
|
884
|
+
o && (await u({
|
|
885
|
+
...o,
|
|
886
886
|
amount: Number(A),
|
|
887
|
-
percentage:
|
|
888
|
-
}), d(L(n.alert_budget_updated,
|
|
887
|
+
percentage: o.category.totalAmount / Number(A) * 100
|
|
888
|
+
}), C(!1), d(L(n.alert_budget_updated, o.category.name)));
|
|
889
889
|
}, O = async () => {
|
|
890
|
-
|
|
890
|
+
o && (await r(o.guid), d(L(n.alert_budget_deleted, o.category.name))), M();
|
|
891
891
|
}, M = () => {
|
|
892
892
|
h(!1), setTimeout(() => {
|
|
893
893
|
g(void 0);
|
|
894
894
|
}, 250);
|
|
895
895
|
}, R = () => {
|
|
896
|
-
|
|
896
|
+
C(!1), v(`${o?.amount}`);
|
|
897
897
|
};
|
|
898
|
-
if (
|
|
898
|
+
if (o)
|
|
899
899
|
return /* @__PURE__ */ m(l.Fragment, { children: [
|
|
900
|
-
/* @__PURE__ */
|
|
900
|
+
/* @__PURE__ */ m(
|
|
901
901
|
P,
|
|
902
902
|
{
|
|
903
903
|
ariaLabelClose: i.close_aria,
|
|
904
904
|
isOpen: f,
|
|
905
905
|
onClose: M,
|
|
906
|
-
onPrimaryAction: () =>
|
|
906
|
+
onPrimaryAction: () => C(!0),
|
|
907
907
|
onSecondaryAction: () => S(!0),
|
|
908
908
|
primaryText: n.details_edit_button,
|
|
909
909
|
secondaryColor: "error",
|
|
910
910
|
secondaryText: n.details_delete_button,
|
|
911
911
|
title: n.details_title,
|
|
912
|
-
children: /* @__PURE__ */ e(kt, { budget: a })
|
|
913
|
-
}
|
|
914
|
-
),
|
|
915
|
-
/* @__PURE__ */ m(
|
|
916
|
-
z,
|
|
917
|
-
{
|
|
918
|
-
copy: { close_aria: i.close_aria, title: n.details_edit_title },
|
|
919
|
-
disablePrimaryButton: Number(A) <= 0,
|
|
920
|
-
isOpen: p,
|
|
921
|
-
onClose: () => {
|
|
922
|
-
},
|
|
923
|
-
onPrimaryAction: x,
|
|
924
|
-
primaryText: n.edit_save_button,
|
|
925
912
|
children: [
|
|
926
|
-
/* @__PURE__ */ e(
|
|
927
|
-
le,
|
|
928
|
-
{
|
|
929
|
-
amount: A,
|
|
930
|
-
categoryName: a.category.name,
|
|
931
|
-
onAmountChanged: v
|
|
932
|
-
}
|
|
933
|
-
),
|
|
913
|
+
/* @__PURE__ */ e(kt, { budget: o }),
|
|
934
914
|
/* @__PURE__ */ e(
|
|
935
915
|
Ie,
|
|
936
916
|
{
|
|
937
917
|
anchorOrigin: { vertical: "bottom", horizontal: "right" },
|
|
938
918
|
autoHideDuration: 3500,
|
|
939
|
-
onClose:
|
|
919
|
+
onClose: () => d(""),
|
|
940
920
|
open: !!s,
|
|
941
|
-
children: /* @__PURE__ */ e(De, { closeText: "", onClose:
|
|
921
|
+
children: /* @__PURE__ */ e(De, { closeText: "", onClose: () => d(""), severity: "success", variant: "filled", children: s })
|
|
942
922
|
}
|
|
943
923
|
)
|
|
944
924
|
]
|
|
945
925
|
}
|
|
946
926
|
),
|
|
927
|
+
/* @__PURE__ */ e(
|
|
928
|
+
z,
|
|
929
|
+
{
|
|
930
|
+
copy: { close_aria: i.close_aria, title: n.details_edit_title },
|
|
931
|
+
disablePrimaryButton: Number(A) <= 0,
|
|
932
|
+
isOpen: p,
|
|
933
|
+
onClose: R,
|
|
934
|
+
onPrimaryAction: x,
|
|
935
|
+
onSecondaryAction: R,
|
|
936
|
+
primaryText: n.edit_save_button,
|
|
937
|
+
children: /* @__PURE__ */ e(
|
|
938
|
+
le,
|
|
939
|
+
{
|
|
940
|
+
amount: A,
|
|
941
|
+
categoryName: o.category.name,
|
|
942
|
+
onAmountChanged: v
|
|
943
|
+
}
|
|
944
|
+
)
|
|
945
|
+
}
|
|
946
|
+
),
|
|
947
947
|
/* @__PURE__ */ e(
|
|
948
948
|
z,
|
|
949
949
|
{
|
|
@@ -954,16 +954,16 @@ const Tt = ({
|
|
|
954
954
|
primaryColor: "error",
|
|
955
955
|
primaryText: n.details_delete_button,
|
|
956
956
|
secondaryColor: "secondary",
|
|
957
|
-
children: /* @__PURE__ */ e(y, { variant: "Paragraph", children: L(n.delete_description,
|
|
957
|
+
children: /* @__PURE__ */ e(y, { variant: "Paragraph", children: L(n.delete_description, o.category.name) })
|
|
958
958
|
}
|
|
959
959
|
)
|
|
960
960
|
] });
|
|
961
961
|
}), $t = ({ budget: t, onClick: n }) => {
|
|
962
962
|
const {
|
|
963
963
|
amount: i,
|
|
964
|
-
budgetColors: { background: s, description:
|
|
964
|
+
budgetColors: { background: s, description: a },
|
|
965
965
|
category_guid: r,
|
|
966
|
-
description:
|
|
966
|
+
description: o,
|
|
967
967
|
percentage: c,
|
|
968
968
|
subBudgets: d,
|
|
969
969
|
transaction_total: g
|
|
@@ -973,22 +973,22 @@ const Tt = ({
|
|
|
973
973
|
/* @__PURE__ */ e(
|
|
974
974
|
Z,
|
|
975
975
|
{
|
|
976
|
-
primary: /* @__PURE__ */ m(
|
|
976
|
+
primary: /* @__PURE__ */ m(B, { component: "span", direction: "row", justifyContent: "space-between", children: [
|
|
977
977
|
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: t.category.name }),
|
|
978
978
|
/* @__PURE__ */ e(y, { fontWeight: 400, variant: "Body", children: `
|
|
979
979
|
${T(g, "0,0")} /
|
|
980
980
|
${T(i, "0,0")}
|
|
981
981
|
` })
|
|
982
982
|
] }),
|
|
983
|
-
secondary: /* @__PURE__ */ m(
|
|
983
|
+
secondary: /* @__PURE__ */ m(B, { component: "span", direction: "row", justifyContent: "space-between", children: [
|
|
984
984
|
/* @__PURE__ */ e(y, { variant: "XSmall", children: `${d.length} Sub-budgets` }),
|
|
985
|
-
/* @__PURE__ */ e(y, { bold: c > 100, color:
|
|
985
|
+
/* @__PURE__ */ e(y, { bold: c > 100, color: a, variant: "XSmall", children: o })
|
|
986
986
|
] })
|
|
987
987
|
}
|
|
988
988
|
)
|
|
989
989
|
] }) });
|
|
990
990
|
}, Pt = I(() => {
|
|
991
|
-
const { onEvent: t } = X(), { budgets: n } = w(), { detailedBudgets: i, setSelectedBudget: s } = D(),
|
|
991
|
+
const { onEvent: t } = X(), { budgets: n } = w(), { detailedBudgets: i, setSelectedBudget: s } = D(), a = (r) => {
|
|
992
992
|
s(r), t($.BUDGETS_CLICK_BUDGET_CATEGORY, {
|
|
993
993
|
budget_category: r.category.name,
|
|
994
994
|
click_type: "list"
|
|
@@ -997,12 +997,12 @@ const Tt = ({
|
|
|
997
997
|
return /* @__PURE__ */ m(he, { elevation: 2, children: [
|
|
998
998
|
/* @__PURE__ */ e(Me, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Ae, { children: n.budget_categories_title }) }),
|
|
999
999
|
/* @__PURE__ */ e(fe, { sx: { p: 0, ":last-child": { p: 0 } }, children: /* @__PURE__ */ e(K, { children: i.map((r) => /* @__PURE__ */ m(l.Fragment, { children: [
|
|
1000
|
-
/* @__PURE__ */ e($t, { budget: r, onClick:
|
|
1000
|
+
/* @__PURE__ */ e($t, { budget: r, onClick: a }),
|
|
1001
1001
|
/* @__PURE__ */ e(se, {})
|
|
1002
1002
|
] }, r.guid)) }) })
|
|
1003
1003
|
] });
|
|
1004
1004
|
}), Gt = I(() => {
|
|
1005
|
-
const t = te(), { onEvent: n } = X(), { visibleAccounts: i } = ve(), { budgets: s, common:
|
|
1005
|
+
const t = te(), { onEvent: n } = X(), { visibleAccounts: i } = ve(), { budgets: s, common: a, recurring: r } = w(), { incomeCategories: o, spendCategories: c } = F(), { detailedBudgets: d, totalBudgeted: g } = D(), { incomeTotal: u } = ne(), { setFilter: _ } = re(), [f, h] = l.useState(!1), [p, C] = l.useMemo(() => {
|
|
1006
1006
|
const v = c.reduce((R, N) => R + N.totalAmount, 0);
|
|
1007
1007
|
let x = v / g;
|
|
1008
1008
|
x > 1 && (x = 1);
|
|
@@ -1017,7 +1017,7 @@ const Tt = ({
|
|
|
1017
1017
|
return [v, M];
|
|
1018
1018
|
}, [d, c]), [b, S] = l.useMemo(() => {
|
|
1019
1019
|
const v = Math.abs(
|
|
1020
|
-
|
|
1020
|
+
o.reduce((M, R) => M + R.totalAmount, 0)
|
|
1021
1021
|
);
|
|
1022
1022
|
let x = v / u;
|
|
1023
1023
|
x > 1 && (x = 1);
|
|
@@ -1028,7 +1028,7 @@ const Tt = ({
|
|
|
1028
1028
|
}
|
|
1029
1029
|
];
|
|
1030
1030
|
return [v, O];
|
|
1031
|
-
}, [
|
|
1031
|
+
}, [o, u]), A = () => {
|
|
1032
1032
|
_({
|
|
1033
1033
|
accounts: i.map((v) => v.guid),
|
|
1034
1034
|
dateRange: {
|
|
@@ -1039,18 +1039,18 @@ const Tt = ({
|
|
|
1039
1039
|
};
|
|
1040
1040
|
return /* @__PURE__ */ m(he, { elevation: 2, sx: { overflow: "visible" }, children: [
|
|
1041
1041
|
/* @__PURE__ */ e(Me, { sx: { pb: 8, pl: 24 }, title: /* @__PURE__ */ e(Ae, { children: s.overview_title }) }),
|
|
1042
|
-
/* @__PURE__ */ e(fe, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ m(
|
|
1043
|
-
/* @__PURE__ */ m(
|
|
1042
|
+
/* @__PURE__ */ e(fe, { sx: { pt: 12, px: 24 }, children: /* @__PURE__ */ m(B, { gap: 24, children: [
|
|
1043
|
+
/* @__PURE__ */ m(B, { gap: 8, children: [
|
|
1044
1044
|
/* @__PURE__ */ e(y, { bold: !0, sx: { mb: 8 }, variant: "Body", children: s.spending_title }),
|
|
1045
|
-
/* @__PURE__ */ e(pe, { data:
|
|
1045
|
+
/* @__PURE__ */ e(pe, { data: C, height: 16 }),
|
|
1046
1046
|
/* @__PURE__ */ e(y, { variant: "Small", children: L(
|
|
1047
1047
|
s.spending_description,
|
|
1048
1048
|
T(p, "0,0"),
|
|
1049
1049
|
T(g, "0,0")
|
|
1050
1050
|
) })
|
|
1051
1051
|
] }),
|
|
1052
|
-
/* @__PURE__ */ m(
|
|
1053
|
-
/* @__PURE__ */ m(
|
|
1052
|
+
/* @__PURE__ */ m(B, { gap: 8, children: [
|
|
1053
|
+
/* @__PURE__ */ m(B, { alignItems: "center", direction: "row", gap: 4, mb: -4, children: [
|
|
1054
1054
|
/* @__PURE__ */ e(y, { bold: !0, variant: "Body", children: s.income_title }),
|
|
1055
1055
|
/* @__PURE__ */ e(
|
|
1056
1056
|
ct,
|
|
@@ -1073,7 +1073,7 @@ const Tt = ({
|
|
|
1073
1073
|
/* @__PURE__ */ e(
|
|
1074
1074
|
P,
|
|
1075
1075
|
{
|
|
1076
|
-
ariaLabelClose:
|
|
1076
|
+
ariaLabelClose: a.close_aria,
|
|
1077
1077
|
isOpen: f,
|
|
1078
1078
|
onClose: () => h(!1),
|
|
1079
1079
|
title: r.manage_income,
|
|
@@ -1082,22 +1082,22 @@ const Tt = ({
|
|
|
1082
1082
|
)
|
|
1083
1083
|
] });
|
|
1084
1084
|
}), xe = 480, Pn = I(({ onBackClick: t, sx: n }) => {
|
|
1085
|
-
const i = te(), { onEvent: s } = X(), { visibleAccounts:
|
|
1085
|
+
const i = te(), { onEvent: s } = X(), { visibleAccounts: a } = ve(), { budgets: r, common: o } = w(), { isCopyLoaded: c, isInitialized: d, selectedAccounts: g, setDisplayedDate: u, setSelectedAccounts: _ } = ae(), {
|
|
1086
1086
|
alert: f,
|
|
1087
1087
|
dateRange: h,
|
|
1088
1088
|
isDataLoaded: p,
|
|
1089
|
-
loadBudgetData:
|
|
1089
|
+
loadBudgetData: C,
|
|
1090
1090
|
setDateRange: b,
|
|
1091
1091
|
setAlert: S,
|
|
1092
1092
|
setTheme: A,
|
|
1093
1093
|
detailedBudgets: v
|
|
1094
1094
|
} = D(), { loadRepeatingTransactions: x, setDateRange: O } = ne(), { reloadCategoryTotals: M } = F(), { isSmallTablet: R, isMobile: N, isSmallMobile: de } = ce(), k = R || N || de, [Pe, q] = l.useState(!1);
|
|
1095
|
-
l.useEffect(() => (A(i), _(
|
|
1095
|
+
l.useEffect(() => (A(i), _(a), b({ start: Q(J()), end: ge(J()) }), s($.BUDGETS_VIEW), () => {
|
|
1096
1096
|
b({ start: Q(J()), end: ge(J()) });
|
|
1097
1097
|
}), []), l.useEffect(() => {
|
|
1098
|
-
_(
|
|
1099
|
-
}, [
|
|
1100
|
-
d && (u(h.start, h.end), M(g, h.start, h.end).finally(), O(h), p || (x().finally(),
|
|
1098
|
+
_(a);
|
|
1099
|
+
}, [a]), l.useEffect(() => {
|
|
1100
|
+
d && (u(h.start, h.end), M(g, h.start, h.end).finally(), O(h), p || (x().finally(), C().finally()));
|
|
1101
1101
|
}, [d, g, h]), we({
|
|
1102
1102
|
widgetName: "BubbleBudgetsWidget",
|
|
1103
1103
|
isLoaded: p
|
|
@@ -1116,7 +1116,7 @@ const Tt = ({
|
|
|
1116
1116
|
return !c || !d || !p ? /* @__PURE__ */ e(U, {}) : /* @__PURE__ */ m(
|
|
1117
1117
|
Je,
|
|
1118
1118
|
{
|
|
1119
|
-
accountOptions:
|
|
1119
|
+
accountOptions: a,
|
|
1120
1120
|
actions: [
|
|
1121
1121
|
{
|
|
1122
1122
|
iconName: "add",
|
|
@@ -1136,14 +1136,14 @@ const Tt = ({
|
|
|
1136
1136
|
children: [
|
|
1137
1137
|
(!d || !p) && /* @__PURE__ */ e(U, {}),
|
|
1138
1138
|
d && p && /* @__PURE__ */ m(
|
|
1139
|
-
|
|
1139
|
+
B,
|
|
1140
1140
|
{
|
|
1141
1141
|
direction: k ? "column" : "row",
|
|
1142
1142
|
height: "100%",
|
|
1143
1143
|
sx: { justifyContent: "center" },
|
|
1144
1144
|
width: "100%",
|
|
1145
1145
|
children: [
|
|
1146
|
-
/* @__PURE__ */ e(
|
|
1146
|
+
/* @__PURE__ */ e(B, { height: k ? 450 : "calc(100dvh - 150px)", children: /* @__PURE__ */ e(
|
|
1147
1147
|
Ne,
|
|
1148
1148
|
{
|
|
1149
1149
|
createBudgetOnClick: be,
|
|
@@ -1154,7 +1154,7 @@ const Tt = ({
|
|
|
1154
1154
|
}
|
|
1155
1155
|
) }),
|
|
1156
1156
|
v.length !== 0 && /* @__PURE__ */ m(
|
|
1157
|
-
|
|
1157
|
+
B,
|
|
1158
1158
|
{
|
|
1159
1159
|
gap: 24,
|
|
1160
1160
|
height: "100%",
|
|
@@ -1173,7 +1173,7 @@ const Tt = ({
|
|
|
1173
1173
|
/* @__PURE__ */ e(
|
|
1174
1174
|
P,
|
|
1175
1175
|
{
|
|
1176
|
-
ariaLabelClose:
|
|
1176
|
+
ariaLabelClose: o.close_aria,
|
|
1177
1177
|
isOpen: Pe,
|
|
1178
1178
|
onClose: () => q(!1),
|
|
1179
1179
|
title: r.add_new_title,
|