A local-first personal finance app
:sparkles: (mobile) allow creating transactions via the footer (#1545)
Matiss Janis Aboltins6dfc43abf1a6
diff --git a/packages/desktop-client/e2e/mobile.test.js b/packages/desktop-client/e2e/mobile.test.jsindex d5f65b38ce..d39d0cfb1e 100644--- a/packages/desktop-client/e2e/mobile.test.js+++ b/packages/desktop-client/e2e/mobile.test.js@@ -71,7 +71,33 @@ test.describe('Mobile', () => {await expect(accountPage.transactions).not.toHaveCount(0);});- test('creates a transaction', async () => {+ test('creates a transaction via footer button', async () => {+ const transactionEntryPage = await navigation.goToTransactionEntryPage();++ await expect(transactionEntryPage.header).toHaveText('New Transaction');++ await transactionEntryPage.amountField.fill('12.34');+ await transactionEntryPage.fillField(+ page.getByTestId('payee-field'),+ 'Kroger',+ );+ await transactionEntryPage.fillField(+ page.getByTestId('category-field'),+ 'Clothing',+ );+ await transactionEntryPage.fillField(+ page.getByTestId('account-field'),+ 'Ally Savings',+ );++ const accountPage = await transactionEntryPage.createTransaction();++ await expect(accountPage.transactions.nth(0)).toHaveText(+ 'KrogerClothing-12.34',+ );+ });++ test('creates a transaction from `/accounts/:id` page', async () => {const accountsPage = await navigation.goToAccountsPage();const accountPage = await accountsPage.openNthAccount(1);const transactionEntryPage = await accountPage.clickCreateTransaction();@@ -88,7 +114,7 @@ test.describe('Mobile', () => {'Clothing',);- await transactionEntryPage.add.click();+ await transactionEntryPage.createTransaction();await expect(accountPage.transactions.nth(0)).toHaveText('KrogerClothing-12.34',diff --git a/packages/desktop-client/e2e/page-models/mobile-navigation.js b/packages/desktop-client/e2e/page-models/mobile-navigation.jsindex 16d667af25..eeabd4b4c0 100644--- a/packages/desktop-client/e2e/page-models/mobile-navigation.js+++ b/packages/desktop-client/e2e/page-models/mobile-navigation.js@@ -1,5 +1,6 @@import { MobileAccountsPage } from './mobile-accounts-page';import { MobileBudgetPage } from './mobile-budget-page';+import { MobileTransactionEntryPage } from './mobile-transaction-entry-page';import { SettingsPage } from './settings-page';export class MobileNavigation {@@ -21,6 +22,13 @@ export class MobileNavigation {return new MobileAccountsPage(this.page);}+ async goToTransactionEntryPage() {+ const link = this.page.getByRole('link', { name: 'Transaction' });+ await link.click();++ return new MobileTransactionEntryPage(this.page);+ }+async goToSettingsPage() {const link = this.page.getByRole('link', { name: 'Settings' });await link.click();diff --git a/packages/desktop-client/e2e/page-models/mobile-transaction-entry-page.js b/packages/desktop-client/e2e/page-models/mobile-transaction-entry-page.jsindex 3b5115f72f..c4281c2b99 100644--- a/packages/desktop-client/e2e/page-models/mobile-transaction-entry-page.js+++ b/packages/desktop-client/e2e/page-models/mobile-transaction-entry-page.js@@ -1,3 +1,5 @@+import { MobileAccountPage } from './mobile-account-page';+export class MobileTransactionEntryPage {constructor(page) {this.page = page;@@ -12,4 +14,10 @@ export class MobileTransactionEntryPage {await this.page.locator('css=[role=combobox] input').fill(content);await this.page.keyboard.press('Enter');}++ async createTransaction() {+ await this.add.click();++ return new MobileAccountPage(this.page);+ }}diff --git a/packages/desktop-client/src/components/FinancesApp.tsx b/packages/desktop-client/src/components/FinancesApp.tsxindex 76858fdad6..26f3852e41 100644--- a/packages/desktop-client/src/components/FinancesApp.tsx+++ b/packages/desktop-client/src/components/FinancesApp.tsx@@ -21,6 +21,7 @@ import checkForUpdateNotification from 'loot-core/src/client/update-notificationimport * as undo from 'loot-core/src/platform/client/undo';import { useActions } from '../hooks/useActions';+import Add from '../icons/v1/Add';import Cog from '../icons/v1/Cog';import PiggyBank from '../icons/v1/PiggyBank';import Wallet from '../icons/v1/Wallet';@@ -108,6 +109,7 @@ function MobileNavTabs() {><NavTab name="Budget" path="/budget" icon={Wallet} /><NavTab name="Accounts" path="/accounts" icon={PiggyBank} />+ <NavTab name="Transaction" path="/transactions/new" icon={Add} /><NavTab name="Settings" path="/settings" icon={Cog} /></div>);@@ -264,6 +266,14 @@ function FinancesApp() {</WideNotSupported>}/>+ <Route+ path="/transactions/new"+ element={+ <WideNotSupported>+ <TransactionEdit />+ </WideNotSupported>+ }+ /></Routes><Modals />diff --git a/packages/desktop-client/src/components/accounts/MobileAccountDetails.js b/packages/desktop-client/src/components/accounts/MobileAccountDetails.jsindex 1d3ac56fd7..0e300076ea 100644--- a/packages/desktop-client/src/components/accounts/MobileAccountDetails.js+++ b/packages/desktop-client/src/components/accounts/MobileAccountDetails.js@@ -95,7 +95,7 @@ export default function AccountDetails({alignItems: 'center',flexShrink: 0,overflowY: 'hidden',- paddingTop: 20,+ paddingTop: 10,top: 0,width: '100%',}}diff --git a/packages/desktop-client/src/components/transactions/MobileTransaction.js b/packages/desktop-client/src/components/transactions/MobileTransaction.jsindex 4f95dd8956..9b766b97f9 100644--- a/packages/desktop-client/src/components/transactions/MobileTransaction.js+++ b/packages/desktop-client/src/components/transactions/MobileTransaction.js@@ -373,7 +373,7 @@ class TransactionEditInner extends PureComponent {}}><Link- to={`/accounts/${account.id}`}+ to={account ? `/accounts/${account.id}` : '/budget'}style={{alignItems: 'center',display: 'flex',@@ -524,6 +524,7 @@ class TransactionEditInner extends PureComponent {disabled={!adding}value={account ? account.name : null}onClick={() => this.onClick(transaction.id, 'account')}+ data-testid="account-field"/></View>diff --git a/upcoming-release-notes/1545.md b/upcoming-release-notes/1545.mdnew file mode 100644index 0000000000..a49afd9d64--- /dev/null+++ b/upcoming-release-notes/1545.md@@ -0,0 +1,6 @@+---+category: Enhancements+authors: [MatissJanis]+---++Mobile: add transaction creation button in the footer