From 00ee165f8e438ce084248628db03041b90459764 Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez <joeljeremy.marquez@gmail.com> Date: Fri, 26 Jan 2024 07:09:29 -0800 Subject: [PATCH] Mobile Off Budget category label (#2284) * Mobile Off Budget category label * Release notes * Fix error * Fix release notes --- .../accounts/MobileAccountDetails.jsx | 2 +- .../transactions/MobileTransaction.jsx | 51 ++++++++++--------- upcoming-release-notes/2284.md | 6 +++ 3 files changed, 34 insertions(+), 25 deletions(-) create mode 100644 upcoming-release-notes/2284.md diff --git a/packages/desktop-client/src/components/accounts/MobileAccountDetails.jsx b/packages/desktop-client/src/components/accounts/MobileAccountDetails.jsx index 3dc2c8e14..bd7c60bc4 100644 --- a/packages/desktop-client/src/components/accounts/MobileAccountDetails.jsx +++ b/packages/desktop-client/src/components/accounts/MobileAccountDetails.jsx @@ -199,11 +199,11 @@ export function AccountDetails({ </View> <PullToRefresh onRefresh={onRefresh}> <TransactionList + account={account} transactions={allTransactions} categories={categories} accounts={accounts} payees={payees} - showCategory={!account.offbudget} isNew={isNewTransaction} onLoadMore={onLoadMore} onSelect={onSelectTransaction} diff --git a/packages/desktop-client/src/components/transactions/MobileTransaction.jsx b/packages/desktop-client/src/components/transactions/MobileTransaction.jsx index 4f05daa85..aa939b539 100644 --- a/packages/desktop-client/src/components/transactions/MobileTransaction.jsx +++ b/packages/desktop-client/src/components/transactions/MobileTransaction.jsx @@ -1131,10 +1131,10 @@ export const TransactionEdit = props => { const Transaction = memo(function Transaction({ transaction, + account, accounts, categories, payees, - showCategory, added, onSelect, style, @@ -1169,11 +1169,15 @@ const Transaction = memo(function Transaction({ payee, transferAcct, ); - const prettyCategory = transferAcct - ? 'Transfer' - : isParent - ? 'Split' - : categoryName; + const specialCategory = account?.offbudget + ? 'Off Budget' + : transferAcct + ? 'Transfer' + : isParent + ? 'Split' + : null; + + const prettyCategory = specialCategory || categoryName; const isPreview = isPreviewId(id); const isReconciled = transaction.reconciled; @@ -1260,22 +1264,21 @@ const Transaction = memo(function Transaction({ }} /> )} - {showCategory && ( - <TextOneLine - style={{ - fontSize: 11, - marginTop: 1, - fontWeight: '400', - color: prettyCategory - ? theme.tableTextSelected - : theme.menuItemTextSelected, - fontStyle: prettyCategory ? null : 'italic', - textAlign: 'left', - }} - > - {prettyCategory || 'Uncategorized'} - </TextOneLine> - )} + <TextOneLine + style={{ + fontSize: 11, + marginTop: 1, + fontWeight: '400', + color: prettyCategory + ? theme.tableTextSelected + : theme.menuItemTextSelected, + fontStyle: + specialCategory || !prettyCategory ? 'italic' : undefined, + textAlign: 'left', + }} + > + {prettyCategory || 'Uncategorized'} + </TextOneLine> </View> )} </View> @@ -1296,11 +1299,11 @@ const Transaction = memo(function Transaction({ }); export function TransactionList({ + account, accounts, categories, payees, transactions, - showCategory, isNew, onSelect, scrollProps = {}, @@ -1384,10 +1387,10 @@ export function TransactionList({ > <Transaction transaction={transaction} + account={account} categories={categories} accounts={accounts} payees={payees} - showCategory={showCategory} added={isNew(transaction.id)} onSelect={onSelect} // onSelect(transaction)} /> diff --git a/upcoming-release-notes/2284.md b/upcoming-release-notes/2284.md new file mode 100644 index 000000000..7b946dee4 --- /dev/null +++ b/upcoming-release-notes/2284.md @@ -0,0 +1,6 @@ +--- +category: Enhancements +authors: [joel-jeremy] +--- + +Add Off Budget category label to mobile transactions page -- GitLab