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

Add Reconcile button on the account page. #3684

Merged
merged 19 commits into from
Oct 20, 2024
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
50 changes: 31 additions & 19 deletions packages/desktop-client/src/components/accounts/Header.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
SvgArrowsExpand3,
SvgArrowsShrink3,
SvgDownloadThickBottom,
SvgLockClosed,
SvgPencil1,
} from '../../icons/v2';
import { theme, styles } from '../../style';
Expand Down Expand Up @@ -92,8 +93,10 @@ export function AccountHeader({
}) {
const { t } = useTranslation();
const [menuOpen, setMenuOpen] = useState(false);
const [reconcileOpen, setReconcileOpen] = useState(false);
const searchInput = useRef(null);
const triggerRef = useRef(null);
const reconcileRef = useRef(null);
const splitsExpanded = useSplitsExpanded();
const syncServerStatus = useSyncServerStatus();
const isUsingServer = syncServerStatus !== 'no-server';
Expand Down Expand Up @@ -256,6 +259,31 @@ export function AccountHeader({
onChange={onSearch}
inputRef={searchInput}
/>
<View style={{ marginLeft: 16 }} title={t('Reconcile')}>
Copy link
Contributor

Choose a reason for hiding this comment

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

⚠️ Potential issue

Move the title attribute to the Button component for correct tooltip display

The title attribute on the <View> component may not render a tooltip as expected. To ensure the tooltip appears when a user hovers over the button, move the title attribute to the <Button> component.

Apply this diff to fix the issue:

-              <View style={{ marginLeft: 16 }} title={t('Reconcile')}>
+              <View style={{ marginLeft: 16 }}>
                 <Button
+                  title={t('Reconcile')}
                   ref={reconcileRef}
                   variant="bare"
                   aria-label={t('Reconcile')}
                   onPress={() => {
                     setReconcileOpen(true);
                   }}
                 >
                   <SvgLockClosed width={13} height={13} />
                 </Button>

Alternatively, consider using a Tooltip component if available in your UI library for better consistency and flexibility.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
<View style={{ marginLeft: 16 }} title={t('Reconcile')}>
<View style={{ marginLeft: 16 }}>
<Button
title={t('Reconcile')}
ref={reconcileRef}
variant="bare"
aria-label={t('Reconcile')}
onPress={() => {
setReconcileOpen(true);
}}
>
<SvgLockClosed width={13} height={13} />
</Button>

<Button
ref={reconcileRef}
variant="bare"
aria-label={t('Reconcile')}
onPress={() => {
setReconcileOpen(true);
}}
>
<SvgLockClosed width={13} height={13} />
</Button>
<Popover
placement="bottom"
triggerRef={reconcileRef}
style={{ width: 275 }}
isOpen={reconcileOpen}
onOpenChange={() => setReconcileOpen(false)}
>
<ReconcileMenu
account={account}
onClose={() => setReconcileOpen(false)}
onReconcile={onReconcile}
/>
</Popover>
</View>
{workingHard ? (
<View>
<AnimatedLoading style={{ width: 16, height: 16 }} />
Expand Down Expand Up @@ -287,7 +315,7 @@ export function AccountHeader({
: t('Expand split transactions')
}
isDisabled={search !== '' || filterConditions.length > 0}
style={{ padding: 6, marginLeft: 10 }}
style={{ padding: 6 }}
onPress={onToggleSplits}
>
<View
Expand Down Expand Up @@ -330,8 +358,6 @@ export function AccountHeader({
setMenuOpen(false);
onMenuSelect(item);
}}
onReconcile={onReconcile}
onClose={() => setMenuOpen(false)}
/>
</Popover>
</View>
Expand Down Expand Up @@ -522,29 +548,16 @@ function AccountMenu({
canShowBalances,
showCleared,
showReconciled,
onClose,
isSorted,
onReconcile,
onMenuSelect,
}) {
const { t } = useTranslation();
const [tooltip, setTooltip] = useState('default');
const syncServerStatus = useSyncServerStatus();

return tooltip === 'reconcile' ? (
<ReconcileMenu
account={account}
onClose={onClose}
onReconcile={onReconcile}
/>
) : (
return (
<Menu
onMenuSelect={item => {
if (item === 'reconcile') {
setTooltip('reconcile');
} else {
onMenuSelect(item);
}
onMenuSelect(item);
}}
items={[
isSorted && {
Expand All @@ -570,7 +583,6 @@ function AccountMenu({
: t('Show reconciled transactions'),
},
{ name: 'export', text: t('Export') },
{ name: 'reconcile', text: t('Reconcile') },
account &&
!account.closed &&
(canSync
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3684.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [attyluccio]
---

Add Reconcile button on account page