bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/timer/container.jsx

35 lines
1.1 KiB
React
Raw Normal View History

import React from 'react';
2020-04-26 03:03:35 +08:00
import { withTracker } from 'meteor/react-meteor-data';
import Timer from './component';
import Service from './service';
import { layoutSelectInput, layoutDispatch } from '/imports/ui/components/layout/context';
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
2020-04-26 03:03:35 +08:00
2020-04-27 01:44:01 +08:00
const TimerContainer = ({ children, ...props }) => {
const layoutContextDispatch = layoutDispatch();
const cameraDock = layoutSelectInput((i) => i.cameraDock);
const { isResizing } = cameraDock;
const { data: currentUserData } = useCurrentUser((user) => ({
isModerator: user.isModerator,
}));
const isModerator = currentUserData?.isModerator;
2020-04-27 01:44:01 +08:00
return (
<Timer {...{ layoutContextDispatch, isResizing, isModerator, ...props }}>
2020-04-27 01:44:01 +08:00
{children}
</Timer>
);
};
2020-04-26 03:03:35 +08:00
export default withTracker(() => {
const isRTL = document.documentElement.getAttribute('dir') === 'rtl';
return {
isRTL,
isActive: Service.isActive(),
2023-05-16 03:46:44 +08:00
timeOffset: Service.getTimeOffset(),
timer: Service.getTimer(),
currentTrack: Service.getCurrentTrack(),
2020-04-26 03:03:35 +08:00
};
})(TimerContainer);