linting
This commit is contained in:
parent
5fa2ecdb3e
commit
b5f0911867
|
@ -20,13 +20,11 @@ import { AnswerBetPanel } from 'web/components/answers/answer-bet-panel'
|
|||
import { Row } from 'web/components/layout/row'
|
||||
import { Avatar } from 'web/components/avatar'
|
||||
import { Linkify } from 'web/components/linkify'
|
||||
import { BuyButton } from 'web/components/yes-no-selector'
|
||||
import { UserLink } from 'web/components/user-link'
|
||||
import { Button } from 'web/components/button'
|
||||
import { useAdmin } from 'web/hooks/use-admin'
|
||||
import { needsAdminToResolve } from 'web/pages/[username]/[contractSlug]'
|
||||
import { CATEGORY_COLORS } from '../charts/contract/choice'
|
||||
import { getChartAnswers } from '../charts/contract/choice'
|
||||
import { useChartAnswers } from '../charts/contract/choice'
|
||||
|
||||
export function AnswersPanel(props: {
|
||||
contract: FreeResponseContract | MultipleChoiceContract
|
||||
|
@ -107,10 +105,9 @@ export function AnswersPanel(props: {
|
|||
? 'checkbox'
|
||||
: undefined
|
||||
|
||||
const colorSortedAnswer = getChartAnswers(
|
||||
contract,
|
||||
CATEGORY_COLORS.length
|
||||
).map((value, index) => value.text)
|
||||
const colorSortedAnswer = useChartAnswers(contract).map(
|
||||
(value, _index) => value.text
|
||||
)
|
||||
|
||||
return (
|
||||
<Col className="gap-3">
|
||||
|
@ -190,7 +187,7 @@ function OpenAnswer(props: {
|
|||
colorIndex: number | undefined
|
||||
}) {
|
||||
const { answer, contract, colorIndex } = props
|
||||
const { username, avatarUrl, name, text } = answer
|
||||
const { username, avatarUrl, text } = answer
|
||||
const prob = getDpmOutcomeProbability(contract.totalShares, answer.id)
|
||||
const probPercent = formatPercent(prob)
|
||||
const [open, setOpen] = useState(false)
|
||||
|
|
|
@ -142,9 +142,8 @@ const Legend = (props: { className?: string; items: LegendItem[] }) => {
|
|||
)
|
||||
}
|
||||
|
||||
export function getChartAnswers(
|
||||
contract: FreeResponseContract | MultipleChoiceContract,
|
||||
length: number
|
||||
export function useChartAnswers(
|
||||
contract: FreeResponseContract | MultipleChoiceContract
|
||||
) {
|
||||
return useMemo(
|
||||
() => getTrackedAnswers(contract, CATEGORY_COLORS.length),
|
||||
|
@ -161,11 +160,7 @@ export const ChoiceContractChart = (props: {
|
|||
}) => {
|
||||
const { contract, bets, width, height, onMouseOver } = props
|
||||
const [start, end] = getDateRange(contract)
|
||||
// const answers = useMemo(
|
||||
// () => getTrackedAnswers(contract, CATEGORY_COLORS.length),
|
||||
// [contract]
|
||||
// )
|
||||
const answers = getChartAnswers(contract, CATEGORY_COLORS.length)
|
||||
const answers = useChartAnswers(contract)
|
||||
const betPoints = useMemo(() => getBetPoints(answers, bets), [answers, bets])
|
||||
const data = useMemo(
|
||||
() => [
|
||||
|
|
Loading…
Reference in New Issue
Block a user