07ce27f20b
* Copy feed template from TailwindUI * Show all bets in a feed-like manner * Tweak design of individual trades * Allow traders to comment on their bets * Code cleanups * Incorporate contract description into the feed * Support description editing from contract feed * Group together bets placed within 24h * Fix build error * Add a feed item for market resolution * Add a feed item for markets that have closed * Comment on a separate subcollection
13 lines
376 B
TypeScript
13 lines
376 B
TypeScript
import { useEffect, useState } from 'react'
|
|
import { Comment, listenForComments } from '../lib/firebase/comments'
|
|
|
|
export const useComments = (contractId: string) => {
|
|
const [comments, setComments] = useState<Comment[] | 'loading'>('loading')
|
|
|
|
useEffect(() => {
|
|
if (contractId) return listenForComments(contractId, setComments)
|
|
}, [contractId])
|
|
|
|
return comments
|
|
}
|