2021-03-26 05:22:50 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { withTracker } from 'meteor/react-meteor-data';
|
2023-12-05 22:18:45 +08:00
|
|
|
import { useSubscription } from '@apollo/client';
|
2021-03-26 05:22:50 +08:00
|
|
|
import ConnectionStatusButtonComponent from './component';
|
2024-04-03 21:01:08 +08:00
|
|
|
import { USER_CURRENT_STATUS_SUBSCRIPTION } from '../queries';
|
|
|
|
import Auth from '/imports/ui/services/auth';
|
2024-05-18 04:33:52 +08:00
|
|
|
import useSettings from '/imports/ui/services/settings/hooks/useSettings';
|
|
|
|
import { SETTINGS } from '/imports/ui/services/settings/enums';
|
2021-03-26 05:22:50 +08:00
|
|
|
|
2023-12-05 22:18:45 +08:00
|
|
|
const connectionStatusButtonContainer = (props) => {
|
2024-04-03 21:01:08 +08:00
|
|
|
const { data } = useSubscription(USER_CURRENT_STATUS_SUBSCRIPTION, {
|
|
|
|
variables: { userId: Auth.userID },
|
|
|
|
});
|
|
|
|
const myCurrentStatus = data && data.length > 0
|
|
|
|
? data[0].currentStatus
|
|
|
|
: 'normal';
|
2023-12-05 22:18:45 +08:00
|
|
|
|
2024-05-18 04:33:52 +08:00
|
|
|
const { paginationEnabled } = useSettings(SETTINGS.APPLICATION);
|
|
|
|
const { viewParticipantsWebcams } = useSettings(SETTINGS.DATA_SAVING);
|
|
|
|
|
|
|
|
return (
|
|
|
|
<ConnectionStatusButtonComponent
|
|
|
|
myCurrentStatus={myCurrentStatus}
|
|
|
|
paginationEnabled={paginationEnabled}
|
|
|
|
viewParticipantsWebcams={viewParticipantsWebcams}
|
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
);
|
2023-12-05 22:18:45 +08:00
|
|
|
};
|
2021-03-26 05:22:50 +08:00
|
|
|
|
|
|
|
export default withTracker(() => {
|
|
|
|
const { connected } = Meteor.status();
|
2024-05-02 03:48:12 +08:00
|
|
|
const isGridLayout = Session.get('isGridEnabled');
|
2021-03-26 05:22:50 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
connected,
|
2024-05-02 03:48:12 +08:00
|
|
|
isGridLayout,
|
2021-03-26 05:22:50 +08:00
|
|
|
};
|
|
|
|
})(connectionStatusButtonContainer);
|