mirror of
https://github.com/actualbudget/actual.git
synced 2026-03-11 20:44:32 -05:00
Compare commits
28 Commits
move-redux
...
scrollToLo
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83cd364c5f | ||
|
|
b61b1758d6 | ||
|
|
dbc434c84e | ||
|
|
b1ea639e11 | ||
|
|
bc6098fbb3 | ||
|
|
15869eca61 | ||
|
|
c5c098ea0c | ||
|
|
f6b88cc1ba | ||
|
|
ca1d067921 | ||
|
|
18e55800e4 | ||
|
|
18314acd25 | ||
|
|
042058ec7b | ||
|
|
9580be7bc4 | ||
|
|
569b995278 | ||
|
|
9590a93e9f | ||
|
|
c20ebd9dbd | ||
|
|
112f066b8b | ||
|
|
cf6825a541 | ||
|
|
9ec0bdec33 | ||
|
|
4c57596117 | ||
|
|
9e7ebb405f | ||
|
|
7ba3a37ead | ||
|
|
201e1dab54 | ||
|
|
ab124105c2 | ||
|
|
129b2c3061 | ||
|
|
9d6b574708 | ||
|
|
bbec585305 | ||
|
|
2476e45735 |
1
packages/desktop-client/locale
Submodule
1
packages/desktop-client/locale
Submodule
Submodule packages/desktop-client/locale added at a0e122296a
@@ -37,7 +37,6 @@ export const BudgetCategories = memo(
|
|||||||
function onCollapse(value) {
|
function onCollapse(value) {
|
||||||
setCollapsedGroupIdsPref(value);
|
setCollapsedGroupIdsPref(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
const [isAddingGroup, setIsAddingGroup] = useState(false);
|
const [isAddingGroup, setIsAddingGroup] = useState(false);
|
||||||
const [newCategoryForGroup, setNewCategoryForGroup] = useState(null);
|
const [newCategoryForGroup, setNewCategoryForGroup] = useState(null);
|
||||||
const items = useMemo(() => {
|
const items = useMemo(() => {
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
import React, { useState } from 'react';
|
import React, { useRef, useState, useEffect } from 'react';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
import { useCategories } from '../../hooks/useCategories';
|
import { useCategories } from '../../hooks/useCategories';
|
||||||
import { useLocalPref } from '../../hooks/useLocalPref';
|
import { useLocalPref } from '../../hooks/useLocalPref';
|
||||||
@@ -29,12 +30,38 @@ export function BudgetTable(props) {
|
|||||||
onBudgetAction,
|
onBudgetAction,
|
||||||
} = props;
|
} = props;
|
||||||
|
|
||||||
|
const budgetCategoriesRef = useRef();
|
||||||
|
const scrollableDivRef = useRef();
|
||||||
|
const location = useLocation();
|
||||||
const { grouped: categoryGroups } = useCategories();
|
const { grouped: categoryGroups } = useCategories();
|
||||||
const [collapsedGroupIds = [], setCollapsedGroupIdsPref] =
|
const [collapsedGroupIds = [], setCollapsedGroupIdsPref] =
|
||||||
useLocalPref('budget.collapsed');
|
useLocalPref('budget.collapsed');
|
||||||
const [showHiddenCategories, setShowHiddenCategoriesPef] = useLocalPref(
|
const [showHiddenCategories, setShowHiddenCategoriesPef] = useLocalPref(
|
||||||
'budget.showHiddenCategories',
|
'budget.showHiddenCategories',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getCurrentScrollPosition = () => {
|
||||||
|
return scrollableDivRef.current?.scrollTop || 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
const onShowActivityWithScroll = (categoryId, month) => {
|
||||||
|
const scrollPosition = getCurrentScrollPosition();
|
||||||
|
onShowActivity(categoryId, month, scrollPosition);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const savedScrollPosition = location.state?.scrollPosition;
|
||||||
|
|
||||||
|
if (savedScrollPosition && scrollableDivRef.current) {
|
||||||
|
// Use requestAnimationFrame to ensure the DOM is ready
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
if (scrollableDivRef.current) {
|
||||||
|
scrollableDivRef.current.scrollTop = savedScrollPosition;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}, [location.state?.scrollPosition]);
|
||||||
|
|
||||||
const [editing, setEditing] = useState(null);
|
const [editing, setEditing] = useState(null);
|
||||||
|
|
||||||
const onEditMonth = (id, month) => {
|
const onEditMonth = (id, month) => {
|
||||||
@@ -201,6 +228,7 @@ export function BudgetTable(props) {
|
|||||||
collapseAllCategories={collapseAllCategories}
|
collapseAllCategories={collapseAllCategories}
|
||||||
/>
|
/>
|
||||||
<View
|
<View
|
||||||
|
id="scrollableDiv"
|
||||||
style={{
|
style={{
|
||||||
overflowY: 'scroll',
|
overflowY: 'scroll',
|
||||||
overflowAnchor: 'none',
|
overflowAnchor: 'none',
|
||||||
@@ -208,6 +236,7 @@ export function BudgetTable(props) {
|
|||||||
paddingLeft: 5,
|
paddingLeft: 5,
|
||||||
paddingRight: 5,
|
paddingRight: 5,
|
||||||
}}
|
}}
|
||||||
|
innerRef={scrollableDivRef}
|
||||||
>
|
>
|
||||||
<View
|
<View
|
||||||
style={{
|
style={{
|
||||||
@@ -228,7 +257,7 @@ export function BudgetTable(props) {
|
|||||||
onReorderCategory={_onReorderCategory}
|
onReorderCategory={_onReorderCategory}
|
||||||
onReorderGroup={_onReorderGroup}
|
onReorderGroup={_onReorderGroup}
|
||||||
onBudgetAction={onBudgetAction}
|
onBudgetAction={onBudgetAction}
|
||||||
onShowActivity={onShowActivity}
|
onShowActivity={onShowActivityWithScroll}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</View>
|
</View>
|
||||||
|
|||||||
@@ -276,7 +276,7 @@ function BudgetInner(props: BudgetInnerProps) {
|
|||||||
dispatch(applyBudgetAction(month, type, args));
|
dispatch(applyBudgetAction(month, type, args));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onShowActivity = (categoryId, month) => {
|
const onShowActivity = (categoryId, month, scrollPosition) => {
|
||||||
const conditions = [
|
const conditions = [
|
||||||
{ field: 'category', op: 'is', value: categoryId, type: 'id' },
|
{ field: 'category', op: 'is', value: categoryId, type: 'id' },
|
||||||
{
|
{
|
||||||
@@ -287,6 +287,12 @@ function BudgetInner(props: BudgetInnerProps) {
|
|||||||
type: 'date',
|
type: 'date',
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
navigate('/budget', {
|
||||||
|
replace: true,
|
||||||
|
state: { scrollPosition }
|
||||||
|
});
|
||||||
|
|
||||||
navigate('/accounts', {
|
navigate('/accounts', {
|
||||||
state: {
|
state: {
|
||||||
goBack: true,
|
goBack: true,
|
||||||
|
|||||||
@@ -302,7 +302,9 @@ export const CategoryMonth = memo(function CategoryMonth({
|
|||||||
<Field name="spent" width="flex" style={{ textAlign: 'right' }}>
|
<Field name="spent" width="flex" style={{ textAlign: 'right' }}>
|
||||||
<span
|
<span
|
||||||
data-testid="category-month-spent"
|
data-testid="category-month-spent"
|
||||||
onClick={() => onShowActivity(category.id, month)}
|
onClick={() => {
|
||||||
|
onShowActivity(category.id, month);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<CellValue
|
<CellValue
|
||||||
binding={reportBudget.catSumAmount(category.id)}
|
binding={reportBudget.catSumAmount(category.id)}
|
||||||
|
|||||||
@@ -295,7 +295,9 @@ export const ExpenseCategoryMonth = memo(function ExpenseCategoryMonth({
|
|||||||
<Field name="spent" width="flex" style={{ textAlign: 'right' }}>
|
<Field name="spent" width="flex" style={{ textAlign: 'right' }}>
|
||||||
<span
|
<span
|
||||||
data-testid="category-month-spent"
|
data-testid="category-month-spent"
|
||||||
onClick={() => onShowActivity(category.id, month)}
|
onClick={() => {
|
||||||
|
onShowActivity(category.id, month);
|
||||||
|
}}
|
||||||
>
|
>
|
||||||
<CellValue
|
<CellValue
|
||||||
binding={rolloverBudget.catSumAmount(category.id)}
|
binding={rolloverBudget.catSumAmount(category.id)}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import React, { memo, useRef } from 'react';
|
import React, { memo, useRef, useEffect } from 'react';
|
||||||
import { useDispatch } from 'react-redux';
|
import { useDispatch } from 'react-redux';
|
||||||
|
import { useLocation } from 'react-router-dom';
|
||||||
|
|
||||||
import { AutoTextSize } from 'auto-text-size';
|
import { AutoTextSize } from 'auto-text-size';
|
||||||
import memoizeOne from 'memoize-one';
|
import memoizeOne from 'memoize-one';
|
||||||
@@ -328,6 +329,8 @@ const ExpenseCategory = memo(function ExpenseCategory({
|
|||||||
onBudgetAction,
|
onBudgetAction,
|
||||||
show3Cols,
|
show3Cols,
|
||||||
showBudgetedCol,
|
showBudgetedCol,
|
||||||
|
setScrollPosition,
|
||||||
|
onShowActivityWithScroll,
|
||||||
}) {
|
}) {
|
||||||
const opacity = blank ? 0 : 1;
|
const opacity = blank ? 0 : 1;
|
||||||
|
|
||||||
@@ -396,10 +399,6 @@ const ExpenseCategory = memo(function ExpenseCategory({
|
|||||||
|
|
||||||
const listItemRef = useRef();
|
const listItemRef = useRef();
|
||||||
const format = useFormat();
|
const format = useFormat();
|
||||||
const navigate = useNavigate();
|
|
||||||
const onShowActivity = () => {
|
|
||||||
navigate(`/categories/${category.id}?month=${month}`);
|
|
||||||
};
|
|
||||||
|
|
||||||
const sidebarColumnWidth = getColumnWidth({ show3Cols, isSidebar: true });
|
const sidebarColumnWidth = getColumnWidth({ show3Cols, isSidebar: true });
|
||||||
const columnWidth = getColumnWidth({ show3Cols });
|
const columnWidth = getColumnWidth({ show3Cols });
|
||||||
@@ -517,7 +516,9 @@ const ExpenseCategory = memo(function ExpenseCategory({
|
|||||||
binding={spent}
|
binding={spent}
|
||||||
getStyle={makeAmountGrey}
|
getStyle={makeAmountGrey}
|
||||||
type="financial"
|
type="financial"
|
||||||
onClick={onShowActivity}
|
onClick={() => {
|
||||||
|
onShowActivityWithScroll(category.id, month);
|
||||||
|
}}
|
||||||
formatter={value => (
|
formatter={value => (
|
||||||
<Button
|
<Button
|
||||||
type="bare"
|
type="bare"
|
||||||
@@ -1235,6 +1236,8 @@ const ExpenseGroup = memo(function ExpenseGroup({
|
|||||||
showHiddenCategories,
|
showHiddenCategories,
|
||||||
collapsed,
|
collapsed,
|
||||||
onToggleCollapse,
|
onToggleCollapse,
|
||||||
|
setScrollPosition,
|
||||||
|
onShowActivityWithScroll,
|
||||||
}) {
|
}) {
|
||||||
function editable(content) {
|
function editable(content) {
|
||||||
if (!editMode) {
|
if (!editMode) {
|
||||||
@@ -1347,6 +1350,8 @@ const ExpenseGroup = memo(function ExpenseGroup({
|
|||||||
month={month}
|
month={month}
|
||||||
// onReorder={onReorderCategory}
|
// onReorder={onReorderCategory}
|
||||||
onBudgetAction={onBudgetAction}
|
onBudgetAction={onBudgetAction}
|
||||||
|
setScrollPosition={setScrollPosition}
|
||||||
|
onShowActivityWithScroll={onShowActivityWithScroll}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -1458,6 +1463,8 @@ function BudgetGroups({
|
|||||||
showBudgetedCol,
|
showBudgetedCol,
|
||||||
show3Cols,
|
show3Cols,
|
||||||
showHiddenCategories,
|
showHiddenCategories,
|
||||||
|
setScrollPosition,
|
||||||
|
onShowActivityWithScroll,
|
||||||
}) {
|
}) {
|
||||||
const separateGroups = memoizeOne(groups => {
|
const separateGroups = memoizeOne(groups => {
|
||||||
return {
|
return {
|
||||||
@@ -1507,6 +1514,8 @@ function BudgetGroups({
|
|||||||
showHiddenCategories={showHiddenCategories}
|
showHiddenCategories={showHiddenCategories}
|
||||||
collapsed={collapsedGroupIds.includes(group.id)}
|
collapsed={collapsedGroupIds.includes(group.id)}
|
||||||
onToggleCollapse={onToggleCollapse}
|
onToggleCollapse={onToggleCollapse}
|
||||||
|
setScrollPosition={setScrollPosition}
|
||||||
|
onShowActivityWithScroll={onShowActivityWithScroll}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
})}
|
})}
|
||||||
@@ -1557,6 +1566,8 @@ export function BudgetTable({
|
|||||||
}) {
|
}) {
|
||||||
const { width } = useResponsive();
|
const { width } = useResponsive();
|
||||||
const show3Cols = width >= 360;
|
const show3Cols = width >= 360;
|
||||||
|
const location = useLocation();
|
||||||
|
const navigate = useNavigate();
|
||||||
|
|
||||||
// let editMode = false; // neuter editMode -- sorry, not rewriting drag-n-drop right now
|
// let editMode = false; // neuter editMode -- sorry, not rewriting drag-n-drop right now
|
||||||
|
|
||||||
@@ -1564,6 +1575,44 @@ export function BudgetTable({
|
|||||||
'mobile.showSpentColumn',
|
'mobile.showSpentColumn',
|
||||||
);
|
);
|
||||||
|
|
||||||
|
const getCurrentScrollPosition = () => {
|
||||||
|
const scrollableDiv = document.getElementById('scrollableDiv');
|
||||||
|
return scrollableDiv?.scrollTop || 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
const setScrollPosition = () => {
|
||||||
|
const scrollPosition = getCurrentScrollPosition();
|
||||||
|
|
||||||
|
navigate('/budget', {
|
||||||
|
replace: true,
|
||||||
|
state: { scrollPosition }
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const onShowActivityWithScroll = (categoryId, month) => {
|
||||||
|
const scrollPosition = getCurrentScrollPosition();
|
||||||
|
|
||||||
|
navigate('/budget', {
|
||||||
|
replace: true,
|
||||||
|
state: { scrollPosition }
|
||||||
|
});
|
||||||
|
|
||||||
|
navigate(`/categories/${categoryId}?month=${month}`);
|
||||||
|
};
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const savedScrollPosition = location.state?.scrollPosition;
|
||||||
|
|
||||||
|
if (savedScrollPosition) {
|
||||||
|
const scrollableDiv = document.getElementById('scrollableDiv');
|
||||||
|
if (scrollableDiv) {
|
||||||
|
requestAnimationFrame(() => {
|
||||||
|
scrollableDiv.scrollTop = savedScrollPosition;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}, [location.state?.scrollPosition]);
|
||||||
|
|
||||||
function toggleSpentColumn() {
|
function toggleSpentColumn() {
|
||||||
setShowSpentColumnPref(!showSpentColumn);
|
setShowSpentColumnPref(!showSpentColumn);
|
||||||
}
|
}
|
||||||
@@ -1623,9 +1672,12 @@ export function BudgetTable({
|
|||||||
<PullToRefresh onRefresh={onRefresh}>
|
<PullToRefresh onRefresh={onRefresh}>
|
||||||
<View
|
<View
|
||||||
data-testid="budget-table"
|
data-testid="budget-table"
|
||||||
|
id="scrollableDiv"
|
||||||
style={{
|
style={{
|
||||||
backgroundColor: theme.pageBackground,
|
backgroundColor: theme.pageBackground,
|
||||||
paddingBottom: MOBILE_NAV_HEIGHT,
|
paddingBottom: MOBILE_NAV_HEIGHT,
|
||||||
|
overflowY: 'auto',
|
||||||
|
height: '100%',
|
||||||
}}
|
}}
|
||||||
>
|
>
|
||||||
<BudgetGroups
|
<BudgetGroups
|
||||||
@@ -1647,6 +1699,8 @@ export function BudgetTable({
|
|||||||
onReorderCategory={onReorderCategory}
|
onReorderCategory={onReorderCategory}
|
||||||
onReorderGroup={onReorderGroup}
|
onReorderGroup={onReorderGroup}
|
||||||
onBudgetAction={onBudgetAction}
|
onBudgetAction={onBudgetAction}
|
||||||
|
setScrollPosition={setScrollPosition}
|
||||||
|
onShowActivityWithScroll={onShowActivityWithScroll}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
</PullToRefresh>
|
</PullToRefresh>
|
||||||
|
|||||||
6
upcoming-release-notes/2859.md
Normal file
6
upcoming-release-notes/2859.md
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
category: Enhancements
|
||||||
|
authors: [Crazypkr]
|
||||||
|
---
|
||||||
|
|
||||||
|
Add ability to return back to previous scroll location on Budget Table when clicking spent column to view transactions
|
||||||
Reference in New Issue
Block a user