manifold/web/hooks/use-charity-txns.ts
Sinclair Chen 833dd37469
Comment tips (attempt 2) (#539)
* Add tip arrows UI (visual)

* move tipper into its own component

* simplify score calculation

* Add tip txns

- more specific txn types
- fix transact cloud function to be able to create tip txns
- insert tips into comments via a context

* Refactor tipper to send tip txns

* Stop tipping yourself. Disable anons.

* Style tipper (smaller)

* remove default exports

* capitalize tooltips

* rename stuff

* add exhausting hook dependencies

* replace context with prop threading

* fix eslint unused vars

* fix: thread tips correctly into fr comments
2022-06-17 22:28:16 -05:00

14 lines
364 B
TypeScript

import { useEffect, useState } from 'react'
import { DonationTxn } from 'common/txn'
import { listenForCharityTxns } from 'web/lib/firebase/txns'
export const useCharityTxns = (charityId: string) => {
const [txns, setTxns] = useState<DonationTxn[]>([])
useEffect(() => {
return listenForCharityTxns(charityId, setTxns)
}, [charityId])
return txns
}