Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Save custom reports #1924

Closed
wants to merge 94 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
94 commits
Select commit Hold shift + click to select a range
e196a34
Reorganize and add graphs
carkom Sep 8, 2023
ed576f0
Merge remote-tracking branch 'upstream/master' into reportsOrganization
carkom Oct 12, 2023
0ea6036
Create Customizable Chart
carkom Oct 13, 2023
29cdc84
Notes
carkom Oct 13, 2023
b90ccc9
Hide Menu update Donut
carkom Oct 13, 2023
758f91b
lint fixes
carkom Oct 13, 2023
7a50264
Organize Menus
carkom Oct 13, 2023
a57f362
Change Title
carkom Oct 13, 2023
e032d66
UI changes
carkom Oct 14, 2023
0709edd
Merge branch 'master' into reportsOrganization
carkom Oct 14, 2023
8a1465e
Merge remote-tracking branch 'upstream/master' into reportsOrganization
carkom Oct 14, 2023
94dd8df
Merge branch 'reportsOrganization' of https://github.com/carkom/actua…
carkom Oct 14, 2023
9b64c00
UI updates
carkom Oct 14, 2023
014d4ea
Add Data Table
carkom Oct 16, 2023
1c83854
Functionality additions and Privacy Filters
carkom Oct 16, 2023
c6d4ebc
Merge branch 'master' into reportsOrganization
carkom Oct 16, 2023
175d88f
Date filters working and formatting changes
carkom Oct 17, 2023
2877942
Fix default spreadsheet and add tableGraph
carkom Oct 18, 2023
6a5d4f3
Integrate Summary Data and Split Legend
carkom Oct 18, 2023
a08df24
started adding functionality on charts
carkom Oct 19, 2023
6aa596b
Merge branch 'master' into reportsOrganization
carkom Oct 19, 2023
9518f5d
list fix
carkom Oct 19, 2023
a3eaf1e
Enabling more graphs, fixing errors
carkom Oct 20, 2023
053c419
Legend, interactions, Empty Rows Filter
carkom Oct 20, 2023
b2d14d7
fixes for EmptyRows/interactions/legends
carkom Oct 21, 2023
318f016
formatting UI and filtering data
carkom Oct 21, 2023
578d2de
format date
carkom Oct 21, 2023
f87255e
Merge branch 'master' into reportsOrganization
carkom Oct 21, 2023
15448b3
fix errors
carkom Oct 21, 2023
b40ba7b
Fix Legend Order
carkom Oct 22, 2023
47557d9
lint fixes
carkom Oct 22, 2023
f5fbbce
Add tooltips
carkom Oct 22, 2023
cde6193
Feature Flag
carkom Oct 22, 2023
a432aae
Merge branch 'master' into reportsOrganization
carkom Oct 24, 2023
7d99b30
fix overview card, fix offbudget checkbox
carkom Oct 24, 2023
4de4996
Revamped dataType, added scrollBars
carkom Oct 25, 2023
2d492e1
data display adjustments
carkom Oct 26, 2023
47058b1
data spreadsheet updates/groups added to matrix
carkom Oct 27, 2023
80d08c6
Add Category Selector
carkom Oct 28, 2023
6953a0d
Add Labels Button
carkom Oct 28, 2023
69db103
formatting fixes
carkom Oct 28, 2023
a9e414d
Add Averages to dataTable
carkom Oct 28, 2023
d367884
data bug fix
carkom Oct 28, 2023
54f8cf2
Added all type back in with exceptions
carkom Oct 29, 2023
de892a4
formatting
carkom Oct 29, 2023
443fce0
Merge branch 'master' into reportsOrganization
carkom Oct 31, 2023
d887a44
split assets/debts, add Uncategorized
carkom Oct 31, 2023
f2dd6d8
bug fixes and UI updates
carkom Oct 31, 2023
8df59c0
add scrollbars to table
carkom Oct 31, 2023
7790fd6
Merge branch 'master' into reportsOrganization
carkom Oct 31, 2023
e698f1c
formatting dataTable
carkom Nov 1, 2023
e7093aa
tooltips, navigation and graph labels
carkom Nov 3, 2023
c0cc2e9
Merge branch 'master' into reportsOrganization
carkom Nov 5, 2023
5d05239
Merge branch 'master' into reportsOrganization
carkom Nov 6, 2023
f7b1cc9
Code clean-up and re-org
carkom Nov 6, 2023
a20d18a
revert color change
carkom Nov 6, 2023
0df6f8e
Change labels name
carkom Nov 7, 2023
4a70b46
SaveReports
carkom Nov 8, 2023
92e8092
Merge branch 'reportsOrganization' into saveReports
carkom Nov 8, 2023
2acc968
setup menu and catch elements
carkom Nov 8, 2023
331febe
creating cards for overview
carkom Nov 10, 2023
3fa193a
organize files
carkom Nov 11, 2023
a8ffc0d
Merge branch 'master' into reportsOrganization
carkom Nov 11, 2023
2dde53d
code cleanup
carkom Nov 13, 2023
aa7ac72
Tooltip Colors
carkom Nov 13, 2023
4728537
Descoping legend for future PR
carkom Nov 13, 2023
9e3364f
descope legend & rename split
carkom Nov 14, 2023
8699335
rename type variable to be more descriptive
carkom Nov 14, 2023
32da839
Merge remote-tracking branch 'upstream/master' into reportsOrganization
carkom Nov 14, 2023
4d3bb9f
adjustments for sankey and eslint merges
carkom Nov 14, 2023
6d42ece
notes update
carkom Nov 14, 2023
3f82ccb
code review fixes
carkom Nov 15, 2023
64d672f
Merge branch 'master' into reportsOrganization
carkom Nov 15, 2023
a77aa2e
Merge branch 'reportsOrganization' into saveReports
carkom Nov 15, 2023
a1c3abf
adjustments for merges
carkom Nov 15, 2023
4ff5d97
Pass Report from Card
carkom Nov 16, 2023
36112d9
Merge remote-tracking branch 'upstream/master' into saveReports
carkom Nov 16, 2023
8a23481
Merge branch 'base-Stable' into saveReports
carkom Nov 16, 2023
f102925
Merge remote-tracking branch 'upstream/master' into saveReports
carkom Nov 16, 2023
89774ac
Recalling Saved Report
carkom Nov 16, 2023
27fd47c
organize reports into grid layout
carkom Nov 17, 2023
3934aee
All menu items working
carkom Nov 17, 2023
4acc19d
Overview List menu button
carkom Nov 17, 2023
1f5e864
configure all graphTypes on Overview page
carkom Nov 17, 2023
e297316
save selected categories
carkom Nov 17, 2023
d0b1f40
clean-up
carkom Nov 17, 2023
3230ac2
create table card view
carkom Nov 17, 2023
8e5c183
format table card
carkom Nov 17, 2023
ccb2d4d
add interval and colors to migration
carkom Nov 18, 2023
b5363e9
notes
carkom Nov 18, 2023
1767827
lint fix
carkom Nov 18, 2023
6fb0601
VRT updates
carkom Nov 18, 2023
a05eca1
db changes
carkom Dec 12, 2023
257cf46
match db updates
carkom Dec 14, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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.
3 changes: 3 additions & 0 deletions packages/desktop-client/src/components/common/AnchorLink.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,22 @@ type AnchorLinkProps = {
style?: CSSProperties;
activeStyle?: CSSProperties;
children?: ReactNode;
report?: [];
};

