diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx index 4d380951f1d41292e342723a8ac278113f4d186a..9aa4e7a923c71768aad2897c84b9cc340bce71e8 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTable.tsx @@ -50,7 +50,7 @@ export function ReportTable({ }); const renderItem = useCallback( - ({ item, groupByItem, mode, style, monthsCount }) => { + ({ item, groupByItem, mode, style, monthsCount, compact }) => { return ( <ReportTableRow item={item} @@ -59,6 +59,7 @@ export function ReportTable({ mode={mode} style={style} monthsCount={monthsCount} + compact={compact} /> ); }, diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx index 7db0209fde0591b643a10dafbb92a4b6f41cb3b0..ea81dc5343814cad26668a827209e040ecb63186 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableHeader.tsx @@ -64,7 +64,7 @@ export function ReportTableHeader({ return ( <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} key={index} @@ -77,7 +77,7 @@ export function ReportTableHeader({ <> <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value="Deposits" @@ -85,7 +85,7 @@ export function ReportTableHeader({ /> <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value="Payments" @@ -95,7 +95,7 @@ export function ReportTableHeader({ )} <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value="Totals" @@ -103,7 +103,7 @@ export function ReportTableHeader({ /> <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value="Average" diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx index ca8c7621db00fa5e4e746ed19b67f00a450b8ffb..d961144b652e3ddcf984f08d497eab29915790d7 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableList.tsx @@ -30,8 +30,9 @@ export function ReportTableList({ index: number; parent_index?: number; style?: CSSProperties; + compact: boolean; }; - function RenderRow({ index, parent_index, style }: RenderRowProps) { + function RenderRow({ index, parent_index, style, compact }: RenderRowProps) { const item = parent_index === undefined ? data[index] @@ -43,6 +44,7 @@ export function ReportTableList({ mode, style, monthsCount, + compact, }); } @@ -55,6 +57,7 @@ export function ReportTableList({ <> <RenderRow index={index} + compact={compact} style={ item.categories && { color: theme.tableRowHeaderText, @@ -71,6 +74,7 @@ export function ReportTableList({ <RenderRow key={category.id} index={i} + compact={compact} parent_index={index} /> ); diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx index b0adffaa2dd885ffed52a961029c770c1a116123..4779f22dfffd4fa9d17c4ed80972e30ea31fc1c6 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableRow.tsx @@ -17,6 +17,7 @@ type ReportTableRowProps = { mode: string; style?: CSSProperties; monthsCount: number; + compact: boolean; }; export const ReportTableRow = memo( @@ -27,6 +28,7 @@ export const ReportTableRow = memo( mode, style, monthsCount, + compact, }: ReportTableRowProps) => { const average = amountToInteger(item[balanceTypeOp]) / monthsCount; return ( @@ -54,7 +56,7 @@ export const ReportTableRow = memo( <Cell key={amountToCurrency(month[balanceTypeOp])} style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value={amountToCurrency(month[balanceTypeOp])} @@ -80,7 +82,7 @@ export const ReportTableRow = memo( width="flex" privacyFilter style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} /> @@ -94,7 +96,7 @@ export const ReportTableRow = memo( width="flex" privacyFilter style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} /> @@ -109,7 +111,7 @@ export const ReportTableRow = memo( } style={{ fontWeight: 600, - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} width="flex" @@ -124,7 +126,7 @@ export const ReportTableRow = memo( } style={{ fontWeight: 600, - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} width="flex" diff --git a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx index c149e5d6ccab63db9657665b0654cd8327aa3020..784f6054e240e0c911bca71a3e9eeecb5f51d1c7 100644 --- a/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx +++ b/packages/desktop-client/src/components/reports/graphs/tableGraph/ReportTableTotals.tsx @@ -85,7 +85,7 @@ export function ReportTableTotals({ return ( <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} key={amountToCurrency(item[balanceTypeOp])} @@ -104,7 +104,7 @@ export function ReportTableTotals({ <> <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value={amountToCurrency(data.totalAssets)} @@ -118,7 +118,7 @@ export function ReportTableTotals({ /> <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value={amountToCurrency(data.totalDebts)} @@ -134,7 +134,7 @@ export function ReportTableTotals({ )} <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value={amountToCurrency(data[balanceTypeOp])} @@ -148,7 +148,7 @@ export function ReportTableTotals({ /> <Cell style={{ - minWidth: 85, + minWidth: compact ? 80 : 125, ...styles.tnum, }} value={integerToCurrency(Math.round(average))} diff --git a/packages/desktop-client/src/components/reports/reports/CustomReport.jsx b/packages/desktop-client/src/components/reports/reports/CustomReport.jsx index 009a66e88262e92f0e4ff4a8191869125b4bb969..c182ec38479625cf7f46cfa4925e460175f91f91 100644 --- a/packages/desktop-client/src/components/reports/reports/CustomReport.jsx +++ b/packages/desktop-client/src/components/reports/reports/CustomReport.jsx @@ -54,7 +54,7 @@ export function CustomReport() { } = useFilters(); const location = useLocation(); - const loadReport = location.state.report ?? defaultState; + const loadReport = location.state && (location.state.report ?? defaultState); const [allMonths, setAllMonths] = useState(null); const [typeDisabled, setTypeDisabled] = useState(['Net']); diff --git a/upcoming-release-notes/2258.md b/upcoming-release-notes/2258.md new file mode 100644 index 0000000000000000000000000000000000000000..372cadd501f1bc4fd05495b9f56addb0c3f0a7fa --- /dev/null +++ b/upcoming-release-notes/2258.md @@ -0,0 +1,6 @@ +--- +category: Maintenance +authors: [carkom] +--- + +Adding compact elements to custom reports.