actualbudget / actual

A local-first personal finance app
https://actualbudget.org
MIT License
15.62k stars 1.21k forks source link

Undoable auto transfer notes + auto notes for cover #3411

Closed joel-jeremy closed 2 months ago

joel-jeremy commented 2 months ago

Resolves https://github.com/actualbudget/actual/issues/3404

netlify[bot] commented 2 months ago

Deploy Preview for actualbudget ready!

Name Link
Latest commit 7a7c74a9354ef551d09b3eef8381031100f2bba7
Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/66ea641b949c7600082b3a8d
Deploy Preview https://deploy-preview-3411.demo.actualbudget.org
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

github-actions[bot] commented 2 months ago

Bundle Stats β€” desktop-client

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
9 5.18 MB β†’ 5.18 MB (-4.3 kB) -0.08%
Changeset File | Ξ” | Size ---- | - | ---- `src/components/budget/util.ts` | πŸ“ˆ +386 B (+12.31%) | 3.06 kB β†’ 3.44 kB `src/components/budget/rollover/TransferMenu.tsx` | πŸ“ˆ +235 B (+9.47%) | 2.42 kB β†’ 2.65 kB `src/components/modals/TransferModal.tsx` | πŸ“ˆ +151 B (+3.92%) | 3.76 kB β†’ 3.91 kB `src/components/Modals.tsx` | πŸ“ˆ +46 B (+0.30%) | 14.93 kB β†’ 14.98 kB `src/components/mobile/budget/BudgetTable.jsx` | πŸ“ˆ +33 B (+0.06%) | 52.14 kB β†’ 52.17 kB `home/runner/work/actual/actual/packages/loot-core/src/shared/rules.ts` | πŸ“‰ -73 B (-1.10%) | 6.48 kB β†’ 6.41 kB `src/components/modals/EditRuleModal.jsx` | πŸ“‰ -1.67 kB (-4.29%) | 38.94 kB β†’ 37.27 kB `src/components/settings/Experimental.tsx` | πŸ“‰ -233 B (-4.80%) | 4.74 kB β†’ 4.51 kB `src/hooks/useFeatureFlag.ts` | πŸ“‰ -27 B (-7.28%) | 371 B β†’ 344 B `src/components/rules/ActionExpression.tsx` | πŸ“‰ -375 B (-9.12%) | 4.01 kB β†’ 3.65 kB `src/components/budget/rollover/CoverMenu.tsx` | πŸ“‰ -227 B (-10.41%) | 2.13 kB β†’ 1.91 kB `src/components/modals/CoverModal.tsx` | πŸ“‰ -327 B (-10.42%) | 3.06 kB β†’ 2.74 kB `src/components/budget/rollover/BalanceMovementMenu.tsx` | πŸ“‰ -1.41 kB (-50.24%) | 2.81 kB β†’ 1.4 kB `src/icons/v1/Code.tsx` | πŸ”₯ -448 B (-100%) | 448 B β†’ 0 B `src/icons/v1/AlignLeft.tsx` | πŸ”₯ -387 B (-100%) | 387 B β†’ 0 B
View detailed bundle breakdown
**Added** No assets were added **Removed** No assets were removed **Bigger** Asset | File Size | % Changed ----- | --------- | --------- static/js/narrow.js | 80.62 kB β†’ 80.65 kB (+33 B) | +0.04% **Smaller** Asset | File Size | % Changed ----- | --------- | --------- static/js/index.js | 3.21 MB β†’ 3.2 MB (-4.33 kB) | -0.13% **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- static/js/resize-observer.js | 18.37 kB | 0% static/js/indexeddb-main-thread-worker-e59fee74.js | 13.5 kB | 0% static/js/BackgroundImage.js | 122.29 kB | 0% static/js/usePreviewTransactions.js | 1.59 kB | 0% static/js/AppliedFilters.js | 20.97 kB | 0% static/js/wide.js | 225.21 kB | 0% static/js/ReportRouter.js | 1.5 MB | 0%
github-actions[bot] commented 2 months ago

Bundle Stats β€” loot-core

Hey there, this message comes from a GitHub action that helps you and reviewers to understand how these changes affect the size of this project's bundle.

As this PR is updated, I'll keep you updated on how the bundle size is impacted.

Total

