2024-04-03 21:01:08 +08:00
|
|
|
import React from 'react';
|
|
|
|
import { useSubscription } from '@apollo/client';
|
|
|
|
import { CONNECTION_STATUS_REPORT_SUBSCRIPTION } from '../queries';
|
|
|
|
import Service from '../service';
|
|
|
|
import Component from './component';
|
2024-04-04 21:41:01 +08:00
|
|
|
import useCurrentUser from '/imports/ui/core/hooks/useCurrentUser';
|
2024-04-20 04:34:43 +08:00
|
|
|
import { useStreams } from '../../video-provider/video-provider-graphql/hooks';
|
2024-04-03 21:01:08 +08:00
|
|
|
|
|
|
|
const ConnectionStatusContainer = (props) => {
|
|
|
|
const { data } = useSubscription(CONNECTION_STATUS_REPORT_SUBSCRIPTION);
|
|
|
|
const connectionData = data ? Service.sortConnectionData(data.user_connectionStatusReport) : [];
|
2024-04-04 21:41:01 +08:00
|
|
|
const { data: currentUser } = useCurrentUser((u) => ({ isModerator: u.isModerator }));
|
|
|
|
const amIModerator = !!currentUser?.isModerator;
|
2024-04-20 04:34:43 +08:00
|
|
|
const { streams } = useStreams();
|
2024-04-03 21:01:08 +08:00
|
|
|
return (
|
|
|
|
<Component
|
|
|
|
connectionData={connectionData}
|
2024-04-04 21:41:01 +08:00
|
|
|
amIModerator={amIModerator}
|
2024-04-20 04:34:43 +08:00
|
|
|
streams={streams}
|
2024-04-03 21:01:08 +08:00
|
|
|
{...props}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
export default ConnectionStatusContainer;
|