Skip to content

Commit

Permalink
revert changes
Browse files Browse the repository at this point in the history
  • Loading branch information
carkom committed Jan 22, 2024
1 parent d49d3dd commit 493f92c
Show file tree
Hide file tree
Showing 9 changed files with 56 additions and 436 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -597,7 +597,7 @@ export function AppliedFilters({
onUpdateChange,

Check warning on line 597 in packages/desktop-client/src/components/filters/FiltersMenu.jsx

View workflow job for this annotation

GitHub Actions / lint

'onUpdateChange' is defined but never used
}) {
const onUpdateAppliedFilter = (filter, newFilter) => {
onUpdateChange?.(null, 'modify');
//onUpdateChange?.(null, 'modify');
return onUpdate(filter, newFilter);
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@ const startDate = monthUtils.subMonths(monthUtils.currentMonth(), 5);
const endDate = monthUtils.currentMonth();
const categories = useCategories();

Check failure on line 13 in packages/desktop-client/src/components/reports/ReportOptions.ts

View workflow job for this annotation

GitHub Actions / lint

React Hook "useCategories" cannot be called at the top level. React Hooks must be called in a React function component or a custom React Hook function
const selectAll: CategoryEntity[] = [];
categories.grouped.map(categoryGroup =>
categoryGroup.categories &&
categoryGroup.categories.map(category => selectAll.push(category)),
categories.grouped.map(
categoryGroup =>
categoryGroup.categories &&
categoryGroup.categories.map(category => selectAll.push(category)),
);

export const defaultReport: CustomReportEntity = {
Expand Down
34 changes: 11 additions & 23 deletions packages/desktop-client/src/components/reports/ReportSidebar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,8 @@ export function ReportSidebar({
setSelectedCategories,
onChangeDates,
onChangeViews,
onReportChange,
}) {
const onSelectRange = cond => {
onReportChange(null, 'modify');
setDateRange(cond);
switch (cond) {
case 'All time':
Expand Down Expand Up @@ -75,7 +73,6 @@ export function ReportSidebar({
};

const onChangeMode = cond => {
onReportChange(null, 'modify');
setMode(cond);
if (cond === 'time') {
if (customReportItems.graphType === 'TableGraph') {
Expand Down Expand Up @@ -106,7 +103,6 @@ export function ReportSidebar({
};

const onChangeSplit = cond => {
onReportChange(null, 'modify');
setGroupBy(cond);
if (customReportItems.mode === 'total') {
if (customReportItems.graphType !== 'TableGraph') {
Expand All @@ -124,7 +120,7 @@ export function ReportSidebar({
};

const onChangeBalanceType = cond => {
onReportChange(null, 'modify');
//onReportChange(null, 'modify');
setBalanceType(cond);
};

Expand Down Expand Up @@ -256,10 +252,7 @@ export function ReportSidebar({
id="show-empty-columns"
checked={customReportItems.showEmpty}
value={customReportItems.showEmpty}
onChange={() => {
setShowEmpty(!customReportItems.showEmpty);
onReportChange(null, 'modify');
}}
onChange={() => setShowEmpty(!customReportItems.showEmpty)}
/>
<label
htmlFor="show-empty-columns"
Expand All @@ -284,7 +277,6 @@ export function ReportSidebar({
value={customReportItems.showOffBudget}
onChange={() => {
setShowOffBudget(!customReportItems.showOffBudget);
onReportChange(null, 'modify');
}}
/>
<label
Expand All @@ -308,10 +300,9 @@ export function ReportSidebar({
id="show-uncategorized"
checked={customReportItems.showUncategorized}
value={customReportItems.showUncategorized}
onChange={() => {
setShowUncategorized(!customReportItems.showUncategorized);
onReportChange(null, 'modify');
}}
onChange={() =>
setShowUncategorized(!customReportItems.showUncategorized)
}
/>
<label
htmlFor="show-uncategorized"
Expand Down Expand Up @@ -358,7 +349,6 @@ export function ReportSidebar({
customReportItems.startDate,
customReportItems.endDate,
);
onReportChange(null, 'modify');
}}
>
Static
Expand Down Expand Up @@ -400,16 +390,15 @@ export function ReportSidebar({
From:
</Text>
<Select
onChange={newValue => {
onChange={newValue =>
onChangeDates(
...validateStart(
allMonths,
newValue,
customReportItems.endDate,
),
);
onReportChange(null, 'modify');
}}
)
}
value={customReportItems.startDate}
defaultLabel={monthUtils.format(
customReportItems.startDate,
Expand All @@ -429,16 +418,15 @@ export function ReportSidebar({
To:
</Text>
<Select
onChange={newValue => {
onChange={newValue =>
onChangeDates(
...validateEnd(
allMonths,
customReportItems.startDate,
newValue,
),
);
onReportChange(null, 'modify');
}}
)
}
value={customReportItems.endDate}
options={allMonths.map(({ name, pretty }) => [name, pretty])}
/>
Expand Down
28 changes: 3 additions & 25 deletions packages/desktop-client/src/components/reports/ReportTopbar.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ import { View } from '../common/View';
import { FilterButton } from '../filters/FiltersMenu';

import { GraphButton } from './GraphButton';
import { SaveReport } from './SaveReport';
import { SaveReportMenuButton } from './SaveReport';

export function ReportTopbar({
customReportItems,
report,
savedStatus,
setGraphType,
setTypeDisabled,
setBalanceType,
Expand All @@ -29,8 +27,6 @@ export function ReportTopbar({
viewLabels,
onApplyFilter,
onChangeViews,
onReportChange,
onResetReports,
}) {
return (
<View
Expand All @@ -45,7 +41,6 @@ export function ReportTopbar({
selected={customReportItems.graphType === 'TableGraph'}
title="Data Table"
onSelect={() => {
onReportChange(null, 'modify');
setGraphType('TableGraph');
onChangeViews('viewLegend', false);
setTypeDisabled([]);
Expand All @@ -63,7 +58,6 @@ export function ReportTopbar({
customReportItems.graphType === 'StackedBarGraph'
}
onSelect={() => {
onReportChange(null, 'modify');
if (customReportItems.mode === 'total') {
setGraphType('BarGraph');
if (['Net'].includes(customReportItems.balanceType)) {
Expand All @@ -88,7 +82,6 @@ export function ReportTopbar({
title="Area Graph"
selected={customReportItems.graphType === 'AreaGraph'}
onSelect={() => {
onReportChange(null, 'modify');
setGraphType('AreaGraph');
setGroupBy('Month');
onChangeViews('viewLegend', false);
Expand All @@ -103,7 +96,6 @@ export function ReportTopbar({
title="Donut Graph"
selected={customReportItems.graphType === 'DonutGraph'}
onSelect={() => {
onReportChange(null, 'modify');
setGraphType('DonutGraph');
setTypeDisabled(['Net']);
setBalanceType('Payment');
Expand All @@ -125,7 +117,6 @@ export function ReportTopbar({
<GraphButton
selected={viewLegend}
onSelect={() => {
onReportChange(null, 'modify');
onChangeViews('viewLegend');
}}
style={{ marginRight: 15 }}
Expand Down Expand Up @@ -168,22 +159,9 @@ export function ReportTopbar({
flexShrink: 0,
}}
/>
<FilterButton
compact
hover
onApply={e => {
onApplyFilter(e);
onReportChange(null, 'modify');
}}
/>
<FilterButton onApply={onApplyFilter} compact hover />
<View style={{ flex: 1 }} />
<SaveReport
customReportItems={customReportItems}
report={report}
savedStatus={savedStatus}
onReportChange={onReportChange}
onResetReports={onResetReports}
/>
<SaveReportMenuButton />
</View>
);
}
Loading

0 comments on commit 493f92c

Please sign in to comment.