Skip to content

Commit

Permalink
Merge branch 'master' into reportsOrganization
Browse files Browse the repository at this point in the history
  • Loading branch information
carkom authored Nov 5, 2023
2 parents e7093aa + d8c885b commit c0cc2e9
Show file tree
Hide file tree
Showing 67 changed files with 276 additions and 323 deletions.
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.
2 changes: 1 addition & 1 deletion packages/desktop-client/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@actual-app/web",
"version": "23.10.0",
"version": "23.11.0",
"license": "MIT",
"files": [
"build"
Expand Down
10 changes: 8 additions & 2 deletions packages/desktop-client/src/components/Titlebar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,21 @@ import useSheetValue from './spreadsheet/useSheetValue';
import { ThemeSelector } from './ThemeSelector';
import { Tooltip } from './tooltips';

export let TitlebarContext = createContext(null);
export type TitlebarContextValue = {
sendEvent: (msg: string) => void;
subscribe: (listener) => () => void;
};

export let TitlebarContext = createContext<TitlebarContextValue>(null);

type TitlebarProviderProps = {
children?: ReactNode;
};

export function TitlebarProvider({ children }: TitlebarProviderProps) {
let listeners = useRef([]);

function sendEvent(msg) {
function sendEvent(msg: string) {
listeners.current.forEach(func => func(msg));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default function BalanceWithCarryover({
alignSelf: 'center',
marginLeft: 2,
position: 'absolute',
right: -4,
right: -8,
top: 0,
bottom: 0,
justifyContent: 'center',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { memo } from 'react';
import React, { type ComponentProps, memo } from 'react';

import * as monthUtils from 'loot-core/src/shared/months';

Expand All @@ -7,8 +7,15 @@ import View from '../common/View';
import { MonthPicker } from './MonthPicker';
import { getScrollbarWidth } from './util';

const BudgetPageHeader = memo(
({ startMonth, onMonthSelect, numMonths, monthBounds, style }) => {
type BudgetPageHeaderProps = {
startMonth: string;
onMonthSelect: (month: string) => void;
numMonths: number;
monthBounds: ComponentProps<typeof MonthPicker>['monthBounds'];
};

const BudgetPageHeader = memo<BudgetPageHeaderProps>(
({ startMonth, onMonthSelect, numMonths, monthBounds }) => {
function getValidMonth(month) {
let start = monthBounds.start;
let end = monthUtils.subMonths(monthBounds.end, numMonths - 1);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { forwardRef, useEffect } from 'react';
import React, { forwardRef, useEffect, type ComponentProps } from 'react';
import { useSelector } from 'react-redux';
import AutoSizer from 'react-virtualized-auto-sizer';

Expand All @@ -9,7 +9,7 @@ import { useBudgetMonthCount } from './BudgetMonthCountContext';
import BudgetPageHeader from './BudgetPageHeader';
import BudgetTable from './BudgetTable';

function getNumPossibleMonths(width) {
function getNumPossibleMonths(width: number) {
let estimatedTableWidth = width - 200;

if (estimatedTableWidth < 500) {
Expand All @@ -27,7 +27,15 @@ function getNumPossibleMonths(width) {
return 6;
}

const DynamicBudgetTableInner = forwardRef(
type DynamicBudgetTableInnerProps = {
width: number;
height: number;
} & ComponentProps<typeof BudgetTable>;

const DynamicBudgetTableInner = forwardRef<
BudgetTable,
DynamicBudgetTableInnerProps
>(
(
{
width,
Expand Down Expand Up @@ -92,17 +100,19 @@ const DynamicBudgetTableInner = forwardRef(
},
);

export default forwardRef((props, ref) => {
return (
<AutoSizer>
{({ width, height }) => (
<DynamicBudgetTableInner
ref={ref}
width={width}
height={height}
{...props}
/>
)}
</AutoSizer>
);
});
export default forwardRef<BudgetTable, DynamicBudgetTableInnerProps>(
(props, ref) => {
return (
<AutoSizer>
{({ width, height }) => (
<DynamicBudgetTableInner
ref={ref}
width={width}
height={height}
{...props}
/>
)}
</AutoSizer>
);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -382,6 +382,7 @@ class Budget extends Component {
onReorderGroup={this.onReorderGroup}
onOpenActionSheet={() => {}} //this.onOpenActionSheet}
onBudgetAction={applyBudgetAction}
onRefresh={onRefresh}
savePrefs={savePrefs}
/>
)}
Expand Down
156 changes: 80 additions & 76 deletions packages/desktop-client/src/components/budget/MobileBudgetTable.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import Label from '../common/Label';
import Menu from '../common/Menu';
import Text from '../common/Text';
import View from '../common/View';
import PullToRefresh from '../responsive/PullToRefresh';
import { useServerURL } from '../ServerContext';
import CellValue from '../spreadsheet/CellValue';
import NamespaceContext from '../spreadsheet/NamespaceContext';
Expand Down Expand Up @@ -1526,6 +1527,7 @@ export function BudgetTable(props) {
onShowBudgetDetails,
// onOpenActionSheet,
onBudgetAction,
onRefresh,
savePrefs,
} = props;

Expand Down Expand Up @@ -1742,83 +1744,85 @@ export function BudgetTable(props) {
</View>
</View>
<View style={{ overflowY: 'auto' }}>
{!editMode ? (
// <ScrollView
// ref={el => (this.list = el)}
// keyboardShouldPersistTaps="always"
// refreshControl={refreshControl}
// style={{ backgroundColor: colors.n10 }}
// automaticallyAdjustContentInsets={false}
// >
<View>
<BudgetGroups
type={type}
categoryGroups={categoryGroups}
showBudgetedCol={showBudgetedCol}
show3Cols={show3Cols}
showHiddenCategories={showHiddenCategories}
// gestures={gestures}
month={month}
editMode={editMode}
editingGroupId={editingGroupId}
onEditGroup={onEditGroup}
editingCategoryId={editingCategoryId}
onEditCategory={onEditCategory}
editingBudgetCategoryId={editingBudgetCategoryId}
onEditCategoryBudget={onEditCategoryBudget}
openBudgetActionMenuId={openBudgetActionMenuId}
onOpenBudgetActionMenu={onOpenBudgetActionMenu}
onSaveCategory={onSaveCategory}
onDeleteCategory={onDeleteCategory}
onAddCategory={onAddCategory}
onAddGroup={onAddGroup}
onSaveGroup={onSaveGroup}
onDeleteGroup={onDeleteGroup}
onReorderCategory={onReorderCategory}
onReorderGroup={onReorderGroup}
onBudgetAction={onBudgetAction}
/>
</View>
) : (
// </ScrollView>
// <DragDrop>
// {({
// dragging,
// onGestureEvent,
// onHandlerStateChange,
// scrollRef,
// onScroll
// }) => (
<View>
<BudgetGroups
type={type}
categoryGroups={categoryGroups}
showBudgetedCol={showBudgetedCol}
show3Cols={show3Cols}
showHiddenCategories={showHiddenCategories}
// gestures={gestures}
editMode={editMode}
editingGroupId={editingGroupId}
onEditGroup={onEditGroup}
editingCategoryId={editingCategoryId}
onEditCategory={onEditCategory}
editingBudgetCategoryId={editingBudgetCategoryId}
onEditCategoryBudget={onEditCategoryBudget}
onSaveCategory={onSaveCategory}
onDeleteCategory={onDeleteCategory}
onAddCategory={onAddCategory}
onAddGroup={onAddGroup}
onSaveGroup={onSaveGroup}
onDeleteGroup={onDeleteGroup}
onReorderCategory={onReorderCategory}
onReorderGroup={onReorderGroup}
onBudgetAction={onBudgetAction}
/>
</View>
<PullToRefresh onRefresh={onRefresh}>
{!editMode ? (
// <ScrollView
// ref={el => (this.list = el)}
// keyboardShouldPersistTaps="always"
// refreshControl={refreshControl}
// style={{ backgroundColor: colors.n10 }}
// automaticallyAdjustContentInsets={false}
// >
<View>
<BudgetGroups
type={type}
categoryGroups={categoryGroups}
showBudgetedCol={showBudgetedCol}
show3Cols={show3Cols}
showHiddenCategories={showHiddenCategories}
// gestures={gestures}
month={month}
editMode={editMode}
editingGroupId={editingGroupId}
onEditGroup={onEditGroup}
editingCategoryId={editingCategoryId}
onEditCategory={onEditCategory}
editingBudgetCategoryId={editingBudgetCategoryId}
onEditCategoryBudget={onEditCategoryBudget}
openBudgetActionMenuId={openBudgetActionMenuId}
onOpenBudgetActionMenu={onOpenBudgetActionMenu}
onSaveCategory={onSaveCategory}
onDeleteCategory={onDeleteCategory}
onAddCategory={onAddCategory}
onAddGroup={onAddGroup}
onSaveGroup={onSaveGroup}
onDeleteGroup={onDeleteGroup}
onReorderCategory={onReorderCategory}
onReorderGroup={onReorderGroup}
onBudgetAction={onBudgetAction}
/>
</View>
) : (
// </ScrollView>
// <DragDrop>
// {({
// dragging,
// onGestureEvent,
// onHandlerStateChange,
// scrollRef,
// onScroll
// }) => (
<View>
<BudgetGroups
type={type}
categoryGroups={categoryGroups}
showBudgetedCol={showBudgetedCol}
show3Cols={show3Cols}
showHiddenCategories={showHiddenCategories}
// gestures={gestures}
editMode={editMode}
editingGroupId={editingGroupId}
onEditGroup={onEditGroup}
editingCategoryId={editingCategoryId}
onEditCategory={onEditCategory}
editingBudgetCategoryId={editingBudgetCategoryId}
onEditCategoryBudget={onEditCategoryBudget}
onSaveCategory={onSaveCategory}
onDeleteCategory={onDeleteCategory}
onAddCategory={onAddCategory}
onAddGroup={onAddGroup}
onSaveGroup={onSaveGroup}
onDeleteGroup={onDeleteGroup}
onReorderCategory={onReorderCategory}
onReorderGroup={onReorderGroup}
onBudgetAction={onBudgetAction}
/>
</View>

// <DragDropHighlight />
// </DragDrop>
)}
// <DragDropHighlight />
// </DragDrop>
)}
</PullToRefresh>
</View>
</View>
</NamespaceContext.Provider>
Expand Down
Loading

0 comments on commit c0cc2e9

Please sign in to comment.