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] Budget menu modals #2491

Merged
merged 15 commits into from
Apr 11, 2024
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.
27 changes: 22 additions & 5 deletions packages/desktop-client/src/components/Modals.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,10 @@ import * as monthUtils from 'loot-core/src/shared/months';
import { useActions } from '../hooks/useActions';
import { useSyncServerStatus } from '../hooks/useSyncServerStatus';

import { ModalTitle } from './common/Modal';
import { AccountAutocompleteModal } from './modals/AccountAutocompleteModal';
import { AccountMenuModal } from './modals/AccountMenuModal';
import { BudgetMenuModal } from './modals/BudgetMenuModal';
import { CategoryAutocompleteModal } from './modals/CategoryAutocompleteModal';
import { CategoryGroupMenuModal } from './modals/CategoryGroupMenuModal';
import { CategoryMenuModal } from './modals/CategoryMenuModal';
Expand Down Expand Up @@ -46,7 +48,7 @@ import { ScheduledTransactionMenuModal } from './modals/ScheduledTransactionMenu
import { SelectLinkedAccounts } from './modals/SelectLinkedAccounts';
import { SimpleFinInitialise } from './modals/SimpleFinInitialise';
import { SingleInputModal } from './modals/SingleInputModal';
import { SwitchBudgetType } from './modals/SwitchBudgetType';
import { SwitchBudgetTypeModal } from './modals/SwitchBudgetTypeModal';
import { TransferModal } from './modals/TransferModal';
import { DiscoverSchedules } from './schedules/DiscoverSchedules';
import { PostsOfflineNotification } from './schedules/PostsOfflineNotification';
Expand Down Expand Up @@ -313,7 +315,7 @@ export function Modals() {
return (
<SingleInputModal
modalProps={modalProps}
title="New Category"
title={<ModalTitle title="New Category" shrinkOnOverflow />}
inputPlaceholder="Category name"
buttonText="Add"
onValidate={options.onValidate}
Expand All @@ -325,7 +327,7 @@ export function Modals() {
return (
<SingleInputModal
modalProps={modalProps}
title="New Category Group"
title={<ModalTitle title="New Category Group" shrinkOnOverflow />}
inputPlaceholder="Category group name"
buttonText="Add"
onValidate={options.onValidate}
Expand Down Expand Up @@ -400,10 +402,10 @@ export function Modals() {

case 'switch-budget-type':
return (
<SwitchBudgetType
<SwitchBudgetTypeModal
key={name}
modalProps={modalProps}
onSwitch={options?.onSwitch}
onSwitch={options.onSwitch}
/>
);

Expand Down Expand Up @@ -549,6 +551,21 @@ export function Modals() {
/>
);

case 'budget-menu':
return (
<NamespaceContext.Provider
key={name}
value={monthUtils.sheetForMonth(options.month)}
>
<BudgetMenuModal
modalProps={modalProps}
month={options.month}
onToggleHiddenCategories={options.onToggleHiddenCategories}
onSwitchBudgetType={options.onSwitchBudgetType}
/>
</NamespaceContext.Provider>
);

default:
console.error('Unknown modal:', name);
return null;
Expand Down
10 changes: 2 additions & 8 deletions packages/desktop-client/src/components/common/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ export function Menu<T extends MenuItem>({
);
}

const lastItem = items[idx - 1];
const Icon = item.icon;

return (
Expand All @@ -153,14 +152,9 @@ export function Menu<T extends MenuItem>({
key={item.name}
style={{
cursor: 'default',
padding: '9px 10px',
marginTop:
idx === 0 ||
lastItem === Menu.line ||
lastItem.type === Menu.label
? 0
: -3,
padding: 10,
flexDirection: 'row',
justifyContent: 'center',
alignItems: 'center',
color: theme.menuItemText,
...(item.disabled && { color: theme.buttonBareDisabledText }),
Expand Down
Loading
Loading