bigbluebutton-Github/bigbluebutton-html5/imports/ui/components/connection-status/button/container.jsx
Ramón Souza 96085110a5
refactor: fix sonarcloud alerts (#20604)
* remove unused argument

* fix Do not use "Error" to declare a variable

* fix Do not use "Array" to declare a parameter

* fix React component names must start with an uppercase letter

* adjust error boundary prop type

* add default values for lock settings
2024-06-28 15:58:38 -04:00

39 lines
1.5 KiB
JavaScript

import React from 'react';
import ConnectionStatusButtonComponent from './component';
import { USER_CURRENT_STATUS_SUBSCRIPTION } from '../queries';
import Auth from '/imports/ui/services/auth';
import useDeduplicatedSubscription from '/imports/ui/core/hooks/useDeduplicatedSubscription';
import useSettings from '/imports/ui/services/settings/hooks/useSettings';
import { SETTINGS } from '/imports/ui/services/settings/enums';
import { useStorageKey } from '/imports/ui/services/storage/hooks';
import { useReactiveVar } from '@apollo/client';
import connectionStatus from '/imports/ui/core/graphql/singletons/connectionStatus';
const ConnectionStatusButtonContainer = (props) => {
const connected = useReactiveVar(connectionStatus.getConnectedStatusVar());
const { data } = useDeduplicatedSubscription(USER_CURRENT_STATUS_SUBSCRIPTION, {
variables: { userId: Auth.userID },
});
const myCurrentStatus = data && data.length > 0
? data[0].currentStatus
: 'normal';
const { paginationEnabled } = useSettings(SETTINGS.APPLICATION);
const { viewParticipantsWebcams } = useSettings(SETTINGS.DATA_SAVING);
const isGridLayout = useStorageKey('isGridEnabled');
return (
<ConnectionStatusButtonComponent
myCurrentStatus={myCurrentStatus}
paginationEnabled={paginationEnabled}
viewParticipantsWebcams={viewParticipantsWebcams}
isGridLayout={isGridLayout}
connected={connected}
{...props}
/>
);
};
export default ConnectionStatusButtonContainer;