import React from 'react'; import Box from '@mui/material/Box'; import Typography from '@mui/material/Typography'; import HowToVoteIcon from '@mui/icons-material/HowToVote'; import { useQuery } from '@tanstack/react-query'; import { nextcloudApi } from '../../services/nextcloud'; interface PollMessageContentProps { roomToken: string; pollId: number; pollName: string; isOwnMessage: boolean; } const PollMessageContent: React.FC = ({ roomToken, pollId, pollName, isOwnMessage }) => { const { data: poll } = useQuery({ queryKey: ['nextcloud', 'poll', roomToken, pollId], queryFn: () => nextcloudApi.getPollDetails(roomToken, pollId), staleTime: 60_000, }); return ( Abstimmung {poll?.question ?? pollName} {poll?.options && poll.options.slice(0, 4).map((opt, idx) => ( • {opt} ))} {poll?.options && poll.options.length > 4 && ( +{poll.options.length - 4} weitere Optionen )} ); }; export default PollMessageContent;