bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/activity-check/container.jsx

36 lines
1.2 KiB
React
Raw Normal View History

2019-02-27 01:40:01 +08:00
import React from 'react';
import PropTypes from 'prop-types';
2019-02-27 01:40:01 +08:00
import { injectIntl } from 'react-intl';
import { useMutation } from '@apollo/client';
2019-02-27 01:40:01 +08:00
import ActivityCheck from './component';
import { USER_SEND_ACTIVITY_SIGN } from './mutations';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
2019-02-27 01:40:01 +08:00
const ActivityCheckContainer = ({ intl }) => {
const [userActivitySign] = useMutation(USER_SEND_ACTIVITY_SIGN);
const { data: currentUserData } = useCurrentUser((user) => ({
inactivityWarningDisplay: user.inactivityWarningDisplay,
inactivityWarningTimeoutSecs: user.inactivityWarningTimeoutSecs,
}));
const inactivityWarningDisplay = currentUserData?.inactivityWarningDisplay;
const inactivityWarningTimeoutSecs = currentUserData?.inactivityWarningTimeoutSecs;
if (!inactivityWarningDisplay) return null;
return (
<ActivityCheck
userActivitySign={userActivitySign}
inactivityCheck={inactivityWarningDisplay}
responseDelay={inactivityWarningTimeoutSecs}
intl={intl}
/>
);
};
ActivityCheckContainer.propTypes = {
intl: PropTypes.shape({
formatMessage: PropTypes.func.isRequired,
}).isRequired,
};
2019-02-27 01:40:01 +08:00
export default injectIntl(ActivityCheckContainer);