Skip to content

A local-first personal finance app

Refactor account header to use SpaceBetween component for spacing (#5994)

Matiss Janis Aboltins25d072944eff
diff --git a/packages/desktop-client/src/components/accounts/Header.tsx b/packages/desktop-client/src/components/accounts/Header.tsx
index 6f28d73a16..d35fd45c4e 100644
--- a/packages/desktop-client/src/components/accounts/Header.tsx
+++ b/packages/desktop-client/src/components/accounts/Header.tsx
@@ -25,6 +25,7 @@ import { InitialFocus } from '@actual-app/components/initial-focus';
import { Input } from '@actual-app/components/input';
import { Menu } from '@actual-app/components/menu';
import { Popover } from '@actual-app/components/popover';
+import { SpaceBetween } from '@actual-app/components/space-between';
import { Stack } from '@actual-app/components/stack';
import { styles } from '@actual-app/components/styles';
import { theme } from '@actual-app/components/theme';
@@ -383,192 +384,192 @@ export function AccountHeader({
<FilterButton onApply={onApplyFilter} />
</View>
<View style={{ flex: 1 }} />
- <Search
- placeholder={t('Search')}
- value={search}
- onChange={onSearch}
- ref={searchInput}
- // Remove marginRight magically being added by Stack...
- // We need to refactor the Stack component
- style={{ marginRight: 0 }}
- />
- {workingHard ? (
- <View>
- <AnimatedLoading style={{ width: 16, height: 16 }} />
- </View>
- ) : (
- <SelectedTransactionsButton
- getTransaction={id => transactions.find(t => t.id === id)}
- onShow={onShowTransactions}
- onDuplicate={onBatchDuplicate}
- onDelete={onBatchDelete}
- onEdit={onBatchEdit}
- onRunRules={onRunRules}
- onLinkSchedule={onBatchLinkSchedule}
- onUnlinkSchedule={onBatchUnlinkSchedule}
- onCreateRule={onCreateRule}
- onSetTransfer={onSetTransfer}
- onScheduleAction={onScheduleAction}
- showMakeTransfer={showMakeTransfer}
- onMakeAsSplitTransaction={onMakeAsSplitTransaction}
- onMakeAsNonSplitTransactions={onMakeAsNonSplitTransactions}
- onMergeTransactions={onMergeTransactions}
+
+ <SpaceBetween gap={10}>
+ <Search
+ placeholder={t('Search')}
+ value={search}
+ onChange={onSearch}
+ ref={searchInput}
/>
- )}
- <View style={{ flex: '0 0 auto', marginLeft: 10 }}>
- {account && (
- <Tooltip
- style={{
- ...styles.tooltip,
- marginBottom: 10,
- }}
- content={
- account?.last_reconciled
- ? t(
- 'Reconciled {{ relativeTimeAgo }} ({{ absoluteDate }})',
- {
- relativeTimeAgo: tsToRelativeTime(
- account.last_reconciled,
- locale,
- ),
- absoluteDate: formatDate(
- new Date(
- parseInt(account.last_reconciled ?? '0', 10),
+ {workingHard ? (
+ <View>
+ <AnimatedLoading style={{ width: 16, height: 16 }} />
+ </View>
+ ) : (
+ <SelectedTransactionsButton
+ getTransaction={id => transactions.find(t => t.id === id)}
+ onShow={onShowTransactions}
+ onDuplicate={onBatchDuplicate}
+ onDelete={onBatchDelete}
+ onEdit={onBatchEdit}
+ onRunRules={onRunRules}
+ onLinkSchedule={onBatchLinkSchedule}
+ onUnlinkSchedule={onBatchUnlinkSchedule}
+ onCreateRule={onCreateRule}
+ onSetTransfer={onSetTransfer}
+ onScheduleAction={onScheduleAction}
+ showMakeTransfer={showMakeTransfer}
+ onMakeAsSplitTransaction={onMakeAsSplitTransaction}
+ onMakeAsNonSplitTransactions={onMakeAsNonSplitTransactions}
+ onMergeTransactions={onMergeTransactions}
+ />
+ )}
+ <View style={{ flex: '0 0 auto' }}>
+ {account && (
+ <Tooltip
+ style={{
+ ...styles.tooltip,
+ marginBottom: 10,
+ }}
+ content={
+ account?.last_reconciled
+ ? t(
+ 'Reconciled {{ relativeTimeAgo }} ({{ absoluteDate }})',
+ {
+ relativeTimeAgo: tsToRelativeTime(
+ account.last_reconciled,
+ locale,
),
- dateFormat,
- { locale },
- ),
- },
- )
- : t('Not yet reconciled')
- }
- placement="top"
- triggerProps={{
- isDisabled: reconcileOpen,
- }}
- >
- <Button
- ref={reconcileRef}
- variant="bare"
- aria-label={t('Reconcile')}
- style={{ padding: 6 }}
- onPress={() => {
- setReconcileOpen(true);
+ absoluteDate: formatDate(
+ new Date(
+ parseInt(account.last_reconciled ?? '0', 10),
+ ),
+ dateFormat,
+ { locale },
+ ),
+ },
+ )
+ : t('Not yet reconciled')
+ }
+ placement="top"
+ triggerProps={{
+ isDisabled: reconcileOpen,
}}
>
- <View>
- <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>
- </Tooltip>
- )}
- </View>
- <Button
- variant="bare"
- aria-label={
- splitsExpanded.state.mode === 'collapse'
- ? t('Collapse split transactions')
- : t('Expand split transactions')
- }
- style={{ padding: 6 }}
- onPress={onToggleSplits}
- >
- <View
- title={
+ <Button
+ ref={reconcileRef}
+ variant="bare"
+ aria-label={t('Reconcile')}
+ style={{ padding: 6 }}
+ onPress={() => {
+ setReconcileOpen(true);
+ }}
+ >
+ <View>
+ <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>
+ </Tooltip>
+ )}
+ </View>
+ <Button
+ variant="bare"
+ aria-label={
splitsExpanded.state.mode === 'collapse'
? t('Collapse split transactions')
: t('Expand split transactions')
}
+ style={{ padding: 6 }}
+ onPress={onToggleSplits}
>
- {splitsExpanded.state.mode === 'collapse' ? (
- <SvgArrowsShrink3 style={{ width: 14, height: 14 }} />
- ) : (
- <SvgArrowsExpand3 style={{ width: 14, height: 14 }} />
- )}
- </View>
- </Button>
- {account ? (
- <View style={{ flex: '0 0 auto' }}>
- <DialogTrigger>
- <Button variant="bare" aria-label={t('Account menu')}>
- <SvgDotsHorizontalTriple
- width={15}
- height={15}
- style={{ transform: 'rotateZ(90deg)' }}
- />
- </Button>
-
- <Popover style={{ minWidth: 275 }}>
- <Dialog>
- <AccountMenu
- account={account}
- canSync={canSync}
- showNetWorthChart={showNetWorthChart}
- canShowBalances={
- canCalculateBalance ? canCalculateBalance() : false
- }
- isSorted={isSorted}
- showBalances={showBalances}
- showCleared={showCleared}
- showReconciled={showReconciled}
- onMenuSelect={onMenuSelect}
+ <View
+ title={
+ splitsExpanded.state.mode === 'collapse'
+ ? t('Collapse split transactions')
+ : t('Expand split transactions')
+ }
+ >
+ {splitsExpanded.state.mode === 'collapse' ? (
+ <SvgArrowsShrink3 style={{ width: 14, height: 14 }} />
+ ) : (
+ <SvgArrowsExpand3 style={{ width: 14, height: 14 }} />
+ )}
+ </View>
+ </Button>
+ {account ? (
+ <View style={{ flex: '0 0 auto' }}>
+ <DialogTrigger>
+ <Button variant="bare" aria-label={t('Account menu')}>
+ <SvgDotsHorizontalTriple
+ width={15}
+ height={15}
+ style={{ transform: 'rotateZ(90deg)' }}
/>
- </Dialog>
- </Popover>
- </DialogTrigger>
- </View>
- ) : (
- <View style={{ flex: '0 0 auto' }}>
- <DialogTrigger>
- <Button variant="bare" aria-label={t('Account menu')}>
- <SvgDotsHorizontalTriple
- width={15}
- height={15}
- style={{ transform: 'rotateZ(90deg)' }}
- />
- </Button>
-
- <Popover>
- <Dialog>
- <Menu
- slot="close"
- onMenuSelect={onMenuSelect}
- items={[
- ...(isSorted
- ? [
- {
- name: 'remove-sorting',
- text: t('Remove all sorting'),
- } as const,
- ]
- : []),
- { name: 'export', text: t('Export') },
- {
- name: 'toggle-net-worth-chart',
- text: showNetWorthChart
- ? t('Hide balance chart')
- : t('Show balance chart'),
- },
- ]}
+ </Button>
+
+ <Popover style={{ minWidth: 275 }}>
+ <Dialog>
+ <AccountMenu
+ account={account}
+ canSync={canSync}
+ showNetWorthChart={showNetWorthChart}
+ canShowBalances={
+ canCalculateBalance ? canCalculateBalance() : false
+ }
+ isSorted={isSorted}
+ showBalances={showBalances}
+ showCleared={showCleared}
+ showReconciled={showReconciled}
+ onMenuSelect={onMenuSelect}
+ />
+ </Dialog>
+ </Popover>
+ </DialogTrigger>
+ </View>
+ ) : (
+ <View style={{ flex: '0 0 auto' }}>
+ <DialogTrigger>
+ <Button variant="bare" aria-label={t('Account menu')}>
+ <SvgDotsHorizontalTriple
+ width={15}
+ height={15}
+ style={{ transform: 'rotateZ(90deg)' }}
/>
- </Dialog>
- </Popover>
- </DialogTrigger>
- </View>
- )}
+ </Button>
+
+ <Popover>
+ <Dialog>
+ <Menu
+ slot="close"
+ onMenuSelect={onMenuSelect}
+ items={[
+ ...(isSorted
+ ? [
+ {
+ name: 'remove-sorting',
+ text: t('Remove all sorting'),
+ } as const,
+ ]
+ : []),
+ { name: 'export', text: t('Export') },
+ {
+ name: 'toggle-net-worth-chart',
+ text: showNetWorthChart
+ ? t('Hide balance chart')
+ : t('Show balance chart'),
+ },
+ ]}
+ />
+ </Dialog>
+ </Popover>
+ </DialogTrigger>
+ </View>
+ )}
+ </SpaceBetween>
</Stack>
{filterConditions?.length > 0 && (
<FiltersStack
diff --git a/packages/desktop-client/src/components/table.tsx b/packages/desktop-client/src/components/table.tsx
index 5ea162279a..dc7bfffcd1 100644
--- a/packages/desktop-client/src/components/table.tsx
+++ b/packages/desktop-client/src/components/table.tsx
@@ -848,7 +848,7 @@ export function SelectedItemsButton<Name extends string>({
typeof name === 'function' ? name(selectedItems.size) : name;
return (
- <View style={{ marginLeft: 10, flexShrink: 0 }}>
+ <View style={{ flexShrink: 0 }}>
<Button
ref={triggerRef}
variant="bare"
diff --git a/upcoming-release-notes/5994.md b/upcoming-release-notes/5994.md
new file mode 100644
index 0000000000..2e1e5e1631
--- /dev/null
+++ b/upcoming-release-notes/5994.md
@@ -0,0 +1,7 @@
+---
+category: Bugfix
+authors: [MatissJanis]
+---
+
+Transaction table: add space between searchbar and loading icon
+