73fc67955d
* Add components for CPM landing and charity pages * Remove misc.ts to fix build * Set up cloud function for writing txns * More plumbing for txns * Fix up API call * Use Date.now() to keep timestamps simple * Some styles for charity list page * Hard code charities data * Pass charity data to charity page * Update txn type * Listen for charity txns * Handle txn to non-user by burning it * Read txns for charity card and charity page. * Set images to object contain * Clean up txn types * Move pic to top of card. Other misc styling. * Update charity short & long descriptions * Add `token` and `category` to Txn * Fix breakages * Show Charity link in the sidebar * Fix typing issues * Fix not reading from the right type * Switch out icon * Also show Charity icon on mobile * Update copy Co-authored-by: Austin Chen <akrolsmir@gmail.com> Co-authored-by: James Grugett <jahooma@gmail.com>
14 lines
353 B
TypeScript
14 lines
353 B
TypeScript
import { useEffect, useState } from 'react'
|
|
import { Txn } from '../../common/txn'
|
|
import { listenForCharityTxns } from '../lib/firebase/txns'
|
|
|
|
export const useCharityTxns = (charityId: string) => {
|
|
const [txns, setTxns] = useState<Txn[]>([])
|
|
|
|
useEffect(() => {
|
|
return listenForCharityTxns(charityId, setTxns)
|
|
}, [charityId])
|
|
|
|
return txns
|
|
}
|