-
-
Notifications
You must be signed in to change notification settings - Fork 436
/
Copy pathnotifications-renderer.tsx
39 lines (36 loc) · 1.33 KB
/
notifications-renderer.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import * as React from '@theia/core/shared/react';
import * as ReactDOM from '@theia/core/shared/react-dom';
import {
inject,
injectable,
postConstruct,
} from '@theia/core/shared/inversify';
import { NotificationCenterComponent } from './notification-center-component';
import { NotificationToastsComponent } from './notification-toasts-component';
import { NotificationsRenderer as TheiaNotificationsRenderer } from '@theia/messages/lib/browser/notifications-renderer';
import { FrontendApplicationStateService } from '@theia/core/lib/browser/frontend-application-state';
@injectable()
export class NotificationsRenderer extends TheiaNotificationsRenderer {
@inject(FrontendApplicationStateService)
private readonly appStateService: FrontendApplicationStateService;
@postConstruct()
protected override init(): void {
// Unlike Theia, IDE2 renders the notification area only when the app is ready.
this.appStateService.reachedState('ready').then(() => {
this.createOverlayContainer();
this.render();
});
}
protected override render(): void {
ReactDOM.render(
<div>
<NotificationToastsComponent
manager={this.manager}
corePreferences={this.corePreferences}
/>
<NotificationCenterComponent manager={this.manager} />
</div>,
this.container
);
}
}