Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mobile payees and rules pages #2037

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
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.
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.
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.
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.
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.
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.
2 changes: 2 additions & 0 deletions packages/desktop-client/src/components/FinancesApp.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,8 @@ function FinancesAppWithoutContext() {
<Route path="/budget" element={<MobileNavTabs />} />
<Route path="/accounts" element={<MobileNavTabs />} />
<Route path="/settings" element={<MobileNavTabs />} />
<Route path="/payees" element={<MobileNavTabs />} />
<Route path="/rules" element={<MobileNavTabs />} />
<Route path="*" element={null} />
</Routes>
</View>
Expand Down
12 changes: 10 additions & 2 deletions packages/desktop-client/src/components/ManageRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import { type RuleEntity } from 'loot-core/src/types/models';

import { useCategories } from '../hooks/useCategories';
import { useSelected, SelectedProvider } from '../hooks/useSelected';
import { useResponsive } from '../ResponsiveProvider';
import { theme } from '../style';

import { Button } from './common/Button';
Expand Down Expand Up @@ -241,6 +242,8 @@ function ManageRulesContent({
setHoveredRule(id);
}, []);

const { isNarrowWidth } = useResponsive();

return (
<SelectedProvider instance={selectedInst}>
<View>
Expand All @@ -250,14 +253,16 @@ function ManageRulesContent({
alignItems: 'center',
padding: isModal ? '0 13px 15px' : '0 0 15px',
flexShrink: 0,
justifyContent: 'space-between',
flexWrap: 'wrap',
}}
>
<View
style={{
color: theme.pageTextLight,
flexDirection: 'row',
alignItems: 'center',
width: '50%',
justifySelf: 'flex-start',
}}
>
<Text>
Expand All @@ -270,11 +275,14 @@ function ManageRulesContent({
</ExternalLink>
</Text>
</View>
<View style={{ flex: 1 }} />
<Search
placeholder="Filter rules..."
value={filter}
onChange={onSearchChange}
style={{
justifySelf: 'flex-end',
...(isNarrowWidth && { flexBasis: '100%', marginTop: 10 }),
}}
/>
</View>
<View style={{ flex: 1 }}>
Expand Down
11 changes: 7 additions & 4 deletions packages/desktop-client/src/components/common/Search.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { type ChangeEvent, type Ref } from 'react';

import { SvgRemove, SvgSearchAlternate } from '../../icons/v2';
import { theme } from '../../style';
import { type CSSProperties, theme } from '../../style';

import { Button } from './Button';
import { InputWithContent } from './InputWithContent';
Expand All @@ -12,25 +12,28 @@ type SearchProps = {
onChange: (value: string) => unknown;
placeholder: string;
isInModal?: boolean;
width?: number;
style?: CSSProperties;
};

const DEFAULT_WIDTH = 250;

export function Search({
inputRef,
value,
onChange,
placeholder,
isInModal = false,
width = 250,
style,
}: SearchProps) {
return (
<InputWithContent
inputRef={inputRef}
style={{
width,
width: style?.width || DEFAULT_WIDTH,
flex: '',
borderColor: isInModal ? null : 'transparent',
backgroundColor: isInModal ? null : theme.formInputBackground,
...style,
}}
focusStyle={
isInModal
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,14 @@ export function MobileNavTabs() {
Icon: SvgCalendar,
},
{
name: 'Payees (Soon)',
path: '/payees/soon',
name: 'Payees',
path: '/payees',
style: navTabStyle,
Icon: SvgStoreFront,
},
{
name: 'Rules (Soon)',
path: '/rules/soon',
name: 'Rules',
path: '/rules',
style: navTabStyle,
Icon: SvgTuning,
},
Expand Down
10 changes: 3 additions & 7 deletions packages/desktop-client/src/components/modals/EditRule.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ function ScheduleDescription({ id }) {

return (
<View style={{ flex: 1, flexDirection: 'row', alignItems: 'center' }}>
<View style={{ marginRight: 15, flexDirection: 'row' }}>
<View style={{ marginRight: 15, flexWrap: 'wrap', flexDirection: 'row' }}>
<Text
style={{
whiteSpace: 'nowrap',
Expand All @@ -288,13 +288,9 @@ function ScheduleDescription({ id }) {
/>
</Text>
<Text style={{ margin: '0 5px' }}></Text>
<Text style={{ flexShrink: 0 }}>
Amount: {formatAmount(schedule._amount)}
</Text>
<Text>Amount: {formatAmount(schedule._amount)}</Text>
<Text style={{ margin: '0 5px' }}></Text>
<Text style={{ flexShrink: 0 }}>
Next: {monthUtils.format(schedule.next_date, dateFormat)}
</Text>
<Text>Next: {monthUtils.format(schedule.next_date, dateFormat)}</Text>
</View>
<StatusBadge status={status} />
</View>
Expand Down
23 changes: 14 additions & 9 deletions packages/desktop-client/src/components/payees/ManagePayees.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import {
} from '../../hooks/useSelected';
import { useStableCallback } from '../../hooks/useStableCallback';
import { SvgExpandArrow } from '../../icons/v0';
import { useResponsive } from '../../ResponsiveProvider';
import { theme } from '../../style';
import { Button } from '../common/Button';
import { Search } from '../common/Search';
Expand Down Expand Up @@ -219,8 +220,8 @@ export const ManagePayees = forwardRef(
);

const payeesById = getPayeesById(payees);

const [menuOpen, setMenuOpen] = useState(false);
const { isNarrowWidth } = useResponsive();

return (
<View style={{ height: '100%' }}>
Expand All @@ -229,9 +230,16 @@ export const ManagePayees = forwardRef(
flexDirection: 'row',
alignItems: 'center',
padding: '0 0 15px',
justifyContent: 'space-between',
flexWrap: 'wrap-reverse',
}}
>
<View style={{ flexShrink: 0 }}>
<View
style={{
flexDirection: 'row',
justifySelf: 'flex-start',
}}
>
<Button
type="bare"
style={{ marginRight: 10 }}
Expand All @@ -254,12 +262,6 @@ export const ManagePayees = forwardRef(
onMerge={onMerge}
/>
)}
</View>
<View
style={{
flexShrink: 0,
}}
>
{(orphanedOnly ||
(orphanedPayees && orphanedPayees.length > 0)) && (
<Button
Expand All @@ -281,12 +283,15 @@ export const ManagePayees = forwardRef(
</Button>
)}
</View>
<View style={{ flex: 1 }} />
<Search
id="filter-input"
placeholder="Filter payees..."
value={filter}
onChange={applyFilter}
style={{
justifySelf: 'flex-end',
...(isNarrowWidth && { flexBasis: '100%', marginBottom: 10 }),
}}
/>
</View>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,9 @@ export function ScheduleLink({
<Search
inputRef={searchInput}
isInModal
width={300}
style={{
width: 300,
}}
placeholder="Filter schedules…"
value={filter}
onChange={setFilter}
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/2037.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Features
authors: [joel-jeremy]
---

Mobile payees and rules pages