Skip to content

Commit

Permalink
Update payload
Browse files Browse the repository at this point in the history
  • Loading branch information
joel-jeremy committed Jan 13, 2025
1 parent 27497a8 commit 582138a
Show file tree
Hide file tree
Showing 40 changed files with 815 additions and 608 deletions.
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/HelpMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ export const HelpMenu = () => {
openDocsForCurrentPage();
break;
case 'keyboard-shortcuts':
dispatch(pushModal({ name: 'keyboard-shortcuts' }));
dispatch(pushModal({ modal: { name: 'keyboard-shortcuts' } }));
break;
case 'goal-templates':
dispatch(pushModal({ name: 'goal-templates' }));
dispatch(pushModal({ modal: { name: 'goal-templates' } }));
break;
}
};
Expand Down
28 changes: 16 additions & 12 deletions packages/desktop-client/src/components/ManageRules.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -220,12 +220,14 @@ export function ManageRules({
const onEditRule = useCallback(rule => {
dispatch(
pushModal({
name: 'edit-rule',
options: {
rule,
onSave: async () => {
await loadRules();
setLoading(false);
modal: {
name: 'edit-rule',
options: {
rule,
onSave: async () => {
await loadRules();
setLoading(false);
},
},
},
}),
Expand Down Expand Up @@ -256,12 +258,14 @@ export function ManageRules({

dispatch(
pushModal({
name: 'edit-rule',
options: {
rule,
onSave: async () => {
await loadRules();
setLoading(false);
modal: {
name: 'edit-rule',
options: {
rule,
onSave: async () => {
await loadRules();
setLoading(false);
},
},
},
}),
Expand Down
58 changes: 35 additions & 23 deletions packages/desktop-client/src/components/accounts/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -647,14 +647,16 @@ class AccountInternal extends PureComponent<
if (accountId && res?.length > 0) {
this.props.dispatch(
pushModal({
name: 'import-transactions',
options: {
accountId,
filename: res[0],
onImported: (didChange: boolean) => {
if (didChange) {
this.fetchTransactions();
}
modal: {
name: 'import-transactions',
options: {
accountId,
filename: res[0],
onImported: (didChange: boolean) => {
if (didChange) {
this.fetchTransactions();
}
},
},
},
}),
Expand Down Expand Up @@ -817,21 +819,25 @@ class AccountInternal extends PureComponent<
case 'link':
this.props.dispatch(
pushModal({
name: 'add-account',
options: {
upgradingAccountId: accountId,
modal: {
name: 'add-account',
options: {
upgradingAccountId: accountId,
},
},
}),
);
break;
case 'unlink':
this.props.dispatch(
pushModal({
name: 'confirm-unlink-account',
options: {
accountName: account.name,
onUnlink: () => {
this.props.dispatch(unlinkAccount({ id: accountId }));
modal: {
name: 'confirm-unlink-account',
options: {
accountName: account.name,
onUnlink: () => {
this.props.dispatch(unlinkAccount({ id: accountId }));
},
},
},
}),
Expand Down Expand Up @@ -1227,12 +1233,14 @@ class AccountInternal extends PureComponent<
if (transactions.length > 0) {
this.props.dispatch(
pushModal({
name: 'confirm-transaction-edit',
options: {
onConfirm: () => {
onConfirm(ids);
modal: {
name: 'confirm-transaction-edit',
options: {
onConfirm: () => {
onConfirm(ids);
},
confirmReason,
},
confirmReason,
},
}),
);
Expand Down Expand Up @@ -1330,7 +1338,9 @@ class AccountInternal extends PureComponent<
],
} satisfies NewRuleEntity;

this.props.dispatch(pushModal({ name: 'edit-rule', options: { rule } }));
this.props.dispatch(
pushModal({ modal: { name: 'edit-rule', options: { rule } } }),
);
};

onSetTransfer = async (ids: string[]) => {
Expand Down Expand Up @@ -1862,7 +1872,9 @@ class AccountInternal extends PureComponent<
<EmptyMessage
onAdd={() =>
this.props.dispatch(
replaceModal({ name: 'add-account', options: {} }),
replaceModal({
modal: { name: 'add-account', options: {} },
}),
)
}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -284,9 +284,11 @@ function LockToggle({ style, onToggleSave }: LockToggleProps) {
onPress={() =>
dispatch(
pushModal({
name: 'transfer-ownership',
options: {
onSave: () => onToggleSave(),
modal: {
name: 'transfer-ownership',
options: {
onSave: () => onToggleSave(),
},
},
}),
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,12 +191,14 @@ function UserDirectoryContent({
user => {
dispatch(
pushModal({
name: 'edit-user',
options: {
user,
onSave: async () => {
await loadUsers();
setLoading(false);
modal: {
name: 'edit-user',
options: {
user,
onSave: async () => {
await loadUsers();
setLoading(false);
},
},
},
}),
Expand All @@ -215,12 +217,14 @@ function UserDirectoryContent({

dispatch(
pushModal({
name: 'edit-user',
options: {
user,
onSave: async () => {
await loadUsers();
setLoading(false);
modal: {
name: 'edit-user',
options: {
user,
onSave: async () => {
await loadUsers();
setLoading(false);
},
},
},
}),
Expand Down
30 changes: 18 additions & 12 deletions packages/desktop-client/src/components/budget/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -223,13 +223,17 @@ function BudgetInner(props: BudgetInnerProps) {
if (mustTransfer) {
dispatch(
pushModal({
name: 'confirm-category-delete',
options: {
category: id,
onDelete: transferCategory => {
if (id !== transferCategory) {
dispatch(deleteCategory({ id, transferId: transferCategory }));
}
modal: {
name: 'confirm-category-delete',
options: {
category: id,
onDelete: transferCategory => {
if (id !== transferCategory) {
dispatch(
deleteCategory({ id, transferId: transferCategory }),
);
}
},
},
},
}),
Expand Down Expand Up @@ -261,11 +265,13 @@ function BudgetInner(props: BudgetInnerProps) {
if (mustTransfer) {
dispatch(
pushModal({
name: 'confirm-category-delete',
options: {
group: id,
onDelete: transferCategory => {
dispatch(deleteGroup({ id, transferId: transferCategory }));
modal: {
name: 'confirm-category-delete',
options: {
group: id,
onDelete: transferCategory => {
dispatch(deleteGroup({ id, transferId: transferCategory }));
},
},
},
}),
Expand Down
16 changes: 11 additions & 5 deletions packages/desktop-client/src/components/manager/BudgetList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,9 @@ export function BudgetList({ showHeader = true, quickSwitchMode = false }) {
<BudgetListHeader
quickSwitchMode={quickSwitchMode}
onRefresh={refresh}
onOpenSettings={() => dispatch(pushModal({ name: 'files-settings' }))}
onOpenSettings={() =>
dispatch(pushModal({ modal: { name: 'files-settings' } }))
}
/>
)}
<BudgetFiles
Expand All @@ -599,14 +601,18 @@ export function BudgetList({ showHeader = true, quickSwitchMode = false }) {
quickSwitchMode={quickSwitchMode}
onSelect={onSelect}
onDelete={(file: File) =>
dispatch(pushModal({ name: 'delete-budget', options: { file } }))
dispatch(
pushModal({ modal: { name: 'delete-budget', options: { file } } }),
)
}
onDuplicate={(file: File) => {
if (file && 'id' in file) {
dispatch(
pushModal({
name: 'duplicate-budget',
options: { file, managePage: true },
modal: {
name: 'duplicate-budget',
options: { file, managePage: true },
},
}),
);
} else {
Expand Down Expand Up @@ -634,7 +640,7 @@ export function BudgetList({ showHeader = true, quickSwitchMode = false }) {
color: theme.pageTextLight,
}}
onPress={() => {
dispatch(pushModal({ name: 'import' }));
dispatch(pushModal({ modal: { name: 'import' } }));
}}
>
<Trans>Import file</Trans>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,9 @@ export function WelcomeScreen() {
flexShrink: 0,
}}
>
<Button onPress={() => dispatch(pushModal({ name: 'import' }))}>
<Button
onPress={() => dispatch(pushModal({ modal: { name: 'import' } }))}
>
{t('Import my budget')}
</Button>
<View
Expand Down
Loading

0 comments on commit 582138a

Please sign in to comment.