@mx-cartographer/experiences 9.7.166 → 9.7.168
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 +10 -2
- package/dist/budgets/components/budgetdetails/BudgetDetails.es.js +35 -35
- package/dist/budgets/components/budgetdetails/BudgetDetails.es.js.map +1 -1
- package/dist/common/components/dialog/Dialog.es.js +26 -29
- package/dist/common/components/dialog/Dialog.es.js.map +1 -1
- package/dist/core/types/AppData.d.ts +1 -0
- package/dist/spending/components/Spending.es.js +52 -52
- package/dist/spending/components/Spending.es.js.map +1 -1
- package/dist/transactions/components/shared/transactiondetails/actions/CategoryAction.es.js +51 -49
- package/dist/transactions/components/shared/transactiondetails/actions/CategoryAction.es.js.map +1 -1
- package/dist/transactions/components/transactionwidget/actions/EditCategoryAction.es.js +25 -23
- package/dist/transactions/components/transactionwidget/actions/EditCategoryAction.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
package/CHANGELOG.md
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
+
## [9.7.168] - 11-16-2026
|
|
2
|
+
|
|
3
|
+
- **ADDED** - `clientConfig.transactions.hide_export_csv` client setting to hide Export CSV in the spending, budgets, and trends widgets (WELL-131)
|
|
4
|
+
|
|
5
|
+
## [9.7.167] - 11-16-2026
|
|
6
|
+
|
|
7
|
+
- **FIXED** - Shared dialog titles are read by screen readers and wrap instead of being cut off, and dialogs use the paper background (WELL-202)
|
|
8
|
+
|
|
1
9
|
## [9.7.166] - 11-16-2026
|
|
2
10
|
|
|
3
11
|
- **FIXED** - Save Enough to Live On: 8px corners on the card table and the Make Transfer drawer's bottom card (WEC-2330)
|
|
4
|
-
- **CHANGED** - The Make Transfer drawer (Save Enough to Live On, Save an Extra
|
|
12
|
+
- **CHANGED** - The Make Transfer drawer (Save Enough to Live On, Save an Extra $100) uses the default back arrow, not a close X (WEC-2330)
|
|
5
13
|
- **FIXED** - Switch Direct Deposit's default card wash is at Figma's 127° (WEC-2330)
|
|
6
14
|
- **FIXED** - Upcoming Bill's drawer tip has no close button (WEC-2330)
|
|
7
15
|
- **CHANGED** - Upcoming Bill's drawer shows only the paid bills and opens on the latest (WEC-2330)
|
|
8
|
-
- **REMOVED** - Upcoming Bill's projected-bill tab and its "Projected amount" row, and the
|
|
16
|
+
- **REMOVED** - Upcoming Bill's projected-bill tab and its "Projected amount" row, and the unused `projected_amount` field of the insights feed copy type (WEC-2330)
|
|
9
17
|
|
|
10
18
|
## [9.7.165] - 11-16-2026
|
|
11
19
|
|
|
@@ -1,72 +1,72 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
2
|
-
import { useScreenSize as
|
|
3
|
-
import
|
|
4
|
-
import { exportTransactionsToCSV as
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import { Header as
|
|
8
|
-
import { SubBudgetList as
|
|
1
|
+
import { useAppConfig as D, useBudgetsStore as j, useGlobalCopyStore as G, useTransactionStore as I } from "../../../common/context/hooks.es.js";
|
|
2
|
+
import { useScreenSize as L } from "../../../common/hooks/useScreenSize.es.js";
|
|
3
|
+
import z from "../../../common/components/drawer/Drawer.es.js";
|
|
4
|
+
import { exportTransactionsToCSV as A } from "../../../core/utils/TransactionUtils.es.js";
|
|
5
|
+
import E from "../../../transactions/components/shared/TransactionList.es.js";
|
|
6
|
+
import W from "../../../transactions/components/shared/TransactionDetails.es.js";
|
|
7
|
+
import { Header as H } from "./Header.es.js";
|
|
8
|
+
import { SubBudgetList as M } from "./SubBudgetList.es.js";
|
|
9
9
|
import c from "react";
|
|
10
|
-
import { observer as
|
|
10
|
+
import { observer as O } from "mobx-react-lite";
|
|
11
11
|
import e from "@mui/material/Stack";
|
|
12
|
-
import { Icon as
|
|
13
|
-
import
|
|
12
|
+
import { Icon as R } from "@mxenabled/mxui";
|
|
13
|
+
import V from "@mui/material/Button";
|
|
14
14
|
import { jsx as t, jsxs as r } from "react/jsx-runtime";
|
|
15
15
|
import p from "@mui/material/Tab";
|
|
16
|
-
import
|
|
17
|
-
var
|
|
18
|
-
const {
|
|
19
|
-
|
|
20
|
-
},
|
|
21
|
-
|
|
16
|
+
import $ from "@mui/material/Tabs";
|
|
17
|
+
var nt = O(({ budget: l }) => {
|
|
18
|
+
const { clientConfig: u, is_mobile_webview: f } = D(), { setAlert: h } = j(), { budgets: o, common: b, transactions: _ } = G(), { isDesktop: T, isSmallTablet: C, isTablet: g } = L(), { sortedTransactions: s, sortedTransactionsWithSplits: S, tags: v } = I(), [n, x] = c.useState(0), [m, a] = c.useState(""), i = c.useMemo(() => s.find((d) => d.guid === m), [m, s]), w = (d, k) => {
|
|
19
|
+
x(k);
|
|
20
|
+
}, y = () => {
|
|
21
|
+
A(S, v), h({
|
|
22
22
|
msg: o.alert_csv_downloaded,
|
|
23
23
|
severity: "success"
|
|
24
24
|
});
|
|
25
|
-
},
|
|
25
|
+
}, B = s.length > 0 && !f && !u?.transactions?.hide_export_csv && (T || g && !C);
|
|
26
26
|
return /* @__PURE__ */ r(e, {
|
|
27
27
|
gap: 24,
|
|
28
|
-
children: [/* @__PURE__ */ t(
|
|
29
|
-
/* @__PURE__ */ r(
|
|
30
|
-
onChange:
|
|
28
|
+
children: [/* @__PURE__ */ t(H, { budget: l }), /* @__PURE__ */ r(e, { children: [
|
|
29
|
+
/* @__PURE__ */ r($, {
|
|
30
|
+
onChange: w,
|
|
31
31
|
sx: { width: "100%" },
|
|
32
32
|
textColor: "primary",
|
|
33
|
-
value:
|
|
33
|
+
value: n,
|
|
34
34
|
variant: "fullWidth",
|
|
35
35
|
children: [/* @__PURE__ */ t(p, { label: o.details_transactions_tab }), /* @__PURE__ */ t(p, { label: o.details_subbudgets_tab })]
|
|
36
36
|
}),
|
|
37
|
-
|
|
37
|
+
n === 0 && /* @__PURE__ */ r(e, { children: [B && /* @__PURE__ */ t(e, {
|
|
38
38
|
direction: "row",
|
|
39
39
|
justifyContent: "right",
|
|
40
40
|
mb: -24,
|
|
41
41
|
mr: 8,
|
|
42
42
|
mt: 8,
|
|
43
43
|
zIndex: 1,
|
|
44
|
-
children: /* @__PURE__ */ t(
|
|
45
|
-
onClick:
|
|
46
|
-
startIcon: /* @__PURE__ */ t(
|
|
44
|
+
children: /* @__PURE__ */ t(V, {
|
|
45
|
+
onClick: y,
|
|
46
|
+
startIcon: /* @__PURE__ */ t(R, { name: "ios_share" }),
|
|
47
47
|
variant: "text",
|
|
48
|
-
children:
|
|
48
|
+
children: _.export_csv_btn
|
|
49
49
|
})
|
|
50
|
-
}), /* @__PURE__ */ t(
|
|
50
|
+
}), /* @__PURE__ */ t(E, {
|
|
51
51
|
height: "100%",
|
|
52
|
-
onClick:
|
|
52
|
+
onClick: a
|
|
53
53
|
})] }),
|
|
54
|
-
|
|
54
|
+
n === 1 && /* @__PURE__ */ t(M, {
|
|
55
55
|
budget: l,
|
|
56
|
-
onTransactionClick:
|
|
56
|
+
onTransactionClick: a
|
|
57
57
|
}),
|
|
58
|
-
/* @__PURE__ */ t(
|
|
58
|
+
/* @__PURE__ */ t(z, {
|
|
59
59
|
ariaLabelClose: b.close_aria,
|
|
60
60
|
isOpen: !!i,
|
|
61
|
-
onClose: () =>
|
|
61
|
+
onClose: () => a(""),
|
|
62
62
|
title: o.details_transaction_drawer,
|
|
63
|
-
children: i && /* @__PURE__ */ t(
|
|
63
|
+
children: i && /* @__PURE__ */ t(W, { transaction: i })
|
|
64
64
|
})
|
|
65
65
|
] })]
|
|
66
66
|
});
|
|
67
67
|
});
|
|
68
68
|
export {
|
|
69
|
-
|
|
69
|
+
nt as BudgetDetails
|
|
70
70
|
};
|
|
71
71
|
|
|
72
72
|
//# sourceMappingURL=BudgetDetails.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BudgetDetails.es.js","names":[],"sources":["../../../../src/budgets/components/budgetdetails/BudgetDetails.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { Icon } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useBudgetsStore,\n useGlobalCopyStore,\n useScreenSize,\n useTransactionStore,\n} from '../../../common'\nimport { type DetailedBudget } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\n\nimport { TransactionDetails, TransactionList } from '../../../transactions'\n\nimport { Header } from './Header'\nimport { SubBudgetList } from './SubBudgetList'\n\ninterface BudgetDetailsProps {\n budget: DetailedBudget\n}\n\nexport const BudgetDetails: React.FC<BudgetDetailsProps> = observer(({ budget }) => {\n const { is_mobile_webview } = useAppConfig()\n const { setAlert } = useBudgetsStore()\n const { budgets: copy, common: commonCopy, transactions: transactionCopy } = useGlobalCopyStore()\n const { isDesktop, isSmallTablet, isTablet } = useScreenSize()\n const {\n sortedTransactions: transactions,\n sortedTransactionsWithSplits,\n tags,\n } = useTransactionStore()\n\n const [selectedTab, setSelectedTab] = React.useState(0)\n const [transactionGuid, setTransactionGuid] = React.useState('')\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 }\n\n const handleExportToCsv = () => {\n exportTransactionsToCSV(sortedTransactionsWithSplits, tags)\n setAlert({ msg: copy.alert_csv_downloaded, severity: 'success' })\n }\n\n const shouldShowExportButton =\n transactions.length > 0
|
|
1
|
+
{"version":3,"file":"BudgetDetails.es.js","names":[],"sources":["../../../../src/budgets/components/budgetdetails/BudgetDetails.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Button from '@mui/material/Button'\nimport Stack from '@mui/material/Stack'\nimport Tab from '@mui/material/Tab'\nimport Tabs from '@mui/material/Tabs'\n\nimport { Icon } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useBudgetsStore,\n useGlobalCopyStore,\n useScreenSize,\n useTransactionStore,\n} from '../../../common'\nimport { type DetailedBudget } from '../../../core'\nimport { exportTransactionsToCSV } from '../../../core/utils/TransactionUtils'\n\nimport { TransactionDetails, TransactionList } from '../../../transactions'\n\nimport { Header } from './Header'\nimport { SubBudgetList } from './SubBudgetList'\n\ninterface BudgetDetailsProps {\n budget: DetailedBudget\n}\n\nexport const BudgetDetails: React.FC<BudgetDetailsProps> = observer(({ budget }) => {\n const { clientConfig, is_mobile_webview } = useAppConfig()\n const { setAlert } = useBudgetsStore()\n const { budgets: copy, common: commonCopy, transactions: transactionCopy } = useGlobalCopyStore()\n const { isDesktop, isSmallTablet, isTablet } = useScreenSize()\n const {\n sortedTransactions: transactions,\n sortedTransactionsWithSplits,\n tags,\n } = useTransactionStore()\n\n const [selectedTab, setSelectedTab] = React.useState(0)\n const [transactionGuid, setTransactionGuid] = React.useState('')\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 }\n\n const handleExportToCsv = () => {\n exportTransactionsToCSV(sortedTransactionsWithSplits, tags)\n setAlert({ msg: copy.alert_csv_downloaded, severity: 'success' })\n }\n\n const shouldShowExportButton =\n transactions.length > 0 &&\n !is_mobile_webview &&\n !clientConfig?.transactions?.hide_export_csv &&\n (isDesktop || (isTablet && !isSmallTablet))\n\n return (\n <Stack gap={24}>\n <Header budget={budget} />\n\n <Stack>\n <Tabs\n onChange={handleTabChange}\n sx={{ width: '100%' }}\n textColor=\"primary\"\n value={selectedTab}\n variant=\"fullWidth\"\n >\n <Tab label={copy.details_transactions_tab} />\n <Tab label={copy.details_subbudgets_tab} />\n </Tabs>\n {selectedTab === 0 && (\n <Stack>\n {shouldShowExportButton && (\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 height=\"100%\" onClick={setTransactionGuid} />\n </Stack>\n )}\n {selectedTab === 1 && (\n <SubBudgetList budget={budget} onTransactionClick={setTransactionGuid} />\n )}\n\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={Boolean(transaction)}\n onClose={() => setTransactionGuid('')}\n title={copy.details_transaction_drawer}\n >\n {transaction && <TransactionDetails transaction={transaction} />}\n </Drawer>\n </Stack>\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;AA8BA,IAAa,KAA8C,EAAA,CAAU,EAAE,QAAA,EAAA,MAAa;AAClF,QAAM,EAAE,cAAA,GAAc,mBAAA,EAAA,IAAsB,EAAa,GACnD,EAAE,UAAA,EAAA,IAAa,EAAgB,GAC/B,EAAE,SAAS,GAAM,QAAQ,GAAY,cAAc,EAAA,IAAoB,EAAmB,GAC1F,EAAE,WAAA,GAAW,eAAA,GAAe,UAAA,EAAA,IAAa,EAAc,GACvD,EACJ,oBAAoB,GACpB,8BAAA,GACA,MAAA,EAAA,IACE,EAAoB,GAElB,CAAC,GAAa,CAAA,IAAkB,EAAM,SAAS,CAAC,GAChD,CAAC,GAAiB,CAAA,IAAsB,EAAM,SAAS,EAAE,GAEzD,IAAc,EAAM,QAAA,MAClB,EAAa,KAAA,CAAM,MAAM,EAAE,SAAS,CAAe,GACzD,CAAC,GAAiB,CAAY,CAChC,GAEM,IAAA,CAAmB,GAA8B,MAAqB;AAC1E,IAAA,EAAe,CAAQ;AAAA,EACzB,GAEM,IAAA,MAA0B;AAC9B,IAAA,EAAwB,GAA8B,CAAI,GAC1D,EAAS;AAAA,MAAE,KAAK,EAAK;AAAA,MAAsB,UAAU;AAAA,IAAU,CAAC;AAAA,EAClE,GAEM,IACJ,EAAa,SAAS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AA,QAEX,UAAA,KAAe,gBAAA,EAAC,GAAD,EAAiC,aAAA,EAAc,CAAA;AAAA,MACzD,CAAA;AAAA,IACH,EAAA,CAAA,CACF;AAAA;AAEX,CAAC"}
|
|
@@ -1,45 +1,42 @@
|
|
|
1
|
-
import { useScreenSize as
|
|
2
|
-
import { useFocusReturn as
|
|
3
|
-
import
|
|
4
|
-
import { DialogFooter as
|
|
5
|
-
import { jsx as o, jsxs as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
var G = ({ className: l, copy:
|
|
9
|
-
const { sx: a, ...
|
|
10
|
-
|
|
11
|
-
},
|
|
12
|
-
t && t(),
|
|
1
|
+
import { useScreenSize as W } from "../../hooks/useScreenSize.es.js";
|
|
2
|
+
import { useFocusReturn as j } from "../../hooks/useFocusReturn.es.js";
|
|
3
|
+
import v from "react";
|
|
4
|
+
import { DialogFooter as z, DialogHeader as H } from "@mxenabled/mxui";
|
|
5
|
+
import { jsx as o, jsxs as I } from "react/jsx-runtime";
|
|
6
|
+
import _ from "@mui/material/Dialog";
|
|
7
|
+
import C from "@mui/material/DialogContent";
|
|
8
|
+
var G = ({ className: l, copy: r, disablePrimaryButton: n = !1, showActions: m = !0, isOpen: e = !1, onClose: i, onPrimaryAction: c, primaryColor: d = "primary", primaryText: f = "Confirm", returnFocusTo: p, onSecondaryAction: t, secondaryColor: x = "primary", secondaryText: u = "Cancel", children: g, ...h }) => {
|
|
9
|
+
const { sx: a, ...b } = h, y = r?.title ?? "", D = r?.close_aria ?? "Close", s = v.useId(), { isSmallMobile: S } = W(), { onExited: P, onFocus: A, rootRef: F } = j(e, p), R = () => {
|
|
10
|
+
c?.(), i();
|
|
11
|
+
}, M = () => {
|
|
12
|
+
t && t(), i();
|
|
13
13
|
};
|
|
14
14
|
return /* @__PURE__ */ o("div", {
|
|
15
15
|
className: `mx-cmn-dialog ${l}`,
|
|
16
|
-
children: /* @__PURE__ */
|
|
16
|
+
children: /* @__PURE__ */ I(_, {
|
|
17
17
|
"aria-labelledby": s,
|
|
18
18
|
maxWidth: "xs",
|
|
19
|
-
onClose:
|
|
19
|
+
onClose: i,
|
|
20
20
|
open: e,
|
|
21
21
|
sx: [{
|
|
22
|
-
"& .MuiDialog-paperScrollPaper": { backgroundColor: "background.default" },
|
|
23
22
|
...S && { "& .MuiDialog-paper": { minWidth: "100%" } },
|
|
24
23
|
height: "100%"
|
|
25
24
|
}, ...a ? [a] : []],
|
|
26
|
-
...
|
|
25
|
+
...b,
|
|
27
26
|
disableRestoreFocus: !0,
|
|
28
27
|
onFocus: A,
|
|
29
28
|
ref: F,
|
|
30
29
|
slotProps: { transition: { onExited: P } },
|
|
31
30
|
children: [
|
|
32
|
-
/* @__PURE__ */ o(
|
|
33
|
-
ariaHidden: !0,
|
|
31
|
+
/* @__PURE__ */ o(H, {
|
|
34
32
|
copy: {
|
|
35
|
-
title:
|
|
36
|
-
close_aria:
|
|
33
|
+
title: y,
|
|
34
|
+
close_aria: D
|
|
37
35
|
},
|
|
38
36
|
id: s,
|
|
39
|
-
onClose:
|
|
40
|
-
truncate: !0
|
|
37
|
+
onClose: i
|
|
41
38
|
}),
|
|
42
|
-
/* @__PURE__ */ o(
|
|
39
|
+
/* @__PURE__ */ o(C, {
|
|
43
40
|
sx: {
|
|
44
41
|
boxSizing: "border-box",
|
|
45
42
|
lineHeight: 1.5,
|
|
@@ -47,14 +44,14 @@ var G = ({ className: l, copy: i, disablePrimaryButton: n = !1, showActions: c =
|
|
|
47
44
|
},
|
|
48
45
|
children: g
|
|
49
46
|
}),
|
|
50
|
-
|
|
47
|
+
m && /* @__PURE__ */ o(z, {
|
|
51
48
|
isPrimaryDisabled: n,
|
|
52
|
-
onPrimaryAction:
|
|
53
|
-
onSecondaryAction:
|
|
49
|
+
onPrimaryAction: R,
|
|
50
|
+
onSecondaryAction: M,
|
|
54
51
|
primaryColor: d,
|
|
55
|
-
primaryText:
|
|
56
|
-
secondaryColor:
|
|
57
|
-
secondaryText:
|
|
52
|
+
primaryText: f,
|
|
53
|
+
secondaryColor: x,
|
|
54
|
+
secondaryText: u
|
|
58
55
|
})
|
|
59
56
|
]
|
|
60
57
|
})
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.es.js","names":[],"sources":["../../../../src/common/components/dialog/Dialog.tsx"],"sourcesContent":["import React from 'react'\n\nimport MuiDialog from '@mui/material/Dialog'\nimport { DialogProps as MuiDialogProps } from '@mui/material/Dialog'\nimport DialogContent from '@mui/material/DialogContent'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { DialogFooter, DialogHeader } from '@mxenabled/mxui'\nimport { useScreenSize } from '../../hooks'\nimport { useFocusReturn } from '../../hooks/useFocusReturn'\n\nexport type CopyObject = {\n close_aria?: string\n title: string\n}\n\ntype OwnedMuiProps =\n | 'disableRestoreFocus'\n | 'onFocus'\n | 'open'\n | 'slotProps'\n | 'slots'\n | 'TransitionComponent'\n | 'TransitionProps'\n\nexport interface DialogProps extends Omit<MuiDialogProps, OwnedMuiProps> {\n className?: string\n copy: CopyObject\n disablePrimaryButton?: boolean\n /** Render the footer action buttons. Default true; content-only dialogs (e.g. the insights survey modal) pass false. */\n showActions?: boolean\n isOpen: boolean\n onClose: (event?: unknown, reason?: string) => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n primaryText?: string\n /** Where focus goes on close. Takes precedence over the element that opened the dialog. */\n returnFocusTo?: React.RefObject<HTMLElement | null>\n secondaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n secondaryText?: string\n}\n\nconst Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({\n className,\n copy,\n disablePrimaryButton = false,\n showActions = true,\n isOpen = false,\n onClose,\n onPrimaryAction,\n primaryColor = 'primary',\n primaryText = 'Confirm',\n returnFocusTo,\n onSecondaryAction,\n secondaryColor = 'primary',\n secondaryText = 'Cancel',\n children,\n ...rest\n}) => {\n // Extract sx from rest to merge with Dialog's own styles instead of overwriting\n const { sx: restSx, ...restProps } = rest\n const title = copy?.title ?? ''\n const closeAria = copy?.close_aria ?? 'Close'\n\n
|
|
1
|
+
{"version":3,"file":"Dialog.es.js","names":[],"sources":["../../../../src/common/components/dialog/Dialog.tsx"],"sourcesContent":["import React from 'react'\n\nimport MuiDialog from '@mui/material/Dialog'\nimport { DialogProps as MuiDialogProps } from '@mui/material/Dialog'\nimport DialogContent from '@mui/material/DialogContent'\nimport type { SxProps } from '@mui/material/styles'\n\nimport { DialogFooter, DialogHeader } from '@mxenabled/mxui'\nimport { useScreenSize } from '../../hooks'\nimport { useFocusReturn } from '../../hooks/useFocusReturn'\n\nexport type CopyObject = {\n close_aria?: string\n title: string\n}\n\ntype OwnedMuiProps =\n | 'disableRestoreFocus'\n | 'onFocus'\n | 'open'\n | 'slotProps'\n | 'slots'\n | 'TransitionComponent'\n | 'TransitionProps'\n\nexport interface DialogProps extends Omit<MuiDialogProps, OwnedMuiProps> {\n className?: string\n copy: CopyObject\n disablePrimaryButton?: boolean\n /** Render the footer action buttons. Default true; content-only dialogs (e.g. the insights survey modal) pass false. */\n showActions?: boolean\n isOpen: boolean\n onClose: (event?: unknown, reason?: string) => void\n onPrimaryAction?: () => void\n onSecondaryAction?: () => void\n primaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n primaryText?: string\n /** Where focus goes on close. Takes precedence over the element that opened the dialog. */\n returnFocusTo?: React.RefObject<HTMLElement | null>\n secondaryColor?: 'primary' | 'inherit' | 'secondary' | 'success' | 'error' | 'info' | 'warning'\n secondaryText?: string\n}\n\nconst Dialog: React.FC<React.PropsWithChildren<DialogProps>> = ({\n className,\n copy,\n disablePrimaryButton = false,\n showActions = true,\n isOpen = false,\n onClose,\n onPrimaryAction,\n primaryColor = 'primary',\n primaryText = 'Confirm',\n returnFocusTo,\n onSecondaryAction,\n secondaryColor = 'primary',\n secondaryText = 'Cancel',\n children,\n ...rest\n}) => {\n // Extract sx from rest to merge with Dialog's own styles instead of overwriting\n const { sx: restSx, ...restProps } = rest\n const title = copy?.title ?? ''\n const closeAria = copy?.close_aria ?? 'Close'\n\n const titleId = React.useId()\n\n const { isSmallMobile } = useScreenSize()\n\n const { onExited, onFocus, rootRef } = useFocusReturn(isOpen, returnFocusTo)\n\n const handlePrimaryAction = () => {\n onPrimaryAction?.()\n onClose()\n }\n\n const handleSecondaryAction = () => {\n if (onSecondaryAction) {\n onSecondaryAction()\n }\n onClose()\n }\n\n return (\n <div className={`mx-cmn-dialog ${className}`}>\n <MuiDialog\n aria-labelledby={titleId}\n maxWidth=\"xs\"\n onClose={onClose}\n open={isOpen}\n sx={\n [\n {\n ...(isSmallMobile && { '& .MuiDialog-paper': { minWidth: '100%' } }),\n height: '100%',\n },\n ...(restSx ? [restSx] : []),\n ] as SxProps\n }\n {...restProps}\n disableRestoreFocus={true}\n onFocus={onFocus}\n ref={rootRef}\n slotProps={{ transition: { onExited } }}\n >\n {/* Do not aria-hide the heading: JAWS then reads no dialog name. */}\n <DialogHeader copy={{ title, close_aria: closeAria }} id={titleId} onClose={onClose} />\n\n <DialogContent sx={{ boxSizing: 'border-box', lineHeight: 1.5, maxWidth: '100%' }}>\n {children}\n </DialogContent>\n\n {showActions && (\n <DialogFooter\n isPrimaryDisabled={disablePrimaryButton}\n onPrimaryAction={handlePrimaryAction}\n onSecondaryAction={handleSecondaryAction}\n primaryColor={primaryColor}\n primaryText={primaryText}\n secondaryColor={secondaryColor}\n secondaryText={secondaryText}\n />\n )}\n </MuiDialog>\n </div>\n )\n}\n\nexport default Dialog\n"],"mappings":";;;;;;;AA2CA,IAAM,IAAA,CAA0D,EAC9D,WAAA,GACA,MAAA,GACA,sBAAA,IAAuB,IACvB,aAAA,IAAc,IACd,QAAA,IAAS,IACT,SAAA,GACA,iBAAA,GACA,cAAA,IAAe,WACf,aAAA,IAAc,WACd,eAAA,GACA,mBAAA,GACA,gBAAA,IA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BAAA,EAAC,GAAD;AAAA,UACE,mBAAmB;AAAA,UACnB,iBAAiB;AAAA,UACjB,mBAAmB;AAAA,UACL,cAAA;AAAA,UACD,aAAA;AAAA,UACG,gBAAA;AAAA,UACD,eAAA;AAAA,QAChB,CAAA;AAAA,MAEM;AAAA;EACR,CAAA;AAET"}
|
|
@@ -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,MAAiB;AACrB,QAAM,IAAQ,GAAS,GACjB,EAAE,mBAAA,EAAA,IAAsB,EAAa,GAErC,EAAE,cAAA,EAAA,IAAiB,EAAa,GAChC,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,GA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":["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(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AAAA,QAAG,QAAQ;AAAA,QAC3E,UAAA,gBAAA,EAAC,IAAD;AAAA,UACE,SAAS;AAAA,UACT,WAAW,gBAAA,EAAC,IAAD,EAAM,MAAK,YAAa,CAAA;AAAA,UACnC,SAAQ;AAAA,UAEP,UAAA,EAAgB;AAAA,QACX,CAAA;AAAA,MACH,CAAA,GAET,gBAAA,EAAC,IAAD,EAAiB,SAAS,EAAqB,CAAA,CAC1C,EAAA,CAAA;AAAA,IACD,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,65 +1,65 @@
|
|
|
1
|
-
import { buildDynamicCopy as
|
|
2
|
-
import { useCategoryStore as
|
|
3
|
-
import
|
|
4
|
-
import { ANALYTICS_EVENTS as
|
|
5
|
-
import { useTransactionsUiStore as
|
|
6
|
-
import { ON_CLICK_EVENTS as
|
|
7
|
-
import
|
|
1
|
+
import { buildDynamicCopy as y } from "../../../../../core/utils/Localization.es.js";
|
|
2
|
+
import { useCategoryStore as L, useEvent as E, useGlobalCopyStore as N, useTransactionStore as O } from "../../../../../common/context/hooks.es.js";
|
|
3
|
+
import R from "../../../../../common/components/dialog/Dialog.es.js";
|
|
4
|
+
import { ANALYTICS_EVENTS as w } from "../../../../../common/constants/Analytics.es.js";
|
|
5
|
+
import { useTransactionsUiStore as D } from "../../../../context/hooks.es.js";
|
|
6
|
+
import { ON_CLICK_EVENTS as G } from "../../../../constants/OnClickEvents.es.js";
|
|
7
|
+
import P from "../../../../../categories/components/CategorySelectorDrawer.es.js";
|
|
8
8
|
import i from "react";
|
|
9
|
-
import { CategoryIcon as
|
|
10
|
-
import { Icon as
|
|
11
|
-
import { jsx as t, jsxs as
|
|
12
|
-
import { useTheme as
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
var
|
|
20
|
-
const { addOrUpdateTransactionRule:
|
|
21
|
-
await
|
|
9
|
+
import { CategoryIcon as K, CategoryIconVariants as V, P as Y, Text as j } from "@mxenabled/mxui";
|
|
10
|
+
import { Icon as k } from "@mxenabled/mx-icons";
|
|
11
|
+
import { jsx as t, jsxs as g } from "react/jsx-runtime";
|
|
12
|
+
import { useTheme as z } from "@mui/material/styles";
|
|
13
|
+
import B from "@mui/material/ListItem";
|
|
14
|
+
import M from "@mui/material/Avatar";
|
|
15
|
+
import U from "@mui/material/ListItemAvatar";
|
|
16
|
+
import F from "@mui/material/ListItemButton";
|
|
17
|
+
import W from "@mui/material/ListItemIcon";
|
|
18
|
+
import $ from "@mui/material/ListItemText";
|
|
19
|
+
var pe = ({ transaction: e }) => {
|
|
20
|
+
const { addOrUpdateTransactionRule: f, updateTransaction: C } = O(), { categories: s } = L(), { onEvent: c } = E(), { setShouldDisableDrawerScroll: T, updateManualTransaction: h } = D(), { transactions: r } = N(), S = z(), l = i.useRef(null), m = i.useId(), [I, d] = i.useState(!1), [a, n] = i.useState(""), p = async (o) => {
|
|
21
|
+
await C({
|
|
22
22
|
...e,
|
|
23
23
|
category_guid: a
|
|
24
|
-
}), o && await
|
|
25
|
-
},
|
|
24
|
+
}), o && await f(a, e), n(""), c(w.TRANSACTION_DETAILS_CLICK_CATEGORY, { transaction_guid: e.guid });
|
|
25
|
+
}, x = (o) => {
|
|
26
26
|
if (e.is_manual && !e.guid) {
|
|
27
|
-
const _ = s.find((
|
|
28
|
-
|
|
27
|
+
const _ = s.find((b) => b.guid === o);
|
|
28
|
+
h({
|
|
29
29
|
...e,
|
|
30
30
|
category: _?.name,
|
|
31
31
|
category_guid: o,
|
|
32
32
|
top_level_category_guid: _?.parent_guid || o
|
|
33
33
|
});
|
|
34
34
|
} else n(o);
|
|
35
|
-
|
|
36
|
-
},
|
|
37
|
-
|
|
38
|
-
},
|
|
39
|
-
return /* @__PURE__ */
|
|
35
|
+
u();
|
|
36
|
+
}, u = () => {
|
|
37
|
+
d(!1), T(!1);
|
|
38
|
+
}, A = i.useMemo(() => s.find((o) => o.guid === a), [a]), v = S.palette.mode === "dark" ? "grey.800" : "grey.100";
|
|
39
|
+
return /* @__PURE__ */ g(B, {
|
|
40
40
|
disableGutters: !0,
|
|
41
41
|
disablePadding: !0,
|
|
42
42
|
children: [
|
|
43
|
-
/* @__PURE__ */
|
|
43
|
+
/* @__PURE__ */ g(F, {
|
|
44
44
|
ref: l,
|
|
45
45
|
onClick: () => {
|
|
46
|
-
c(
|
|
46
|
+
c(G.ON_TRANSACTION_CATEGORY_CLICK), d(!0);
|
|
47
47
|
},
|
|
48
48
|
children: [
|
|
49
|
-
/* @__PURE__ */ t(
|
|
50
|
-
sx: { bgcolor:
|
|
49
|
+
/* @__PURE__ */ t(U, { children: /* @__PURE__ */ t(M, {
|
|
50
|
+
sx: { bgcolor: v },
|
|
51
51
|
variant: "rounded",
|
|
52
|
-
children: /* @__PURE__ */ t(
|
|
52
|
+
children: /* @__PURE__ */ t(K, {
|
|
53
53
|
categoryGuid: e.top_level_category_guid,
|
|
54
54
|
icon_ratio: 1,
|
|
55
55
|
size: 20,
|
|
56
56
|
sx: { color: "text.primary" },
|
|
57
|
-
variant:
|
|
57
|
+
variant: V.Transparent
|
|
58
58
|
})
|
|
59
59
|
}) }),
|
|
60
|
-
/* @__PURE__ */ t(
|
|
60
|
+
/* @__PURE__ */ t($, {
|
|
61
61
|
primary: r.category_title,
|
|
62
|
-
secondary: /* @__PURE__ */ t(
|
|
62
|
+
secondary: /* @__PURE__ */ t(j, {
|
|
63
63
|
bold: !0,
|
|
64
64
|
sx: { color: "text.primary" },
|
|
65
65
|
variant: "body1",
|
|
@@ -71,38 +71,40 @@ var de = ({ transaction: e }) => {
|
|
|
71
71
|
fontWeight: "normal"
|
|
72
72
|
} }
|
|
73
73
|
}),
|
|
74
|
-
/* @__PURE__ */ t(
|
|
74
|
+
/* @__PURE__ */ t(W, { children: /* @__PURE__ */ t(k, {
|
|
75
75
|
name: "chevron_right",
|
|
76
76
|
sx: { color: "text.primary" }
|
|
77
77
|
}) })
|
|
78
78
|
]
|
|
79
79
|
}),
|
|
80
|
-
/* @__PURE__ */ t(
|
|
80
|
+
/* @__PURE__ */ t(P, {
|
|
81
81
|
initialSelected: e.category_guid,
|
|
82
|
-
onClose:
|
|
83
|
-
onSelect:
|
|
84
|
-
showDrawer:
|
|
82
|
+
onClose: u,
|
|
83
|
+
onSelect: x,
|
|
84
|
+
showDrawer: I,
|
|
85
85
|
title: r.actions_select_a_category
|
|
86
86
|
}),
|
|
87
|
-
/* @__PURE__ */ t(
|
|
88
|
-
|
|
87
|
+
/* @__PURE__ */ t(R, {
|
|
88
|
+
"aria-describedby": m,
|
|
89
|
+
copy: { title: y(r.actions_apply_to_all_transaction_types, e.description) },
|
|
89
90
|
isOpen: !!a,
|
|
90
91
|
onClose: () => n(""),
|
|
91
|
-
onPrimaryAction: () =>
|
|
92
|
-
onSecondaryAction: () =>
|
|
92
|
+
onPrimaryAction: () => p(!0),
|
|
93
|
+
onSecondaryAction: () => p(!1),
|
|
93
94
|
primaryText: r.actions_apply_to_all,
|
|
94
95
|
returnFocusTo: l,
|
|
95
96
|
secondaryText: r.actions_this_time_only,
|
|
96
|
-
children: /* @__PURE__ */ t(
|
|
97
|
+
children: /* @__PURE__ */ t(Y, {
|
|
98
|
+
id: m,
|
|
97
99
|
variant: "subtitle1",
|
|
98
|
-
children:
|
|
100
|
+
children: y(r.actions_all_past_and_future, /* @__PURE__ */ t("strong", { children: e.description }), A?.name)
|
|
99
101
|
})
|
|
100
102
|
})
|
|
101
103
|
]
|
|
102
104
|
});
|
|
103
105
|
};
|
|
104
106
|
export {
|
|
105
|
-
|
|
107
|
+
pe as default
|
|
106
108
|
};
|
|
107
109
|
|
|
108
110
|
//# sourceMappingURL=CategoryAction.es.js.map
|
package/dist/transactions/components/shared/transactiondetails/actions/CategoryAction.es.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryAction.es.js","names":[],"sources":["../../../../../../src/transactions/components/shared/transactiondetails/actions/CategoryAction.tsx"],"sourcesContent":["import React from 'react'\n\nimport Avatar from '@mui/material/Avatar'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemButton from '@mui/material/ListItemButton'\nimport ListItemIcon from '@mui/material/ListItemIcon'\nimport ListItemText from '@mui/material/ListItemText'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, CategoryIconVariants, P, Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\nimport { CategorySelectorDrawer } from '../../../../../categories'\n\nimport {\n ANALYTICS_EVENTS,\n Dialog,\n useCategoryStore,\n useGlobalCopyStore,\n} from '../../../../../common'\nimport type { Transaction } from '../../../../../core'\n\nimport { ON_CLICK_EVENTS } from '../../../../constants/OnClickEvents'\nimport { useTransactionsUiStore } from '../../../../context/hooks'\nimport { useEvent, useTransactionStore } from '../../../../../common'\nimport { buildDynamicCopy } from '../../../../../core/utils/Localization'\n\ninterface CategoryActionProps {\n transaction: Transaction\n}\n\nconst CategoryAction: React.FC<CategoryActionProps> = ({ transaction }) => {\n const { addOrUpdateTransactionRule, updateTransaction } = useTransactionStore()\n const { categories } = useCategoryStore()\n const { onEvent } = useEvent()\n const { setShouldDisableDrawerScroll, updateManualTransaction } = useTransactionsUiStore()\n const { transactions: copy } = useGlobalCopyStore()\n\n const theme = useTheme()\n\n const categoryRowRef = React.useRef<HTMLDivElement>(null)\n const [open, setOpen] = React.useState(false)\n const [selectedGuid, setSelectedGuid] = React.useState('')\n\n const handleCategoryChange = async (applyToAll: boolean) => {\n await updateTransaction({ ...transaction, category_guid: selectedGuid })\n if (applyToAll) {\n await addOrUpdateTransactionRule(selectedGuid, transaction)\n }\n setSelectedGuid('')\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_CLICK_CATEGORY, {\n transaction_guid: transaction.guid,\n })\n }\n\n const handleSelected = (guid: string) => {\n if (transaction.is_manual && !transaction.guid) {\n const category = categories.find((c) => c.guid === guid)\n updateManualTransaction({\n ...transaction,\n category: category?.name,\n category_guid: guid,\n top_level_category_guid: category?.parent_guid || guid,\n })\n } else {\n setSelectedGuid(guid)\n }\n\n handleCloseDrawer()\n }\n\n const handleCloseDrawer = () => {\n setOpen(false)\n setShouldDisableDrawerScroll(false)\n }\n\n const category = React.useMemo(\n () => categories.find((item) => item.guid === selectedGuid),\n [selectedGuid],\n )\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <ListItem disableGutters={true} disablePadding={true}>\n <ListItemButton\n ref={categoryRowRef}\n onClick={() => {\n onEvent(ON_CLICK_EVENTS.ON_TRANSACTION_CATEGORY_CLICK)\n setOpen(true)\n }}\n >\n <ListItemAvatar>\n <Avatar sx={{ bgcolor: bgColor }} variant=\"rounded\">\n <CategoryIcon\n categoryGuid={transaction.top_level_category_guid}\n icon_ratio={1}\n size={20}\n sx={{ color: 'text.primary' }}\n variant={CategoryIconVariants.Transparent}\n />\n </Avatar>\n </ListItemAvatar>\n <ListItemText\n primary={copy.category_title}\n secondary={\n <Text bold={true} sx={{ color: 'text.primary' }} variant=\"body1\">\n {transaction.category ?? copy.actions_select_a_category}\n </Text>\n }\n slotProps={{ primary: { variant: 'caption', fontSize: 11, fontWeight: 'normal' } }}\n />\n <ListItemIcon>\n <Icon name=\"chevron_right\" sx={{ color: 'text.primary' }} />\n </ListItemIcon>\n </ListItemButton>\n\n <CategorySelectorDrawer\n initialSelected={transaction.category_guid}\n onClose={handleCloseDrawer}\n onSelect={handleSelected}\n showDrawer={open}\n title={copy.actions_select_a_category}\n />\n\n <Dialog\n copy={{\n title: buildDynamicCopy(\n copy.actions_apply_to_all_transaction_types,\n transaction.description,\n ) as string,\n }}\n isOpen={Boolean(selectedGuid)}\n onClose={() => setSelectedGuid('')}\n onPrimaryAction={() => handleCategoryChange(true)}\n onSecondaryAction={() => handleCategoryChange(false)}\n primaryText={copy.actions_apply_to_all}\n returnFocusTo={categoryRowRef}\n secondaryText={copy.actions_this_time_only}\n >\n <P variant=\"subtitle1\">\n {\n buildDynamicCopy(\n copy.actions_all_past_and_future,\n transaction.description
|
|
1
|
+
{"version":3,"file":"CategoryAction.es.js","names":[],"sources":["../../../../../../src/transactions/components/shared/transactiondetails/actions/CategoryAction.tsx"],"sourcesContent":["import React from 'react'\n\nimport Avatar from '@mui/material/Avatar'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemButton from '@mui/material/ListItemButton'\nimport ListItemIcon from '@mui/material/ListItemIcon'\nimport ListItemText from '@mui/material/ListItemText'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, CategoryIconVariants, P, Text } from '@mxenabled/mxui'\nimport { Icon } from '@mxenabled/mx-icons'\nimport { CategorySelectorDrawer } from '../../../../../categories'\n\nimport {\n ANALYTICS_EVENTS,\n Dialog,\n useCategoryStore,\n useGlobalCopyStore,\n} from '../../../../../common'\nimport type { Transaction } from '../../../../../core'\n\nimport { ON_CLICK_EVENTS } from '../../../../constants/OnClickEvents'\nimport { useTransactionsUiStore } from '../../../../context/hooks'\nimport { useEvent, useTransactionStore } from '../../../../../common'\nimport { buildDynamicCopy } from '../../../../../core/utils/Localization'\n\ninterface CategoryActionProps {\n transaction: Transaction\n}\n\nconst CategoryAction: React.FC<CategoryActionProps> = ({ transaction }) => {\n const { addOrUpdateTransactionRule, updateTransaction } = useTransactionStore()\n const { categories } = useCategoryStore()\n const { onEvent } = useEvent()\n const { setShouldDisableDrawerScroll, updateManualTransaction } = useTransactionsUiStore()\n const { transactions: copy } = useGlobalCopyStore()\n\n const theme = useTheme()\n\n const categoryRowRef = React.useRef<HTMLDivElement>(null)\n const messageId = React.useId()\n const [open, setOpen] = React.useState(false)\n const [selectedGuid, setSelectedGuid] = React.useState('')\n\n const handleCategoryChange = async (applyToAll: boolean) => {\n await updateTransaction({ ...transaction, category_guid: selectedGuid })\n if (applyToAll) {\n await addOrUpdateTransactionRule(selectedGuid, transaction)\n }\n setSelectedGuid('')\n onEvent(ANALYTICS_EVENTS.TRANSACTION_DETAILS_CLICK_CATEGORY, {\n transaction_guid: transaction.guid,\n })\n }\n\n const handleSelected = (guid: string) => {\n if (transaction.is_manual && !transaction.guid) {\n const category = categories.find((c) => c.guid === guid)\n updateManualTransaction({\n ...transaction,\n category: category?.name,\n category_guid: guid,\n top_level_category_guid: category?.parent_guid || guid,\n })\n } else {\n setSelectedGuid(guid)\n }\n\n handleCloseDrawer()\n }\n\n const handleCloseDrawer = () => {\n setOpen(false)\n setShouldDisableDrawerScroll(false)\n }\n\n const category = React.useMemo(\n () => categories.find((item) => item.guid === selectedGuid),\n [selectedGuid],\n )\n\n const bgColor = theme.palette.mode === 'dark' ? 'grey.800' : 'grey.100'\n\n return (\n <ListItem disableGutters={true} disablePadding={true}>\n <ListItemButton\n ref={categoryRowRef}\n onClick={() => {\n onEvent(ON_CLICK_EVENTS.ON_TRANSACTION_CATEGORY_CLICK)\n setOpen(true)\n }}\n >\n <ListItemAvatar>\n <Avatar sx={{ bgcolor: bgColor }} variant=\"rounded\">\n <CategoryIcon\n categoryGuid={transaction.top_level_category_guid}\n icon_ratio={1}\n size={20}\n sx={{ color: 'text.primary' }}\n variant={CategoryIconVariants.Transparent}\n />\n </Avatar>\n </ListItemAvatar>\n <ListItemText\n primary={copy.category_title}\n secondary={\n <Text bold={true} sx={{ color: 'text.primary' }} variant=\"body1\">\n {transaction.category ?? copy.actions_select_a_category}\n </Text>\n }\n slotProps={{ primary: { variant: 'caption', fontSize: 11, fontWeight: 'normal' } }}\n />\n <ListItemIcon>\n <Icon name=\"chevron_right\" sx={{ color: 'text.primary' }} />\n </ListItemIcon>\n </ListItemButton>\n\n <CategorySelectorDrawer\n initialSelected={transaction.category_guid}\n onClose={handleCloseDrawer}\n onSelect={handleSelected}\n showDrawer={open}\n title={copy.actions_select_a_category}\n />\n\n <Dialog\n aria-describedby={messageId}\n copy={{\n title: buildDynamicCopy(\n copy.actions_apply_to_all_transaction_types,\n transaction.description,\n ) as string,\n }}\n isOpen={Boolean(selectedGuid)}\n onClose={() => setSelectedGuid('')}\n onPrimaryAction={() => handleCategoryChange(true)}\n onSecondaryAction={() => handleCategoryChange(false)}\n primaryText={copy.actions_apply_to_all}\n returnFocusTo={categoryRowRef}\n secondaryText={copy.actions_this_time_only}\n >\n <P id={messageId} variant=\"subtitle1\">\n {\n buildDynamicCopy(\n copy.actions_all_past_and_future,\n <strong>{transaction.description}</strong>,\n category?.name,\n ) as React.ReactNode\n }\n </P>\n </Dialog>\n </ListItem>\n )\n}\n\nexport default CategoryAction\n"],"mappings":";;;;;;;;;;;;;;;;;;AA+BA,IAAM,KAAA,CAAiD,EAAE,aAAA,EAAA,MAAkB;AACzE,QAAM,EAAE,4BAAA,GAA4B,mBAAA,EAAA,IAAsB,EAAoB,GACxE,EAAE,YAAA,EAAA,IAAe,EAAiB,GAClC,EAAE,SAAA,EAAA,IAAY,EAAS,GACvB,EAAE,8BAAA,GAA8B,yBAAA,EAAA,IAA4B,EAAuB,GACnF,EAAE,cAAc,EAAA,IAAS,EAAmB,GAE5C,IAAQ,EAAS,GAEjB,IAAiB,EAAM,OAAuB,IAAI,GAClD,IAAY,EAAM,MAAM,GACxB,CAAC,GAAM,CAAA,IAAW,EAAM,SAAS,EAAK,GACtC,CAAC,GAAc,CAAA,IAAmB,EAAM,SAAS,EAAE,GAEnD,IAAuB,OAAO,MAAwB;AAC1D,UAAM,EAAkB;AAAA,MAAE,GAAG;AAAA,MAAa,eAAe;AAAA,IAAa,CAAC,GACnE,KACF,MAAM,EAA2B,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Copy as
|
|
2
|
-
import { useCategoryStore as _, useGlobalCopyStore as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
1
|
+
import { buildDynamicCopy as l } from "../../../../core/utils/Localization.es.js";
|
|
2
|
+
import { useCategoryStore as _, useGlobalCopyStore as g, useTransactionStore as f } from "../../../../common/context/hooks.es.js";
|
|
3
|
+
import C from "../../../../common/components/dialog/Dialog.es.js";
|
|
4
|
+
import h from "../../../../categories/components/CategorySelectorDrawer.es.js";
|
|
5
|
+
import s from "react";
|
|
6
6
|
import { observer as x } from "mobx-react-lite";
|
|
7
7
|
import { P as S } from "@mxenabled/mxui";
|
|
8
|
-
import { jsx as
|
|
8
|
+
import { jsx as r, jsxs as b } from "react/jsx-runtime";
|
|
9
9
|
import w from "@mui/material/Box";
|
|
10
10
|
var T = ({ onClose: c, transaction: t }) => {
|
|
11
|
-
const { addOrUpdateTransactionRule:
|
|
12
|
-
await
|
|
11
|
+
const { addOrUpdateTransactionRule: m, updateTransaction: y } = f(), { transactions: e } = g(), { categories: p } = _(), [o, n] = s.useState(""), d = s.useId(), u = s.useMemo(() => p.find((a) => a.guid === o), [o]), i = async (a) => {
|
|
12
|
+
await y({
|
|
13
13
|
...t,
|
|
14
|
-
category_guid:
|
|
15
|
-
}), a && await
|
|
14
|
+
category_guid: o
|
|
15
|
+
}), a && await m(o, t), n(""), c();
|
|
16
16
|
};
|
|
17
|
-
return /* @__PURE__ */
|
|
17
|
+
return /* @__PURE__ */ b(w, {
|
|
18
18
|
className: "mx-txn-edit-category-action",
|
|
19
|
-
children: [/* @__PURE__ */
|
|
19
|
+
children: [/* @__PURE__ */ r(h, {
|
|
20
20
|
initialSelected: t.category_guid,
|
|
21
21
|
onClose: c,
|
|
22
22
|
onSelect: (a) => n(a),
|
|
23
23
|
showDrawer: !!t,
|
|
24
|
-
title:
|
|
25
|
-
}), /* @__PURE__ */
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
24
|
+
title: e.actions_select_a_category
|
|
25
|
+
}), /* @__PURE__ */ r(C, {
|
|
26
|
+
"aria-describedby": d,
|
|
27
|
+
copy: { title: l(e.actions_apply_to_all_transaction_types, t.description) },
|
|
28
|
+
isOpen: !!o,
|
|
29
|
+
onClose: () => i(!1),
|
|
30
|
+
onPrimaryAction: () => i(!0),
|
|
31
|
+
onSecondaryAction: () => i(!1),
|
|
32
|
+
primaryText: e.actions_apply_to_all,
|
|
33
|
+
secondaryText: e.actions_this_time_only,
|
|
34
|
+
children: /* @__PURE__ */ r(S, {
|
|
35
|
+
id: d,
|
|
34
36
|
variant: "subtitle1",
|
|
35
|
-
children:
|
|
37
|
+
children: l(e.actions_all_past_and_future, /* @__PURE__ */ r("strong", { children: t.description }), u?.name)
|
|
36
38
|
})
|
|
37
39
|
})]
|
|
38
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditCategoryAction.es.js","names":[],"sources":["../../../../../src/transactions/components/transactionwidget/actions/EditCategoryAction.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\n\nimport { P } from '@mxenabled/mxui'\n\nimport { CategorySelectorDrawer } from '../../../../categories'\n\nimport { Dialog, useCategoryStore, useGlobalCopyStore } from '../../../../common'\nimport type { Transaction } from '../../../../core'\n\nimport { useTransactionStore } from '../../../../common'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\n\ninterface EditCategoryActionProps {\n onClose: () => void\n transaction: Transaction\n}\n\nconst EditCategoryAction: React.FC<EditCategoryActionProps> = ({ onClose, transaction }) => {\n const { addOrUpdateTransactionRule, updateTransaction } = useTransactionStore()\n const { transactions: copy } = useGlobalCopyStore()\n\n const { categories } = useCategoryStore()\n\n const [categoryGuid, setCategoryGuid] = React.useState('')\n\n const category = React.useMemo(\n () => categories.find((item) => item.guid === categoryGuid),\n [categoryGuid],\n )\n\n const handleCategoryChanged = async (applyToAll: boolean) => {\n await updateTransaction({ ...transaction, category_guid: categoryGuid })\n if (applyToAll) {\n await addOrUpdateTransactionRule(categoryGuid, transaction)\n }\n\n setCategoryGuid('')\n onClose()\n }\n\n return (\n <Box className=\"mx-txn-edit-category-action\">\n <CategorySelectorDrawer\n initialSelected={transaction.category_guid}\n onClose={onClose}\n onSelect={(guid: string) => setCategoryGuid(guid)}\n showDrawer={!!transaction}\n title={copy.actions_select_a_category}\n />\n <Dialog\n copy={{\n title: buildDynamicCopy(\n copy.actions_apply_to_all_transaction_types,\n transaction.description,\n ) as string,\n }}\n isOpen={!!categoryGuid}\n onClose={() => handleCategoryChanged(false)}\n onPrimaryAction={() => handleCategoryChanged(true)}\n onSecondaryAction={() => handleCategoryChanged(false)}\n primaryText={copy.actions_apply_to_all}\n secondaryText={copy.actions_this_time_only}\n >\n <P variant=\"subtitle1\">\n {\n buildDynamicCopy(\n copy.actions_all_past_and_future,\n transaction.description
|
|
1
|
+
{"version":3,"file":"EditCategoryAction.es.js","names":[],"sources":["../../../../../src/transactions/components/transactionwidget/actions/EditCategoryAction.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport Box from '@mui/material/Box'\n\nimport { P } from '@mxenabled/mxui'\n\nimport { CategorySelectorDrawer } from '../../../../categories'\n\nimport { Dialog, useCategoryStore, useGlobalCopyStore } from '../../../../common'\nimport type { Transaction } from '../../../../core'\n\nimport { useTransactionStore } from '../../../../common'\nimport { buildDynamicCopy } from '../../../../core/utils/Localization'\n\ninterface EditCategoryActionProps {\n onClose: () => void\n transaction: Transaction\n}\n\nconst EditCategoryAction: React.FC<EditCategoryActionProps> = ({ onClose, transaction }) => {\n const { addOrUpdateTransactionRule, updateTransaction } = useTransactionStore()\n const { transactions: copy } = useGlobalCopyStore()\n\n const { categories } = useCategoryStore()\n\n const [categoryGuid, setCategoryGuid] = React.useState('')\n const messageId = React.useId()\n\n const category = React.useMemo(\n () => categories.find((item) => item.guid === categoryGuid),\n [categoryGuid],\n )\n\n const handleCategoryChanged = async (applyToAll: boolean) => {\n await updateTransaction({ ...transaction, category_guid: categoryGuid })\n if (applyToAll) {\n await addOrUpdateTransactionRule(categoryGuid, transaction)\n }\n\n setCategoryGuid('')\n onClose()\n }\n\n return (\n <Box className=\"mx-txn-edit-category-action\">\n <CategorySelectorDrawer\n initialSelected={transaction.category_guid}\n onClose={onClose}\n onSelect={(guid: string) => setCategoryGuid(guid)}\n showDrawer={!!transaction}\n title={copy.actions_select_a_category}\n />\n <Dialog\n aria-describedby={messageId}\n copy={{\n title: buildDynamicCopy(\n copy.actions_apply_to_all_transaction_types,\n transaction.description,\n ) as string,\n }}\n isOpen={!!categoryGuid}\n onClose={() => handleCategoryChanged(false)}\n onPrimaryAction={() => handleCategoryChanged(true)}\n onSecondaryAction={() => handleCategoryChanged(false)}\n primaryText={copy.actions_apply_to_all}\n secondaryText={copy.actions_this_time_only}\n >\n <P id={messageId} variant=\"subtitle1\">\n {\n buildDynamicCopy(\n copy.actions_all_past_and_future,\n <strong>{transaction.description}</strong>,\n category?.name,\n ) as React.ReactNode\n }\n </P>\n </Dialog>\n </Box>\n )\n}\n\nexport default observer(EditCategoryAction)\n"],"mappings":";;;;;;;;;AAoBA,IAAM,IAAA,CAAyD,EAAE,SAAA,GAAS,aAAA,EAAA,MAAkB;AAC1F,QAAM,EAAE,4BAAA,GAA4B,mBAAA,EAAA,IAAsB,EAAoB,GACxE,EAAE,cAAc,EAAA,IAAS,EAAmB,GAE5C,EAAE,YAAA,EAAA,IAAe,EAAiB,GAElC,CAAC,GAAc,CAAA,IAAmB,EAAM,SAAS,EAAE,GACnD,IAAY,EAAM,MAAM,GAExB,IAAW,EAAM,QAAA,MACf,EAAW,KAAA,CAAM,MAAS,EAAK,SAAS,CAAY,GAC1D,CAAC,CAAY,CACf,GAEM,IAAwB,OAAO,MAAwB;AAC3D,UAAM,EAAkB;AAAA,MAAE,GAAG;AAAA,MAAa,eAAe;AAAA,IAAa,CAAC,GACnE,KACF,MAAM,EAA2B,GAAc,CAAW,GAG5D,EAAgB,EAAE,GAClB,EAAQ;AAAA,EACV;AAEA,SACE,gBAAA,EAAC,GAAD;AAAA,IAAK,WAAU;AAAA,IAAf,UAAA,CACE,gBAAA,EAAC,GAAD;AAAA,MACE,iBAAiB,EAAY;AAAA,MACpB,SAAA;AAAA,MACT,UAAA,CAAW,MAAiB,EAAgB,CAAI;AAAA,MAChD,YAAY,CAAC,CAAC;AAAA,MACd,OAAO,EAAK;AAAA,IACb,CAAA,GACD,gBAAA,EAAC,GAAD;AAAA,MACE,oBAAkB;AAAA,MAClB,MAAM,EACJ,OAAO,EACL,EAAK,wCACL,EAAY,WACd,EACF;AAAA,MACA,QAAQ,CAAC,CAAC;AAAA,MACV,SAAA,MAAe,EAAsB,EAAK;AAAA,MAC1C,iBAAA,MAAuB,EAAsB,EAAI;AAAA,MACjD,mBAAA,MAAyB,EAAsB,EAAK;AAAA,MACpD,aAAa,EAAK;AAAA,MAClB,eAAe,EAAK;AAAA,MAEpB,UAAA,gBAAA,EAAC,GAAD;AAAA,QAAG,IAAI;AAAA,QAAW,SAAQ;AAAA,QAEtB,UAAA,EACE,EAAK,6BACL,gBAAA,EAAC,UAAD,EAAA,UAAS,EAAY,YAAoB,CAAA,GACzC,GAAU,IACZ;AAAA,MAED,CAAA;AAAA,IACG,CAAA,CACL;AAAA;AAET,GAEA,IAAe,EAAS,CAAkB"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { useAppConfig as
|
|
2
|
-
import { useScreenSize as
|
|
3
|
-
import { formatCurrency as
|
|
4
|
-
import
|
|
5
|
-
import { getCategoryColor as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
1
|
+
import { useAppConfig as $, useGlobalCopyStore as A, useTransactionStore as G, useTrendsStore as R } from "../../common/context/hooks.es.js";
|
|
2
|
+
import { useScreenSize as j } from "../../common/hooks/useScreenSize.es.js";
|
|
3
|
+
import { formatCurrency as z } from "../../core/utils/NumberFormatting.es.js";
|
|
4
|
+
import M from "../../common/components/drawer/Drawer.es.js";
|
|
5
|
+
import { getCategoryColor as B } from "../../core/utils/CategoryUtil.es.js";
|
|
6
|
+
import E from "../../transactions/components/transactionwidget/actions/ExportCsvAction.es.js";
|
|
7
|
+
import P from "../../transactions/components/shared/TransactionList.es.js";
|
|
8
|
+
import W from "../../transactions/components/shared/TransactionDetails.es.js";
|
|
9
|
+
import F from "./CategoryDetailChart.es.js";
|
|
10
10
|
import u from "react";
|
|
11
|
-
import { observer as
|
|
11
|
+
import { observer as H } from "mobx-react-lite";
|
|
12
12
|
import c from "@mui/material/Stack";
|
|
13
|
-
import { CategoryIcon as
|
|
13
|
+
import { CategoryIcon as O, Text as h } from "@mxenabled/mxui";
|
|
14
14
|
import { jsx as t, jsxs as i } from "react/jsx-runtime";
|
|
15
|
-
import { useTheme as
|
|
16
|
-
import
|
|
17
|
-
import
|
|
18
|
-
import
|
|
19
|
-
import
|
|
20
|
-
var
|
|
21
|
-
const g =
|
|
15
|
+
import { useTheme as q } from "@mui/material/styles";
|
|
16
|
+
import J from "@mui/material/List";
|
|
17
|
+
import K from "@mui/material/ListItem";
|
|
18
|
+
import N from "@mui/material/ListItemAvatar";
|
|
19
|
+
import Q from "@mui/material/ListItemText";
|
|
20
|
+
var ut = H(() => {
|
|
21
|
+
const g = q(), { clientConfig: y, is_mobile_webview: b } = $(), { isDesktop: C, isSmallTablet: _, isTablet: x } = j(), { common: v, trends: o } = A(), { selectedCategoryData: e, selectedDateRangeMonthRange: T } = R(), { sortedTransactions: a } = G(), [m, l] = u.useState(null);
|
|
22
22
|
if (!e) return null;
|
|
23
|
-
const { guid: r, name: p, is_income: d, totalAmount:
|
|
23
|
+
const { guid: r, name: p, is_income: d, totalAmount: S } = e, L = B(r, g), w = d ? o.income_label : o.spending_label, D = `${p}, ${d ? o.monthly_income : o.monthly_spending}`, I = ` ${e.transactions.length === 1 ? o.transaction : o.transactions} (${e.transactions.length})`, s = u.useMemo(() => a.find((n) => n.guid === m), [m, a]), k = a.length > 0 && !b && !y?.transactions?.hide_export_csv && (C || x && !_), f = (n) => n.category_guid === r || n.top_level_category_guid === r;
|
|
24
24
|
return /* @__PURE__ */ i(c, {
|
|
25
25
|
sx: { alignItems: "center" },
|
|
26
26
|
children: [
|
|
@@ -32,13 +32,13 @@ var ft = F(() => {
|
|
|
32
32
|
px: 12,
|
|
33
33
|
width: "100%"
|
|
34
34
|
},
|
|
35
|
-
children: [/* @__PURE__ */ t(
|
|
35
|
+
children: [/* @__PURE__ */ t(J, {
|
|
36
36
|
sx: { px: 12 },
|
|
37
|
-
children: /* @__PURE__ */ i(
|
|
38
|
-
/* @__PURE__ */ t(
|
|
39
|
-
/* @__PURE__ */ t(
|
|
37
|
+
children: /* @__PURE__ */ i(K, { children: [
|
|
38
|
+
/* @__PURE__ */ t(N, { children: /* @__PURE__ */ t(O, { categoryGuid: r }) }),
|
|
39
|
+
/* @__PURE__ */ t(Q, {
|
|
40
40
|
primary: p,
|
|
41
|
-
secondary:
|
|
41
|
+
secondary: T,
|
|
42
42
|
slotProps: {
|
|
43
43
|
primary: {
|
|
44
44
|
component: "div",
|
|
@@ -56,16 +56,16 @@ var ft = F(() => {
|
|
|
56
56
|
/* @__PURE__ */ t(h, {
|
|
57
57
|
component: "div",
|
|
58
58
|
variant: "h3",
|
|
59
|
-
children:
|
|
59
|
+
children: z(Math.abs(S), "0,0.00")
|
|
60
60
|
})
|
|
61
61
|
] })
|
|
62
|
-
}), /* @__PURE__ */ t(
|
|
63
|
-
chartColor:
|
|
64
|
-
chartLabel:
|
|
65
|
-
chartTitle:
|
|
62
|
+
}), /* @__PURE__ */ t(F, {
|
|
63
|
+
chartColor: L,
|
|
64
|
+
chartLabel: w,
|
|
65
|
+
chartTitle: D
|
|
66
66
|
})]
|
|
67
67
|
}),
|
|
68
|
-
/* @__PURE__ */ t(
|
|
68
|
+
/* @__PURE__ */ t(P, {
|
|
69
69
|
filter: f,
|
|
70
70
|
onClick: l,
|
|
71
71
|
scrollsWithParent: !0,
|
|
@@ -80,22 +80,22 @@ var ft = F(() => {
|
|
|
80
80
|
children: [/* @__PURE__ */ t(h, {
|
|
81
81
|
bold: !0,
|
|
82
82
|
variant: "body1",
|
|
83
|
-
children:
|
|
84
|
-
}),
|
|
83
|
+
children: I
|
|
84
|
+
}), k && /* @__PURE__ */ t(E, { filter: f })]
|
|
85
85
|
})
|
|
86
86
|
}),
|
|
87
|
-
/* @__PURE__ */ t(
|
|
88
|
-
ariaLabelClose:
|
|
87
|
+
/* @__PURE__ */ t(M, {
|
|
88
|
+
ariaLabelClose: v.close_aria,
|
|
89
89
|
isOpen: !!s,
|
|
90
90
|
onClose: () => l(""),
|
|
91
91
|
title: o.transaction,
|
|
92
|
-
children: s && /* @__PURE__ */ t(
|
|
92
|
+
children: s && /* @__PURE__ */ t(W, { transaction: s })
|
|
93
93
|
})
|
|
94
94
|
]
|
|
95
95
|
});
|
|
96
96
|
});
|
|
97
97
|
export {
|
|
98
|
-
|
|
98
|
+
ut as CategoryDetails
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
//# sourceMappingURL=CategoryDetails.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CategoryDetails.es.js","names":[],"sources":["../../../src/trends/components/CategoryDetails.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useGlobalCopyStore,\n useTrendsStore,\n useTransactionStore,\n useScreenSize,\n} from '../../common'\nimport { type Transaction } from '../../core'\n\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport { ExportCsvAction, TransactionDetails, TransactionList } from '../../transactions'\n\nimport CategoryDetailChart from './CategoryDetailChart'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\nexport const CategoryDetails = observer(() => {\n const theme = useTheme()\n const { is_mobile_webview } = useAppConfig()\n const { isDesktop, isSmallTablet, isTablet } = useScreenSize()\n const { common: commonCopy, trends: copy } = useGlobalCopyStore()\n const { selectedCategoryData, selectedDateRangeMonthRange } = useTrendsStore()\n const { sortedTransactions: transactions } = useTransactionStore()\n\n const [transactionGuid, setTransactionGuid] = React.useState<string | null>(null)\n\n if (!selectedCategoryData) {\n return null\n }\n\n const { guid, name, is_income, totalAmount } = selectedCategoryData\n\n const chartColor = getCategoryColor(guid, theme)\n const chartLabel = is_income ? copy.income_label : copy.spending_label\n const chartTitle = `${name}, ${is_income ? copy.monthly_income : copy.monthly_spending}`\n const transactionCountLabel = ` ${\n selectedCategoryData.transactions.length === 1 ? copy.transaction : copy.transactions\n } (${selectedCategoryData.transactions.length})`\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const shouldShowExportButton =\n transactions.length > 0
|
|
1
|
+
{"version":3,"file":"CategoryDetails.es.js","names":[],"sources":["../../../src/trends/components/CategoryDetails.tsx"],"sourcesContent":["import React from 'react'\nimport { observer } from 'mobx-react-lite'\n\nimport List from '@mui/material/List'\nimport ListItem from '@mui/material/ListItem'\nimport ListItemAvatar from '@mui/material/ListItemAvatar'\nimport ListItemText from '@mui/material/ListItemText'\nimport Stack from '@mui/material/Stack'\nimport { useTheme } from '@mui/material/styles'\n\nimport { CategoryIcon, Text } from '@mxenabled/mxui'\n\nimport {\n Drawer,\n useAppConfig,\n useGlobalCopyStore,\n useTrendsStore,\n useTransactionStore,\n useScreenSize,\n} from '../../common'\nimport { type Transaction } from '../../core'\n\nimport { getCategoryColor } from '../../core/utils/CategoryUtil'\nimport { ExportCsvAction, TransactionDetails, TransactionList } from '../../transactions'\n\nimport CategoryDetailChart from './CategoryDetailChart'\nimport { formatCurrency } from '../../core/utils/NumberFormatting'\n\nexport const CategoryDetails = observer(() => {\n const theme = useTheme()\n const { clientConfig, is_mobile_webview } = useAppConfig()\n const { isDesktop, isSmallTablet, isTablet } = useScreenSize()\n const { common: commonCopy, trends: copy } = useGlobalCopyStore()\n const { selectedCategoryData, selectedDateRangeMonthRange } = useTrendsStore()\n const { sortedTransactions: transactions } = useTransactionStore()\n\n const [transactionGuid, setTransactionGuid] = React.useState<string | null>(null)\n\n if (!selectedCategoryData) {\n return null\n }\n\n const { guid, name, is_income, totalAmount } = selectedCategoryData\n\n const chartColor = getCategoryColor(guid, theme)\n const chartLabel = is_income ? copy.income_label : copy.spending_label\n const chartTitle = `${name}, ${is_income ? copy.monthly_income : copy.monthly_spending}`\n const transactionCountLabel = ` ${\n selectedCategoryData.transactions.length === 1 ? copy.transaction : copy.transactions\n } (${selectedCategoryData.transactions.length})`\n\n const transaction = React.useMemo(\n () => transactions.find((t) => t.guid === transactionGuid),\n [transactionGuid, transactions],\n )\n\n const shouldShowExportButton =\n transactions.length > 0 &&\n !is_mobile_webview &&\n !clientConfig?.transactions?.hide_export_csv &&\n (isDesktop || (isTablet && !isSmallTablet))\n\n const categoryFilter = (t: Transaction) =>\n t.category_guid === guid || t.top_level_category_guid === guid\n\n return (\n <Stack sx={{ alignItems: 'center' }}>\n <Stack sx={{ bgcolor: 'background.paper', borderRadius: 0, pt: 16, px: 12, width: '100%' }}>\n <List sx={{ px: 12 }}>\n <ListItem>\n <ListItemAvatar>\n <CategoryIcon categoryGuid={guid} />\n </ListItemAvatar>\n <ListItemText\n primary={name}\n secondary={selectedDateRangeMonthRange}\n slotProps={{\n primary: { component: 'div', variant: 'h3', fontSize: 18, fontWeight: 700 },\n secondary: { component: 'div', variant: 'body2', fontSize: 13 },\n }}\n />\n <Text component=\"div\" variant=\"h3\">\n {formatCurrency(Math.abs(totalAmount), '0,0.00')}\n </Text>\n </ListItem>\n </List>\n\n <CategoryDetailChart\n chartColor={chartColor}\n chartLabel={chartLabel}\n chartTitle={chartTitle}\n />\n </Stack>\n <TransactionList\n filter={categoryFilter}\n onClick={setTransactionGuid}\n scrollsWithParent={true}\n stickyHeader={\n <Stack\n alignItems=\"center\"\n direction=\"row\"\n justifyContent=\"space-between\"\n sx={{ px: 24, py: 4 }}\n >\n <Text bold={true} variant=\"body1\">\n {transactionCountLabel}\n </Text>\n {shouldShowExportButton && <ExportCsvAction filter={categoryFilter} />}\n </Stack>\n }\n />\n <Drawer\n ariaLabelClose={commonCopy.close_aria}\n isOpen={Boolean(transaction)}\n onClose={() => setTransactionGuid('')}\n title={copy.transaction}\n >\n {transaction && <TransactionDetails transaction={transaction} />}\n </Drawer>\n </Stack>\n )\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4BA,IAAa,KAAkB,EAAA,MAAe;AAC5C,QAAM,IAAQ,EAAS,GACjB,EAAE,cAAA,GAAc,mBAAA,EAAA,IAAsB,EAAa,GACnD,EAAE,WAAA,GAAW,eAAA,GAAe,UAAA,EAAA,IAAa,EAAc,GACvD,EAAE,QAAQ,GAAY,QAAQ,EAAA,IAAS,EAAmB,GAC1D,EAAE,sBAAA,GAAsB,6BAAA,EAAA,IAAgC,EAAe,GACvE,EAAE,oBAAoB,EAAA,IAAiB,EAAoB,GAE3D,CAAC,GAAiB,CAAA,IAAsB,EAAM,SAAwB,IAAI;AAEhF,MAAI,CAAC,EACH,QAAO;AAGT,QAAM,EAAE,MAAA,GAAM,MAAA,GAAM,WAAA,GAAW,aAAA,EAAA,IAAgB,GAEzC,IAAa,EAAiB,GAAM,CAAK,GACzC,IAAa,IAAY,EAAK,eAAe,EAAK,gBAClD,IAAa,GAAG,CAAA,KAAS,IAAY,EAAK,iBAAiB,EAAK,gBAAA,IAChE,IAAwB,IAC5B,EAAqB,aAAa,WAAW,IAAI,EAAK,cAAc,EAAK,YAAA,KACtE,EAAqB,aAAa,MAAA,KAE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