Function PollModal

PollModal component renders a modal for creating, viewing, and managing polls.

import { PollModal } from 'mediasfu-reactjs';
import { io } from 'socket.io-client';

// Define poll array and poll objects
const polls = [
{
id: "1",
question: "Do you like React?",
options: ["Yes", "No"],
votes: [0, 0],
status: "active",
},
];
const currentPoll = polls[0];
const socket = io("http://localhost:3000");

// Render the PollModal component
<PollModal
isPollModalVisible={true}
onClose={() => console.log("Modal closed")}
position="topRight"
backgroundColor="#f5f5f5"
member="user1"
islevel="2"
polls={polls}
poll={currentPoll}
socket={socket}
roomName="Room 1"
showAlert={(message, type) => console.log("Show alert:", message, type)}
updateIsPollModalVisible={() => console.log("Toggle poll modal visibility")}
handleCreatePoll={(pollOptions) => console.log("Create poll:", pollOptions)}
handleEndPoll={(pollId) => console.log("End poll:", pollId)}
handleVotePoll={(voteOptions) => console.log("Vote in poll:", voteOptions)}
/>

Properties

propTypes?: any

Ignored by React.

Only kept in types for backwards compatibility. Will be removed in a future major release.

displayName?: string

Used in debugging messages. You might want to set it explicitly if you want to display a different name for debugging purposes.


const MyComponent: FC = () => {
return <div>Hello!</div>
}

MyComponent.displayName = 'MyAwesomeComponent'