export default function AnchorLink({
to,
style,
activeStyle,
children,
report,
}: AnchorLinkProps) {
let match = useMatch({ path: to });

return (
<NavLink
to={to}
state={report ? { report: report } : {}}
className={`${css([
styles.smallText,
style,
Expand Down
15 changes: 7 additions & 8 deletions packages/desktop-client/src/components/common/Menu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ type MenuItem = {
disabled?: boolean;
icon?;
iconSize?: number;
text: string;
text?: string;
key?: string;
};

type MenuProps = {
header?: ReactNode;
footer?: ReactNode;
items: Array<MenuItem | typeof Menu.line>;
items: Array<MenuItem>;
onMenuSelect: (itemName: MenuItem['name']) => void;
};

Expand All @@ -56,7 +56,7 @@ export default function Menu({

let onKeyDown = e => {
let filteredItems = items.filter(
item => item && item !== Menu.line && item.type !== Menu.label,
item => item && item.type !== Menu.line && item.type !== Menu.label,
);
let currentIndex = filteredItems.indexOf(items[hoveredIndex]);

Expand Down Expand Up @@ -84,7 +84,7 @@ export default function Menu({
case 'Enter':
e.preventDefault();
const item = items[hoveredIndex];
if (hoveredIndex !== null && item !== Menu.line) {
if (hoveredIndex !== null && item.type !== Menu.line) {
onMenuSelect?.(item.name);
}
break;
Expand All @@ -107,7 +107,7 @@ export default function Menu({
>
{header}
{items.map((item, idx) => {
if (item === Menu.line) {
if (item.type === Menu.line) {
return (
<View key={idx} style={{ margin: '3px 0px' }}>
<View style={{ borderTop: '1px solid ' + theme.menuBorder }} />
Expand Down Expand Up @@ -142,7 +142,7 @@ export default function Menu({
padding: '9px 10px',
marginTop:
idx === 0 ||
lastItem === Menu.line ||
lastItem.type === Menu.line ||
lastItem.type === Menu.label
? 0
: -3,
Expand Down Expand Up @@ -182,6 +182,5 @@ export default function Menu({
);
}

const MenuLine: unique symbol = Symbol('menu-line');
Menu.line = MenuLine;
Menu.line = Symbol('menu-line');
Menu.label = Symbol('menu-label');
4 changes: 2 additions & 2 deletions packages/desktop-client/src/components/common/MenuButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ import DotsHorizontalTriple from '../../icons/v1/DotsHorizontalTriple';

import Button from './Button';

export default function MenuButton({ onClick }) {
export default function MenuButton({ onClick, style }) {
return (
<Button type="bare" onClick={onClick} aria-label="Menu">
<Button type="bare" onClick={onClick} aria-label="Menu" style={style}>
<DotsHorizontalTriple
width={15}
height={15}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function FilterMenu({ onClose, filterId, onFilterMenuSelect }) {
? [
{ name: 'rename-filter', text: 'Rename' },
{ name: 'delete-filter', text: 'Delete' },
Menu.line,
{ name: 'menu-line', type: Menu.line },
{
name: 'save-filter',
text: 'Save new filter',
Expand All @@ -47,7 +47,7 @@ function FilterMenu({ onClose, filterId, onFilterMenuSelect }) {
{ name: 'update-filter', text: 'Update condtions' },
{ name: 'reload-filter', text: 'Revert changes' },
{ name: 'delete-filter', text: 'Delete' },
Menu.line,
{ name: 'menu-line', type: Menu.line },
{ name: 'save-filter', text: 'Save new filter' },
{ name: 'clear-filter', text: 'Clear all conditions' },
]),
Expand Down Expand Up @@ -197,7 +197,7 @@ function SavedFilterMenuButton({
}
};

async function onAddUpdate() {
const onAddUpdate = async () => {
if (adding) {
//create new flow
savedFilter = {
Expand Down Expand Up @@ -233,7 +233,7 @@ function SavedFilterMenuButton({
setNameOpen(false);
onReloadSavedFilter(savedFilter);
}
}
};

return (
<View>
Expand Down
2 changes: 1 addition & 1 deletion packages/desktop-client/src/components/payees/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ function PayeeMenu({ payeesById, selectedPayees, onDelete, onMerge, onClose }) {
text: 'Merge',
disabled: isDisabled || selectedPayees.size < 2,
},
Menu.line,
{ name: 'menu-line', type: Menu.line },
]}
/>
</Tooltip>
Expand Down
82 changes: 35 additions & 47 deletions packages/desktop-client/src/components/reports/ChooseGraph.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,19 @@
import React from 'react';

import View from '../common/View';

import AreaGraph from './graphs/AreaGraph';
import BarGraph from './graphs/BarGraph';
import BarLineGraph from './graphs/BarLineGraph';
import DonutGraph from './graphs/DonutGraph';
import LineGraph from './graphs/LineGraph';
import StackedBarGraph from './graphs/StackedBarGraph';
import TableGraph from './graphs/TableGraph';
import { ReportOptions } from './ReportOptions';
import ReportTable from './ReportTable';
import ReportTableHeader from './ReportTableHeader';
import ReportTableList from './ReportTableList';
import ReportTableTotals from './ReportTableTotals';

export function ChooseGraph({
start,
end,
compact,
style,
data,
mode,
graphType,
Expand All @@ -25,18 +22,21 @@ export function ChooseGraph({
empty,
scrollWidth,
setScrollWidth,
months,
}) {
const graphStyle = compact ? { ...style } : { flexGrow: 1 };

function saveScrollWidth(parent, child) {
let width = parent > 0 && child > 0 && parent - child;

setScrollWidth(!width ? 0 : width);
if (setScrollWidth) {
setScrollWidth(!width ? 0 : width);
}
}

if (graphType === 'AreaGraph') {
return (
<AreaGraph
style={{ flexGrow: 1 }}
style={graphStyle}
compact={compact}
start={start}
end={end}
data={data}
Expand All @@ -47,7 +47,8 @@ export function ChooseGraph({
if (graphType === 'BarGraph') {
return (
<BarGraph
style={{ flexGrow: 1 }}
style={graphStyle}
compact={compact}
start={start}
end={end}
data={data}
Expand All @@ -60,17 +61,19 @@ export function ChooseGraph({
if (graphType === 'BarLineGraph') {
return (
<BarLineGraph
style={{ flexGrow: 1 }}
style={graphStyle}
compact={compact}
start={start}
end={end}
graphData={data.graphData}
graphData={data}
/>
);
}
if (graphType === 'DonutGraph') {
return (
<DonutGraph
style={{ flexGrow: 1 }}
style={graphStyle}
compact={compact}
start={start}
end={end}
data={data}
Expand All @@ -83,17 +86,19 @@ export function ChooseGraph({
if (graphType === 'LineGraph') {
return (
<LineGraph
style={{ flexGrow: 1 }}
style={graphStyle}
compact={compact}
start={start}
end={end}
graphData={data.graphData}
graphData={data}
/>
);
}
if (graphType === 'StackedBarGraph') {
return (
<StackedBarGraph
style={{ flexGrow: 1 }}
style={graphStyle}
compact={compact}
start={start}
end={end}
data={data}
Expand All @@ -103,36 +108,19 @@ export function ChooseGraph({
}
if (graphType === 'TableGraph') {
return (
<View
style={{
overflow: 'auto',
}}
>
<ReportTableHeader
interval={mode === 'time' && months}
scrollWidth={scrollWidth}
groupBy={groupBy}
balanceType={balanceType}
/>
<ReportTable saveScrollWidth={saveScrollWidth}>
<ReportTableList
data={data}
empty={empty}
monthsCount={months.length}
balanceTypeOp={ReportOptions.balanceTypeMap.get(balanceType)}
mode={mode}
groupBy={groupBy}
/>
<ReportTableTotals
scrollWidth={scrollWidth}
data={data}
mode={mode}
balanceTypeOp={ReportOptions.balanceTypeMap.get(balanceType)}
monthsCount={months.length}
balanceType={balanceType}
/>
</ReportTable>
</View>
<TableGraph
mode={mode}
start={start}
end={end}
scrollWidth={scrollWidth}
saveScrollWidth={saveScrollWidth}
balanceType={balanceType}
style={style}
data={data}
groupBy={groupBy}
empty={empty}
compact={compact}
/>
);
}
}
7 changes: 7 additions & 0 deletions packages/desktop-client/src/components/reports/Convert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
export default function Convert(item) {
if (Number.isInteger(item)) {
return item === 1 ? true : false;
} else {
return item ? 1 : 0;
}
}
38 changes: 30 additions & 8 deletions packages/desktop-client/src/components/reports/Overview.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
import React from 'react';
import { useSelector } from 'react-redux';

import { useReports } from 'loot-core/src/client/data-hooks/reports';

import useFeatureFlag from '../../hooks/useFeatureFlag';
import AnimatedLoading from '../../icons/AnimatedLoading';
import { styles } from '../../style';
import { theme, styles } from '../../style';
import View from '../common/View';

import Convert from './Convert';
import CashFlowCard from './reports/CashFlowCard';
import CategorySpendingCard from './reports/CategorySpendingCard';
import CustomReportCard from './reports/CustomReportCard';
import CustomReportListCards from './reports/CustomReportListCards';
import NetWorthCard from './reports/NetWorthCard';
import SankeyCard from './reports/SankeyCard';

Expand All @@ -27,13 +31,20 @@ export function LoadingIndicator() {
}

export default function Overview() {
let reports = useReports();
let categorySpendingReportFeatureFlag = useFeatureFlag(
'categorySpendingReport',
);
let sankeyFeatureFlag = useFeatureFlag('sankeyReport');

let customReportsFeatureFlag = useFeatureFlag('customReports');

const featureCount =
3 -
Convert(categorySpendingReportFeatureFlag) -
Convert(sankeyFeatureFlag) -
Convert(customReportsFeatureFlag);

let accounts = useSelector(state => state.queries.accounts);
return (
<View
Expand All @@ -59,14 +70,25 @@ export default function Overview() {
>
{categorySpendingReportFeatureFlag && <CategorySpendingCard />}
{sankeyFeatureFlag && <SankeyCard />}
{customReportsFeatureFlag ? (
<CustomReportCard />
) : (
<div style={{ flex: 1 }} />
)}
{!categorySpendingReportFeatureFlag && <div style={{ flex: 1 }} />}
{!sankeyFeatureFlag && <div style={{ flex: 1 }} />}
{customReportsFeatureFlag && <CustomReportCard />}
{featureCount !== 3 &&
[...Array(featureCount)].map((e, i) => (
<View key={i} style={{ padding: 15, flex: 1 }} />
))}
</View>
{customReportsFeatureFlag && (
<>
<View
style={{
height: 1,
backgroundColor: theme.sidebarBackground,
marginTop: 10,
flexShrink: 0,
}}
/>
<CustomReportListCards reports={reports} />
</>
)}
</View>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { theme } from '../../style';
import AnchorLink from '../common/AnchorLink';
import View from '../common/View';

export default function ReportCard({ flex, to, style, children }) {
export default function ReportCard({ flex, to, style, report, children }) {
const containerProps = { flex, margin: 15 };

const content = (
Expand Down Expand Up @@ -34,6 +34,7 @@ export default function ReportCard({ flex, to, style, children }) {
<AnchorLink
to={to}
style={{ textDecoration: 'none', flex, ...containerProps }}
report={report}
>
{content}
</AnchorLink>
Expand Down
Loading
Loading