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

Created Add Split Button #4536

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

tempiz
Copy link

@tempiz tempiz commented Mar 4, 2025

On the desktop client, a user can split a transaction an endless amount of times. On mobile, it is hard coded to a single split. This change creates an add split button below split transaction boxes on mobile to allow for additional splits.

Edit: I was informed infact it is possible to add endless amounts of splits on mobile by using the "Remaining" button at the bottom. This may not be intuitive for new users like myself. This PR adds an "Add Split" button below the split transaction elements on the page for a clear intuitive way to add more splits.

I am open to feedback on this, or closing if other reviewers feel the current implementation is sufficient.

@actual-github-bot actual-github-bot bot changed the title Created Add Split Button [WIP] Created Add Split Button Mar 4, 2025
Copy link

netlify bot commented Mar 4, 2025

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit c95621d
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/67c91e1b74c3cb000807fac5
😎 Deploy Preview https://deploy-preview-4536.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.

@youngcw
Copy link
Member

youngcw commented Mar 4, 2025

There is already a button to add a split. The the one that says how much is left

Copy link
Contributor

github-actions bot commented Mar 4, 2025

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
18 8.1 MB → 8.1 MB (+1.06 kB) +0.01%
Changeset
File Δ Size
node_modules/clsx/dist/clsx.mjs 🆕 +368 B 0 B → 368 B
node_modules/clsx/dist/clsx.mjs?commonjs-proxy 🆕 +64 B 0 B → 64 B
src/components/mobile/transactions/TransactionEdit.jsx 📈 +1.16 kB (+3.31%) 34.89 kB → 36.04 kB
node_modules/react-grid-layout/build/components/WidthProvider.js 📈 +1 B (+0.02%) 5.22 kB → 5.22 kB
node_modules/react-grid-layout/build/GridItem.js 📈 +1 B (+0.00%) 21.49 kB → 21.49 kB
node_modules/react-grid-layout/build/ReactGridLayout.js 📈 +1 B (+0.00%) 24.96 kB → 24.96 kB
node_modules/clsx/dist/clsx.js 🔥 -509 B (-100%) 509 B → 0 B
node_modules/clsx/dist/clsx.js?commonjs-module 🔥 -27 B (-100%) 27 B → 0 B
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 5.35 MB → 5.35 MB (+1016 B) +0.02%
static/js/ReportRouter.js 1.59 MB → 1.59 MB (+67 B) +0.00%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/en.js 106.5 kB 0%
static/js/es.js 58.26 kB 0%
static/js/en-GB.js 96.66 kB 0%
static/js/de.js 115.52 kB 0%
static/js/fr.js 116.49 kB 0%
static/js/AppliedFilters.js 10.87 kB 0%
static/js/useAccountPreviewTransactions.js 1.69 kB 0%
static/js/pt-BR.js 110.52 kB 0%
static/js/nl.js 103.3 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/workbox-window.prod.es5.js 5.69 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/uk.js 111.06 kB 0%
static/js/narrow.js 88.98 kB 0%
static/js/wide.js 103.22 kB 0%

Copy link
Contributor

github-actions bot commented Mar 4, 2025

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.83 MB 0%

Changeset

No files were changed

View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

No assets were bigger

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
kcab.worker.js 1.83 MB 0%

@tempiz
Copy link
Author

tempiz commented Mar 4, 2025

There is already a button to add a split. The the one that says how much is left

I may not have explained this right, or im just blind. The goal here is to allow the user to split more than twice. So splitting a transaction three or four ways instead of just splitting twice. On desktop there is an add split button that allows splitting between more than two categories on one transaction. Unless I am blind on mobile, which is possibe lol.

@youngcw
Copy link
Member

youngcw commented Mar 4, 2025

You can add more than two ways. The button at the bottom adds more split lines

@tempiz
Copy link
Author

tempiz commented Mar 4, 2025

You can add more than two ways. The button at the bottom adds more split lines

