UNPKG

stream-chat-react

Version:

React components to create chat conversations or livestream style chat

19 lines (18 loc) 1.23 kB
import React, { useMemo } from 'react'; import { PollVoteListing } from '../../PollVote'; import { usePollOptionVotesPagination } from '../../hooks'; import { LoadingIndicator } from '../../../Loading'; import { InfiniteScrollPaginator } from '../../../InfiniteScrollPaginator/InfiniteScrollPaginator'; import { PollOptionWithVotesHeader } from './PollOptionWithVotesHeader'; export const PollOptionVotesList = ({ option }) => { const paginationParams = useMemo(() => ({ filter: { option_id: option.id } }), [option.id]); const { error, hasNextPage, loading, loadMore, votes } = usePollOptionVotesPagination({ paginationParams, }); return (React.createElement("div", { className: 'str-chat__poll-option str-chat__poll-option--full-vote-list' }, React.createElement(PollOptionWithVotesHeader, { option: option }), React.createElement(InfiniteScrollPaginator, { loadNextOnScrollToBottom: loadMore, threshold: 40 }, React.createElement(PollVoteListing, { votes: votes }), hasNextPage && (React.createElement("div", { className: 'str-chat__loading-indicator-placeholder' }, loading && React.createElement(LoadingIndicator, null)))), error && error.message)); };