2021-03-26 05:22:50 +08:00
|
|
|
import React from 'react';
|
2024-06-11 21:43:43 +08:00
|
|
|
import { useReactiveVar } from '@apollo/client';
|
2024-07-19 20:52:55 +08:00
|
|
|
import ConnectionStatusButtonComponent from './component';
|
2024-06-11 21:43:43 +08:00
|
|
|
import connectionStatus from '/imports/ui/core/graphql/singletons/connectionStatus';
|
2024-07-05 04:26:09 +08:00
|
|
|
import { getWorstStatus } from '../service';
|
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-07-05 04:26:09 +08:00
|
|
|
const rttStatus = useReactiveVar(connectionStatus.getRttStatusVar());
|
|
|
|
const jitterStatus = useReactiveVar(connectionStatus.getJitterStatusVar());
|
|
|
|
const packetLossStatus = useReactiveVar(connectionStatus.getPacketLossStatusVar());
|
2024-06-11 21:43:43 +08:00
|
|
|
|
2024-07-05 04:26:09 +08:00
|
|
|
const myCurrentStatus = getWorstStatus([rttStatus, jitterStatus, packetLossStatus]);
|
2023-12-05 22:18:45 +08:00
|
|
|
|
2024-05-18 04:33:52 +08:00
|
|
|
return (
|
|
|
|
<ConnectionStatusButtonComponent
|
|
|
|
myCurrentStatus={myCurrentStatus}
|
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;
|