2022-09-10 04:15:11 +08:00
|
|
|
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';
|
2022-09-10 04:15:11 +08:00
|
|
|
import { layoutSelectInput, layoutDispatch } from '/imports/ui/components/layout/context';
|
2023-11-30 21:24:25 +08:00
|
|
|
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();
|
2022-09-10 04:15:11 +08:00
|
|
|
const cameraDock = layoutSelectInput((i) => i.cameraDock);
|
|
|
|
const { isResizing } = cameraDock;
|
2023-11-30 21:24:25 +08:00
|
|
|
const { data: currentUserData } = useCurrentUser((user) => ({
|
|
|
|
isModerator: user.isModerator,
|
|
|
|
}));
|
|
|
|
|
|
|
|
const isModerator = currentUserData?.isModerator;
|
|
|
|
|
2020-04-27 01:44:01 +08:00
|
|
|
return (
|
2023-11-30 21:24:25 +08:00
|
|
|
<Timer {...{ layoutContextDispatch, isResizing, isModerator, ...props }}>
|
2020-04-27 01:44:01 +08:00
|
|
|
{children}
|
|
|
|
</Timer>
|
|
|
|
);
|
2023-06-09 03:24:25 +08:00
|
|
|
};
|
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(),
|
2022-02-02 03:05:02 +08:00
|
|
|
currentTrack: Service.getCurrentTrack(),
|
2020-04-26 03:03:35 +08:00
|
|
|
};
|
|
|
|
})(TimerContainer);
|