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