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';
|
2021-03-26 05:22:50 +08:00
|
|
|
import ConnectionStatusButtonComponent from './component';
|
2023-12-05 22:18:45 +08:00
|
|
|
import Service from '../service';
|
|
|
|
import { CONNECTION_STATUS_REPORT_SUBSCRIPTION } from '../queries';
|
2021-03-26 05:22:50 +08:00
|
|
|
|
2023-12-05 22:18:45 +08:00
|
|
|
const connectionStatusButtonContainer = (props) => {
|
|
|
|
const { data } = useSubscription(CONNECTION_STATUS_REPORT_SUBSCRIPTION);
|
|
|
|
|
|
|
|
const connectionData = data ? Service.sortConnectionData(data.user_connectionStatusReport) : [];
|
|
|
|
|
|
|
|
return <ConnectionStatusButtonComponent connectionData={connectionData} {...props} />;
|
|
|
|
};
|
2021-03-26 05:22:50 +08:00
|
|
|
|
|
|
|
export default withTracker(() => {
|
|
|
|
const { connected } = Meteor.status();
|
|
|
|
|
|
|
|
return {
|
|
|
|
connected,
|
|
|
|
};
|
|
|
|
})(connectionStatusButtonContainer);
|