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

feat: colored negative account balances in sidebar #4681

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

Conversation

tostasmistas
Copy link
Contributor

@tostasmistas tostasmistas commented Mar 23, 2025

This PR resolves #4673.

It adds a setting, that when enabled, colors account balances in the sidebar based on their value: positives balances are displayed in green and negative balances are displayed in red.


Untitled


Without colored account balances With colored account balances With colored account balances
and privacy filter
image image image

Copy link

netlify bot commented Mar 23, 2025

Deploy Preview for actualbudget ready!

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

Copy link
Contributor

github-actions bot commented Mar 23, 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.5 MB → 8.5 MB (+1.67 kB) +0.02%
Changeset
File Δ Size
src/components/sidebar/Account.tsx 📈 +579 B (+7.29%) 7.76 kB → 8.32 kB
locale/de.json 📈 +1.1 kB (+0.91%) 121.27 kB → 122.37 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/de.js 121.27 kB → 122.37 kB (+1.1 kB) +0.91%
static/js/index.js 5.5 MB → 5.5 MB (+579 B) +0.01%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
static/js/en-GB.js 5.37 kB 0%
static/js/es.js 65.71 kB 0%
static/js/nl.js 102.79 kB 0%
static/js/en.js 110.12 kB 0%
static/js/indexeddb-main-thread-worker-e59fee74.js 13.5 kB 0%
static/js/workbox-window.prod.es5.js 5.69 kB 0%
static/js/resize-observer.js 18.37 kB 0%
static/js/fr.js 128.02 kB 0%
static/js/pt-BR.js 120.98 kB 0%
static/js/uk.js 110.59 kB 0%
static/js/BackgroundImage.js 122.29 kB 0%
static/js/AppliedFilters.js 10.87 kB 0%
static/js/wide.js 112.23 kB 0%
static/js/useAccountPreviewTransactions.js 1.69 kB 0%
static/js/narrow.js 383.22 kB 0%
static/js/ReportRouter.js 1.59 MB 0%

Copy link
Contributor

github-actions bot commented Mar 23, 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 2.28 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 2.28 MB 0%

@tostasmistas
Copy link
Contributor Author

/update-vrt

@tostasmistas tostasmistas marked this pull request as ready for review March 23, 2025 23:07
Copy link
Contributor

coderabbitai bot commented Mar 23, 2025

Walkthrough

The pull request updates the account component in the desktop client to enhance the rendering of account balances. The changes include importing a helper function from the budget utility module that determines the full styling for amounts based on theme colors. The CellValue component is modified to utilize a child function that renders a new CellValueText component with conditional styling. In addition, new state variables (coloredAccountBalances and isAccountBalanceColored) are introduced to support conditional color application based on the account’s existence and whether the balance is positive or negative. These modifications adjust the presentation of balance values, enabling visual differentiation, particularly highlighting negative values.

Assessment against linked issues

