Skip to content

Commit

Permalink
add buttons for combined-account transaction pages on mobile (#3734)
Browse files Browse the repository at this point in the history
* add buttons for combined-account transaction pages (#2333)

* add release note for #3734

* add accessibility label to mobile combined-account header button

* increase touch targets for combined-account buttons

* remove highlight color and add bounce to header buttons

to match the feel of the other account buttons

* update vrt screenshots for actualbudget#3734
  • Loading branch information
gabeklavans authored Jan 7, 2025
1 parent eadd11b commit 8f66605
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 9 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import React, { type CSSProperties, useCallback } from 'react';
import { useTranslation } from 'react-i18next';
import { useDispatch, useSelector } from 'react-redux';

import { css } from '@emotion/css';

import { replaceModal, syncAndDownload } from 'loot-core/src/client/actions';
import * as queries from 'loot-core/src/client/queries';
import { type AccountEntity } from 'loot-core/types/models';
Expand All @@ -10,7 +12,7 @@ import { useAccounts } from '../../../hooks/useAccounts';
import { useFailedAccounts } from '../../../hooks/useFailedAccounts';
import { useNavigate } from '../../../hooks/useNavigate';
import { useSyncedPref } from '../../../hooks/useSyncedPref';
import { SvgAdd } from '../../../icons/v1';
import { SvgAdd, SvgCheveronRight } from '../../../icons/v1';
import { theme, styles } from '../../../style';
import { makeAmountFullStyle } from '../../budget/util';
import { Button } from '../../common/Button2';
Expand All @@ -24,48 +26,75 @@ import { MOBILE_NAV_HEIGHT } from '../MobileNavTabs';
import { PullToRefresh } from '../PullToRefresh';

type AccountHeaderProps<SheetFieldName extends SheetFields<'account'>> = {
id: string;
name: string;
amount: Binding<'account', SheetFieldName>;
style?: CSSProperties;
};

function AccountHeader<SheetFieldName extends SheetFields<'account'>>({
id,
name,
amount,
style = {},
}: AccountHeaderProps<SheetFieldName>) {
const navigate = useNavigate();

return (
<View
<Button
variant="bare"
aria-label={`View ${name} transactions`}
onPress={() => navigate(`/accounts/${id}`)}
style={{
flex: 1,
flexDirection: 'row',
marginTop: 10,
marginRight: 10,
paddingTop: 15,
paddingBottom: 15,
paddingLeft: 0,
paddingRight: 0,
color: theme.pageTextLight,
width: '100%',
...style,
}}
// to match the feel of the other account buttons
className={css([
{
'&[data-pressed], &[data-hovered]': {
backgroundColor: 'transparent',
transform: 'translateY(1px)',
},
},
])}
>
<View style={{ flex: 1 }}>
<View style={{ flex: 1, alignItems: 'center', flexDirection: 'row' }}>
<Text
style={{
...styles.text,
fontSize: 14,
fontSize: 17,
}}
data-testid="name"
>
{name}
</Text>
<SvgCheveronRight
style={{
flexShrink: 0,
color: theme.mobileHeaderTextSubdued,
marginLeft: 5,
}}
width={styles.text.fontSize}
height={styles.text.fontSize}
/>
</View>
<CellValue binding={amount} type="financial">
{props => (
<CellValueText<'account', SheetFieldName>
{...props}
style={{ ...styles.text, fontSize: 14 }}
style={{ ...styles.text }}
/>
)}
</CellValue>
</View>
</Button>
);
}

Expand Down Expand Up @@ -227,7 +256,11 @@ function AccountList({
<PullToRefresh onRefresh={onSync}>
<View aria-label="Account list" style={{ margin: 10 }}>
{onBudgetAccounts.length > 0 && (
<AccountHeader name="On budget" amount={getOnBudgetBalance()} />
<AccountHeader
id="onbudget"
name="On budget"
amount={getOnBudgetBalance()}
/>
)}
{onBudgetAccounts.map(acct => (
<AccountCard
Expand All @@ -244,6 +277,7 @@ function AccountList({

{offBudgetAccounts.length > 0 && (
<AccountHeader
id="offbudget"
name="Off budget"
amount={getOffBudgetBalance()}
style={{ marginTop: 30 }}
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3734.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [GabeKlavans]
---

Add navigation to combined-accounts transactions lists from the accounts page on mobile.

0 comments on commit 8f66605

Please sign in to comment.