2021-03-26 05:22:50 +08:00
|
|
|
import React from 'react';
|
|
|
|
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-06-04 21:40:54 +08:00
|
|
|
import useDeduplicatedSubscription from '/imports/ui/core/hooks/useDeduplicatedSubscription';
|
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';
|
2024-06-06 21:50:03 +08:00
|
|
|
import { useStorageKey } from '/imports/ui/services/storage/hooks';
|
2024-06-11 21:43:43 +08:00
|
|
|
import { useReactiveVar } from '@apollo/client';
|
|
|
|
import connectionStatus from '/imports/ui/core/graphql/singletons/connectionStatus';
|
2021-03-26 05:22:50 +08:00
|
|
|
|
2024-06-29 03:58:38 +08:00
|
|
|
const ConnectionStatusButtonContainer = (props) => {
|
2024-06-11 21:43:43 +08:00
|
|
|
const connected = useReactiveVar(connectionStatus.getConnectedStatusVar());
|
|
|
|
|
2024-06-04 21:40:54 +08:00
|
|
|
const { data } = useDeduplicatedSubscription(USER_CURRENT_STATUS_SUBSCRIPTION, {
|
2024-04-03 21:01:08 +08:00
|
|
|
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);
|
2024-06-06 21:50:03 +08:00
|
|
|
const isGridLayout = useStorageKey('isGridEnabled');
|
2024-05-18 04:33:52 +08:00
|
|
|
|
|
|
|
return (
|
|
|
|
<ConnectionStatusButtonComponent
|
|
|
|
myCurrentStatus={myCurrentStatus}
|
|
|
|
paginationEnabled={paginationEnabled}
|
|
|
|
viewParticipantsWebcams={viewParticipantsWebcams}
|
2024-06-06 21:50:03 +08:00
|
|
|
isGridLayout={isGridLayout}
|
2024-06-11 21:43:43 +08:00
|
|
|
connected={connected}
|
2024-05-18 04:33:52 +08:00
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
);
|
2023-12-05 22:18:45 +08:00
|
|
|
};
|
2021-03-26 05:22:50 +08:00
|
|
|
|
2024-06-29 03:58:38 +08:00
|
|
|
export default ConnectionStatusButtonContainer;
|