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

feat: now button at budget page #3703

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 7 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.
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
26 changes: 25 additions & 1 deletion packages/desktop-client/src/components/budget/MonthPicker.tsx
Original file line number Diff line number Diff line change
@@ -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 BoundsProps } from './MonthsContext';
Expand All @@ -24,6 +27,7 @@ export const MonthPicker = ({
style,
onSelect,
}: MonthPickerProps) => {
const { t } = useTranslation();
const [hoverId, setHoverId] = useState(null);
const [targetMonthCount, setTargetMonthCount] = useState(12);

Expand Down Expand Up @@ -78,6 +82,26 @@ export const MonthPicker = ({
justifyContent: 'center',
}}
>
<Link
variant="button"
buttonVariant="bare"
onPress={() => onSelect(currentMonth)}
style={{
position: 'absolute',
left: 0,
padding: '3px 3px',
marginLeft: '4px',
}}
>
<View title={t('Today')}>
<SvgCalendar
style={{
width: 16,
height: 16,
}}
/>
</View>
</Link>
{range.map((month, idx) => {
const monthName = monthUtils.format(month, 'MMM');
const selected =
Expand Down
6 changes: 6 additions & 0 deletions upcoming-release-notes/3703.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
category: Enhancements
authors: [UnderKoen]
---

Add button to go to current month in budget view
Loading