diff --git a/web/components/answers/answers-graph.tsx b/web/components/answers/answers-graph.tsx index 357662cd..1282b928 100644 --- a/web/components/answers/answers-graph.tsx +++ b/web/components/answers/answers-graph.tsx @@ -38,7 +38,8 @@ export const AnswersGraph = memo(function AnswersGraph(props: { const { width } = useWindowSize() - const labelLength = !width || width > 800 ? 50 : 20 + const isLargeWidth = !width || width > 800 + const labelLength = isLargeWidth ? 50 : 20 const endTime = resolutionTime || isClosed @@ -68,16 +69,15 @@ export const AnswersGraph = memo(function AnswersGraph(props: { answers?.find((answer) => answer.id === outcome)?.text ?? 'None' const answerText = answer.slice(0, labelLength) + (answer.length > labelLength ? '...' : '') - const id = `#${outcome}: ${answerText}` - return { id, data: points } + return { id: answerText, data: points } }) data.reverse() const yTickValues = [0, 25, 50, 75, 100] - const numXTickValues = !width || width < 800 ? 2 : 5 + const numXTickValues = isLargeWidth ? 5 : 2 const hoursAgo = latestTime.subtract(5, 'hours') const startDate = dayjs(contract.createdTime).isBefore(hoursAgo) ? new Date(contract.createdTime) @@ -87,8 +87,8 @@ export const AnswersGraph = memo(function AnswersGraph(props: { return (