actualbudget / actual

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

[WIP] Make the width of categories column in the budget view customizable #3445

Closed EvidentlyCube closed 1 month ago

EvidentlyCube commented 2 months ago

Background

It's the smallest deal breaker I ever had but after imported my nYNAB budgets I have a lot of categories which names don't fit in the available space on the budget view and in a lot of cases I can't shorten them and keep them meaningful enough for my needs:

image

What I've done

A new "Display" section in configuration - it supports values from 100 to 1024 (arbitrarily selected), gracefully handles incorrect input (resets to original value). image

It should properly handle most UI elements (I've tried to find all the places that hardcoded the old width of 200 px): image

Notes:

Finally, this does go a bit against the design strategy:

The goal of the UI is to be minimalistic [...] We are against adding a button/user setting for every little piece of UI (sizes, paddings, margins, etc.)

But at the same time the default 200 is awfully small, especially with upcoming i18n as many languages are much wider than English.

netlify[bot] commented 2 months ago

Deploy Preview for actualbudget ready!

Name Link
Latest commit 7a5e6f62f6836eaf3e6ef23645c60fb3721e8c8c
Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/66e73adce32129000812e6e5
Deploy Preview https://deploy-preview-3445.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.17 MB → 5.17 MB (+1.98 kB) +0.04%
Changeset File | Δ | Size ---- | - | ---- `src/components/settings/Display.tsx` | 🆕 +1.82 kB | 0 B → 1.82 kB `src/components/settings/UI.tsx` | 📈 +539 B (+29.47%) | 1.79 kB → 2.31 kB `src/components/budget/BudgetPageHeader.tsx` | 📈 +74 B (+10.69%) | 692 B → 766 B `src/components/budget/DynamicBudgetTable.tsx` | 📈 +84 B (+2.85%) | 2.88 kB → 2.96 kB `src/components/budget/rollover/budgetsummary/ToBudget.tsx` | 📈 +74 B (+2.72%) | 2.65 kB → 2.73 kB `src/components/budget/BudgetTotals.tsx` | 📈 +84 B (+2.60%) | 3.16 kB → 3.24 kB `src/components/budget/SidebarCategory.tsx` | 📈 +84 B (+1.66%) | 4.95 kB → 5.03 kB `src/components/budget/SidebarGroup.tsx` | 📈 +84 B (+1.46%) | 5.63 kB → 5.72 kB `src/components/budget/BudgetTable.jsx` | 📈 +74 B (+1.20%) | 6.01 kB → 6.08 kB `src/components/settings/index.tsx` | 📈 +68 B (+1.09%) | 6.1 kB → 6.17 kB `src/components/budget/rollover/RolloverComponents.tsx` | 📈 +84 B (+0.60%) | 13.76 kB → 13.84 kB `src/components/settings/Format.tsx` | 📉 -547 B (-11.87%) | 4.5 kB → 3.96 kB `src/components/settings/Themes.tsx` | 📉 -539 B (-23.04%) | 2.28 kB → 1.76 kB
View detailed bundle breakdown
**Added** No assets were added **Removed** No assets were removed **Bigger** Asset | File Size | % Changed ----- | --------- | --------- static/js/index.js | 3.2 MB → 3.2 MB (+1.51 kB) | +0.05% static/js/wide.js | 225.15 kB → 225.63 kB (+484 B) | +0.21% **Smaller** No assets were smaller **Unchanged** Asset | File Size | % Changed ----- | --------- | --------- static/js/indexeddb-main-thread-worker-e59fee74.js | 13.5 kB | 0% static/js/resize-observer.js | 18.37 kB | 0% static/js/narrow.js | 78.89 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/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.19 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.19 MB | 0%
EvidentlyCube commented 2 months ago

At the moment two VRT tests are failing.

settings.test.js:29:7 › Settings › checks the page visuals is expected as the settings has a new section in this PR

mobile.test.js:140:7 › Mobile › checks that settings page can be opened I think this one is also caused by a new section being added causing a slight shift in the text:

image

youngcw commented 2 months ago

If the changes are expected then update the snapshots as part of the PR

EvidentlyCube commented 2 months ago

@youngcw Thanks, I'll see what I can do! I am on Linux and so almost every VRT test fails due to a lot of tiny differences in font rendering, so I'll need to have some fun with getting development env up on my TV PC.

youngcw commented 2 months ago

They get updated in docker for consistency. The package readme shows the process

EvidentlyCube commented 2 months ago

They get updated in docker for consistency. The package readme shows the process

Ugh, I noticed docker and my brain immediately went "nah, I am good". Thanks, updated and checks are passing!

Things I am least confident about:

  1. 200 as the default value is hardcoded everywhere. It's no different from the number being hardcoded in the styles before but I am generally not too fond of it, especially that things depend on it being the same.
  2. I feel like there should be a way to force a default value for a local pref but I failed to find anything. It'd save the code from doing = 200 everywhere useLocalPref() happens.
  3. "Should this be in settings or somewhere else" is probably the biggest question. An ideal scenario would most likely be a way to drag the edge of the column and resize it with the mouse but that's not something I am willing to attempt unless I'll know it's something that would be accepted as a solution.

Otherwise I tried to mimic the code as best I could. It's the biggest React codebase I see and it's very intimidating to look at.

jfdoming commented 2 months ago

They get updated in docker for consistency. The package readme shows the process

Ugh, I noticed docker and my brain immediately went "nah, I am good". Thanks, updated and checks are passing!

Things I am least confident about:

  1. 200 as the default value is hardcoded everywhere. It's no different from the number being hardcoded in the styles before but I am generally not too fond of it, especially that things depend on it being the same.
  2. I feel like there should be a way to force a default value for a local pref but I failed to find anything. It'd save the code from doing = 200 everywhere useLocalPref() happens.
  3. "Should this be in settings or somewhere else" is probably the biggest question. An ideal scenario would most likely be a way to drag the edge of the column and resize it with the mouse but that's not something I am willing to attempt unless I'll know it's something that would be accepted as a solution.

Otherwise I tried to mimic the code as best I could. It's the biggest React codebase I see and it's very intimidating to look at.

I do think there's #3309 which might attempt mouse resize as well

EvidentlyCube commented 2 months ago

I do think there's https://github.com/actualbudget/actual/pull/3309 which might attempt mouse resize as well

It does mouse resize indeed. Then there's a reason to get back to this PR once the other one is merged and rewrite it to use mouse instead.

Jonathan-Fang commented 2 months ago

Rewrite using the mouse to drag the edge or the column sounds like a great idea! It can help fill the whitespace on 1920x1080 monitors too.

github-actions[bot] commented 1 month ago

:wave: Hi! It looks like this PR has not had any changes for a week now. Would you like someone to review this PR? If so - please remove the "[WIP]" prefix from the PR title. That will let the community know that this PR is open for a review.

coderabbitai[bot] commented 1 month ago

Walkthrough

The changes introduce a new hook, useLocalPref, across various components in the budget management section of the application. This hook retrieves user-defined preferences for the width of budget categories, replacing hardcoded values with dynamically adjustable widths. Additionally, a new DisplaySettings component is introduced to manage these preferences interactively, allowing users to set and validate their preferred widths.

Changes

File Change Summary
packages/desktop-client/src/components/budget/BudgetPageHeader.tsx, BudgetTable.jsx, BudgetTotals.tsx, DynamicBudgetTable.tsx, SidebarCategory.tsx, SidebarGroup.tsx, rollover/RolloverComponents.tsx, rollover/budgetsummary/ToBudget.tsx Introduced useLocalPref hook to manage categoryWidth, replacing hardcoded values with user-defined preferences.
packages/desktop-client/src/components/settings/Display.tsx Added a new DisplaySettings component for managing and validating category width input.
packages/desktop-client/src/components/settings/Format.tsx, Themes.tsx Removed locally defined Column component and imported it from the UI module.
packages/desktop-client/src/components/settings/UI.tsx Introduced a new Column component for reusable layout.
packages/loot-core/src/types/prefs.d.ts Added a new property 'category.width' to the LocalPrefs type.

Possibly related PRs

Suggested labels

#sparkles: Merged


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?

:heart: 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)
:placard: 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 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 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.
github-actions[bot] commented 1 month ago

:wave: Hi! It looks like this PR has not had any changes for a week now. Would you like someone to review this PR? If so - please remove the "[WIP]" prefix from the PR title. That will let the community know that this PR is open for a review.

github-actions[bot] commented 1 month ago

This PR was closed because it has been stalled for 5 days with no activity.