Sort donations chronologically
This commit is contained in:
parent
dc26e768a5
commit
dee260fc17
|
@ -42,6 +42,7 @@ function CharityPage(props: { charity: Charity }) {
|
||||||
const user = useUser()
|
const user = useUser()
|
||||||
|
|
||||||
const txns = useCharityTxns(charity.id)
|
const txns = useCharityTxns(charity.id)
|
||||||
|
const newToOld = _.sortBy(txns, (txn) => -txn.createdTime)
|
||||||
const totalRaised = _.sumBy(txns, (txn) => txn.amount)
|
const totalRaised = _.sumBy(txns, (txn) => txn.amount)
|
||||||
const fromYou = _.sumBy(
|
const fromYou = _.sumBy(
|
||||||
txns.filter((txn) => txn.fromId === user?.id),
|
txns.filter((txn) => txn.fromId === user?.id),
|
||||||
|
@ -92,7 +93,7 @@ function CharityPage(props: { charity: Charity }) {
|
||||||
</Row>
|
</Row>
|
||||||
<h2 className="mt-7 mb-2 text-xl text-indigo-700">About</h2>
|
<h2 className="mt-7 mb-2 text-xl text-indigo-700">About</h2>
|
||||||
<Blurb text={description} />
|
<Blurb text={description} />
|
||||||
{txns.map((txn) => (
|
{newToOld.map((txn) => (
|
||||||
<Donation key={txn.id} txn={txn} />
|
<Donation key={txn.id} txn={txn} />
|
||||||
))}
|
))}
|
||||||
</Col>
|
</Col>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user