Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(chat): combine chat poll responses #19698

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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