Objective Addressed Explanation
Color-code accounts with negative balances (#4673)
Provide a checkbox toggle in Settings for the color-coding feature (#4673) No checkbox toggle functionality or settings integration is implemented.

Possibly related PRs

Suggested labels

:sparkles: Merged, :white_check_mark: Approved

Suggested reviewers

  • youngcw

📜 Recent review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between 1d6e5e1 and d0f369b.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/4681.md is excluded by !**/*.md
📒 Files selected for processing (1)
  • packages/desktop-client/src/components/sidebar/Account.tsx (3 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • packages/desktop-client/src/components/sidebar/Account.tsx
⏰ Context from checks skipped due to timeout of 90000ms (4)
  • GitHub Check: Functional
  • GitHub Check: Visual regression
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: build (windows-latest)

🪧 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 plan to trigger planning for file edits and PR creation.
  • @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.

@MatissJanis
Copy link
Member

👋 Heya! Thanks for opening this PR. I'll share my thoughts and then let other maintainers weigh in.

Personally, I do not like having rainbow colors in the side navigation. We try to make Actual
's design simplistic. I believe adding rainbow colors everywhere violates this (i.e. If we are introducing colors here - why not in transaction table? CSV imports? Rules? Filters? Etc.).

But the addition of a new setting would solve this, right? Kind of.. but it violates another principle we have - we do not want to have a long list of settings - one for each and every little ui quirk/edge case that folks might have. Actual has some level of flexibility, but it's not a complete sandbox. Thus - adding a setting for the colors in the side nav is a hard pass.

So what can we do here? My recommendation would be to apply a custom css stylesheet for these colors. There's plenty of browser extensions that allow this.

But I would not be in favour of mainlaining this PR.

@youngcw
Copy link
Member

youngcw commented Mar 24, 2025

Im not a fan of the green, but I would be ok with negative is red since that is already a thing other places.

@tostasmistas
Copy link
Contributor Author

Thanks for the feedback! I understand the concern about maintaining a clean design and avoiding excessive settings. However, I think that highlighting negative balances specifically isn't just a minor UI tweak - it has real value in making it easier to quickly identify accounts with a negative balance, especially when users have a long list of accounts.

Since red is already used elsewhere for negative balances, including the mobile view for the accounts list, applying it in the sidebar maintains consistency rather than introducing something new. Unlike green for positive balances, which I understand could be seen as unnecessary, red for negatives aligns with existing design choices and improves usability.

So we could have something like this:

Desktop Mobile
image image

in the sidebar, color negative account balances in red
@tostasmistas tostasmistas force-pushed the feat/accounts-balance-color branch from 1d6e5e1 to d0f369b Compare March 26, 2025 11:23
@tostasmistas tostasmistas changed the title feat: colored account balances in sidebar feat: colored negative account balances in sidebar Mar 26, 2025
@tostasmistas
Copy link
Contributor Author

/update-vrt

@lelemm
Copy link
Contributor

lelemm commented Mar 26, 2025

I don't mind the red in negatives, but I don't like having the green.
One standing out is enough to differentiate the bad one.
Also, if it's red, I don't like the sign on it. Red without a sign makes it cleaner, like in the summary card: (keep it for colorblind)

image

@tostasmistas
Copy link
Contributor Author

I have updated the PR to remove the setting, and now by default only the negative balances are colored in red.

@MatissJanis
Copy link
Member

Thanks for removing the setting toggle and the green color indicator.

I'm still on the fence about the red color for account balances. Negative balance is not always "bad". For example in the demo budget mortgage is a negative amount. It's not necessarily "bad" and thus in my opinion - should not have a special color highlight. I can see similar cases with other off-budget accounts too.

That being said - only adding the red color highlight is a much less controversial change and I won't stand in the way of merging it if the other maintainers are happy with it.

@youngcw
Copy link
Member

youngcw commented Mar 28, 2025

Occasionally people ask for accounting format numbers. Maybe at some point we could add that in as an option that would leave the numbers all the same color.

@Teprifer
Copy link

Occasionally people ask for accounting format numbers. Maybe at some point we could add that in as an option that would leave the numbers all the same color.

This was my original suggestion when this came up in discord as well.

@MatissJanis
Copy link
Member

@youngcw @Teprifer just so I get this right - are you recommending adding a configurable setting for balance colors? Or is it something else?

For a new setting I have a very strong opinion explained in the comment above.

@youngcw
Copy link
Member

youngcw commented Mar 31, 2025

I was thinking red for negative accounts would be for everyone, then potentially an option to choose if you have standard negative numbers or accounting style negative numbers.

@Teprifer
Copy link

Teprifer commented Apr 1, 2025

@youngcw @Teprifer just so I get this right - are you recommending adding a configurable setting for balance colors? Or is it something else?

For a new setting I have a very strong opinion explained in the comment above.

Something else, either separate, or in addition to. I actually thought we had an existing feature request for this but I couldn't find one, so have now created one: #4721

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.

[Feature] Color-code Accounts with Negative Balances for Easy Identification
5 participants