import clsx from 'clsx' import { contractPath } from 'web/lib/firebase/contracts' import { CPMMContract } from 'common/contract' import { formatPercent } from 'common/util/format' import { useProbChanges } from 'web/hooks/use-prob-changes' import { linkClass, SiteLink } from '../site-link' import { Col } from '../layout/col' import { Row } from '../layout/row' import { useState } from 'react' export function ProbChangeTable(props: { userId: string | undefined }) { const { userId } = props const changes = useProbChanges(userId ?? '') const [expanded, setExpanded] = useState(false) if (!changes) { return null } const count = expanded ? 16 : 4 const { positiveChanges, negativeChanges } = changes const filteredPositiveChanges = positiveChanges.slice(0, count / 2) const filteredNegativeChanges = negativeChanges.slice(0, count / 2) const filteredChanges = [ ...filteredPositiveChanges, ...filteredNegativeChanges, ] return (