mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2025-12-30 11:22:31 +00:00
* feat(polls/web/native): rework polls to manage editing and saving before sending to other participants
45 lines
1013 B
TypeScript
45 lines
1013 B
TypeScript
import React from 'react';
|
|
import { View, ViewStyle } from 'react-native';
|
|
import { useSelector } from 'react-redux';
|
|
|
|
import { shouldShowResults } from '../../functions';
|
|
|
|
import PollAnswer from './PollAnswer';
|
|
import PollResults from './PollResults';
|
|
import { chatStyles } from './styles';
|
|
|
|
interface IProps {
|
|
|
|
/**
|
|
* Id of the poll.
|
|
*/
|
|
pollId: string;
|
|
|
|
/**
|
|
* Create mode control.
|
|
*/
|
|
setCreateMode: (mode: boolean) => void;
|
|
|
|
}
|
|
|
|
const PollItem = ({ pollId, setCreateMode }: IProps) => {
|
|
const showResults = useSelector(shouldShowResults(pollId));
|
|
|
|
return (
|
|
<View
|
|
style = { chatStyles.pollItemContainer as ViewStyle }>
|
|
{ showResults
|
|
? <PollResults
|
|
key = { pollId }
|
|
pollId = { pollId } />
|
|
: <PollAnswer
|
|
pollId = { pollId }
|
|
setCreateMode = { setCreateMode } />
|
|
}
|
|
|
|
</View>
|
|
);
|
|
};
|
|
|
|
export default PollItem;
|