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 all 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.
61 changes: 39 additions & 22 deletions packages/desktop-client/src/components/accounts/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import {
SvgArrowsExpand3,
SvgArrowsShrink3,
SvgDownloadThickBottom,
SvgLockClosed,
SvgPencil1,
} from '../../icons/v2';
import { theme, styles } from '../../style';
Expand Down Expand Up @@ -92,7 +93,7 @@ type AccountHeaderProps = {
onSync: () => void;
onImport: () => void;
onMenuSelect: AccountMenuProps['onMenuSelect'];
onReconcile: AccountMenuProps['onReconcile'];
onReconcile: ComponentProps<typeof ReconcileMenu>['onReconcile'];
onBatchEdit: ComponentProps<typeof SelectedTransactionsButton>['onEdit'];
onBatchDelete: ComponentProps<typeof SelectedTransactionsButton>['onDelete'];
onBatchDuplicate: ComponentProps<
Expand Down Expand Up @@ -181,8 +182,10 @@ export function AccountHeader({
}: AccountHeaderProps) {
const { t } = useTranslation();
const [menuOpen, setMenuOpen] = useState(false);
const [reconcileOpen, setReconcileOpen] = useState(false);
const searchInput = useRef<HTMLInputElement>(null);
const triggerRef = useRef(null);
const reconcileRef = useRef(null);
const splitsExpanded = useSplitsExpanded();
const syncServerStatus = useSyncServerStatus();
const isUsingServer = syncServerStatus !== 'no-server';
Expand Down Expand Up @@ -366,6 +369,38 @@ export function AccountHeader({
onMakeAsNonSplitTransactions={onMakeAsNonSplitTransactions}
/>
)}
<View>
{account && (
<>
<Button
ref={reconcileRef}
variant="bare"
aria-label={t('Reconcile')}
style={{ padding: 6, marginLeft: 10 }}
onPress={() => {
setReconcileOpen(true);
}}
>
<View title={t('Reconcile')}>
<SvgLockClosed width={14} height={14} />
</View>
</Button>
<Popover
placement="bottom"
triggerRef={reconcileRef}
style={{ width: 275 }}
isOpen={reconcileOpen}
onOpenChange={() => setReconcileOpen(false)}
>
<ReconcileMenu
account={account}
onClose={() => setReconcileOpen(false)}
onReconcile={onReconcile}
/>
</Popover>
</>
)}
</View>
<Button
variant="bare"
aria-label={
Expand All @@ -374,7 +409,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 @@ -417,8 +452,6 @@ export function AccountHeader({
setMenuOpen(false);
onMenuSelect(item);
}}
onReconcile={onReconcile}
onClose={() => setMenuOpen(false)}
/>
</Popover>
</View>
Expand Down Expand Up @@ -639,9 +672,7 @@ type AccountMenuProps = {
canShowBalances: boolean;
showCleared: boolean;
showReconciled: boolean;
onClose: ComponentProps<typeof ReconcileMenu>['onClose'];
isSorted: boolean;
onReconcile: ComponentProps<typeof ReconcileMenu>['onReconcile'];
onMenuSelect: (
item:
| 'link'
Expand All @@ -663,29 +694,16 @@ function AccountMenu({
canShowBalances,
showCleared,
showReconciled,
onClose,
isSorted,
onReconcile,
onMenuSelect,
}: AccountMenuProps) {
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 Down Expand Up @@ -719,7 +737,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