-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Functionality additions and Privacy Filters
- Loading branch information
Showing
9 changed files
with
278 additions
and
84 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
124 changes: 124 additions & 0 deletions
124
packages/desktop-client/src/components/reports/ReportSummary.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,124 @@ | ||
import React from 'react'; | ||
|
||
import * as monthUtils from 'loot-core/src/shared/months'; | ||
import { integerToCurrency } from 'loot-core/src/shared/util'; | ||
|
||
import { theme, styles } from '../../style'; | ||
import Text from '../common/Text'; | ||
import View from '../common/View'; | ||
import PrivacyFilter from '../PrivacyFilter'; | ||
|
||
export function ReportSummary({ | ||
start, | ||
end, | ||
totalExpenses, | ||
totalIncome, | ||
onSelectSummary, | ||
selectType, | ||
}) { | ||
let amt = | ||
selectType === 'Expense' | ||
? totalExpenses | ||
: selectType === 'Income' | ||
? totalIncome | ||
: totalExpenses + totalIncome; | ||
let net = totalExpenses > totalIncome ? 'EXPENSE' : 'INCOME'; | ||
return ( | ||
<View | ||
style={{ | ||
overflow: 'auto', | ||
flexDirection: 'column', | ||
}} | ||
> | ||
<View | ||
style={{ | ||
backgroundColor: theme.pageBackground, | ||
height: 100, | ||
alignItems: 'center', | ||
justifyContent: 'center', | ||
}} | ||
> | ||
<Text | ||
style={[ | ||
styles.largeText, | ||
{ | ||
alignItems: 'center', | ||
marginBottom: 2, | ||
fontWeight: 600, | ||
}, | ||
]} | ||
> | ||
{monthUtils.format(start, 'MMM yyyy')} -{' '} | ||
{monthUtils.format(end, 'MMM yyyy')} | ||
</Text> | ||
</View> | ||
<View | ||
style={{ | ||
backgroundColor: theme.pageBackground, | ||
height: 100, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
marginTop: 10, | ||
}} | ||
> | ||
<Text | ||
style={[ | ||
styles.mediumText, | ||
{ | ||
alignItems: 'center', | ||
marginBottom: 2, | ||
fontWeight: 400, | ||
}, | ||
]} | ||
> | ||
{selectType === 'Expense' | ||
? 'TOTAL SPENDING' | ||
: selectType === 'Income' | ||
? 'TOTAL INCOME' | ||
: 'NET ' + net} | ||
</Text> | ||
<Text | ||
style={[ | ||
styles.veryLargeText, | ||
{ | ||
alignItems: 'center', | ||
marginBottom: 2, | ||
fontWeight: 800, | ||
}, | ||
]} | ||
> | ||
<PrivacyFilter blurIntensity={7}> | ||
{integerToCurrency(amt)} | ||
</PrivacyFilter> | ||
</Text> | ||
<Text style={{ fontWeight: 600 }}>For this time period</Text> | ||
</View> | ||
</View> | ||
); | ||
} | ||
|
||
export function ReportSplit({ onSelectSplit }) { | ||
return ( | ||
<View | ||
style={{ | ||
backgroundColor: theme.pageBackground, | ||
paddingTop: 10, | ||
alignItems: 'center', | ||
marginTop: 10, | ||
}} | ||
> | ||
<Text //thinking of using this space for a VictoryLegend if needed | ||
style={[ | ||
styles.largeText, | ||
{ | ||
alignItems: 'center', | ||
marginBottom: 2, | ||
fontWeight: 400, | ||
}, | ||
]} | ||
> | ||
Categories | ||
</Text> | ||
</View> | ||
); | ||
} |
Oops, something went wrong.