Skip to content

Commit

Permalink
Merge branch 'master' into matiss/fix-2091
Browse files Browse the repository at this point in the history
  • Loading branch information
MatissJanis authored Apr 2, 2024
2 parents 6fcde53 + 2a1c452 commit 82e97f8
Show file tree
Hide file tree
Showing 59 changed files with 211 additions and 280 deletions.
2 changes: 1 addition & 1 deletion packages/api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@actual-app/api",
"version": "6.6.0",
"version": "6.7.0",
"license": "MIT",
"description": "An API for Actual",
"engines": {
Expand Down
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": "24.3.0",
"version": "24.4.0",
"license": "MIT",
"files": [
"build"
Expand Down
14 changes: 13 additions & 1 deletion packages/desktop-client/src/components/accounts/Account.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -800,7 +800,8 @@ class AccountInternal extends PureComponent {
};

onBatchEdit = async (name, ids) => {
const onChange = async (name, value) => {
const onChange = async (name, value, mode) => {
const newValue = value === null ? '' : value;
this.setState({ workingHard: true });

const { data } = await runQuery(
Expand Down Expand Up @@ -834,6 +835,17 @@ class AccountInternal extends PureComponent {
return;
}

if (name === 'notes') {
if (mode === 'prepend') {
value =
trans.notes === null ? newValue : newValue + ' ' + trans.notes;
} else if (mode === 'append') {
value =
trans.notes === null ? newValue : trans.notes + ' ' + newValue;
} else if (mode === 'replace') {
value = newValue;
}
}
const transaction = {
...trans,
[name]: value,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,6 @@ export function AccountItem({
const narrowStyle = isNarrowWidth
? {
...styles.mobileMenuItem,
color: theme.menuItemText,
borderRadius: 0,
borderTop: `1px solid ${theme.pillBorder}`,
}
Expand Down Expand Up @@ -211,9 +210,7 @@ export function AccountItem({
className={`${className} ${css([
{
backgroundColor: highlighted
? embedded && isNarrowWidth
? theme.menuItemBackgroundHover
: theme.menuAutoCompleteBackgroundHover
? theme.menuAutoCompleteBackgroundHover
: 'transparent',
padding: 4,
paddingLeft: 20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ function SplitTransactionButton({
style,
...props
}: SplitTransactionButtonProps) {
const { isNarrowWidth } = useResponsive();
return (
<View
// Downshift calls `setTimeout(..., 250)` in the `onMouseMove`
Expand All @@ -254,9 +253,7 @@ function SplitTransactionButton({
role="button"
style={{
backgroundColor: highlighted
? embedded && isNarrowWidth
? theme.menuItemBackgroundHover
: theme.menuAutoCompleteBackgroundHover
? theme.menuAutoCompleteBackgroundHover
: 'transparent',
borderRadius: embedded ? 4 : 0,
flexShrink: 0,
Expand Down Expand Up @@ -312,7 +309,6 @@ export function CategoryItem({
const narrowStyle = isNarrowWidth
? {
...styles.mobileMenuItem,
color: theme.menuItemText,
borderRadius: 0,
borderTop: `1px solid ${theme.pillBorder}`,
}
Expand All @@ -326,9 +322,7 @@ export function CategoryItem({
className={`${className} ${css([
{
backgroundColor: highlighted
? embedded && isNarrowWidth
? theme.menuItemBackgroundHover
: theme.menuAutoCompleteBackgroundHover
? theme.menuAutoCompleteBackgroundHover
: 'transparent',
padding: 4,
paddingLeft: 20,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -427,9 +427,7 @@ export function CreatePayeeButton({
fontWeight: 500,
padding: '6px 9px',
backgroundColor: highlighted
? embedded && isNarrowWidth
? theme.menuItemBackgroundHover
: theme.menuAutoCompleteBackgroundHover
? theme.menuAutoCompleteBackgroundHover
: 'transparent',
':active': {
backgroundColor: 'rgba(100, 100, 100, .25)',
Expand Down Expand Up @@ -484,7 +482,6 @@ export function PayeeItem({
const narrowStyle = isNarrowWidth
? {
...styles.mobileMenuItem,
color: theme.menuItemText,
borderRadius: 0,
borderTop: `1px solid ${theme.pillBorder}`,
}
Expand Down Expand Up @@ -517,9 +514,7 @@ export function PayeeItem({
className={`${className} ${css([
{
backgroundColor: highlighted
? embedded && isNarrowWidth
? theme.menuItemBackgroundHover
: theme.menuAutoCompleteBackgroundHover
? theme.menuAutoCompleteBackgroundHover
: 'transparent',
borderRadius: embedded ? 4 : 0,
padding: 4,
Expand Down
135 changes: 128 additions & 7 deletions packages/desktop-client/src/components/modals/EditField.jsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useState } from 'react';

import { parseISO, format as formatDate, parse as parseDate } from 'date-fns';

Expand Down Expand Up @@ -27,6 +27,7 @@ import {
CreatePayeeButton,
PayeeItem,
} from '../autocomplete/PayeeAutocomplete';
import { Button } from '../common/Button';
import { Input } from '../common/Input';
import { Modal } from '../common/Modal';
import { View } from '../common/View';
Expand All @@ -44,12 +45,18 @@ export function EditField({ modalProps, name, onSubmit, onClose }) {
const payees = usePayees();

const { createPayee } = useActions();

const onCloseInner = () => {
modalProps.onClose();
onClose?.();
};

function onSelectNote(value, mode) {
if (value != null) {
onSubmit(name, value, mode);
}
onCloseInner();
}

function onSelect(value) {
if (value != null) {
// Process the value if needed
Expand Down Expand Up @@ -80,6 +87,8 @@ export function EditField({ modalProps, name, onSubmit, onClose }) {
containerProps: { style: { height: isNarrowWidth ? '90vh' : 275 } },
};

const [noteAmend, onChangeMode] = useState('replace');

switch (name) {
case 'date': {
const today = currentDay();
Expand Down Expand Up @@ -201,11 +210,123 @@ export function EditField({ modalProps, name, onSubmit, onClose }) {
case 'notes':
label = 'Notes';
editor = (
<Input
focused={true}
onEnter={e => onSelect(e.target.value)}
style={inputStyle}
/>
<>
<View
style={{
flexDirection: 'row',
marginTop: 5,
marginBottom: 5,
marginLeft: 8,
marginRight: 4,
alignItems: 'center',
justifyContent: 'center',
}}
>
<Button
selected={noteAmend === 'prepend'}
style={{
padding: '5px 10px',
width: '33.33%',
backgroundColor: theme.menuBackground,
marginRight: 5,
fontSize: 'inherit',
...(noteAmend === 'prepend' && {
backgroundColor: theme.buttonPrimaryBackground,
color: theme.buttonPrimaryText,
':hover': {
backgroundColor: theme.buttonPrimaryBackgroundHover,
color: theme.buttonPrimaryTextHover,
},
}),
...(noteAmend !== 'prepend' && {
backgroundColor: theme.buttonNormalBackground,
color: theme.buttonNormalText,
':hover': {
backgroundColor: theme.buttonNormalBackgroundHover,
color: theme.buttonNormalTextHover,
},
}),
}}
onClick={() => {
onChangeMode('prepend');
document.getElementById('noteInput').focus();
}}
>
Prepend
</Button>
<Button
selected={noteAmend === 'replace'}
style={{
padding: '5px 10px',
width: '33.34%',
backgroundColor: theme.menuBackground,
marginRight: 5,
fontSize: 'inherit',
...(noteAmend === 'replace' && {
backgroundColor: theme.buttonPrimaryBackground,
color: theme.buttonPrimaryText,
':hover': {
backgroundColor: theme.buttonPrimaryBackgroundHover,
color: theme.buttonPrimaryTextHover,
},
}),
...(noteAmend !== 'replace' && {
backgroundColor: theme.buttonNormalBackground,
color: theme.buttonNormalText,
':hover': {
backgroundColor: theme.buttonNormalBackgroundHover,
color: theme.buttonNormalTextHover,
},
}),
}}
onClick={() => {
onChangeMode('replace');
document.getElementById('noteInput').focus();
}}
>
Replace
</Button>
<Button
selected={noteAmend === 'append'}
style={{
padding: '5px 10px',
width: '33.33%',
backgroundColor: theme.menuBackground,
marginRight: 5,
fontSize: 'inherit',
...(noteAmend === 'append' && {
backgroundColor: theme.buttonPrimaryBackground,
color: theme.buttonPrimaryText,
':hover': {
backgroundColor: theme.buttonPrimaryBackgroundHover,
color: theme.buttonPrimaryTextHover,
},
}),
...(noteAmend !== 'append' && {
backgroundColor: theme.buttonNormalBackground,
color: theme.buttonNormalText,
':hover': {
backgroundColor: theme.buttonNormalBackgroundHover,
color: theme.buttonNormalTextHover,
},
}),
}}
onClick={() => {
onChangeMode('append');
document.getElementById('noteInput').focus();
}}
>
Append
</Button>
</View>
<Input
id="noteInput"
autoFocus
focused={true}
onEnter={e => onSelectNote(e.target.value, noteAmend)}
style={inputStyle}
/>
</>
);
break;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,10 +45,15 @@ export function CategorySelector({
filteredGroup(categoryGroup).map(category => selectAll.push(category)),
);

if (selectedCategories === undefined) {
selectedCategories = categoryGroups.flatMap(cg => cg.categories);
}

const selectedCategoryMap = useMemo(
() => selectedCategories.map(selected => selected.id),
[selectedCategories],
);

const allCategoriesSelected = selectAll.every(category =>
selectedCategoryMap.includes(category.id),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ import React from 'react';

import {
SvgCalculator,
SvgChart,
SvgChartBar,
SvgChartPie,
SvgListBullet,
SvgQueue,
SvgTag,
} from '../../icons/v1';
import { SvgChartArea } from '../../icons/v1/ChartArea';
import { theme } from '../../style';
import { View } from '../common/View';
import { FilterButton } from '../filters/FiltersMenu';
Expand Down Expand Up @@ -87,7 +87,7 @@ export function ReportTopbar({
style={{ marginRight: 15 }}
disabled={disabledItems('AreaGraph')}
>
<SvgChart width={15} height={15} />
<SvgChartArea width={15} height={15} />
</GraphButton>
<GraphButton
title="Donut Graph"
Expand Down
18 changes: 18 additions & 0 deletions packages/desktop-client/src/icons/v1/ChartArea.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import * as React from 'react';
import type { SVGProps } from 'react';
export const SvgChartArea = (props: SVGProps<SVGSVGElement>) => (
<svg
{...props}
xmlns="http://www.w3.org/2000/svg"
viewBox="0 0 20 20"
style={{
color: 'inherit',
...props.style,
}}
>
<path
d="M 2.5 13 C 2 13.5 2 13.5 2 14 V 15 C 2 16 2 16 3 16 L 17 16 C 18 16 18 16 18 15 V 8.5 C 18 8 18 8 17.5 7.5 L 16 6 C 15.5 5.6 15.5 5.6 15 6 L 11 10 C 10.5 10.25 10.5 10.25 10 10 L 8 9 C 7.5 8.7 7.5 8.7 7 9 z M 0 5 c 0 -1.1 0.9 -2 2 -2 h 16 a 2 2 0 0 1 2 2 v 12 a 2 2 0 0 1 -2 2 H 2 a 2 2 0 0 1 -2 -2 V 4 z"
fill="currentColor"
/>
</svg>
);
1 change: 1 addition & 0 deletions packages/desktop-client/src/icons/v1/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export { SvgBuoy } from './Buoy';
export { SvgCalculator } from './Calculator';
export { SvgCalendar } from './Calendar';
export { SvgCamera } from './Camera';
export { SvgChartArea } from './ChartArea';
export { SvgChartBar } from './ChartBar';
export { SvgChartPie } from './ChartPie';
export { SvgChart } from './Chart';
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-electron/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"author": "Actual",
"productName": "Actual",
"description": "A simple and powerful personal finance system",
"version": "24.3.0",
"version": "24.4.0",
"scripts": {
"clean": "rm -rf dist",
"update-client": "bin/update-client",
Expand Down
Loading

0 comments on commit 82e97f8

Please sign in to comment.