diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png index 2646cc85e09..38e8e4570aa 100644 Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png differ diff --git a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-loads-the-budget-page-with-budgeted-amounts-1-chromium-linux.png b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-loads-the-budget-page-with-budgeted-amounts-1-chromium-linux.png index fcc9a4669d8..90efef73ea0 100644 Binary files a/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-loads-the-budget-page-with-budgeted-amounts-1-chromium-linux.png and b/packages/desktop-client/e2e/mobile.test.js-snapshots/Mobile-loads-the-budget-page-with-budgeted-amounts-1-chromium-linux.png differ diff --git a/packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx b/packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx index bf7164aff9d..05641edfa81 100644 --- a/packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx +++ b/packages/desktop-client/src/components/autocomplete/CategoryAutocomplete.tsx @@ -7,6 +7,11 @@ import React, { import { css } from 'glamor'; +import { + type CategoryEntity, + type CategoryGroupEntity, +} from 'loot-core/src/types/models'; + import Split from '../../icons/v0/Split'; import { theme } from '../../style'; import Text from '../common/Text'; @@ -14,21 +19,8 @@ import View from '../common/View'; import Autocomplete, { defaultFilterSuggestion } from './Autocomplete'; -export type Category = { - id: string; - cat_group: unknown; - groupName: string; - name: string; -}; - -export type CategoryGroup = { - id: string; - name: string; - categories: Array; -}; - export type CategoryListProps = { - items: Array; + items: Array; getItemProps?: (arg: { item }) => Partial>; highlightedIndex: number; embedded: boolean; @@ -122,7 +114,7 @@ function CategoryList({ }} data-testid="category-item-group" > - {item.groupName} + {`${item.group?.name}`} )}
& { - categoryGroups: CategoryGroup[]; + categoryGroups: Array; showSplitOption?: boolean; groupHeaderStyle?: object; }; @@ -169,19 +161,23 @@ export default function CategoryAutocomplete({ groupHeaderStyle, ...props }: CategoryAutocompleteProps) { - let categorySuggestions = useMemo( + let categorySuggestions: Array< + CategoryEntity & { group?: CategoryGroupEntity } + > = useMemo( () => categoryGroups.reduce( (list, group) => list.concat( - group.categories.map(category => ({ - ...category, - groupName: group.name, - })), + group.categories + .filter(category => category.cat_group === group.id) + .map(category => ({ + ...category, + group: group, + })), ), - showSplitOption ? [{ id: 'split', name: '' }] : [], + showSplitOption ? [{ id: 'split', name: '' } as CategoryEntity] : [], ), - [categoryGroups], + [showSplitOption, categoryGroups], ); return ( diff --git a/packages/desktop-client/src/components/budget/BalanceWithCarryover.tsx b/packages/desktop-client/src/components/budget/BalanceWithCarryover.tsx index 93d1df5312e..b3e2beb897b 100644 --- a/packages/desktop-client/src/components/budget/BalanceWithCarryover.tsx +++ b/packages/desktop-client/src/components/budget/BalanceWithCarryover.tsx @@ -1,6 +1,7 @@ import React, { type ComponentProps } from 'react'; import ArrowThinRight from '../../icons/v1/ArrowThinRight'; +import { type CSSProperties } from '../../style'; import View from '../common/View'; import CellValue from '../spreadsheet/CellValue'; import useSheetValue from '../spreadsheet/useSheetValue'; @@ -11,17 +12,23 @@ type BalanceWithCarryoverProps = { carryover: ComponentProps['binding']; balance: ComponentProps['binding']; disabled?: boolean; + style?: CSSProperties; + balanceStyle?: CSSProperties; + carryoverStyle?: CSSProperties; }; export default function BalanceWithCarryover({ carryover, balance, disabled, + style, + balanceStyle, + carryoverStyle, }: BalanceWithCarryoverProps) { let carryoverValue = useSheetValue(carryover); let balanceValue = useSheetValue(balance); return ( - <> + - {carryoverValue === true && ( + {carryoverValue && ( )} - + ); } diff --git a/packages/desktop-client/src/components/budget/CategoryGroupsContext.js b/packages/desktop-client/src/components/budget/CategoryGroupsContext.js deleted file mode 100644 index b1d9eb6899e..00000000000 --- a/packages/desktop-client/src/components/budget/CategoryGroupsContext.js +++ /dev/null @@ -1,3 +0,0 @@ -import { createContext } from 'react'; - -export let CategoryGroupsContext = createContext([]); diff --git a/packages/desktop-client/src/components/budget/DynamicBudgetTable.js b/packages/desktop-client/src/components/budget/DynamicBudgetTable.js index fec4a397866..dbd83c50abe 100644 --- a/packages/desktop-client/src/components/budget/DynamicBudgetTable.js +++ b/packages/desktop-client/src/components/budget/DynamicBudgetTable.js @@ -8,7 +8,6 @@ import View from '../common/View'; import { useBudgetMonthCount } from './BudgetMonthCountContext'; import BudgetPageHeader from './BudgetPageHeader'; import BudgetTable from './BudgetTable'; -import { CategoryGroupsContext } from './CategoryGroupsContext'; function getNumPossibleMonths(width) { let estimatedTableWidth = width - 200; @@ -61,36 +60,34 @@ const DynamicBudgetTableInner = forwardRef( } return ( - - - - - - + + + + - + ); }, ); diff --git a/packages/desktop-client/src/components/budget/MobileBudgetTable.js b/packages/desktop-client/src/components/budget/MobileBudgetTable.js index e02095ab704..986476f7a3e 100644 --- a/packages/desktop-client/src/components/budget/MobileBudgetTable.js +++ b/packages/desktop-client/src/components/budget/MobileBudgetTable.js @@ -32,7 +32,9 @@ import { AmountInput } from '../util/AmountInput'; // } from '../mobile/AmountInput'; // import { DragDrop, Draggable, Droppable, DragDropHighlight } from './dragdrop'; +import BalanceWithCarryover from './BalanceWithCarryover'; import { ListItem, ROW_HEIGHT } from './MobileTable'; +import BalanceTooltip from './rollover/BalanceTooltip'; import { makeAmountGrey } from './util'; function ToBudget({ toBudget, onClick }) { @@ -49,6 +51,7 @@ function ToBudget({ toBudget, onClick }) { ...styles.underlinedText, color: theme.formInputText, flexShrink: 0, + textAlign: 'left', }} /> {projected ? (