Custom Reports Adjustments (#2659)

* monthly Spending

* Add Average

* notes

* title

* date filter

* TS fixes and hide average when no data

* fix average tooltip and relabel x-axis

* Wording/verbiage

* remove spending files

* adjustments

* reports.d revert

* revert filter changes

* adjust update filters

* notes

* remove old notes

* adjust style

* lint fixes
This commit is contained in:
Neil
2024-04-26 08:59:16 +01:00
committed by GitHub
parent 164dd399b0
commit d49f907f53
18 changed files with 44 additions and 27 deletions

View File

@@ -12,7 +12,7 @@ type AppliedFiltersProps = {
onUpdate: (
filter: RuleConditionEntity,
newFilter: RuleConditionEntity,
) => RuleConditionEntity;
) => void;
onDelete: (filter: RuleConditionEntity) => void;
conditionsOp: string;
onCondOpChange: (value: string, filters: RuleConditionEntity[]) => void;

View File

@@ -24,7 +24,7 @@ type FilterExpressionProps = {
value: string | string[] | number | boolean | undefined;
options: RuleConditionEntity['options'];
style?: CSSProperties;
onChange: (cond: RuleConditionEntity) => RuleConditionEntity;
onChange: (cond: RuleConditionEntity) => void;
onDelete: () => void;
};

View File

@@ -243,7 +243,7 @@ function ConfigureField({
);
}
export function FilterButton({ onApply, compact, hover }) {
export function FilterButton({ onApply, compact, hover, exclude }) {
const filters = useFilters();
const dateFormat = useDateFormat() || 'MM/dd/yyyy';
@@ -359,10 +359,12 @@ export function FilterButton({ onApply, compact, hover }) {
onMenuSelect={name => {
dispatch({ type: 'configure', field: name });
}}
items={filterFields.map(([name, text]) => ({
name,
text: titleFirst(text),
}))}
items={filterFields
.filter(f => (exclude ? !exclude.includes(f[0]) : true))
.map(([name, text]) => ({
name,
text: titleFirst(text),
}))}
/>
</Tooltip>
)}

View File

@@ -27,7 +27,7 @@ export function FiltersStack({
onUpdateFilter: (
filter: RuleConditionEntity,
newFilter: RuleConditionEntity,
) => RuleConditionEntity;
) => void;
onDeleteFilter: (filter: RuleConditionEntity) => void;
onClearFilters: () => void;
onReloadSavedFilter: (savedFilter: SavedFilter, value?: string) => void;

View File

@@ -2,15 +2,24 @@ import React from 'react';
import { integerToCurrency } from 'loot-core/src/shared/util';
import { theme, styles } from '../../style';
import { styles } from '../../style/styles';
import { theme } from '../../style/theme';
import { type CSSProperties } from '../../style/types';
import { Block } from '../common/Block';
export function Change({ amount }) {
export function Change({
amount,
style,
}: {
amount: number;
style?: CSSProperties;
}) {
return (
<Block
style={{
...styles.smallText,
color: amount < 0 ? theme.errorText : theme.noticeTextLight,
...style,
}}
>
{amount >= 0 ? '+' : ''}

View File

@@ -6,7 +6,7 @@ import { Button } from '../common/Button';
type ModeButtonProps = {
selected: boolean;
children: ReactNode;
style: CSSProperties;
style?: CSSProperties;
onSelect: MouseEventHandler<HTMLButtonElement>;
};

View File

@@ -8,8 +8,8 @@ import { View } from '../common/View';
type ReportCardProps = {
to: string;
report: CustomReportEntity;
children: ReactNode;
report?: CustomReportEntity;
flex?: string;
style?: CSSProperties;
};

View File

@@ -102,10 +102,7 @@ export function CashFlowCard() {
{data && (
<View style={{ textAlign: 'right' }}>
<PrivacyFilter activationFilters={[!isCardHovered]}>
<Change
amount={income - expenses}
style={{ color: theme.tableText, fontWeight: 300 }}
/>
<Change amount={income - expenses} />
</PrivacyFilter>
</View>
)}

View File

@@ -3,7 +3,7 @@ import React, { useState, useMemo, useCallback } from 'react';
import * as monthUtils from 'loot-core/src/shared/months';
import { integerToCurrency } from 'loot-core/src/shared/util';
import { theme, styles } from '../../../style';
import { styles } from '../../../style';
import { Block } from '../../common/Block';
import { View } from '../../common/View';
import { PrivacyFilter } from '../../PrivacyFilter';
@@ -59,10 +59,7 @@ export function NetWorthCard({ accounts }) {
</PrivacyFilter>
</Block>
<PrivacyFilter activationFilters={[!isCardHovered]}>
<Change
amount={data.totalChange}
style={{ color: theme.tableText, fontWeight: 300 }}
/>
<Change amount={data.totalChange} />
</PrivacyFilter>
</View>
)}

View File

@@ -110,7 +110,6 @@ export function createCustomSpreadsheet({
startDate,
endDate,
interval,
selectedCategories,
categoryFilter,
conditionsOpKey,
filters,
@@ -122,7 +121,6 @@ export function createCustomSpreadsheet({
startDate,
endDate,
interval,
selectedCategories,
categoryFilter,
conditionsOpKey,
filters,

View File

@@ -59,7 +59,6 @@ export function createGroupedSpreadsheet({
startDate,
endDate,
interval,
selectedCategories,
categoryFilter,
conditionsOpKey,
filters,
@@ -71,7 +70,6 @@ export function createGroupedSpreadsheet({
startDate,
endDate,
interval,
selectedCategories,
categoryFilter,
conditionsOpKey,
filters,

View File

@@ -8,7 +8,6 @@ export function makeQuery(
startDate: string,
endDate: string,
interval: string,
selectedCategories: CategoryEntity[],
categoryFilter: CategoryEntity[],
conditionsOpKey: string,
filters: unknown[],
@@ -27,7 +26,7 @@ export function makeQuery(
const query = q('transactions')
//Apply Category_Selector
.filter(
selectedCategories && {
categoryFilter && {
$or: [
{
category: null,
@@ -66,6 +65,7 @@ export function makeQuery(
{ date: intervalGroup },
{ category: { $id: '$category.id' } },
{ categoryHidden: { $id: '$category.hidden' } },
{ categoryIncome: { $id: '$category.is_income' } },
{ categoryGroup: { $id: '$category.group.id' } },
{ categoryGroupHidden: { $id: '$category.group.hidden' } },
{ account: { $id: '$account.id' } },

View File

@@ -188,5 +188,6 @@ export const pillBorderSelected = colorPalette.purple400;
export const reportsRed = colorPalette.red300;
export const reportsBlue = colorPalette.blue400;
export const reportsGreen = colorPalette.green400;
export const reportsLabel = pageText;
export const reportsInnerLabel = colorPalette.navy800;

View File

@@ -187,4 +187,6 @@ export const pillBorderSelected = colorPalette.purple500;
export const reportsRed = colorPalette.red300;
export const reportsBlue = colorPalette.blue400;
export const reportsGreen = colorPalette.green400;
export const reportsLabel = colorPalette.navy900;
export const reportsInnerLabel = colorPalette.navy800;

View File

@@ -190,5 +190,6 @@ export const pillBorderSelected = colorPalette.purple500;
export const reportsRed = colorPalette.red300;
export const reportsBlue = colorPalette.blue400;
export const reportsGreen = colorPalette.green400;
export const reportsLabel = colorPalette.navy900;
export const reportsInnerLabel = colorPalette.navy800;

View File

@@ -190,4 +190,6 @@ export const pillBorderSelected = colorPalette.purple300;
export const reportsRed = colorPalette.red300;
export const reportsBlue = colorPalette.blue400;
export const reportsGreen = colorPalette.green400;
export const reportsLabel = pageText;
export const reportsInnerLabel = colorPalette.navy800;

View File

@@ -347,6 +347,10 @@ export function getMonth(day: string): string {
return day.slice(0, 7);
}
export function getDay(day: string): number {
return Number(d.format(_parse(day), 'dd'));
}
export function getMonthEnd(day: string): string {
return subDays(nextMonth(day.slice(0, 7)) + '-01', 1);
}

View File

@@ -0,0 +1,6 @@
---
category: Maintenance
authors: [carkom]
---
Some slight adjustments to tidy up the code and make it work better. Some TS updates as well.