Files count Total bundle size % Changed
1 1.26 MB β†’ 1.19 MB (-73.57 kB) -5.69%
Changeset File | Ξ” | Size ---- | - | ---- `packages/loot-core/src/server/budget/actions.ts` | πŸ“ˆ +1.73 kB (+16.86%) | 10.28 kB β†’ 12.01 kB `packages/loot-core/src/server/notes/app.ts` | πŸ“ˆ +31 B (+14.49%) | 214 B β†’ 245 B `packages/loot-core/src/server/db/index.ts` | πŸ“ˆ +659 B (+3.48%) | 18.49 kB β†’ 19.13 kB `packages/loot-core/src/shared/rules.ts` | πŸ“‰ -83 B (-0.92%) | 8.8 kB β†’ 8.72 kB `packages/loot-core/src/server/accounts/rules.ts` | πŸ“‰ -2.85 kB (-8.45%) | 33.74 kB β†’ 30.88 kB `node_modules/handlebars/dist/cjs/handlebars/compiler/parser.js` | πŸ”₯ -200.84 kB (-100%) | 200.84 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/compiler/javascript-compiler.js` | πŸ”₯ -118.53 kB (-100%) | 118.53 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/compiler/compiler.js` | πŸ”₯ -56.75 kB (-100%) | 56.75 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/runtime.js` | πŸ”₯ -43.72 kB (-100%) | 43.72 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/compiler/whitespace-control.js` | πŸ”₯ -22.62 kB (-100%) | 22.62 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/compiler/helpers.js` | πŸ”₯ -18.76 kB (-100%) | 18.76 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/compiler/code-gen.js` | πŸ”₯ -15.51 kB (-100%) | 15.51 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/compiler/visitor.js` | πŸ”₯ -12.33 kB (-100%) | 12.33 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/utils.js` | πŸ”₯ -10.07 kB (-100%) | 10.07 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/helpers/each.js` | πŸ”₯ -9.64 kB (-100%) | 9.64 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/base.js` | πŸ”₯ -9.41 kB (-100%) | 9.41 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/internal/proto-access.js` | πŸ”₯ -8.29 kB (-100%) | 8.29 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/exception.js` | πŸ”₯ -5.81 kB (-100%) | 5.81 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars.js` | πŸ”₯ -4.79 kB (-100%) | 4.79 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars.runtime.js` | πŸ”₯ -4.5 kB (-100%) | 4.5 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/helpers/if.js` | πŸ”₯ -4.35 kB (-100%) | 4.35 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/compiler/base.js` | πŸ”₯ -3.83 kB (-100%) | 3.83 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/helpers.js` | πŸ”₯ -3.82 kB (-100%) | 3.82 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/logger.js` | πŸ”₯ -3.79 kB (-100%) | 3.79 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/helpers/block-helper-missing.js` | πŸ”₯ -3.74 kB (-100%) | 3.74 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/helpers/with.js` | πŸ”₯ -3.67 kB (-100%) | 3.67 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/compiler/ast.js` | πŸ”₯ -3.34 kB (-100%) | 3.34 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/decorators/inline.js` | πŸ”₯ -2.63 kB (-100%) | 2.63 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/helpers/log.js` | πŸ”₯ -2.45 kB (-100%) | 2.45 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/no-conflict.js` | πŸ”₯ -2.45 kB (-100%) | 2.45 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/internal/wrapHelper.js` | πŸ”₯ -2.14 kB (-100%) | 2.14 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/helpers/helper-missing.js` | πŸ”₯ -1.97 kB (-100%) | 1.97 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/internal/create-new-lookup-object.js` | πŸ”₯ -1.74 kB (-100%) | 1.74 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/helpers/lookup.js` | πŸ”₯ -1.21 kB (-100%) | 1.21 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/safe-string.js` | πŸ”₯ -1.14 kB (-100%) | 1.14 kB β†’ 0 B `node_modules/handlebars/dist/cjs/handlebars/decorators.js` | πŸ”₯ -1000 B (-100%) | 1000 B β†’ 0 B
View detailed bundle breakdown
**Added** No assets were added **Removed** No assets were removed **Bigger** No assets were bigger **Smaller** Asset | File Size | % Changed ----- | --------- | --------- kcab.worker.js | 1.26 MB β†’ 1.19 MB (-73.57 kB) | -5.69% **Unchanged** No assets were unchanged
youngcw commented 2 months ago

Seems to work well. @Teprifer do you see anything else that needs fixed here?

Teprifer commented 2 months ago

Seems to work well. @Teprifer do you see anything else that needs fixed here?

I feel bad not picking up on it before. :(

There's something a bit weird with the undo, it needs to be done twice if the note is viewed, this isn't the case in a few days old edge.

To reproduce:

  1. Do a transfer
  2. Click to check note
  3. Click outside to dismiss note
  4. ctrl+z (nothing happens)
  5. ctrl+z again (action is undone)

This stacks:

  1. Do a transfer
  2. Click to check note
  3. Click outside to dismiss note
  4. Do a transfer
  5. Click to check note
  6. Click outside to dismiss note
  7. ctrl+z (nothing happens)
  8. ctrl+z again (second action is undone)
  9. ctrl+z (nothing happens)
  10. ctrl+z again (first action is undone)

If not clicking the note in between, then only one ctrl+z is required.

  1. Do a transfer
  2. ctrl+z (action is undone)

Fairly minor overall, but could be come across as ctrl+z not working in niche cases?

Teprifer commented 2 months ago

Cheers for fixing the ctrl+z.

I, uh, mis-clicked when testing and found a difference in transfer behaviour to Edge:

In Edge if you click a category to assign the funds to another category and select the source category as the destination category nothing happens. In this PR it'll allocate the transfer value again to that category, pulling from To Budget (obviously).

This PR: image

Transfer food to food: image

Result: image

joel-jeremy commented 2 months ago

Cheers for fixing the ctrl+z.

I, uh, mis-clicked when testing and found a difference in transfer behaviour to Edge:

In Edge if you click a category to assign the funds to another category and select the source category as the destination category nothing happens. In this PR it'll allocate the transfer value again to that category, pulling from To Budget (obviously).

This PR: image

Transfer food to food: image

Result: image

Nice catch! I've hidden the source category in the transfer menu and cover menus.

Teprifer commented 2 months ago

@joel-jeremy Has that change been pushed to github? Or has the netlify build not updated? The source category is still showing for me.

Food (transfer) image

I checked cover too, but trying to cover a negative with itself doesn't result in any note or change in budget, so this menu option is as expected. Clothing (cover) image

joel-jeremy commented 2 months ago

@joel-jeremy Has that change been pushed to github? Or has the netlify build not updated? The source category is still showing for me.

Food (transfer) image

I checked cover too, but trying to cover a negative with itself doesn't result in any note or change in budget, so this menu option is as expected. Clothing (cover) image

Thank you for the testing it out! Sorry, I missed an if condition on the new utility method. Should be fixed now.

Teprifer commented 2 months ago

All good, familiar with the "oh that one other bit". Checks out functionality wise so should be good for a code review I think?

coderabbitai[bot] commented 2 months ago

Walkthrough

The changes in this pull request primarily focus on enhancing the handling of category management within various components of the application. Key modifications include the introduction of a new categoryId prop in several modals and menus, the removal of outdated props, and the refactoring of logic to improve clarity and maintainability. Additionally, new utility functions have been added to facilitate category filtering, and changes have been made to ensure budget movements are logged effectively.

Changes

Files Change Summary
packages/desktop-client/src/components/Modals.tsx Added categoryId prop to TransferModal and CoverModal, removed category from CoverModal.
packages/desktop-client/src/components/budget/rollover/BalanceMovementMenu.tsx Removed useBudgetTransferNotes hook, simplifying budget transfer note management.
packages/desktop-client/src/components/budget/rollover/CoverMenu.tsx Introduced removeCategoriesFromGroups utility function, renamed category to categoryId, and adjusted state management for clarity.
packages/desktop-client/src/components/budget/rollover/TransferMenu.tsx Added categoryId prop, refined category filtering logic, and updated state management for category selection.
packages/desktop-client/src/components/budget/util.ts Added removeCategoriesFromGroups function for dynamic category management.
packages/desktop-client/src/components/mobile/budget/BudgetTable.jsx Updated modal invocation parameters from category to categoryId for clarity.
packages/desktop-client/src/components/modals/CoverModal.tsx Updated CoverModalProps to include categoryId, simplified category filtering logic.
packages/desktop-client/src/components/modals/TransferModal.tsx Added categoryId prop, refined category filtering logic for transfers.
packages/loot-core/src/client/state-types/modals.d.ts Added optional categoryId properties to transfer and cover modal types.
packages/loot-core/src/server/budget/actions.ts Introduced addMovementNotes function for logging budget movements.
packages/loot-core/src/server/db/index.ts Modified getCategories and getCategoriesGrouped functions to include optional filtering by IDs. Added toSqlQueryParameters utility function.
packages/loot-core/src/server/notes/app.ts Refactored notes-save method to use a new updateNotes function for better maintainability.
upcoming-release-notes/3411.md Introduced functionality for "undoable auto transfer notes" and "auto notes for cover."

Assessment against linked issues

Objective Addressed Explanation
Bug: Money moves tracking isn't undone on ctrl+z (Issue #3404) ❌ The changes do not address the issue of notes remaining after an undo operation.

Possibly related PRs

Suggested labels

merged, enhancement

Suggested reviewers

Poem

πŸ‡ In the garden where numbers play,
New props and functions lead the way.
With categoryId shining bright,
Budgeting's clearer, what a delight!
So hop along, let changes flow,
In this realm of finance, let’s grow! 🌼


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share - [X](https://twitter.com/intent/tweet?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A&url=https%3A//coderabbit.ai) - [Mastodon](https://mastodon.social/share?text=I%20just%20used%20%40coderabbitai%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20the%20proprietary%20code.%20Check%20it%20out%3A%20https%3A%2F%2Fcoderabbit.ai) - [Reddit](https://www.reddit.com/submit?title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&text=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code.%20Check%20it%20out%3A%20https%3A//coderabbit.ai) - [LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fcoderabbit.ai&mini=true&title=Great%20tool%20for%20code%20review%20-%20CodeRabbit&summary=I%20just%20used%20CodeRabbit%20for%20my%20code%20review%2C%20and%20it%27s%20fantastic%21%20It%27s%20free%20for%20OSS%20and%20offers%20a%20free%20trial%20for%20proprietary%20code)
Tips ### Chat There are 3 ways to chat with [CodeRabbit](https://coderabbit.ai): - Review comments: Directly reply to a review comment made by CodeRabbit. Example: -- `I pushed a fix in commit , please review it.` -- `Generate unit testing code for this file.` - `Open a follow-up GitHub issue for this discussion.` - Files and specific lines of code (under the "Files changed" tab): Tag `@coderabbitai` in a new review comment at the desired location with your query. Examples: -- `@coderabbitai generate unit testing code for this file.` -- `@coderabbitai modularize this function.` - PR comments: Tag `@coderabbitai` in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples: -- `@coderabbitai generate interesting stats about this repository and render them as a table.` -- `@coderabbitai read src/utils.ts and generate unit testing code.` -- `@coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.` -- `@coderabbitai help me debug CodeRabbit configuration file.` Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. ### CodeRabbit Commands (Invoked using PR comments) - `@coderabbitai pause` to pause the reviews on a PR. - `@coderabbitai resume` to resume the paused reviews. - `@coderabbitai review` to trigger an incremental review. This is useful when automatic reviews are disabled for the repository. - `@coderabbitai full review` to do a full review from scratch and review all the files again. - `@coderabbitai summary` to regenerate the summary of the PR. - `@coderabbitai resolve` resolve all the CodeRabbit review comments. - `@coderabbitai configuration` to show the current CodeRabbit configuration for the repository. - `@coderabbitai help` to get help. ### Other keywords and placeholders - Add `@coderabbitai ignore` anywhere in the PR description to prevent this PR from being reviewed. - Add `@coderabbitai summary` to generate the high-level summary at a specific location in the PR description. - Add `@coderabbitai` anywhere in the PR title to generate the title automatically. ### CodeRabbit Configuration File (`.coderabbit.yaml`) - You can programmatically configure CodeRabbit by adding a `.coderabbit.yaml` file to the root of your repository. - Please see the [configuration documentation](https://docs.coderabbit.ai/guides/configure-coderabbit) for more information. - If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: `# yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json` ### Documentation and Community - Visit our [Documentation](https://coderabbit.ai/docs) for detailed information on how to use CodeRabbit. - Join our [Discord Community](https://discord.com/invite/GsXnASn26c) to get help, request features, and share feedback. - Follow us on [X/Twitter](https://twitter.com/coderabbitai) for updates and announcements.
joel-jeremy commented 2 months ago

All good, familiar with the "oh that one other bit". Checks out functionality wise so should be good for a code review I think?

Had to rebase to resolve a conflict. Should be good for code review :)

Teprifer commented 2 months ago

All good, familiar with the "oh that one other bit". Checks out functionality wise so should be good for a code review I think?

Had to rebase to resolve a conflict. Should be good for code review :)

Haha, well, I'm sure a code review would've picked that up - I was more indicating to others as you don't want me pretending I can code review. :)