import Link from 'next/link' import { useEffect, useState } from 'react' import { useUser } from '../hooks/use-user' import { Contract, deleteContract, listContracts } from '../lib/firebase/contracts' function ContractCard(props: { contract: Contract }) { const { contract } = props // only show delete button if there's not bets const showDelete = contract.pot.YES === contract.seedAmounts.YES && contract.pot.NO === contract.seedAmounts.NO const [isDeleted, setIsDeleted] = useState(false) // temporary fix until we stream changes if (isDeleted) return <> return (
  • {contract.question}

    {/*

    {contract.description}

    */}

    Created on{' '}

    {showDelete && }
  • ) } export function ContractsList(props: {}) { const creator = useUser() const [contracts, setContracts] = useState([]) useEffect(() => { if (creator?.id) { // TODO: stream changes from firestore listContracts(creator.id).then(setContracts) } }, [creator]) return (
    ) }