Skip to content

A local-first personal finance app

feat: now button at budget page (#3703)

Koen van Staverenbd126b499beb
diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-1-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-1-chromium-linux.png
index d325f3ee5f..d4090a3115 100644
Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-1-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-2-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-2-chromium-linux.png
index 20c9ddaa8e..79a51f508a 100644
Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-2-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-3-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-3-chromium-linux.png
index fc7aa79158..9c4f9a704d 100644
Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-3-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-renders-the-summary-information-available-funds-overspent-budgeted-and-for-next-month-3-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png
index c29a9743f9..264e2ffa9c 100644
Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-1-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-2-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-2-chromium-linux.png
index a5a5b01ec5..347b8b6c82 100644
Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-2-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-2-chromium-linux.png differ
diff --git a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-3-chromium-linux.png b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-3-chromium-linux.png
index d20cceb488..b5b46e225b 100644
Binary files a/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-3-chromium-linux.png and b/packages/desktop-client/e2e/budget.test.js-snapshots/Budget-transfer-funds-to-another-category-3-chromium-linux.png differ
diff --git a/packages/desktop-client/src/components/budget/BudgetPageHeader.tsx b/packages/desktop-client/src/components/budget/BudgetPageHeader.tsx
index bd6e61060a..dfdb584488 100644
--- a/packages/desktop-client/src/components/budget/BudgetPageHeader.tsx
+++ b/packages/desktop-client/src/components/budget/BudgetPageHeader.tsx
@@ -15,9 +15,16 @@ type BudgetPageHeaderProps = {
export const BudgetPageHeader = memo<BudgetPageHeaderProps>(
({ startMonth, onMonthSelect, numMonths, monthBounds }) => {
+ const offsetMultipleMonths = numMonths === 1 ? 4 : 0;
return (
- <View style={{ marginLeft: 200 + 5, flexShrink: 0 }}>
- <View style={{ marginRight: 5 + getScrollbarWidth() }}>
+ <View
+ style={{ marginLeft: 200 + 5 - offsetMultipleMonths, flexShrink: 0 }}
+ >
+ <View
+ style={{
+ marginRight: 5 + getScrollbarWidth() - offsetMultipleMonths,
+ }}
+ >
<MonthPicker
startMonth={startMonth}
numDisplayed={numMonths}
diff --git a/packages/desktop-client/src/components/budget/MonthPicker.tsx b/packages/desktop-client/src/components/budget/MonthPicker.tsx
index 66f4442387..8acfa85818 100644
--- a/packages/desktop-client/src/components/budget/MonthPicker.tsx
+++ b/packages/desktop-client/src/components/budget/MonthPicker.tsx
@@ -1,10 +1,13 @@
// @ts-strict-ignore
-import { type CSSProperties, useState } from 'react';
+import React, { type CSSProperties, useState } from 'react';
+import { useTranslation } from 'react-i18next';
import * as monthUtils from 'loot-core/src/shared/months';
import { useResizeObserver } from '../../hooks/useResizeObserver';
+import { SvgCalendar } from '../../icons/v2';
import { styles, theme } from '../../style';
+import { Link } from '../common/Link';
import { View } from '../common/View';
import { type MonthBounds } from './MonthsContext';
@@ -24,6 +27,7 @@ export const MonthPicker = ({
style,
onSelect,
}: MonthPickerProps) => {
+ const { t } = useTranslation();
const [hoverId, setHoverId] = useState(null);
const [targetMonthCount, setTargetMonthCount] = useState(12);
@@ -78,6 +82,24 @@ export const MonthPicker = ({
justifyContent: 'center',
}}
>
+ <Link
+ variant="button"
+ buttonVariant="bare"
+ onPress={() => onSelect(currentMonth)}
+ style={{
+ padding: '3px 3px',
+ marginRight: '12px',
+ }}
+ >
+ <View title={t('Today')}>
+ <SvgCalendar
+ style={{
+ width: 16,
+ height: 16,
+ }}
+ />
+ </View>
+ </Link>
{range.map((month, idx) => {
const monthName = monthUtils.format(month, 'MMM');
const selected =
@@ -184,6 +206,13 @@ export const MonthPicker = ({
</View>
);
})}
+ {/*Keep range centered*/}
+ <span
+ style={{
+ width: '22px',
+ marginLeft: '12px',
+ }}
+ />
</View>
</View>
);
diff --git a/upcoming-release-notes/3703.md b/upcoming-release-notes/3703.md
new file mode 100644
index 0000000000..ade91d5e66
--- /dev/null
+++ b/upcoming-release-notes/3703.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [UnderKoen]
+---
+
+Add button to go to current month in budget view