From 2bb4c56fab31826d9b55f4aa623695340f9b7403 Mon Sep 17 00:00:00 2001 From: Joel Jeremy Marquez Date: Tue, 5 Dec 2023 11:17:18 -0800 Subject: [PATCH] Mobile payees and rules pages --- .../src/components/FinancesApp.tsx | 2 ++ .../src/components/ManageRules.tsx | 12 ++++++++-- .../src/components/ManageRulesPage.tsx | 14 +++++++++++- .../src/components/common/Search.tsx | 11 ++++++---- .../src/components/mobile/MobileNavTabs.tsx | 8 +++---- .../src/components/payees/ManagePayees.js | 22 ++++++++++++------- .../src/components/payees/ManagePayeesPage.js | 13 ++++++++++- .../src/components/schedules/LinkSchedule.tsx | 4 +++- 8 files changed, 65 insertions(+), 21 deletions(-) diff --git a/packages/desktop-client/src/components/FinancesApp.tsx b/packages/desktop-client/src/components/FinancesApp.tsx index 58792c219c6..11ab135bec5 100644 --- a/packages/desktop-client/src/components/FinancesApp.tsx +++ b/packages/desktop-client/src/components/FinancesApp.tsx @@ -241,6 +241,8 @@ function FinancesApp() { } /> } /> } /> + } /> + } /> diff --git a/packages/desktop-client/src/components/ManageRules.tsx b/packages/desktop-client/src/components/ManageRules.tsx index 1d6ea7d0a76..d5dcc0102fd 100644 --- a/packages/desktop-client/src/components/ManageRules.tsx +++ b/packages/desktop-client/src/components/ManageRules.tsx @@ -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'; @@ -253,6 +254,8 @@ function ManageRulesContent({ setHoveredRule(id); }, []); + const { isNarrowWidth } = useResponsive(); + if (rules === null) { return null; } @@ -266,6 +269,8 @@ function ManageRulesContent({ alignItems: 'center', padding: isModal ? '0 13px 15px' : '0 0 15px', flexShrink: 0, + justifyContent: 'space-between', + flexWrap: 'wrap', }} > @@ -286,11 +291,14 @@ function ManageRulesContent({ - diff --git a/packages/desktop-client/src/components/ManageRulesPage.tsx b/packages/desktop-client/src/components/ManageRulesPage.tsx index e64f57e8788..d1c8c5800e8 100644 --- a/packages/desktop-client/src/components/ManageRulesPage.tsx +++ b/packages/desktop-client/src/components/ManageRulesPage.tsx @@ -1,11 +1,23 @@ import React from 'react'; +import { useResponsive } from '../ResponsiveProvider'; +import { theme } from '../style'; + import ManageRules from './ManageRules'; import { Page } from './Page'; export function ManageRulesPage() { + const { isNarrowWidth } = useResponsive(); return ( - + ); diff --git a/packages/desktop-client/src/components/common/Search.tsx b/packages/desktop-client/src/components/common/Search.tsx index 9281d75d57d..3574f2f66ce 100644 --- a/packages/desktop-client/src/components/common/Search.tsx +++ b/packages/desktop-client/src/components/common/Search.tsx @@ -2,7 +2,7 @@ import { type ChangeEvent, type Ref } from 'react'; import SvgRemove from '../../icons/v2/Remove'; import SearchAlternate from '../../icons/v2/SearchAlternate'; -import { theme } from '../../style'; +import { type CSSProperties, theme } from '../../style'; import Button from './Button'; import InputWithContent from './InputWithContent'; @@ -13,25 +13,28 @@ type SearchProps = { onChange: (value: string) => unknown; placeholder: string; isInModal?: boolean; - width?: number; + style?: CSSProperties; }; +const DEFAULT_WIDTH = 250; + export default function Search({ inputRef, value, onChange, placeholder, isInModal = false, - width = 250, + style, }: SearchProps) { return ( @@ -228,9 +230,16 @@ export const ManagePayees = forwardRef( flexDirection: 'row', alignItems: 'center', padding: '0 0 15px', + justifyContent: 'space-between', + flexWrap: 'wrap-reverse', }} > - +