Skip to content

Commit

Permalink
formatting dataTable
Browse files Browse the repository at this point in the history
  • Loading branch information
carkom committed Nov 1, 2023
1 parent 7790fd6 commit e698f1c
Showing 1 changed file with 56 additions and 17 deletions.
73 changes: 56 additions & 17 deletions packages/desktop-client/src/components/reports/ReportTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type TableRowProps = {
date: string;
name: string;
monthData: [];
totalAssets: string;
totalDebts: string;
totalAssets: number;
totalDebts: number;
};
typeOp?: string | null;
splitItem: string;
Expand All @@ -44,6 +44,7 @@ const TableRow = memo(
<Cell
value={item[splitItem]}
width="flex"
title={item[splitItem].length > 12 && item[splitItem]}
style={{
minWidth: 125,
}}
Expand All @@ -53,10 +54,14 @@ const TableRow = memo(
return (
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
key={amountToCurrency(item[typeOp])}
value={amountToCurrency(item[typeOp])}
title={
Math.abs(item[typeOp]) > 100000 &&
amountToCurrency(item[typeOp])
}
width="flex"
privacyFilter
/>
Expand All @@ -66,34 +71,49 @@ const TableRow = memo(
<>
<Cell
value={amountToCurrency(item.totalAssets)}
title={
Math.abs(item.totalAssets) > 100000 &&
amountToCurrency(item.totalAssets)
}
width="flex"
style={{
minWidth: 75,
minWidth: 85,
}}
/>
<Cell
value={amountToCurrency(item.totalDebts)}
title={
Math.abs(item.totalDebts) > 100000 &&
amountToCurrency(item.totalDebts)
}
width="flex"
style={{
minWidth: 75,
minWidth: 85,
}}
/>
</>
)}
<Cell
value={amountToCurrency(item[typeOp])}
title={
Math.abs(item[typeOp]) > 100000 && amountToCurrency(item[typeOp])
}
style={{
fontWeight: 600,
minWidth: 75,
minWidth: 85,
}}
width="flex"
privacyFilter
/>
<Cell
value={integerToCurrency(Math.round(average))}
title={
Math.abs(Math.round(average / 100)) > 100000 &&
integerToCurrency(Math.round(average))
}
style={{
fontWeight: 600,
minWidth: 75,
minWidth: 85,
}}
width="flex"
privacyFilter
Expand Down Expand Up @@ -177,7 +197,7 @@ export function TableHeader({ scrollWidth, split, interval, type }) {
return (
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
key={header}
// eslint-disable-next-line rulesdir/typography
Expand All @@ -190,14 +210,14 @@ export function TableHeader({ scrollWidth, split, interval, type }) {
<>
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
value={'Assets'}
width="flex"
/>
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
value={'Debts'}
width="flex"
Expand All @@ -206,14 +226,14 @@ export function TableHeader({ scrollWidth, split, interval, type }) {
)}
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
value={'Totals'}
width="flex"
/>
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
value={'Average'}
width="flex"
Expand Down Expand Up @@ -246,10 +266,14 @@ export function TableTotals({ data, scrollWidth, typeOp, mode, monthsCount }) {
return (
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
key={amountToCurrency(item[typeOp])}
value={amountToCurrency(item[typeOp])}
title={
Math.abs(item[typeOp]) > 100000 &&
amountToCurrency(item[typeOp])
}
width="flex"
privacyFilter
/>
Expand All @@ -259,33 +283,48 @@ export function TableTotals({ data, scrollWidth, typeOp, mode, monthsCount }) {
<>
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
value={amountToCurrency(data.totalAssets)}
title={
Math.abs(data.totalAssets) > 100000 &&
amountToCurrency(data.totalAssets)
}
width="flex"
/>
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
value={amountToCurrency(data.totalDebts)}
title={
Math.abs(data.totalDebts) > 100000 &&
amountToCurrency(data.totalDebts)
}
width="flex"
/>
</>
)}
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
value={amountToCurrency(data[typeOp])}
title={
Math.abs(data[typeOp]) > 100000 && amountToCurrency(data[typeOp])
}
width="flex"
privacyFilter
/>
<Cell
style={{
minWidth: 75,
minWidth: 85,
}}
value={integerToCurrency(Math.round(average))}
title={
Math.abs(Math.round(average / 100)) > 100000 &&
integerToCurrency(Math.round(average))
}
width="flex"
privacyFilter
/>
Expand Down

0 comments on commit e698f1c

Please sign in to comment.