2021-09-10 21:16:44 +08:00
|
|
|
import React from 'react';
|
2020-01-30 02:36:17 +08:00
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
|
|
|
import { injectIntl } from 'react-intl';
|
2022-10-31 23:09:06 +08:00
|
|
|
import PollService from '/imports/ui/components/poll/service';
|
2020-01-30 02:36:17 +08:00
|
|
|
import QuickPollDropdown from './component';
|
2023-12-09 04:24:57 +08:00
|
|
|
import { useMutation } from '@apollo/client';
|
2021-09-11 04:48:52 +08:00
|
|
|
import { layoutDispatch } from '../../layout/context';
|
2023-12-09 04:24:57 +08:00
|
|
|
import { POLL_CANCEL } from '/imports/ui/components/poll/mutations';
|
2024-06-06 21:50:03 +08:00
|
|
|
import { useStorageKey } from '/imports/ui/services/storage/hooks';
|
2020-01-30 02:36:17 +08:00
|
|
|
|
2021-05-18 04:25:07 +08:00
|
|
|
const QuickPollDropdownContainer = (props) => {
|
2021-09-11 04:48:52 +08:00
|
|
|
const layoutContextDispatch = layoutDispatch();
|
2024-06-06 21:50:03 +08:00
|
|
|
const activePoll = useStorageKey('pollInitiated') || false;
|
2023-12-09 04:24:57 +08:00
|
|
|
|
|
|
|
const [stopPoll] = useMutation(POLL_CANCEL);
|
|
|
|
|
2024-06-06 21:50:03 +08:00
|
|
|
return <QuickPollDropdown {...{ layoutContextDispatch, stopPoll, activePoll, ...props }} />;
|
2021-05-18 04:25:07 +08:00
|
|
|
};
|
2020-01-30 02:36:17 +08:00
|
|
|
|
|
|
|
export default withTracker(() => ({
|
2021-05-27 01:52:55 +08:00
|
|
|
pollTypes: PollService.pollTypes,
|
2020-01-30 02:36:17 +08:00
|
|
|
}))(injectIntl(QuickPollDropdownContainer));
|