From 14cf1e6a8b5b7713bfa4664b05768d6a98f47f85 Mon Sep 17 00:00:00 2001 From: mantikoros Date: Mon, 13 Dec 2021 19:23:57 -0600 Subject: [PATCH] ContractCard: declutter, fix deletion --- web/components/contracts-list.tsx | 48 +++++++++++++++++++------------ 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/web/components/contracts-list.tsx b/web/components/contracts-list.tsx index 97e2c06a..35b8f14b 100644 --- a/web/components/contracts-list.tsx +++ b/web/components/contracts-list.tsx @@ -5,43 +5,54 @@ import { Contract, deleteContract, listContracts } from '../lib/firebase/contrac 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.outcomeType} -

    -
    +
    -
    -

    {contract.id}

    + {/*

    {contract.description}

    -
    +
    */} +

    Created on{' '}

    - + + {showDelete && + + }
    @@ -58,6 +69,7 @@ export function ContractsList(props: {}) { useEffect(() => { if (creator?.id) { + // TODO: stream changes from firestore listContracts(creator.id).then(setContracts) } }, [creator])