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';
|
2024-05-02 03:48:12 +08:00
|
|
|
import Settings from '/imports/ui/services/settings';
|
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';
|
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-04-03 21:01:08 +08:00
|
|
|
return <ConnectionStatusButtonComponent myCurrentStatus={myCurrentStatus} {...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');
|
|
|
|
const { paginationEnabled } = Settings.application;
|
|
|
|
const { viewParticipantsWebcams } = Settings.dataSaving;
|
2021-03-26 05:22:50 +08:00
|
|
|
|
|
|
|
return {
|
|
|
|
connected,
|
2024-05-02 03:48:12 +08:00
|
|
|
isGridLayout,
|
|
|
|
paginationEnabled,
|
|
|
|
viewParticipantsWebcams,
|
2021-03-26 05:22:50 +08:00
|
|
|
};
|
|
|
|
})(connectionStatusButtonContainer);
|