A local-first personal finance app
[AI] improve the first-account creation flow (#8496)
Matt Fiddaman4c970ada2c17
diff --git a/packages/desktop-client/e2e/page-models/navigation.ts b/packages/desktop-client/e2e/page-models/navigation.tsindex 40aabf3914..bf1e10df78 100644--- a/packages/desktop-client/e2e/page-models/navigation.ts+++ b/packages/desktop-client/e2e/page-models/navigation.ts@@ -154,14 +154,10 @@ export class Navigation {async createAccount(data: AccountEntry) {await this.page.getByRole('button', { name: 'Add account' }).click();- // Clicking "Create a local account" pushes a second modal whose- // heading is "Create Local Account". Wait for that heading to- // confirm the form is fully mounted before touching any fields.- await clickReactAriaButton(- this.page.getByRole('button', { name: 'Create a local account' }),- );+ // Wait for the form heading to confirm it is fully mounted before+ // touching any fields.await this.page- .getByRole('heading', { name: 'Create Local Account' })+ .getByRole('heading', { name: 'Add account' }).waitFor({ state: 'visible' });await fillReactInput(this.page.getByLabel('Name'), data.name);diff --git a/packages/desktop-client/src/components/accounts/AccountEmptyMessage.tsx b/packages/desktop-client/src/components/accounts/AccountEmptyMessage.tsxindex 5faa7a128c..ccc97e0ec2 100644--- a/packages/desktop-client/src/components/accounts/AccountEmptyMessage.tsx+++ b/packages/desktop-client/src/components/accounts/AccountEmptyMessage.tsx@@ -31,9 +31,10 @@ export function AccountEmptyMessage({ onAdd }: AccountEmptyMessageProps) {><Text style={{ textAlign: 'center', lineHeight: '1.4em' }}><Trans>- For Actual to be useful, you need to <strong>add an account</strong>- . You can link an account to automatically download transactions, or- manage it locally yourself.+ <strong>Let's add your first account.</strong> Accounts hold your+ transactions, like everyday spending, savings, credit cards, or+ cash. You can connect to your bank to import transactions+ automatically, or add them yourself.</Trans></Text>@@ -49,7 +50,7 @@ export function AccountEmptyMessage({ onAdd }: AccountEmptyMessageProps) {<Viewstyle={{ marginTop: 20, fontSize: 13, color: theme.tableTextLight }}>- <Trans>In the future, you can add accounts from the sidebar.</Trans>+ <Trans>You can add more accounts at any time from the sidebar.</Trans></View></View></View>diff --git a/packages/desktop-client/src/components/mobile/accounts/AccountsPage.tsx b/packages/desktop-client/src/components/mobile/accounts/AccountsPage.tsxindex 00a2a00ee3..9a2b95ed0e 100644--- a/packages/desktop-client/src/components/mobile/accounts/AccountsPage.tsx+++ b/packages/desktop-client/src/components/mobile/accounts/AccountsPage.tsx@@ -14,6 +14,7 @@ import {SvgAdd,SvgCheveronDown,SvgCheveronRight,+ SvgPiggyBank,} from '@actual-app/components/icons/v1';import { styles } from '@actual-app/components/styles';import { Text } from '@actual-app/components/text';@@ -226,16 +227,57 @@ function AccountListItem({);}-function EmptyMessage() {+function EmptyMessage({ onAddAccount }: { onAddAccount: () => void }) {return (- <View style={{ flex: 1, padding: 30 }}>- <Text style={styles.text}>+ <View+ style={{+ minHeight: `calc(100vh - ${MOBILE_NAV_HEIGHT}px - 140px)`,+ alignItems: 'center',+ justifyContent: 'center',+ padding: 30,+ gap: 15,+ }}+ >+ <SvgPiggyBank+ width={70}+ height={70}+ style={{ color: theme.pageTextSubdued }}+ />+ <Text+ style={{+ ...styles.largeText,+ fontWeight: 600,+ textAlign: 'center',+ }}+ >+ <Trans>Add your first account</Trans>+ </Text>+ <Text+ style={{+ ...styles.text,+ textAlign: 'center',+ color: theme.pageTextLight,+ lineHeight: 1.5,+ maxWidth: 340,+ }}+ ><Trans>- For Actual to be useful, you need to <strong>add an account</strong>.- You can link an account to automatically download transactions, or- manage it locally yourself.+ Accounts hold your transactions, like everyday spending, savings,+ credit cards, or cash. Add one to start tracking your money.</Trans></Text>+ <Button+ variant="primary"+ style={{+ padding: '12px 20px',+ fontSize: 15,+ minHeight: styles.mobileMinHeight,+ marginTop: 10,+ }}+ onPress={onAddAccount}+ >+ <Trans>Add account</Trans>+ </Button></View>);}@@ -312,66 +354,69 @@ function AllAccountList({}padding={0}>- {accounts.length === 0 && <EmptyMessage />}- <PullToRefresh onRefresh={onSync}>- <View- aria-label={t('Account list')}- style={{ paddingBottom: MOBILE_NAV_HEIGHT }}- >- <AccountHeader- id="all"- name={t('All accounts')}- amount={getAllAccountsBalance()}- />- {onBudgetAccounts.length > 0 && (- <AccountHeader- id="onbudget"- name={t('On budget')}- amount={getOnBudgetBalance()}- />- )}- <AccountList- aria-label={t('On budget accounts')}- accounts={onBudgetAccounts}- getAccountBalance={getAccountBalance}- onOpenAccount={onOpenAccount}- />- {offBudgetAccounts.length > 0 && (+ {accounts.length === 0 ? (+ <EmptyMessage onAddAccount={onAddAccount} />+ ) : (+ <PullToRefresh onRefresh={onSync}>+ <View+ aria-label={t('Account list')}+ style={{ paddingBottom: MOBILE_NAV_HEIGHT }}+ ><AccountHeader- id="offbudget"- name={t('Off budget')}- amount={getOffBudgetBalance()}+ id="all"+ name={t('All accounts')}+ amount={getAllAccountsBalance()}/>- )}- <AccountList- aria-label={t('Off budget accounts')}- accounts={offBudgetAccounts}- getAccountBalance={getAccountBalance}- onOpenAccount={onOpenAccount}- />- {closedAccounts.length > 0 && (- <AccountHeader- id="closed"- name={t('Closed')}- onPress={onToggleClosedAccounts}- amount={getClosedAccountsBalance()}- style={{ marginTop: 30 }}- showCheveronDown={showClosedAccounts}+ {onBudgetAccounts.length > 0 && (+ <AccountHeader+ id="onbudget"+ name={t('On budget')}+ amount={getOnBudgetBalance()}+ />+ )}+ <AccountList+ aria-label={t('On budget accounts')}+ accounts={onBudgetAccounts}+ getAccountBalance={getAccountBalance}+ onOpenAccount={onOpenAccount}/>- )}- {showClosedAccounts && (+ {offBudgetAccounts.length > 0 && (+ <AccountHeader+ id="offbudget"+ name={t('Off budget')}+ amount={getOffBudgetBalance()}+ />+ )}<AccountList- aria-label={t('Closed accounts')}- accounts={closedAccounts}+ aria-label={t('Off budget accounts')}+ accounts={offBudgetAccounts}getAccountBalance={getAccountBalance}onOpenAccount={onOpenAccount}- ref={el => {- if (el) closedAccountsRef.current = el;- }}/>- )}- </View>- </PullToRefresh>+ {closedAccounts.length > 0 && (+ <AccountHeader+ id="closed"+ name={t('Closed')}+ onPress={onToggleClosedAccounts}+ amount={getClosedAccountsBalance()}+ style={{ marginTop: 30 }}+ showCheveronDown={showClosedAccounts}+ />+ )}+ {showClosedAccounts && (+ <AccountList+ aria-label={t('Closed accounts')}+ accounts={closedAccounts}+ getAccountBalance={getAccountBalance}+ onOpenAccount={onOpenAccount}+ ref={el => {+ if (el) closedAccountsRef.current = el;+ }}+ />+ )}+ </View>+ </PullToRefresh>+ )}</Page>);}diff --git a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateAccountModal.tsxindex f03719ac45..547b5ae88e 100644--- a/packages/desktop-client/src/components/modals/CreateAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateAccountModal.tsx@@ -1,4 +1,4 @@-import React from 'react';+import React, { useLayoutEffect } from 'react';import { Trans, useTranslation } from 'react-i18next';import { Button } from '@actual-app/components/button';@@ -13,7 +13,7 @@ import { useBuiltInBankSyncProviders } from '#components/banksync/useBuiltInBankimport { Link } from '#components/common/Link';import { Modal, ModalCloseButton, ModalHeader } from '#components/common/Modal';import { useNavigate } from '#hooks/useNavigate';-import { pushModal } from '#modals/modalsSlice';+import { pushModal, replaceModal } from '#modals/modalsSlice';import type { Modal as ModalType } from '#modals/modalsSlice';import { useDispatch } from '#redux';@@ -39,12 +39,25 @@ export function CreateAccountModal({dispatch(pushModal({ modal: { name: 'add-local-account' } }));};+ const isUsingServer = syncServerStatus !== 'no-server';+ const shouldSkipToLocalAccount = !isUsingServer && upgradingAccountId == null;++ useLayoutEffect(() => {+ if (shouldSkipToLocalAccount) {+ dispatch(replaceModal({ modal: { name: 'add-local-account' } }));+ }+ }, [dispatch, shouldSkipToLocalAccount]);+let title = t('Add account');if (upgradingAccountId != null) {title = t('Link account');}+ if (shouldSkipToLocalAccount) {+ return null;+ }+return (<Modal name="add-account">{({ state }) => (diff --git a/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx b/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsxindex e99423daf7..183ea86f43 100644--- a/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx+++ b/packages/desktop-client/src/components/modals/CreateLocalAccountModal.tsx@@ -27,6 +27,7 @@ import { Checkbox } from '#components/forms';import { validateAccountName } from '#components/util/accountValidation';import { useAccounts } from '#hooks/useAccounts';import { useNavigate } from '#hooks/useNavigate';+import { useSyncServerStatus } from '#hooks/useSyncServerStatus';import { closeModal } from '#modals/modalsSlice';import { useDispatch } from '#redux';@@ -34,6 +35,7 @@ export function CreateLocalAccountModal() {const { t } = useTranslation();const navigate = useNavigate();const dispatch = useDispatch();+ const isUsingServer = useSyncServerStatus() !== 'no-server';const { data: accounts = [] } = useAccounts();const [name, setName] = useState('');const [offbudget, setOffbudget] = useState(false);@@ -86,17 +88,44 @@ export function CreateLocalAccountModal() {<><ModalHeadertitle={- <ModalTitle title={t('Create Local Account')} shrinkOnOverflow />+ <ModalTitle+ title={+ isUsingServer ? t('Create Local Account') : t('Add account')+ }+ shrinkOnOverflow+ />}rightContent={<ModalCloseButton onPress={() => state.close()} />}/><View>+ {!isUsingServer && (+ <Text+ style={{+ color: theme.pageTextSubdued,+ lineHeight: 1.5,+ marginBottom: 15,+ }}+ >+ <Trans>+ Once the account is created, you can also{' '}+ <Link+ variant="external"+ linkColor="muted"+ to="https://actualbudget.org/docs/transactions/importing"+ >+ import QIF/OFX/QFX files+ </Link>{' '}+ into it.+ </Trans>+ </Text>+ )}<Form onSubmit={onSubmit}><InlineField label={t('Name')} width="100%"><InitialFocus><Inputname="name"value={name}+ placeholder={t('e.g. Bank, Savings, Credit Card, Cash')}onChangeValue={setName}onUpdate={value => {const name = value.trim();@@ -150,7 +179,13 @@ export function CreateLocalAccountModal() {marginTop: 3,}}>- <Text>+ <Text style={{ display: 'block' }}>+ <Trans>+ Off-budget accounts (like investments, loans, or your+ house) are tracked but not part of your spending budget.+ </Trans>+ </Text>+ <Text style={{ display: 'block' }}><Trans>This cannot be changed later. See{' '}<Link@@ -191,7 +226,7 @@ export function CreateLocalAccountModal() {<ModalButtons><Button onPress={() => state.close()}>- <Trans>Back</Trans>+ {isUsingServer ? <Trans>Back</Trans> : <Trans>Cancel</Trans>}</Button><Buttontype="submit"diff --git a/upcoming-release-notes/first-account-setup.md b/upcoming-release-notes/first-account-setup.mdnew file mode 100644index 0000000000..16df986996--- /dev/null+++ b/upcoming-release-notes/first-account-setup.md@@ -0,0 +1,6 @@+---+category: Enhancements+authors: [matt-fidd]+---++Improve the process to add a first account