Skip to content

Commit

Permalink
merge fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
carkom committed Feb 3, 2024
1 parent 2d5151b commit da0f587
Show file tree
Hide file tree
Showing 7 changed files with 13 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -412,4 +412,4 @@ export function FilterEditor({ field, op, value, options, onSave, onClose }) {
}}
/>
);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,9 @@ import {
type CategoryGroupEntity,
type PayeeEntity,
} from 'loot-core/src/types/models';
import { useCategories } from '../../hooks/useCategories';

const startDate = monthUtils.subMonths(monthUtils.currentMonth(), 5);
const endDate = monthUtils.currentMonth();
const categories = useCategories();
const selectAll: CategoryEntity[] = [];
categories.grouped.map(categoryGroup =>
categoryGroup.categories &&
categoryGroup.categories.map(category => selectAll.push(category)),
);

export const defaultReport: CustomReportEntity = {
id: undefined,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -279,18 +279,18 @@ export function ReportSidebar({
setShowHiddenCategories(
!customReportItems.showHiddenCategories,
);
onReportChange(null, 'modify');
onReportChange(null, 'modify');
} else if (type === 'show-off-budget') {
setShowOffBudget(!customReportItems.showOffBudget);
onReportChange(null, 'modify');
onReportChange(null, 'modify');
} else if (type === 'show-empty-items') {
setShowEmpty(!customReportItems.showEmpty);
onReportChange(null, 'modify');
onReportChange(null, 'modify');
} else if (type === 'show-uncategorized') {
setShowUncategorized(
!customReportItems.showUncategorized,
);
onReportChange(null, 'modify');
onReportChange(null, 'modify');
}
}}
items={[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { createRef, useState } from 'react';

import { v4 as uuidv4 } from 'uuid';

import { send, sendCatch } from 'loot-core/src/platform/client/fetch';
//import { send, sendCatch } from 'loot-core/src/platform/client/fetch';
import { type CustomReportEntity } from 'loot-core/src/types/models';

import { SvgExpandArrow } from '../../icons/v0';
Expand Down Expand Up @@ -35,7 +35,6 @@ export function SaveReport({
const [err, setErr] = useState(null);
const [name, setName] = useState(report.name);
const inputRef = createRef<HTMLInputElement>();
const id = report.id;

const onAddUpdate = async () => {
let savedReport: CustomReportEntity;
Expand All @@ -61,7 +60,6 @@ export function SaveReport({
}

if (menuItem === 'rename-report') {
//rename or update flow
//rename
savedReport = {
...report,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { RefObject, useEffect } from 'react';
import React, { type RefObject, useEffect } from 'react';

import { theme } from '../../style';
import { Button } from '../common/Button';
Expand Down
8 changes: 5 additions & 3 deletions packages/loot-core/src/client/data-hooks/reports.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,11 @@ export function useReports(): CustomReportEntity[] {
/** Sort reports by alphabetical order */
function sort(reports: CustomReportEntity[]) {
return reports.sort((a, b) =>
a.name
.trim()
.localeCompare(b.name.trim(), undefined, { ignorePunctuation: true }),
a.name && b.name
? a.name.trim().localeCompare(b.name.trim(), undefined, {
ignorePunctuation: true,
})
: 0,
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/loot-core/src/types/models/reports.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { type RuleConditionEntity } from './rule';

export interface CustomReportEntity {
id: string | undefined;
name: string;
name: string | undefined;
startDate: string;
endDate: string;
isDateStatic: boolean;
Expand Down

0 comments on commit da0f587

Please sign in to comment.