Skip to content

Commit

Permalink
Merge pull request #19698 from ramonlsouza/combine-chat-poll-responses
Browse files Browse the repository at this point in the history
fix(chat): combine chat poll responses
  • Loading branch information
ramonlsouza committed Mar 4, 2024
2 parents 1275945 + aa5ca06 commit 1647529
Showing 1 changed file with 8 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React from 'react';
import {
Bar, BarChart, ResponsiveContainer, XAxis, YAxis,
} from 'recharts';
import caseInsensitiveReducer from '/imports/utils/caseInsensitiveReducer';
import Styled from './styles';

interface ChatPollContentProps {
Expand Down Expand Up @@ -53,15 +54,20 @@ const ChatPollContent: React.FC<ChatPollContentProps> = ({
}) => {
const pollData = JSON.parse(string) as unknown;
assertAsMetadata(pollData);
const height = pollData.answers.length * 50;

const answers = pollData.answers.reduce(
caseInsensitiveReducer, [],
);

const height = answers.length * 50;
return (
<div data-test="chatPollMessageText">
<Styled.PollText>
{pollData.questionText}
</Styled.PollText>
<ResponsiveContainer width="90%" height={height}>
<BarChart
data={pollData.answers}
data={answers}
layout="vertical"
>
<XAxis type="number" />
Expand Down

0 comments on commit 1647529

Please sign in to comment.