@mx-cartographer/experiences 9.7.167 → 9.7.169
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 +8 -0
- package/dist/budgets/components/budgetdetails/BudgetDetails.es.js +35 -35
- package/dist/budgets/components/budgetdetails/BudgetDetails.es.js.map +1 -1
- package/dist/core/types/AppData.d.ts +1 -0
- package/dist/core/types/localization/InsightsFeedCopy.d.ts +10 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js +118 -102
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffCalculatorBlock.es.js.map +1 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.d.ts +8 -1
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js +140 -73
- package/dist/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.es.js.map +1 -1
- package/dist/insights-v2/components/Header.es.js +4 -4
- package/dist/insights-v2/components/shared/elevation.es.js +2 -3
- package/dist/insights-v2/components/shared/elevation.es.js.map +1 -1
- package/dist/spending/components/Spending.es.js +52 -52
- package/dist/spending/components/Spending.es.js.map +1 -1
- package/dist/trends/components/CategoryDetails.es.js +36 -36
- package/dist/trends/components/CategoryDetails.es.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,106 +1,172 @@
|
|
|
1
|
-
import { buildPluralCopy as
|
|
2
|
-
import { CURRENCY_FORMAT as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import u from "
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
1
|
+
import { buildDynamicCopy as S, buildPluralCopy as w } from "../../../core/utils/Localization.es.js";
|
|
2
|
+
import { CURRENCY_FORMAT as c, formatCurrency as m } from "../../../core/utils/NumberFormatting.es.js";
|
|
3
|
+
import { ELEVATION_SHADOW as v } from "../../components/shared/elevation.es.js";
|
|
4
|
+
import { SubTabs as T, subTabPanelProps as C } from "../../components/SubTabs.es.js";
|
|
5
|
+
import { PAYMENT_INCREMENTS as u } from "./layout.es.js";
|
|
6
|
+
import b from "react";
|
|
7
|
+
import s from "@mui/material/Stack";
|
|
8
|
+
import { Text as o } from "@mxenabled/mxui";
|
|
9
|
+
import { Icon as _ } from "@mxenabled/mx-icons";
|
|
10
|
+
import { jsx as r, jsxs as n } from "react/jsx-runtime";
|
|
11
|
+
import p from "@mui/material/Box";
|
|
12
|
+
import k from "@mui/material/Divider";
|
|
13
|
+
var f = (e) => m(e, Number.isInteger(e) ? c.whole : c.cents), E = (e, t) => t < 1 ? "-" : e.months_short ? S(e.months_short, String(t)) : w(e.month, e.months, t, String(t)), y = ({ label: e, tone: t, value: a }) => /* @__PURE__ */ n(s, {
|
|
11
14
|
sx: {
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
alignItems: "center",
|
|
16
|
+
flex: 1,
|
|
17
|
+
minWidth: 0
|
|
14
18
|
},
|
|
15
|
-
children: [/* @__PURE__ */ r(
|
|
16
|
-
color: "text.secondary",
|
|
17
|
-
component: "span",
|
|
18
|
-
variant: "caption",
|
|
19
|
-
children: o
|
|
20
|
-
}), /* @__PURE__ */ r(t, {
|
|
19
|
+
children: [/* @__PURE__ */ r(o, {
|
|
21
20
|
bold: !0,
|
|
22
|
-
color:
|
|
21
|
+
color: t,
|
|
23
22
|
component: "span",
|
|
24
23
|
sx: { transition: "color 0.5s" },
|
|
25
|
-
variant: "
|
|
24
|
+
variant: "h3",
|
|
25
|
+
children: a
|
|
26
|
+
}), /* @__PURE__ */ r(o, {
|
|
27
|
+
color: "text.secondary",
|
|
28
|
+
component: "span",
|
|
29
|
+
variant: "caption",
|
|
26
30
|
children: e
|
|
27
31
|
})]
|
|
28
|
-
}),
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
+
}), g = ({ icon: e, label: t, tone: a, value: i }) => /* @__PURE__ */ n(s, {
|
|
33
|
+
direction: "row",
|
|
34
|
+
sx: {
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
gap: 16,
|
|
37
|
+
px: 24,
|
|
38
|
+
py: 14
|
|
39
|
+
},
|
|
40
|
+
children: [
|
|
41
|
+
/* @__PURE__ */ r(p, {
|
|
42
|
+
"aria-hidden": !0,
|
|
43
|
+
sx: {
|
|
44
|
+
alignItems: "center",
|
|
45
|
+
bgcolor: "secondary.lighter",
|
|
46
|
+
borderRadius: "4px",
|
|
47
|
+
color: "text.primary",
|
|
48
|
+
display: "flex",
|
|
49
|
+
flexShrink: 0,
|
|
50
|
+
height: 32,
|
|
51
|
+
justifyContent: "center",
|
|
52
|
+
width: 32
|
|
53
|
+
},
|
|
54
|
+
children: /* @__PURE__ */ r(_, {
|
|
55
|
+
name: e,
|
|
56
|
+
size: 20
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ r(o, {
|
|
60
|
+
component: "span",
|
|
61
|
+
sx: {
|
|
62
|
+
flexGrow: 1,
|
|
63
|
+
minWidth: 0
|
|
64
|
+
},
|
|
65
|
+
variant: "body1",
|
|
66
|
+
children: t
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ r(o, {
|
|
69
|
+
bold: !0,
|
|
70
|
+
color: a,
|
|
71
|
+
component: "span",
|
|
72
|
+
sx: { transition: "color 0.5s" },
|
|
73
|
+
variant: "body1",
|
|
74
|
+
children: i
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
}), B = ({ copy: e, rows: t }) => {
|
|
78
|
+
const a = b.useId(), [i, I] = b.useState(0), d = t ? "text.primary" : "text.secondary", h = u[i], l = t?.[i], R = l ? l.monthlyPayment - l.increment : 0, P = u.map((x) => ({ label: x === 0 ? e.standard ?? e.monthly_payment : `+${m(x, c.whole)}` }));
|
|
79
|
+
return /* @__PURE__ */ n(p, {
|
|
32
80
|
sx: {
|
|
33
|
-
bgcolor:
|
|
34
|
-
borderRadius: "
|
|
35
|
-
boxShadow:
|
|
36
|
-
|
|
81
|
+
bgcolor: "background.paper",
|
|
82
|
+
borderRadius: "8px",
|
|
83
|
+
boxShadow: v[1],
|
|
84
|
+
overflow: "hidden"
|
|
37
85
|
},
|
|
38
|
-
children: [/* @__PURE__ */ r(
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
86
|
+
children: [/* @__PURE__ */ r(T, {
|
|
87
|
+
ariaLabel: e.your_results,
|
|
88
|
+
id: a,
|
|
89
|
+
isTypeFilter: !1,
|
|
90
|
+
onChange: I,
|
|
91
|
+
selectedIndex: i,
|
|
92
|
+
tabs: P
|
|
93
|
+
}), /* @__PURE__ */ n(s, {
|
|
94
|
+
...C(a, i),
|
|
42
95
|
sx: {
|
|
43
|
-
|
|
44
|
-
borderColor: "divider",
|
|
96
|
+
gap: 16,
|
|
45
97
|
p: 16
|
|
46
98
|
},
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}), b.map((l, f) => {
|
|
50
|
-
const c = x[f], s = l?.result.paymentCount ?? 0, h = s >= 1 ? y(o.month, o.months, s, String(s)) : "-";
|
|
51
|
-
return /* @__PURE__ */ n(u, {
|
|
99
|
+
children: [/* @__PURE__ */ n(s, {
|
|
100
|
+
direction: "row",
|
|
52
101
|
sx: {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
py: 24
|
|
102
|
+
alignItems: "center",
|
|
103
|
+
bgcolor: "background.default",
|
|
104
|
+
borderRadius: "8px",
|
|
105
|
+
py: 8
|
|
58
106
|
},
|
|
59
107
|
children: [
|
|
60
|
-
/* @__PURE__ */ r(
|
|
61
|
-
label:
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
108
|
+
/* @__PURE__ */ r(y, {
|
|
109
|
+
label: e.monthly_payment,
|
|
110
|
+
tone: d,
|
|
111
|
+
value: f(R)
|
|
112
|
+
}),
|
|
113
|
+
/* @__PURE__ */ r(o, {
|
|
114
|
+
"aria-hidden": !0,
|
|
115
|
+
color: "text.secondary",
|
|
116
|
+
component: "span",
|
|
117
|
+
variant: "h3",
|
|
118
|
+
children: "+"
|
|
70
119
|
}),
|
|
71
|
-
/* @__PURE__ */ r(
|
|
72
|
-
label:
|
|
73
|
-
tone:
|
|
74
|
-
value: h
|
|
120
|
+
/* @__PURE__ */ r(y, {
|
|
121
|
+
label: e.extra_payment ?? e.monthly_payment,
|
|
122
|
+
tone: h > 0 ? d : "text.secondary",
|
|
123
|
+
value: f(h)
|
|
124
|
+
})
|
|
125
|
+
]
|
|
126
|
+
}), /* @__PURE__ */ n(p, {
|
|
127
|
+
sx: {
|
|
128
|
+
border: 1,
|
|
129
|
+
borderColor: "divider",
|
|
130
|
+
borderRadius: "8px"
|
|
131
|
+
},
|
|
132
|
+
children: [
|
|
133
|
+
/* @__PURE__ */ r(g, {
|
|
134
|
+
icon: "calendar_clock",
|
|
135
|
+
label: e.payoff ?? e.time_to_payoff,
|
|
136
|
+
tone: d,
|
|
137
|
+
value: E(e, l?.result.paymentCount ?? 0)
|
|
75
138
|
}),
|
|
76
|
-
/* @__PURE__ */ r(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
139
|
+
/* @__PURE__ */ r(k, { sx: { ml: 72 } }),
|
|
140
|
+
/* @__PURE__ */ r(g, {
|
|
141
|
+
icon: "list_alt",
|
|
142
|
+
label: e.interest_paid ?? e.total_interest_paid,
|
|
143
|
+
tone: d,
|
|
144
|
+
value: m(l?.result.totalInterestPaid ?? 0, c.cents)
|
|
80
145
|
})
|
|
81
146
|
]
|
|
82
|
-
}
|
|
147
|
+
})]
|
|
83
148
|
})]
|
|
84
149
|
});
|
|
85
|
-
},
|
|
150
|
+
}, G = ({ copy: e }) => /* @__PURE__ */ n(s, {
|
|
86
151
|
role: "alert",
|
|
87
152
|
sx: {
|
|
88
153
|
alignItems: "center",
|
|
89
|
-
bgcolor: "background.
|
|
90
|
-
borderRadius: "
|
|
154
|
+
bgcolor: "background.paper",
|
|
155
|
+
borderRadius: "8px",
|
|
156
|
+
boxShadow: v[1],
|
|
91
157
|
px: 32,
|
|
92
158
|
py: 40,
|
|
93
159
|
textAlign: "center"
|
|
94
160
|
},
|
|
95
161
|
children: [
|
|
96
|
-
/* @__PURE__ */ r(
|
|
162
|
+
/* @__PURE__ */ r(_, {
|
|
97
163
|
"aria-hidden": "true",
|
|
98
164
|
fill: !0,
|
|
99
165
|
name: "error",
|
|
100
166
|
size: 24,
|
|
101
167
|
sx: { color: "primary.main" }
|
|
102
168
|
}),
|
|
103
|
-
/* @__PURE__ */ r(
|
|
169
|
+
/* @__PURE__ */ r(o, {
|
|
104
170
|
bold: !0,
|
|
105
171
|
component: "p",
|
|
106
172
|
sx: {
|
|
@@ -108,18 +174,19 @@ var p = ({ label: o, tone: a, value: e }) => /* @__PURE__ */ n(u, {
|
|
|
108
174
|
pt: 16
|
|
109
175
|
},
|
|
110
176
|
variant: "body1",
|
|
111
|
-
children:
|
|
177
|
+
children: e.calculation_failed
|
|
112
178
|
}),
|
|
113
|
-
/* @__PURE__ */ r(
|
|
179
|
+
/* @__PURE__ */ r(o, {
|
|
114
180
|
component: "p",
|
|
115
181
|
variant: "body2",
|
|
116
|
-
children:
|
|
182
|
+
children: e.calculation_failed_description
|
|
117
183
|
})
|
|
118
184
|
]
|
|
119
185
|
});
|
|
120
186
|
export {
|
|
121
|
-
|
|
122
|
-
|
|
187
|
+
G as CalculationFailed,
|
|
188
|
+
B as PayoffResults,
|
|
189
|
+
E as formatPayoffTime
|
|
123
190
|
};
|
|
124
191
|
|
|
125
192
|
//# sourceMappingURL=PayoffResults.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PayoffResults.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.tsx"],"sourcesContent":["import Box from '@mui/material/Box'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildPluralCopy } from '../../../common'\nimport type { PayoffCalculatorCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { RAISED_CARD_SHADOW } from '../../components/shared/elevation'\n\nimport { PAYMENT_INCREMENTS, type PayoffRow } from './layout'\n\ninterface ResultLineProps {\n label: React.ReactNode\n tone: 'text.primary' | 'text.secondary'\n value: string\n}\n\nconst ResultLine = ({ label, tone, value }: ResultLineProps) => (\n <Stack sx={{ flexDirection: 'row', justifyContent: 'space-between' }}>\n <Text color=\"text.secondary\" component=\"span\" variant=\"caption\">\n {label}\n </Text>\n <Text\n bold={true}\n color={tone}\n component=\"span\"\n sx={{ transition: 'color 0.5s' }}\n variant=\"body1\"\n >\n {value}\n </Text>\n </Stack>\n)\n\ninterface PayoffResultsProps {\n copy: PayoffCalculatorCopy\n /** Undefined until the user has calculated: the rows then show placeholders. */\n rows?: PayoffRow[]\n}\n\nexport const PayoffResults = ({ copy, rows }: PayoffResultsProps) => {\n const isCalculated = !!rows\n const tone = isCalculated ? 'text.primary' : 'text.secondary'\n const shown: Array<PayoffRow | undefined> = rows ?? PAYMENT_INCREMENTS.map(() => undefined)\n\n return (\n <Box\n sx={{\n bgcolor: isCalculated ? 'background.paper' : 'background.default',\n borderRadius: '4px',\n boxShadow: isCalculated ? RAISED_CARD_SHADOW : 'none',\n transition: 'background-color 0.5s, box-shadow 0.5s',\n }}\n >\n <Text\n bold={true}\n color={tone}\n component=\"h3\"\n sx={{ borderBottom: 1, borderColor: 'divider', p: 16 }}\n variant=\"h3\"\n >\n {copy.your_results}\n </Text>\n {shown.map((row, index) => {\n const increment = PAYMENT_INCREMENTS[index]\n const paymentCount = row?.result.paymentCount ?? 0\n const timeToPayoff =\n paymentCount >= 1\n ? (buildPluralCopy(\n copy.month,\n copy.months,\n paymentCount,\n String(paymentCount),\n ) as string)\n : '-'\n\n return (\n <Stack\n key={increment}\n sx={{\n borderBottom: index === shown.length - 1 ? 0 : 1,\n borderColor: 'divider',\n gap: 16,\n px: 16,\n py: 24,\n }}\n >\n <ResultLine\n label={\n <>\n {copy.monthly_payment}\n {increment > 0 && (\n <Text bold={true} color=\"success.main\" component=\"span\" variant=\"caption\">\n {` +${formatCurrency(increment, CURRENCY_FORMAT.cents)}`}\n </Text>\n )}\n </>\n }\n tone={tone}\n value={formatCurrency(row?.monthlyPayment ?? 0, CURRENCY_FORMAT.cents)}\n />\n <ResultLine label={copy.time_to_payoff} tone={tone} value={timeToPayoff} />\n <ResultLine\n label={copy.total_interest_paid}\n tone={tone}\n value={formatCurrency(row?.result.totalInterestPaid ?? 0, CURRENCY_FORMAT.cents)}\n />\n </Stack>\n )\n })}\n </Box>\n )\n}\n\nexport const CalculationFailed = ({ copy }: { copy: PayoffCalculatorCopy }) => (\n <Stack\n role=\"alert\"\n sx={{\n alignItems: 'center',\n bgcolor: 'background.default',\n borderRadius: '4px',\n px: 32,\n py: 40,\n textAlign: 'center',\n }}\n >\n <Icon aria-hidden=\"true\" fill={true} name=\"error\" size={24} sx={{ color: 'primary.main' }} />\n <Text bold={true} component=\"p\" sx={{ pb: 8, pt: 16 }} variant=\"body1\">\n {copy.calculation_failed}\n </Text>\n <Text component=\"p\" variant=\"body2\">\n {copy.calculation_failed_description}\n </Text>\n </Stack>\n)\n"],"mappings":";;;;;;;;;AAoBA,IAAM,IAAA,CAAc,EAAE,OAAA,GAAO,MAAA,GAAM,OAAA,EAAA,MACjC,gBAAA,EAAC,GAAD;AAAA,EAAO,IAAI;AAAA,IAAE,eAAe;AAAA,IAAO,gBAAgB;AAAA,EAAgB;AAAA,EAAnE,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,IAAM,OAAM;AAAA,IAAiB,WAAU;AAAA,IAAO,SAAQ;AAAA,IACnD,UAAA;AAAA,EACG,CAAA,GACN,gBAAA,EAAC,GAAD;AAAA,IACE,MA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ACF,CAAA;AAAA,EACD"}
|
|
1
|
+
{"version":3,"file":"PayoffResults.es.js","names":[],"sources":["../../../../src/insights-v2/actionBlocks/PayoffCalculatorBlock/PayoffResults.tsx"],"sourcesContent":["import React from 'react'\n\nimport Box from '@mui/material/Box'\nimport Divider from '@mui/material/Divider'\nimport Stack from '@mui/material/Stack'\n\nimport { Icon } from '@mxenabled/mx-icons'\nimport { Text } from '@mxenabled/mxui'\n\nimport { buildDynamicCopy, buildPluralCopy } from '../../../common'\nimport type { PayoffCalculatorCopy } from '../../../core'\nimport { CURRENCY_FORMAT, formatCurrency } from '../../../core/utils/NumberFormatting'\n\nimport { SubTabs, subTabPanelProps } from '../../components/SubTabs'\nimport { ELEVATION_SHADOW } from '../../components/shared/elevation'\n\nimport { PAYMENT_INCREMENTS, type PayoffRow } from './layout'\n\ntype Tone = 'text.primary' | 'text.secondary'\n\n/** Whole dollars without cents (Figma's \"$0\", \"$155\"), otherwise to the cent. */\nconst formatPayment = (amount: number) =>\n formatCurrency(amount, Number.isInteger(amount) ? CURRENCY_FORMAT.whole : CURRENCY_FORMAT.cents)\n\n/** \"_1{number} mo\" when the copy has the short form, else the \"month\"/\"months\" plural. */\nexport const formatPayoffTime = (copy: PayoffCalculatorCopy, paymentCount: number): string => {\n if (paymentCount < 1) return '-'\n if (copy.months_short) return buildDynamicCopy(copy.months_short, String(paymentCount)) as string\n\n return buildPluralCopy(copy.month, copy.months, paymentCount, String(paymentCount)) as string\n}\n\nconst PaymentFigure = ({ label, tone, value }: { label: string; tone: Tone; value: string }) => (\n <Stack sx={{ alignItems: 'center', flex: 1, minWidth: 0 }}>\n <Text bold={true} color={tone} component=\"span\" sx={{ transition: 'color 0.5s' }} variant=\"h3\">\n {value}\n </Text>\n <Text color=\"text.secondary\" component=\"span\" variant=\"caption\">\n {label}\n </Text>\n </Stack>\n)\n\ninterface ResultRowProps {\n icon: string\n label: string\n tone: Tone\n value: string\n}\n\nconst ResultRow = ({ icon, label, tone, value }: ResultRowProps) => (\n <Stack direction=\"row\" sx={{ alignItems: 'center', gap: 16, px: 24, py: 14 }}>\n {/* Figma `_components/avatar/background` (#ECECEC) → `secondary.lighter`, dark-mode safe. */}\n <Box\n aria-hidden={true}\n sx={{\n alignItems: 'center',\n bgcolor: 'secondary.lighter',\n borderRadius: '4px',\n color: 'text.primary',\n display: 'flex',\n flexShrink: 0,\n height: 32,\n justifyContent: 'center',\n width: 32,\n }}\n >\n <Icon name={icon} size={20} />\n </Box>\n <Text component=\"span\" sx={{ flexGrow: 1, minWidth: 0 }} variant=\"body1\">\n {label}\n </Text>\n <Text\n bold={true}\n color={tone}\n component=\"span\"\n sx={{ transition: 'color 0.5s' }}\n variant=\"body1\"\n >\n {value}\n </Text>\n </Stack>\n)\n\ninterface PayoffResultsProps {\n copy: PayoffCalculatorCopy\n /** Undefined until the user has calculated: the figures then show placeholders. */\n rows?: PayoffRow[]\n}\n\n/**\n * The scenario card (Figma `Monthly CC Prediction Summary/Drilldown Content`): one tab per payment\n * increment — Standard, +$10, +$20 — each showing the entered payment plus the extra, then the\n * time to payoff and the interest paid at that payment.\n */\nexport const PayoffResults = ({ copy, rows }: PayoffResultsProps) => {\n const id = React.useId()\n const [selectedIndex, setSelectedIndex] = React.useState(0)\n\n const isCalculated = !!rows\n const tone: Tone = isCalculated ? 'text.primary' : 'text.secondary'\n const increment = PAYMENT_INCREMENTS[selectedIndex]\n const row = rows?.[selectedIndex]\n const basePayment = row ? row.monthlyPayment - row.increment : 0\n\n const tabs = PAYMENT_INCREMENTS.map((amount) => ({\n label:\n amount === 0\n ? (copy.standard ?? copy.monthly_payment)\n : `+${formatCurrency(amount, CURRENCY_FORMAT.whole)}`,\n }))\n\n return (\n <Box\n sx={{\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n overflow: 'hidden',\n }}\n >\n {/* MUI Tabs draws its own divider under the row. */}\n <SubTabs\n ariaLabel={copy.your_results}\n id={id}\n isTypeFilter={false}\n onChange={setSelectedIndex}\n selectedIndex={selectedIndex}\n tabs={tabs}\n />\n <Stack {...subTabPanelProps(id, selectedIndex)} sx={{ gap: 16, p: 16 }}>\n <Stack\n direction=\"row\"\n sx={{ alignItems: 'center', bgcolor: 'background.default', borderRadius: '8px', py: 8 }}\n >\n <PaymentFigure\n label={copy.monthly_payment}\n tone={tone}\n value={formatPayment(basePayment)}\n />\n <Text aria-hidden={true} color=\"text.secondary\" component=\"span\" variant=\"h3\">\n +\n </Text>\n <PaymentFigure\n label={copy.extra_payment ?? copy.monthly_payment}\n tone={increment > 0 ? tone : 'text.secondary'}\n value={formatPayment(increment)}\n />\n </Stack>\n <Box sx={{ border: 1, borderColor: 'divider', borderRadius: '8px' }}>\n <ResultRow\n icon=\"calendar_clock\"\n label={copy.payoff ?? copy.time_to_payoff}\n tone={tone}\n value={formatPayoffTime(copy, row?.result.paymentCount ?? 0)}\n />\n <Divider sx={{ ml: 72 }} />\n <ResultRow\n icon=\"list_alt\"\n label={copy.interest_paid ?? copy.total_interest_paid}\n tone={tone}\n value={formatCurrency(row?.result.totalInterestPaid ?? 0, CURRENCY_FORMAT.cents)}\n />\n </Box>\n </Stack>\n </Box>\n )\n}\n\nexport const CalculationFailed = ({ copy }: { copy: PayoffCalculatorCopy }) => (\n <Stack\n role=\"alert\"\n sx={{\n alignItems: 'center',\n bgcolor: 'background.paper',\n borderRadius: '8px',\n boxShadow: ELEVATION_SHADOW[1],\n px: 32,\n py: 40,\n textAlign: 'center',\n }}\n >\n <Icon aria-hidden=\"true\" fill={true} name=\"error\" size={24} sx={{ color: 'primary.main' }} />\n <Text bold={true} component=\"p\" sx={{ pb: 8, pt: 16 }} variant=\"body1\">\n {copy.calculation_failed}\n </Text>\n <Text component=\"p\" variant=\"body2\">\n {copy.calculation_failed_description}\n </Text>\n </Stack>\n)\n"],"mappings":";;;;;;;;;;;;AAqBA,IAAM,IAAA,CAAiB,MACrB,EAAe,GAAQ,OAAO,UAAU,CAAM,IAAI,EAAgB,Q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,CAAqB,EAAE,MAAA,EAAA,MAClC,gBAAA,EAAC,GAAD;AAAA,EACE,MAAK;AAAA,EACL,IAAI;AAAA,IACF,YAAY;AAAA,IACZ,SAAS;AAAA,IACT,cAAc;AAAA,IACd,WAAW,EAAiB,CAAA;AAAA,IAC5B,IAAI;AAAA,IACJ,IAAI;AAAA,IACJ,WAAW;AAAA,EACb;AAAA,EAVF,UAAA;AAAA,IAYE,gBAAA,EAAC,GAAD;AAAA,MAAM,eAAY;AAAA,MAAO,MAAM;AAAA,MAAM,MAAK;AAAA,MAAQ,MAAM;AAAA,MAAI,IAAI,EAAE,OAAO,eAAe;AAAA,IAAI,CAAA;AAAA,IAC5F,gBAAA,EAAC,GAAD;AAAA,MAAM,MAAM;AAAA,MAAM,WAAU;AAAA,MAAI,IAAI;AAAA,QAAE,IAAI;AAAA,QAAG,IAAI;AAAA,MAAG;AAAA,MAAG,SAAQ;AAAA,MAC5D,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,IACN,gBAAA,EAAC,GAAD;AAAA,MAAM,WAAU;AAAA,MAAI,SAAQ;AAAA,MACzB,UAAA,EAAK;AAAA,IACF,CAAA;AAAA,EACD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useBeatActions as s } from "../beatActions.es.js";
|
|
2
|
-
import
|
|
3
|
-
import a from "./
|
|
2
|
+
import m from "./SubHeader.es.js";
|
|
3
|
+
import { InsightOptionsMenu as a } from "./InsightOptionsMenu.es.js";
|
|
4
4
|
import e from "@mui/material/Stack";
|
|
5
5
|
import { H3 as c } from "@mxenabled/mxui";
|
|
6
6
|
import { jsx as r, jsxs as o } from "react/jsx-runtime";
|
|
@@ -23,8 +23,8 @@ var g = ({ isMini: n, subtitle: t, title: i }) => {
|
|
|
23
23
|
children: [/* @__PURE__ */ r(c, {
|
|
24
24
|
truncate: !0,
|
|
25
25
|
children: i
|
|
26
|
-
}), !n && p && /* @__PURE__ */ r(
|
|
27
|
-
}), t && /* @__PURE__ */ r(
|
|
26
|
+
}), !n && p && /* @__PURE__ */ r(a, {})]
|
|
27
|
+
}), t && /* @__PURE__ */ r(m, { subtitle: t })]
|
|
28
28
|
});
|
|
29
29
|
};
|
|
30
30
|
export {
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
var p = {
|
|
2
2
|
1: "0px 2px 8px rgba(0, 0, 0, 0.12)",
|
|
3
3
|
16: "0px 12px 20px rgba(0, 0, 0, 0.22)"
|
|
4
|
-
}, x = "0px
|
|
4
|
+
}, x = "0px 2px 4px rgba(0, 0, 0, 0.12)";
|
|
5
5
|
export {
|
|
6
6
|
p as ELEVATION_SHADOW,
|
|
7
|
-
x as
|
|
8
|
-
r as SMALL_CARD_SHADOW
|
|
7
|
+
x as SMALL_CARD_SHADOW
|
|
9
8
|
};
|
|
10
9
|
|
|
11
10
|
//# sourceMappingURL=elevation.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"elevation.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/elevation.ts"],"sourcesContent":["/** Figma elevation shadows (single drop shadows, not MUI's `shadows[n]`). */\nexport const ELEVATION_SHADOW = {\n /** `elevation/1`: rows on a wash. */\n 1: '0px 2px 8px rgba(0, 0, 0, 0.12)',\n /** `elevation/16`: dialogs, snackbars. */\n 16: '0px 12px 20px rgba(0, 0, 0, 0.22)',\n} as const\n\n/** Soft two-layer card shadow (Figma) for a raised result card; off the numbered scale above. */\nexport const RAISED_CARD_SHADOW =\n '0px 6px 12px rgba(106, 115, 129, 0.16), 0px 3px 8px rgba(87, 102, 117, 0.06)'\n\n/** Small card shadow (Figma 0 / 2 / blur 4, black @ 0.12): the quiz feedback card and merchant header. */\nexport const SMALL_CARD_SHADOW = '0px 2px 4px rgba(0, 0, 0, 0.12)'\n"],"mappings":"AACA,IAAa,IAAmB;AAAA,EAE9B,GAAG;AAAA,EAEH,IAAI;AACN,
|
|
1
|
+
{"version":3,"file":"elevation.es.js","names":[],"sources":["../../../../src/insights-v2/components/shared/elevation.ts"],"sourcesContent":["/** Figma elevation shadows (single drop shadows, not MUI's `shadows[n]`). */\nexport const ELEVATION_SHADOW = {\n /** `elevation/1`: rows on a wash. */\n 1: '0px 2px 8px rgba(0, 0, 0, 0.12)',\n /** `elevation/16`: dialogs, snackbars. */\n 16: '0px 12px 20px rgba(0, 0, 0, 0.22)',\n} as const\n\n/** Soft two-layer card shadow (Figma) for a raised result card; off the numbered scale above. */\nexport const RAISED_CARD_SHADOW =\n '0px 6px 12px rgba(106, 115, 129, 0.16), 0px 3px 8px rgba(87, 102, 117, 0.06)'\n\n/** Small card shadow (Figma 0 / 2 / blur 4, black @ 0.12): the quiz feedback card and merchant header. */\nexport const SMALL_CARD_SHADOW = '0px 2px 4px rgba(0, 0, 0, 0.12)'\n"],"mappings":"AACA,IAAa,IAAmB;AAAA,EAE9B,GAAG;AAAA,EAEH,IAAI;AACN,GAOa,IAAoB"}
|
|
@@ -1,41 +1,41 @@
|
|
|
1
1
|
import { CategoryGuids as i } from "../../core/constants/Category.es.js";
|
|
2
|
-
import { useAppConfig as
|
|
3
|
-
import
|
|
4
|
-
import { exportTransactionsToCSV as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { getIncomeData as
|
|
8
|
-
import
|
|
9
|
-
import
|
|
2
|
+
import { useAppConfig as K, useCategoryStore as P, useGlobalCopyStore as Q, useGlobalUiStore as X, useTransactionStore as Y } from "../../common/context/hooks.es.js";
|
|
3
|
+
import O from "../../common/components/drawer/Drawer.es.js";
|
|
4
|
+
import { exportTransactionsToCSV as Z } from "../../core/utils/TransactionUtils.es.js";
|
|
5
|
+
import tt from "../../transactions/components/shared/TransactionList.es.js";
|
|
6
|
+
import et from "../../transactions/components/shared/TransactionDetails.es.js";
|
|
7
|
+
import { getIncomeData as ot, getSpendingData as at } from "../utils/SpendingData.es.js";
|
|
8
|
+
import G from "./SpendingTabLabel.es.js";
|
|
9
|
+
import N from "./SpendingChart.es.js";
|
|
10
10
|
import s from "react";
|
|
11
|
-
import { observer as
|
|
12
|
-
import
|
|
13
|
-
import { Icon as
|
|
14
|
-
import
|
|
15
|
-
import { jsx as e, jsxs as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import { useTheme as
|
|
20
|
-
var
|
|
11
|
+
import { observer as nt } from "mobx-react-lite";
|
|
12
|
+
import R from "@mui/material/Stack";
|
|
13
|
+
import { Icon as rt } from "@mxenabled/mxui";
|
|
14
|
+
import st from "@mui/material/Button";
|
|
15
|
+
import { jsx as e, jsxs as T } from "react/jsx-runtime";
|
|
16
|
+
import it from "@mui/material/Box";
|
|
17
|
+
import k from "@mui/material/Tab";
|
|
18
|
+
import ct from "@mui/material/Tabs";
|
|
19
|
+
import { useTheme as lt } from "@mui/material";
|
|
20
|
+
var dt = (n) => [
|
|
21
21
|
n.palette.chartMono.chartMono5,
|
|
22
22
|
n.palette.chartMono.chartMono4,
|
|
23
23
|
n.palette.chartMono.chartMono3,
|
|
24
24
|
n.palette.chartMono.chartMono2,
|
|
25
25
|
n.palette.chartMono.chartMono1,
|
|
26
26
|
n.palette.chartMono.chartMono6
|
|
27
|
-
],
|
|
28
|
-
const n =
|
|
27
|
+
], pt = () => {
|
|
28
|
+
const n = lt(), { clientConfig: _, is_mobile_webview: A } = K(), { categories: c, dateRangeCategoryTotals: l } = P(), { categories: d, goals: B, spending: r, transactions: V } = Q(), { displayedDateRange: y, selectedAccountGuids: v } = X(), { setFilter: p, sortedTransactions: f, sortedTransactionsWithSplits: L, tags: j } = Y(), m = _?.master?.deep_link_params?.account_guids, F = _?.master?.deep_link_params?.view, W = !A && !_?.transactions?.hide_export_csv, [u, M] = s.useState(""), [g, z] = s.useState(F === "income" ? 1 : 0), [w, I] = s.useState(""), [U, h] = s.useState(!1), C = s.useMemo(() => at(c, B, d, n, l), [
|
|
29
29
|
c,
|
|
30
30
|
d,
|
|
31
31
|
l
|
|
32
|
-
]), x = s.useMemo(() =>
|
|
32
|
+
]), x = s.useMemo(() => ot(c, d, l, dt(n)), [
|
|
33
33
|
c,
|
|
34
34
|
d,
|
|
35
35
|
l
|
|
36
|
-
]), S = s.useMemo(() =>
|
|
36
|
+
]), S = s.useMemo(() => f.find((t) => t.guid === w), [w, f]), $ = (t, a) => {
|
|
37
37
|
z(a), M("");
|
|
38
|
-
},
|
|
38
|
+
}, E = (t, a = !1) => {
|
|
39
39
|
a ? q(t) : M(u === t || t === "0" ? "" : t);
|
|
40
40
|
}, q = (t) => {
|
|
41
41
|
p({
|
|
@@ -43,17 +43,17 @@ var lt = (n) => [
|
|
|
43
43
|
dateRange: y,
|
|
44
44
|
custom: (a) => u === "other" ? a.top_level_category_guid === t : a.category_guid === t,
|
|
45
45
|
showSplits: !0
|
|
46
|
-
}),
|
|
47
|
-
},
|
|
46
|
+
}), h(!0);
|
|
47
|
+
}, D = (t) => {
|
|
48
48
|
const a = {
|
|
49
49
|
accounts: m || v,
|
|
50
50
|
dateRange: y
|
|
51
51
|
};
|
|
52
52
|
if (g === 0) if (t === "other") {
|
|
53
|
-
const o =
|
|
53
|
+
const o = C.categoryData.find((b) => b.guid === "other");
|
|
54
54
|
p({
|
|
55
55
|
...a,
|
|
56
|
-
custom: (
|
|
56
|
+
custom: (b) => !!o?.categoryTotals?.find((J) => J.guid === b.top_level_category_guid)
|
|
57
57
|
});
|
|
58
58
|
} else p({
|
|
59
59
|
...a,
|
|
@@ -64,68 +64,68 @@ var lt = (n) => [
|
|
|
64
64
|
...a,
|
|
65
65
|
custom: (o) => t ? o.category_guid === t : o.category_guid === i.INCOME || o.top_level_category_guid === i.INCOME
|
|
66
66
|
});
|
|
67
|
-
|
|
67
|
+
h(!0);
|
|
68
68
|
}, H = () => {
|
|
69
|
-
|
|
69
|
+
Z(L, j);
|
|
70
70
|
};
|
|
71
|
-
return /* @__PURE__ */
|
|
72
|
-
/* @__PURE__ */
|
|
71
|
+
return /* @__PURE__ */ T(it, { children: [
|
|
72
|
+
/* @__PURE__ */ T(ct, {
|
|
73
73
|
onChange: $,
|
|
74
74
|
value: g,
|
|
75
75
|
variant: "fullWidth",
|
|
76
|
-
children: [/* @__PURE__ */ e(
|
|
77
|
-
amount:
|
|
76
|
+
children: [/* @__PURE__ */ e(k, { label: /* @__PURE__ */ e(G, {
|
|
77
|
+
amount: C.totalAmount,
|
|
78
78
|
label: r.spend_tab_title
|
|
79
|
-
}) }), /* @__PURE__ */ e(
|
|
79
|
+
}) }), /* @__PURE__ */ e(k, { label: /* @__PURE__ */ e(G, {
|
|
80
80
|
amount: x.totalAmount,
|
|
81
81
|
label: r.income_tab_title
|
|
82
82
|
}) })]
|
|
83
83
|
}),
|
|
84
|
-
g === 0 && /* @__PURE__ */ e(
|
|
85
|
-
data:
|
|
86
|
-
onSelected:
|
|
87
|
-
onViewTransactions:
|
|
84
|
+
g === 0 && /* @__PURE__ */ e(N, {
|
|
85
|
+
data: C,
|
|
86
|
+
onSelected: E,
|
|
87
|
+
onViewTransactions: D,
|
|
88
88
|
selectedId: u,
|
|
89
89
|
title: r.spend_tab_title
|
|
90
90
|
}),
|
|
91
|
-
g === 1 && /* @__PURE__ */ e(
|
|
91
|
+
g === 1 && /* @__PURE__ */ e(N, {
|
|
92
92
|
data: x,
|
|
93
|
-
onSelected:
|
|
94
|
-
onViewTransactions:
|
|
93
|
+
onSelected: E,
|
|
94
|
+
onViewTransactions: D,
|
|
95
95
|
selectedId: u,
|
|
96
96
|
title: r.income_tab_title
|
|
97
97
|
}),
|
|
98
|
-
/* @__PURE__ */ e(
|
|
98
|
+
/* @__PURE__ */ e(O, {
|
|
99
99
|
ariaLabelClose: r.close_drawer_aria,
|
|
100
100
|
isOpen: U,
|
|
101
|
-
onClose: () =>
|
|
101
|
+
onClose: () => h(!1),
|
|
102
102
|
title: r.transactions_drawer_title,
|
|
103
|
-
children: /* @__PURE__ */
|
|
103
|
+
children: /* @__PURE__ */ T(R, { children: [W && f.length > 0 && /* @__PURE__ */ e(R, {
|
|
104
104
|
direction: "row",
|
|
105
105
|
justifyContent: "right",
|
|
106
106
|
mb: -24,
|
|
107
107
|
mr: 8,
|
|
108
108
|
mt: 8,
|
|
109
109
|
zIndex: 1,
|
|
110
|
-
children: /* @__PURE__ */ e(
|
|
110
|
+
children: /* @__PURE__ */ e(st, {
|
|
111
111
|
onClick: H,
|
|
112
|
-
startIcon: /* @__PURE__ */ e(
|
|
112
|
+
startIcon: /* @__PURE__ */ e(rt, { name: "ios_share" }),
|
|
113
113
|
variant: "text",
|
|
114
|
-
children:
|
|
114
|
+
children: V.export_csv_btn
|
|
115
115
|
})
|
|
116
|
-
}), /* @__PURE__ */ e(
|
|
116
|
+
}), /* @__PURE__ */ e(tt, { onClick: I })] })
|
|
117
117
|
}),
|
|
118
|
-
/* @__PURE__ */ e(
|
|
118
|
+
/* @__PURE__ */ e(O, {
|
|
119
119
|
ariaLabelClose: r.close_drawer_aria,
|
|
120
120
|
isOpen: !!S,
|
|
121
121
|
onClose: () => I(""),
|
|
122
122
|
title: r.transaction_details_drawer_title,
|
|
123
|
-
children: S && /* @__PURE__ */ e(
|
|
123
|
+
children: S && /* @__PURE__ */ e(et, { transaction: S })
|
|
124
124
|
})
|
|
125
125
|
] });
|
|
126
|
-
},
|
|
126
|
+
}, Gt = nt(pt);
|
|
127
127
|
export {
|
|
128
|
-
|
|
128
|
+
Gt as default
|
|
129
129
|
};
|
|
130
130
|
|
|
131
131
|
//# sourceMappingURL=Spending.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spending.es.js","names":[],"sources":["../../../src/spending/components/Spending.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\nimport { useTheme } from '@mui/material'\nimport type { Theme } from '@mui/system'\n\nimport { Icon } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useCategoryStore,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n} from '../../common'\nimport { CategoryGuids } from '../../core/constants'\nimport { Transaction } from '../../core'\nimport { exportTransactionsToCSV } from '../../core/utils/TransactionUtils'\n\nimport { TransactionDetails, TransactionList } from '../../transactions'\nimport { getIncomeData, getSpendingData } from '../utils/SpendingData'\nimport SpendingChart from './SpendingChart'\nimport SpendingTabLabel from './SpendingTabLabel'\n\nconst getIncomeColors = (theme: Theme) => {\n return [\n theme.palette.chartMono.chartMono5,\n theme.palette.chartMono.chartMono4,\n theme.palette.chartMono.chartMono3,\n theme.palette.chartMono.chartMono2,\n theme.palette.chartMono.chartMono1,\n theme.palette.chartMono.chartMono6,\n ]\n}\n\nconst Spending = () => {\n const theme = useTheme()\n const { is_mobile_webview } = useAppConfig()\n\n const { clientConfig } = useAppConfig()\n const { categories, dateRangeCategoryTotals } = useCategoryStore()\n\n const {\n categories: categoriesCopy,\n goals: goalsCopy,\n spending: spendingCopy,\n transactions: transactionCopy,\n } = useGlobalCopyStore()\n const { displayedDateRange, selectedAccountGuids } = useGlobalUiStore()\n const {\n setFilter,\n sortedTransactions: transactions,\n sortedTransactionsWithSplits,\n tags,\n } = useTransactionStore()\n\n const accountGuids = clientConfig?.master?.deep_link_params?.account_guids\n const view = clientConfig?.master?.deep_link_params?.view\n\n const [selectedId, setSelectedId] = React.useState('')\n const [selectedTab, setSelectedTab] = React.useState(view === 'income' ? 1 : 0)\n const [transactionGuid, setTransactionGuid] = React.useState('')\n const [transactionsOpen, setTransactionsOpen] = React.useState(false)\n\n const spendingData = React.useMemo(\n () => getSpendingData(categories, goalsCopy, categoriesCopy, theme, dateRangeCategoryTotals),\n [categories, categoriesCopy, dateRangeCategoryTotals],\n )\n\n const incomeData = React.useMemo(\n () =>\n getIncomeData(categories, categoriesCopy, dateRangeCategoryTotals, getIncomeColors(theme)),\n [categories, categoriesCopy, dateRangeCategoryTotals],\n )\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const handleTabChange = (_event: React.SyntheticEvent, newValue: number) => {\n setSelectedTab(newValue)\n setSelectedId('')\n }\n\n const handleSelected = (id: string, isSubcategory: boolean = false) => {\n if (isSubcategory) {\n handleSelectedSubcategory(id)\n } else {\n setSelectedId(selectedId === id || id === '0' ? '' : id)\n }\n }\n\n const handleSelectedSubcategory = (id: string) => {\n const transactionFilter = {\n accounts: accountGuids ? accountGuids : selectedAccountGuids,\n dateRange: displayedDateRange,\n }\n\n setFilter({\n ...transactionFilter,\n custom: (t: Transaction) =>\n selectedId === 'other' ? t.top_level_category_guid === id : t.category_guid === id,\n showSplits: true,\n })\n\n setTransactionsOpen(true)\n }\n\n const handleViewTransactions = (id: string) => {\n const transactionFilter = {\n accounts: accountGuids ? accountGuids : selectedAccountGuids,\n dateRange: displayedDateRange,\n }\n\n if (selectedTab === 0) {\n // Spending\n if (id === 'other') {\n const other = spendingData.categoryData.find((c) => c.guid === 'other')\n setFilter({\n ...transactionFilter,\n custom: (t: Transaction) =>\n Boolean(other?.categoryTotals?.find((ct) => ct.guid === t.top_level_category_guid)),\n })\n } else {\n setFilter({\n ...transactionFilter,\n custom: (t: Transaction) =>\n id\n ? t.top_level_category_guid === id\n : t.top_level_category_guid !== CategoryGuids.INCOME &&\n t.category_guid !== CategoryGuids.INCOME &&\n t.top_level_category_guid !== CategoryGuids.INVESTMENTS &&\n t.top_level_category_guid !== CategoryGuids.TRANSFER,\n showSplits: Boolean(id),\n })\n }\n } else {\n // Income\n setFilter({\n ...transactionFilter,\n custom: (t: Transaction) =>\n id\n ? t.category_guid === id\n : t.category_guid === CategoryGuids.INCOME ||\n t.top_level_category_guid === CategoryGuids.INCOME,\n })\n }\n\n setTransactionsOpen(true)\n }\n\n const handleExportToCsv = () => {\n exportTransactionsToCSV(sortedTransactionsWithSplits, tags)\n }\n\n return (\n <Box>\n <Tabs onChange={handleTabChange} value={selectedTab} variant=\"fullWidth\">\n <Tab\n label={\n <SpendingTabLabel\n amount={spendingData.totalAmount}\n label={spendingCopy.spend_tab_title}\n />\n }\n />\n <Tab\n label={\n <SpendingTabLabel\n amount={incomeData.totalAmount}\n label={spendingCopy.income_tab_title}\n />\n }\n />\n </Tabs>\n {selectedTab === 0 && (\n <SpendingChart\n data={spendingData}\n onSelected={handleSelected}\n onViewTransactions={handleViewTransactions}\n selectedId={selectedId}\n title={spendingCopy.spend_tab_title}\n />\n )}\n {selectedTab === 1 && (\n <SpendingChart\n data={incomeData}\n onSelected={handleSelected}\n onViewTransactions={handleViewTransactions}\n selectedId={selectedId}\n title={spendingCopy.income_tab_title}\n />\n )}\n <Drawer\n ariaLabelClose={spendingCopy.close_drawer_aria}\n isOpen={transactionsOpen}\n onClose={() => setTransactionsOpen(false)}\n title={spendingCopy.transactions_drawer_title}\n >\n <Stack>\n {!is_mobile_webview && transactions.length > 0 && (\n <Stack direction=\"row\" justifyContent=\"right\" mb={-24} mr={8} mt={8} zIndex={1}>\n <Button\n onClick={handleExportToCsv}\n startIcon={<Icon name=\"ios_share\" />}\n variant=\"text\"\n >\n {transactionCopy.export_csv_btn}\n </Button>\n </Stack>\n )}\n <TransactionList onClick={setTransactionGuid} />\n </Stack>\n </Drawer>\n <Drawer\n ariaLabelClose={spendingCopy.close_drawer_aria}\n isOpen={Boolean(transaction)}\n onClose={() => setTransactionGuid('')}\n title={spendingCopy.transaction_details_drawer_title}\n >\n {transaction && <TransactionDetails transaction={transaction} />}\n </Drawer>\n </Box>\n )\n}\n\nexport default observer(Spending)\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAA,CAAmB,MAChB;AAAA,EACL,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAC1B,GAGI,KAAA,MAAi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CAAA;AAAA,IACR,gBAAA,EAAC,GAAD;AAAA,MACE,gBAAgB,EAAa;AAAA,MAC7B,QAAQ,EAAQ;AAAA,MAChB,SAAA,MAAe,EAAmB,EAAE;AAAA,MACpC,OAAO,EAAa;AAAA,MAEnB,UAAA,KAAe,gBAAA,EAAC,IAAD,EAAiC,aAAA,EAAc,CAAA;AAAA,IACzD,CAAA;AAAA,EACL,EAAA,CAAA;AAET,GAEA,KAAe,GAAS,EAAQ"}
|
|
1
|
+
{"version":3,"file":"Spending.es.js","names":[],"sources":["../../../src/spending/components/Spending.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\nimport { useTheme } from '@mui/material'\nimport type { Theme } from '@mui/system'\n\nimport { Icon } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useCategoryStore,\n useGlobalCopyStore,\n useGlobalUiStore,\n useTransactionStore,\n} from '../../common'\nimport { CategoryGuids } from '../../core/constants'\nimport { Transaction } from '../../core'\nimport { exportTransactionsToCSV } from '../../core/utils/TransactionUtils'\n\nimport { TransactionDetails, TransactionList } from '../../transactions'\nimport { getIncomeData, getSpendingData } from '../utils/SpendingData'\nimport SpendingChart from './SpendingChart'\nimport SpendingTabLabel from './SpendingTabLabel'\n\nconst getIncomeColors = (theme: Theme) => {\n return [\n theme.palette.chartMono.chartMono5,\n theme.palette.chartMono.chartMono4,\n theme.palette.chartMono.chartMono3,\n theme.palette.chartMono.chartMono2,\n theme.palette.chartMono.chartMono1,\n theme.palette.chartMono.chartMono6,\n ]\n}\n\nconst Spending = () => {\n const theme = useTheme()\n const { clientConfig, is_mobile_webview } = useAppConfig()\n const { categories, dateRangeCategoryTotals } = useCategoryStore()\n\n const {\n categories: categoriesCopy,\n goals: goalsCopy,\n spending: spendingCopy,\n transactions: transactionCopy,\n } = useGlobalCopyStore()\n const { displayedDateRange, selectedAccountGuids } = useGlobalUiStore()\n const {\n setFilter,\n sortedTransactions: transactions,\n sortedTransactionsWithSplits,\n tags,\n } = useTransactionStore()\n\n const accountGuids = clientConfig?.master?.deep_link_params?.account_guids\n const view = clientConfig?.master?.deep_link_params?.view\n const canExportCsv = !is_mobile_webview && !clientConfig?.transactions?.hide_export_csv\n\n const [selectedId, setSelectedId] = React.useState('')\n const [selectedTab, setSelectedTab] = React.useState(view === 'income' ? 1 : 0)\n const [transactionGuid, setTransactionGuid] = React.useState('')\n const [transactionsOpen, setTransactionsOpen] = React.useState(false)\n\n const spendingData = React.useMemo(\n () => getSpendingData(categories, goalsCopy, categoriesCopy, theme, dateRangeCategoryTotals),\n [categories, categoriesCopy, dateRangeCategoryTotals],\n )\n\n const incomeData = React.useMemo(\n () =>\n getIncomeData(categories, categoriesCopy, dateRangeCategoryTotals, getIncomeColors(theme)),\n [categories, categoriesCopy, dateRangeCategoryTotals],\n )\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const handleTabChange = (_event: React.SyntheticEvent, newValue: number) => {\n setSelectedTab(newValue)\n setSelectedId('')\n }\n\n const handleSelected = (id: string, isSubcategory: boolean = false) => {\n if (isSubcategory) {\n handleSelectedSubcategory(id)\n } else {\n setSelectedId(selectedId === id || id === '0' ? '' : id)\n }\n }\n\n const handleSelectedSubcategory = (id: string) => {\n const transactionFilter = {\n accounts: accountGuids ? accountGuids : selectedAccountGuids,\n dateRange: displayedDateRange,\n }\n\n setFilter({\n ...transactionFilter,\n custom: (t: Transaction) =>\n selectedId === 'other' ? t.top_level_category_guid === id : t.category_guid === id,\n showSplits: true,\n })\n\n setTransactionsOpen(true)\n }\n\n const handleViewTransactions = (id: string) => {\n const transactionFilter = {\n accounts: accountGuids ? accountGuids : selectedAccountGuids,\n dateRange: displayedDateRange,\n }\n\n if (selectedTab === 0) {\n // Spending\n if (id === 'other') {\n const other = spendingData.categoryData.find((c) => c.guid === 'other')\n setFilter({\n ...transactionFilter,\n custom: (t: Transaction) =>\n Boolean(other?.categoryTotals?.find((ct) => ct.guid === t.top_level_category_guid)),\n })\n } else {\n setFilter({\n ...transactionFilter,\n custom: (t: Transaction) =>\n id\n ? t.top_level_category_guid === id\n : t.top_level_category_guid !== CategoryGuids.INCOME &&\n t.category_guid !== CategoryGuids.INCOME &&\n t.top_level_category_guid !== CategoryGuids.INVESTMENTS &&\n t.top_level_category_guid !== CategoryGuids.TRANSFER,\n showSplits: Boolean(id),\n })\n }\n } else {\n // Income\n setFilter({\n ...transactionFilter,\n custom: (t: Transaction) =>\n id\n ? t.category_guid === id\n : t.category_guid === CategoryGuids.INCOME ||\n t.top_level_category_guid === CategoryGuids.INCOME,\n })\n }\n\n setTransactionsOpen(true)\n }\n\n const handleExportToCsv = () => {\n exportTransactionsToCSV(sortedTransactionsWithSplits, tags)\n }\n\n return (\n <Box>\n <Tabs onChange={handleTabChange} value={selectedTab} variant=\"fullWidth\">\n <Tab\n label={\n <SpendingTabLabel\n amount={spendingData.totalAmount}\n label={spendingCopy.spend_tab_title}\n />\n }\n />\n <Tab\n label={\n <SpendingTabLabel\n amount={incomeData.totalAmount}\n label={spendingCopy.income_tab_title}\n />\n }\n />\n </Tabs>\n {selectedTab === 0 && (\n <SpendingChart\n data={spendingData}\n onSelected={handleSelected}\n onViewTransactions={handleViewTransactions}\n selectedId={selectedId}\n title={spendingCopy.spend_tab_title}\n />\n )}\n {selectedTab === 1 && (\n <SpendingChart\n data={incomeData}\n onSelected={handleSelected}\n onViewTransactions={handleViewTransactions}\n selectedId={selectedId}\n title={spendingCopy.income_tab_title}\n />\n )}\n <Drawer\n ariaLabelClose={spendingCopy.close_drawer_aria}\n isOpen={transactionsOpen}\n onClose={() => setTransactionsOpen(false)}\n title={spendingCopy.transactions_drawer_title}\n >\n <Stack>\n {canExportCsv && transactions.length > 0 && (\n <Stack direction=\"row\" justifyContent=\"right\" mb={-24} mr={8} mt={8} zIndex={1}>\n <Button\n onClick={handleExportToCsv}\n startIcon={<Icon name=\"ios_share\" />}\n variant=\"text\"\n >\n {transactionCopy.export_csv_btn}\n </Button>\n </Stack>\n )}\n <TransactionList onClick={setTransactionGuid} />\n </Stack>\n </Drawer>\n <Drawer\n ariaLabelClose={spendingCopy.close_drawer_aria}\n isOpen={Boolean(transaction)}\n onClose={() => setTransactionGuid('')}\n title={spendingCopy.transaction_details_drawer_title}\n >\n {transaction && <TransactionDetails transaction={transaction} />}\n </Drawer>\n </Box>\n )\n}\n\nexport default observer(Spending)\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA8BA,IAAM,KAAA,CAAmB,MAChB;AAAA,EACL,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAAA,EACxB,EAAM,QAAQ,UAAU;AAC1B,GAGI,KAAA,MAAiB;AACrB,QAAM,IAAQ,GAAS,GACjB,EAAE,cAAA,GAAc,mBAAA,EAAA,IAAsB,EAAa,GACnD,EAAE,YAAA,GAAY,yBAAA,EAAA,IAA4B,EAAiB,GAE3D,EACJ,YAAY,GACZ,OAAO,GACP,UAAU,GACV,cAAc,EAAA,IACZ,EAAmB,GACjB,EAAE,oBAAA,GAAoB,sBAAA,EAAA,IAAyB,EAAiB,GAChE,EACJ,WAAA,GACA,oBAAoB,GACpB,8BAAA,GACA,MAAA,EAAA,IACE,EAAoB,GAElB,IAAe,GAAc,QAAQ,kBAAkB,eACvD,IAAO,GAAc,QAAQ,kBAAkB,MAC/C,IAAe,CAAC,KAAqB,CAAC,GAAc,cAAc,iBAElE,CAAC,GAAY,CAAA,IAAiB,EAAM,SAAS,EAAE,GAC/C,CAAC,GAAa,CAAA,IAAkB,EAAM,SAAS,MAAS,WAAW,IAAI,CAAC,GACxE,CAAC,GAAiB,C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