show market tip total

This commit is contained in:
mantikoros 2022-10-01 16:16:34 -05:00
parent fac87f8e0c
commit 2baae33a77
3 changed files with 10 additions and 8 deletions

View File

@ -18,9 +18,7 @@ export function ExtraContractActionsRow(props: { contract: Contract }) {
return ( return (
<Row> <Row>
<FollowMarketButton contract={contract} user={user} /> <FollowMarketButton contract={contract} user={user} />
{user?.id !== contract.creatorId && ( <LikeMarketButton contract={contract} user={user} />
<LikeMarketButton contract={contract} user={user} />
)}
<Tooltip text="Share" placement="bottom" noTap noFade> <Tooltip text="Share" placement="bottom" noTap noFade>
<Button <Button
size="sm" size="sm"

View File

@ -17,9 +17,8 @@ export function LikeMarketButton(props: {
}) { }) {
const { contract, user } = props const { contract, user } = props
const tips = useMarketTipTxns(contract.id).filter( const tips = useMarketTipTxns(contract.id)
(txn) => txn.fromId === user?.id
)
const totalTipped = useMemo(() => { const totalTipped = useMemo(() => {
return sum(tips.map((tip) => tip.amount)) return sum(tips.map((tip) => tip.amount))
}, [tips]) }, [tips])
@ -51,6 +50,7 @@ export function LikeMarketButton(props: {
userLikedContractIds?.includes(contract.id) || userLikedContractIds?.includes(contract.id) ||
(!likes && !!contract.likedByUserIds?.includes(user.id))) (!likes && !!contract.likedByUserIds?.includes(user.id)))
} }
disabled={contract.creatorId === user?.id}
/> />
) )
} }

View File

@ -18,14 +18,18 @@ export function TipButton(props: {
return ( return (
<Tooltip <Tooltip
text={`Tip ${formatMoney(tipAmount)}`} text={disabled ? 'Tips' : `Tip ${formatMoney(tipAmount)}`}
placement="bottom" placement="bottom"
noTap noTap
noFade noFade
> >
<Button <Button
size={'sm'} size={'sm'}
className={clsx('max-w-xs self-center', isCompact && 'px-0 py-0')} className={clsx(
'max-w-xs self-center',
isCompact && 'px-0 py-0',
disabled && 'hover:bg-inherit'
)}
color={'gray-white'} color={'gray-white'}
onClick={onClick} onClick={onClick}
disabled={disabled} disabled={disabled}