Poll Conversation UI
Overview
The PollConversationUI
component renders the user interface for displaying and interacting with polls within chat conversations, allowing users to view poll questions, cast votes, and see real-time updates on poll statuses, all while ensuring an engaging and responsive experience in the LikeMinds chat application.
Customisations
The PollConversationUI
can be customised using the chatBubbleStyles
Props
Property | Type | Description | Default | Required |
---|---|---|---|---|
hue | number | (Optional) The hue value for color customization. | ||
text | string | The text displayed for the poll option. | ✔️ | |
votes | number | The number of votes received for this option. | 0 | ✔️ |
optionArr | Poll[] | Array of poll options. | ✔️ | |
pollTypeText | string | The text describing the poll type. | ✔️ | |
submitTypeText | string | The text for the poll submission button. | ✔️ | |
addOptionInputField | string | The current input value for adding a new option. | "" | ✔️ |
shouldShowSubmitPollButton | boolean | Indicates whether the submit button should be shown. | false | ✔️ |
selectedPolls | number[] | Array of selected poll indices. | ✔️ | |
showSelected | boolean | Indicates if the selected options should be shown. | false | ✔️ |
allowAddOption | boolean | Controls whether users can add new options. | true | ✔️ |
shouldShowVotes | boolean | Indicates if vote counts should be displayed. | true | ✔️ |
hasPollEnded | boolean | Indicates if the poll has ended. | false | ✔️ |
expiryTime | string | The expiration time for the poll. | ✔️ | |
toShowResults | boolean | Indicates if results should be displayed. | false | ✔️ |
member | any | Information about the member participating in the poll. | ✔️ | |
user | any | Information about the user interacting with the poll. | ✔️ | |
isEdited | boolean | Indicates if the poll has been edited. | false | ✔️ |
createdAt | string | Timestamp of when the poll was created. | ✔️ | |
pollAnswerText | string | The text for the poll answer. | ✔️ | |
isPollEnded | boolean | Indicates if the poll has ended. | false | ✔️ |
isIncluded | boolean | Indicates if the poll is included in results. | true | ✔️ |
multipleSelectNo | any | (Optional) Number of multiple selections allowed. | ||
multipleSelectState | number | Current state of multiple selections. | 0 | ✔️ |
showResultsButton | boolean | Indicates if the results button should be shown. | true | ✔️ |
pollType | number | The type of the poll (e.g., single-choice, multiple-choice). | 0 | ✔️ |
onNavigate | Function | Callback to navigate to a specified route. | ✔️ | |
setSelectedPollOptions | Function | Callback to update the selected poll options. | ✔️ | |
addPollOption | Function | Callback to add a new poll option. | ✔️ | |
submitPoll | Function | Callback to submit the poll. | ✔️ | |
setShowSelected | Function | Callback to set the visibility of selected options. | ✔️ | |
setIsAddPollOptionModalVisible | Function | Callback to control the visibility of the add option modal. | ✔️ | |
setAddOptionInputField | Function | Callback to set the input field value for adding an option. | ✔️ | |
openKeyboard | Function | Callback to open the keyboard on user interaction. | ✔️ | |
longPressOpenKeyboard | Function | Callback to open the keyboard on long press. | ✔️ | |
stringManipulation | Function | Function to perform string manipulation. | ✔️ | |
resetShowResult | Function | Callback to reset the display of poll results. | ✔️ |
Poll
Property | Type | Description | Default | Required |
---|---|---|---|---|
id | string | Unique identifier for the poll option. | ✔️ | |
isSelected | boolean | Indicates if the poll option is selected. | false | ✔️ |
percentage | number | The percentage of votes this option has. | 0 | ✔️ |
noVotes | number | The total number of votes for this option. | 0 | ✔️ |