Ahhh I see now. I was clicking it while I didn't assign both other boxes. Sorry for wasting your time!

@youngcw
Copy link
Member

youngcw commented Mar 4, 2025

Feel free to try to make that process easier/more intuitive

@tempiz
Copy link
Author

tempiz commented Mar 4, 2025

Feel free to try to make that process easier/more intuitive

My PR here simply adds an additional "Add Split" button below the latest split element. I could see it being advantageous to leave the functionality of the "Remaining" button's ability to split, as well as the addition of this new button. It would still allow the work flow of users who are accustomed to the current method, while new users like myself may find it more obvious with a separate button.

Open to your thoughts.

@tempiz tempiz changed the title [WIP] Created Add Split Button Created Add Split Button Mar 4, 2025
Copy link
Contributor

coderabbitai bot commented Mar 4, 2025

Walkthrough

The pull request introduces a new conditional rendering block within the TransactionEditInner component that displays an "Add Split" button when there are child transactions (childTransactions.length > 0). When clicked, this button invokes the onAddSplit function, passing the current transaction's ID as an argument. The button is styled to match existing UI elements and is disabled when the editingField state is active, ensuring no interaction during editing. Previously, only a "Split" button was shown when no child transactions were present. No changes have been made to the declarations of exported or public entities.

Suggested labels

:sparkles: Merged

Suggested reviewers

  • matt-fidd
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @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 generate docstrings to generate docstrings for this 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 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 for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🧹 Nitpick comments (2)
packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx (2)

175-186: Consider adding visual distinction between the "Add Split" and "Remaining" buttons

While the new "Add Split" button works well with the existing "Remaining" button in the footer, users might be confused by having two ways to add splits. Both buttons use the same SvgSplit icon but serve different purposes.

Consider differentiating these buttons visually so users can more easily understand their different functions:

  • The footer "Remaining" button helps balance splits with incorrect amounts
  • The new "Add Split" button is purely for adding new split lines

You could use a different icon (perhaps SvgAdd) for the "Add Split" button, or add a subtle visual difference in styling.

-              <SvgSplit
-                width={17}
-                height={17}
-                style={{ color: theme.formLabelText }}
-              />
+              <SvgAdd
+                width={17}
+                height={17}
+                style={{ color: theme.formLabelText }}
+              />

971-972: Use a more descriptive label for the Add Split button

The current label "Add Split" is clear, but you might consider making it even more explicit for new users.

-                {t('Add Split')}
+                {t('Add Split Line')}

This small change would make it even clearer to users that clicking this button adds another split line to further divide the transaction.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between a2fc6bd and fe6817d.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/4536.md is excluded by !**/*.md
📒 Files selected for processing (1)
  • packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx (1 hunks)
🔇 Additional comments (4)
packages/desktop-client/src/components/mobile/transactions/TransactionEdit.jsx (4)

944-975: Good addition of the "Add Split" button

This new conditional rendering block adds the "Add Split" button when child transactions exist, improving usability for mobile users. The implementation is consistent with the existing UI/UX patterns.

The button:

  • Only appears when there are child transactions (smart conditional rendering)
  • Is properly disabled during active editing (matches other button behavior)
  • Uses the same styling and icon as the "Split" button for consistency
  • Is well-positioned below the split transaction boxes for intuitive access
  • Correctly calls the onAddSplit function with the transaction id

This change successfully addresses the PR objectives to make splitting transactions into multiple categories more intuitive for mobile users, similar to desktop functionality.


1276-1282: The onAddSplit implementation is correct

The function correctly modifies the transactions array by adding a new split transaction. It follows the established pattern of returning changes and updating the state.


163-170: LGTM: Footer component properly receives the onAddSplit prop

The Footer component correctly receives the onAddSplit prop, which is then used in the onClickRemainingSplit function and passed to the new "Add Split" button.


804-814: LGTM: The Footer component is properly called with all required props

The Footer component is correctly instantiated with all necessary props, including the onAddSplit function that's needed for the new button functionality.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants