@@ -2,10 +2,7 @@ import { Meteor } from 'meteor/meteor'
2
2
import { DDP } from 'meteor/ddp'
3
3
import * as React from 'react'
4
4
import * as _ from 'underscore'
5
-
6
- import { Translated } from './ReactMeteorData/react-meteor-data'
7
5
import { MomentFromNow } from './Moment'
8
-
9
6
import {
10
7
NotificationCenter ,
11
8
NoticeLevel ,
@@ -14,13 +11,14 @@ import {
14
11
NotifierHandle ,
15
12
} from './notifications/notifications'
16
13
import { WithManagedTracker } from './reactiveData/reactiveDataHelper'
17
- import { withTranslation } from 'react-i18next'
14
+ import { useTranslation } from 'react-i18next'
18
15
import { NotificationCenterPopUps } from './notifications/NotificationCenterPanel'
19
16
import { MeteorPubSub } from '@sofie-automation/meteor-lib/dist/api/pubsub'
20
17
import { ICoreSystem , ServiceMessage , Criticality } from '@sofie-automation/meteor-lib/dist/collections/CoreSystem'
21
18
import { TFunction } from 'react-i18next'
22
19
import { getRandomId } from '@sofie-automation/corelib/dist/lib'
23
20
import { CoreSystem } from '../collections'
21
+ import { useEffect } from 'react'
24
22
25
23
export class ConnectionStatusNotifier extends WithManagedTracker {
26
24
private _notificationList : NotificationList
@@ -233,30 +231,16 @@ function createSystemNotification(cs: ICoreSystem | undefined): Notification | u
233
231
return undefined
234
232
}
235
233
236
- interface IProps { }
237
- interface IState {
238
- dismissed : boolean
239
- }
240
-
241
- export const ConnectionStatusNotification = withTranslation ( ) (
242
- class ConnectionStatusNotification extends React . Component < Translated < IProps > , IState > {
243
- private notifier : ConnectionStatusNotifier | undefined
244
-
245
- constructor ( props : Translated < IProps > ) {
246
- super ( props )
247
- }
234
+ export function ConnectionStatusNotification ( ) : JSX . Element {
235
+ const { t } = useTranslation ( )
248
236
249
- componentDidMount ( ) : void {
250
- this . notifier = new ConnectionStatusNotifier ( this . props . t )
251
- }
237
+ useEffect ( ( ) => {
238
+ const notifier = new ConnectionStatusNotifier ( t )
252
239
253
- componentWillUnmount ( ) : void {
254
- if ( this . notifier ) this . notifier . stop ( )
240
+ return ( ) => {
241
+ notifier . stop ( )
255
242
}
243
+ } , [ t ] )
256
244
257
- render ( ) : JSX . Element {
258
- // this.props.connected
259
- return < NotificationCenterPopUps />
260
- }
261
- }
262
- )
245
+ return < NotificationCenterPopUps />
246
+ }
0 commit comments