-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
base: master
Are you sure you want to change the base?
Conversation
UnderKoen
commented
Jan 28, 2025
•
edited
Loading
edited
Bundle Stats — desktop-clientHey 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
Changeset
View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger
Smaller No assets were smaller Unchanged
|
Bundle Stats — loot-coreHey 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
Changeset No files were changed View detailed bundle breakdownAdded No assets were added Removed No assets were removed Bigger No assets were bigger Smaller No assets were smaller Unchanged
|
✅ Deploy Preview for actualbudget ready!
To edit notification comments on pull requests, go to your Netlify site configuration. |
WalkthroughThe pull request introduces changes to two files in the Possibly related PRs
Suggested labels
Suggested reviewers
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? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
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)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this 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
⛔ 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
andisEditingBalance
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.
The cleared/locked column disappears after reconciling via the context menu. |
…-context-menu # Conflicts: # packages/desktop-client/src/components/sidebar/Account.tsx
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 2
♻️ Duplicate comments (1)
packages/desktop-client/src/components/sidebar/Account.tsx (1)
230-257
: 🛠️ Refactor suggestionValidate balance input before reconciliation.
The balance editing implementation should validate the input to ensure it's a valid currency value before conversion.
Add validation to prevent invalid currency inputs:
onEnter={e => { const inputEl = e.target as HTMLInputElement; const newValue = inputEl.value; - if (newValue.trim() !== '') { + const currencyRegex = /^-?\d*\.?\d{0,2}$/; + if (newValue.trim() !== '' && currencyRegex.test(newValue)) { const v = currencyToInteger(newValue); navigate(to, { state: { reconcileAmount: v } }); + } else { + // Show error message to user + console.error('Invalid currency format'); } setIsEditingBalance(false); }}
🧹 Nitpick comments (2)
packages/desktop-client/src/components/sidebar/Account.tsx (1)
293-294
: Add keyboard accessibility for reconciliation.The reconciliation menu item should be accessible via keyboard shortcuts for better usability.
Add keyboard shortcut:
{ name: 'rename', text: t('Rename') }, -{ name: 'reconcile', text: t('Reconcile') }, +{ name: 'reconcile', text: t('Reconcile'), shortcut: 'Ctrl+R' },Also applies to: 285-287
packages/desktop-client/src/components/accounts/Account.tsx (1)
310-310
: Consider making reconcileAmount required.Since reconciliation is a core feature, consider making
reconcileAmount
a required prop by removing the| null
type to ensure it's always provided with a valid value.- reconcileAmount: number | null; + reconcileAmount: number;
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 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/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.
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.
⏰ Context from checks skipped due to timeout of 90000ms (5)
- GitHub Check: build (macos-latest)
- GitHub Check: build (windows-latest)
- GitHub Check: Wait for Netlify build to finish
- GitHub Check: Analyze
- GitHub Check: build (ubuntu-latest)
🔇 Additional comments (2)
packages/desktop-client/src/components/sidebar/Account.tsx (1)
115-116
: Split editing state for better control.Good separation of concerns by splitting the editing state into
isEditingName
andisEditingBalance
. This improves state management by allowing independent control over name and balance editing.packages/desktop-client/src/components/accounts/Account.tsx (1)
1-2041
:❓ Verification inconclusive
Potential merge conflicts ahead.
This component is being rewritten in another PR (#3685). Coordinate with that PR to ensure changes are properly merged and reconciliation functionality is preserved in the rewrite.
🏁 Script executed:
#!/bin/bash # Check for potential conflicts with PR #3685 gh pr diff 3685 | grep -A 5 "packages/desktop-client/src/components/accounts/Account.tsx"Length of output: 611
Potential merge conflicts ahead.
It appears that this component is undergoing a rewrite in PR [#3685]. The recent diff output indicates changes in key areas (e.g. around the schedules query imports) that might not be fully compatible with the current branch. Please coordinate with the team handling the rewrite to ensure that any modifications—especially those related to reconciliation functionality and query handling—are merged correctly without breaking the intended behavior.
I think the number input box for setting the amount is a little tight. Could that be just a bit taller? Would it be possible to not navigate to the account page if the account is already matching the entered balance? Maybe pop up a notification instead of navigating to the account? The default amount for the reconcile should be the cleared total. |
When you click on the account the non cleared amount is showed, would you not expect this to be the number there when entering? |
also adds padding to the name input field to make the consistent
There was a problem hiding this 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 (3)
packages/desktop-client/src/components/sidebar/Account.tsx (3)
118-119
: Add type safety to state variables.Consider adding explicit types to the state variables to improve type safety and documentation.
- const [isEditingName, setIsEditingName] = useState(false); - const [isEditingBalance, setIsEditingBalance] = useState(false); + const [isEditingName, setIsEditingName] = useState<boolean>(false); + const [isEditingBalance, setIsEditingBalance] = useState<boolean>(false);
209-223
: Add input validation for account name.The current implementation only checks if the name is not empty. Consider adding more robust validation.
onEnter={e => { const inputEl = e.target as HTMLInputElement; const newAccountName = inputEl.value; - if (newAccountName.trim() !== '') { + const trimmedName = newAccountName.trim(); + if (trimmedName !== '' && trimmedName.length <= 50) { dispatch( updateAccount({ account: { ...account, - name: newAccountName, + name: trimmedName, }, }), ); + } else { + dispatch( + addNotification({ + type: 'error', + message: 'Account name must be between 1 and 50 characters.', + }), + ); } setIsEditingName(false); }}
236-240
: Improve input field styling for better usability.As per PR feedback, the input field appears tight. Consider adjusting the height for better usability.
style={{ width: '100%', textAlign: 'right', ...styles.tnum, + height: '24px', + padding: '4px 8px', }}
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (1)
packages/desktop-client/src/components/sidebar/Account.tsx
(9 hunks)
🧰 Additional context used
🧠 Learnings (2)
📓 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/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: Visual regression
- GitHub Check: Functional
- GitHub Check: build (windows-latest)
- GitHub Check: build (ubuntu-latest)
- GitHub Check: Analyze
🔇 Additional comments (2)
packages/desktop-client/src/components/sidebar/Account.tsx (2)
263-263
: Consider using cleared total as default value.As suggested in PR feedback, using the cleared total as the default value might improve the reconciliation workflow.
Could you clarify whether users would expect the cleared total or the current balance as the default value? This would help determine the best approach.
297-300
:❓ Verification inconclusive
Verify cleared/locked column behavior.
Per PR feedback, the cleared/locked column disappears after reconciling via the context menu.
🏁 Script executed:
#!/bin/bash # Search for code handling the cleared/locked column visibility rg -A 5 "cleared.*column|locked.*column"Length of output: 42
Action Required: Verify cleared/locked column behavior
The context provided in the PR feedback indicates that the cleared/locked column disappears after reconciling via the context menu, yet our investigation via the grep search for "cleared.*column" or "locked.*column" in the codebase returned no results. This lack of evidence suggests that the logic regarding the cleared/locked column may not be explicitly handled in the current implementation.
Next steps:
- Manually verify if the cleared/locked column behavior is implemented elsewhere or if it is indeed missing.
- Review any related changes in the code that might indirectly affect this behavior.
I feel like it should match the standard reconcile process. The existing processes uses the cleared amount even if thats not what is showed as the account balance at the top. |