This repository has been archived by the owner on May 11, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(stats): add stub for sources/categories data
- Loading branch information
1 parent
f29745a
commit f3e4188
Showing
9 changed files
with
135 additions
and
15 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
49 changes: 49 additions & 0 deletions
49
front/src/features/statistics/features/categories/Categories.tsx
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,49 @@ | ||
import { useMemo } from 'react' | ||
import { sortBy } from 'lodash' | ||
|
||
import { Currency } from '@shared/enum/Currency' | ||
import { displayMoney } from '@shared/helpers/displayMoney' | ||
import { Table } from '@front/ui/components/layout/table' | ||
|
||
interface Props { | ||
className?: string | ||
currency: Currency | ||
} | ||
|
||
export const Categories = ({ className, currency }: Props) => { | ||
const columns = useMemo( | ||
() => ({ | ||
source: { | ||
title: 'Category', | ||
}, | ||
amount: { | ||
title: 'Amount', | ||
transform: displayMoney(currency), | ||
}, | ||
}), | ||
[currency], | ||
) | ||
|
||
const fakeDate = useMemo( | ||
() => | ||
sortBy( | ||
[ | ||
{ source: 'Cafe', amount: 50000 }, | ||
{ source: 'Lunch', amount: 40000 }, | ||
{ source: 'Travel', amount: 45000 }, | ||
], | ||
'-amount', | ||
), | ||
[], | ||
) | ||
|
||
return ( | ||
<Table | ||
title="Where was the money spent" | ||
columns={columns} | ||
data={fakeDate} | ||
hideHeader | ||
className={className} | ||
/> | ||
) | ||
} |
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 @@ | ||
export { Categories } from './Categories' |
49 changes: 49 additions & 0 deletions
49
front/src/features/statistics/features/sources/Sources.tsx
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,49 @@ | ||
import { useMemo } from 'react' | ||
import { sortBy } from 'lodash' | ||
|
||
import { Table } from '@front/ui/components/layout/table' | ||
import { displayMoney } from '@shared/helpers/displayMoney' | ||
import { Currency } from '@shared/enum/Currency' | ||
|
||
interface Props { | ||
className?: string | ||
currency: Currency | ||
} | ||
|
||
export const Sources = ({ className, currency }: Props) => { | ||
const columns = useMemo( | ||
() => ({ | ||
source: { | ||
title: 'Source', | ||
}, | ||
amount: { | ||
title: 'Amount', | ||
transform: displayMoney(currency), | ||
}, | ||
}), | ||
[currency], | ||
) | ||
|
||
const fakeDate = useMemo( | ||
() => | ||
sortBy( | ||
[ | ||
{ source: 'Breadhead', amount: 50000 }, | ||
{ source: 'Netology', amount: 40000 }, | ||
{ source: 'Whatever', amount: 45000 }, | ||
], | ||
'-amount', | ||
), | ||
[], | ||
) | ||
|
||
return ( | ||
<Table | ||
title="Sources of income" | ||
columns={columns} | ||
data={fakeDate} | ||
hideHeader | ||
className={className} | ||
/> | ||
) | ||
} |
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 @@ | ||
export { Sources } from './Sources' |
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,3 @@ | ||
.ant-table-title { | ||
border-radius: 2px; | ||
} |
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,8 @@ | ||
.title { | ||
font-weight: 500; | ||
font-size: 16px; | ||
margin-left: 8px; | ||
margin-bottom: 4px; | ||
margin-top: 4px; | ||
color: rgba(0, 0, 0, 0.85); | ||
} |
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