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: reconcile on context menu #4252

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

Conversation

UnderKoen
Copy link
Member

@UnderKoen UnderKoen commented Jan 28, 2025

image

@actual-github-bot actual-github-bot bot changed the title feat: reconcile on context menu [WIP] feat: reconcile on context menu Jan 28, 2025
Copy link
Contributor

github-actions bot commented Jan 28, 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
15 6.7 MB → 6.71 MB (+1.89 kB) +0.03%
Changeset
File Δ Size
src/components/sidebar/Account.tsx 📈 +1.65 kB (+21.41%) 7.72 kB → 9.37 kB
src/components/accounts/Account.tsx 📈 +242 B (+0.51%) 46.45 kB → 46.68 kB
View detailed bundle breakdown

Added

No assets were added

Removed

No assets were removed

Bigger

Asset File Size % Changed
static/js/index.js 4.29 MB → 4.29 MB (+1.65 kB) +0.04%
static/js/wide.js 102.8 kB → 103.04 kB (+242 B) +0.23%

Smaller

No assets were smaller

Unchanged

Asset File Size % Changed
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/BackgroundImage.js 122.29 kB 0%
static/js/en-GB.js 93.42 kB 0%
static/js/pt-BR.js 103.29 kB 0%
static/js/uk.js 111.11 kB 0%
static/js/nl.js 79.76 kB 0%
static/js/en.js 99.34 kB 0%
static/js/narrow.js 84.94 kB 0%
static/js/useAccountPreviewTransactions.js 1.69 kB 0%
static/js/AppliedFilters.js 10.52 kB 0%
static/js/ReportRouter.js 1.59 MB 0%

Copy link
Contributor

github-actions bot commented Jan 28, 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.33 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.33 MB 0%

Copy link

netlify bot commented Jan 28, 2025

Deploy Preview for actualbudget ready!

Name Link
🔨 Latest commit 478840b
🔍 Latest deploy log https://app.netlify.com/sites/actualbudget/deploys/67994569b7e7c500084693dd
😎 Deploy Preview https://deploy-preview-4252.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.

@UnderKoen UnderKoen changed the title [WIP] feat: reconcile on context menu feat: reconcile on context menu Jan 28, 2025
Copy link
Contributor

coderabbitai bot commented Jan 28, 2025

Walkthrough

The pull request introduces changes to two files in the desktop-client package: Account.tsx in both the accounts and sidebar components. In the accounts/Account.tsx, modifications focus on adding a reconcileAmount property to the AccountInternal class, allowing dynamic handling of reconciliation amounts through props and state management. The sidebar/Account.tsx file undergoes more extensive changes, including internationalization support, enhanced state management for editing account name and balance, and improved user interaction capabilities. These changes aim to provide more flexible and user-friendly account management functionality.

Possibly related PRs

Suggested labels

sparkles:Merged

Suggested reviewers

  • youngcw
  • matt-fidd

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. (Beta)
  • @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: 1

🧹 Nitpick comments (3)
packages/desktop-client/src/components/sidebar/Account.tsx (1)

Line range hint 198-224: Consider enhancing error feedback for name editing.

While the implementation handles validation correctly, it would be beneficial to provide visual feedback to users when validation fails.

Consider adding error state handling:

 <InitialFocus>
   <Input
     style={{
       padding: 0,
       width: '100%',
+      borderColor: nameError ? theme.errorText : undefined,
     }}
     onBlur={() => setIsEditingName(false)}
     onEnter={e => {
       const inputEl = e.target as HTMLInputElement;
       const newAccountName = inputEl.value;
       if (newAccountName.trim() !== '') {
         dispatch(
           updateAccount({
             account: {
               ...account,
               name: newAccountName,
             },
           }),
         );
       }
       setIsEditingName(false);
     }}
     onEscape={() => setIsEditingName(false)}
     defaultValue={name}
   />
+  {nameError && (
+    <Text style={{ color: theme.errorText, fontSize: 12 }}>
+      {nameError}
+    </Text>
+  )}
 </InitialFocus>
packages/desktop-client/src/components/accounts/Account.tsx (2)

372-372: Consider adding type annotation for reconcileAmount initialization.

While the initialization is correct, adding a type annotation would improve type safety.

-      reconcileAmount: props.reconcileAmount,
+      reconcileAmount: props.reconcileAmount as number | null,

477-480: Consider simplifying the reconcileAmount update.

The update logic could be more concise by directly updating the state.

-    if (this.props.reconcileAmount !== prevProps.reconcileAmount) {
-      this.setState({ reconcileAmount: this.props.reconcileAmount });
-    }
+    this.props.reconcileAmount !== prevProps.reconcileAmount &&
+      this.setState({ reconcileAmount: this.props.reconcileAmount });
📜 Review details

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

📥 Commits

Reviewing files that changed from the base of the PR and between d1c3b9b and 478840b.

⛔ Files ignored due to path filters (1)
  • upcoming-release-notes/4252.md is excluded by !**/*.md
📒 Files selected for processing (2)
  • packages/desktop-client/src/components/accounts/Account.tsx (4 hunks)
  • packages/desktop-client/src/components/sidebar/Account.tsx (9 hunks)
🧰 Additional context used
📓 Learnings (3)
📓 Common learnings
Learnt from: joel-jeremy
PR: actualbudget/actual#3685
File: packages/desktop-client/src/components/accounts/Account.tsx:655-665
Timestamp: 2024-11-10T16:45:31.225Z
Learning: The Account component in 'packages/desktop-client/src/components/accounts/Account.tsx' is being rewritten in a separate PR.
packages/desktop-client/src/components/accounts/Account.tsx (1)
Learnt from: joel-jeremy
PR: actualbudget/actual#3685
File: packages/desktop-client/src/components/accounts/Account.tsx:655-665
Timestamp: 2024-11-10T16:45:31.225Z
Learning: The Account component in 'packages/desktop-client/src/components/accounts/Account.tsx' is being rewritten in a separate PR.
packages/desktop-client/src/components/sidebar/Account.tsx (1)
Learnt from: joel-jeremy
PR: actualbudget/actual#3685
File: packages/desktop-client/src/components/accounts/Account.tsx:655-665
Timestamp: 2024-11-10T16:45:31.225Z
Learning: The Account component in 'packages/desktop-client/src/components/accounts/Account.tsx' is being rewritten in a separate PR.
⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: build (macos-latest)
  • GitHub Check: build (windows-latest)
  • GitHub Check: build (ubuntu-latest)
  • GitHub Check: Wait for Netlify build to finish
  • GitHub Check: Analyze
🔇 Additional comments (5)
packages/desktop-client/src/components/sidebar/Account.tsx (3)

3-3: LGTM! Well-organized imports and hooks.

The new imports and hooks provide necessary functionality for internationalization, currency handling, and value formatting.

Also applies to: 13-13, 40-41


114-115: LGTM! Clear separation of editing states.

The split between isEditingName and isEditingBalance improves code clarity and maintainability by separating concerns.


292-293: LGTM! Well-implemented menu internationalization.

The menu items are properly internationalized using the translation hook, and the reconcile functionality is well-integrated.

packages/desktop-client/src/components/accounts/Account.tsx (2)

310-310: LGTM! Well-typed reconcileAmount property.

The reconcileAmount property is properly typed with null union type for optional values.


2029-2029: LGTM! Proper props passing with null fallback.

The reconcileAmount prop is correctly passed with a null fallback using the nullish coalescing operator.

@youngcw
Copy link
Member

youngcw commented Jan 28, 2025

The cleared/locked column disappears after reconciling via the context menu.

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