diff --git a/web/components/contracts-list.tsx b/web/components/contracts-list.tsx index 55910383..3e90d14f 100644 --- a/web/components/contracts-list.tsx +++ b/web/components/contracts-list.tsx @@ -1,71 +1,8 @@ -import dayjs from 'dayjs' -import Link from 'next/link' import { useEffect, useState } from 'react' import { useUser } from '../hooks/use-user' -import { - Contract, - deleteContract, - listContracts, -} from '../lib/firebase/contracts' +import { Contract, listContracts } from '../lib/firebase/contracts' import { ContractsGrid } from '../pages/markets' -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.id}

    -

    - {contract.description} -

    -
    */} -
    -

    - -

    - - {showDelete && ( - - )} -
    -
    -
    -
    - -
  • - ) -} - export function ContractsList(props: {}) { const creator = useUser() diff --git a/web/components/resolved-panel.tsx b/web/components/resolved-panel.tsx index 223476fc..35e41896 100644 --- a/web/components/resolved-panel.tsx +++ b/web/components/resolved-panel.tsx @@ -1,8 +1,9 @@ import clsx from 'clsx' import dayjs from 'dayjs' +import { useRouter } from 'next/router' import React from 'react' -import { Contract } from '../lib/firebase/contracts' +import { Contract, deleteContract } from '../lib/firebase/contracts' import { formatMoney } from '../lib/util/format' import { Col } from './layout/col' import { Spacer } from './layout/spacer' @@ -11,6 +12,8 @@ export function ResolvedPanel(props: { contract: Contract className?: string }) { + const router = useRouter() + const { contract, className } = props const { resolution, resolutionTime, pot, seedAmounts } = contract @@ -52,6 +55,20 @@ export function ResolvedPanel(props: { <>All bets have been returned. )} + + {/* Show a delete button for contracts without any trading */} + {total === 0 && ( + + )} ) }