-
Notifications
You must be signed in to change notification settings - Fork 3.1k
/
app.tsx
51 lines (44 loc) · 1.57 KB
/
app.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
40
41
42
43
44
45
46
47
48
49
50
51
import {NavigationManager, NotificationsManager, PopupManager} from 'argo-ui';
import {createBrowserHistory} from 'history';
import * as PropTypes from 'prop-types';
import * as React from 'react';
import {AppRouter} from './app-router';
import {ContextApis, Provider} from './shared/context';
const history = createBrowserHistory();
export class App extends React.Component<{}> {
public static childContextTypes = {
history: PropTypes.object,
apis: PropTypes.object
};
private readonly popupManager: PopupManager;
private readonly notificationsManager: NotificationsManager;
private readonly navigationManager: NavigationManager;
constructor(props: {}) {
super(props);
this.popupManager = new PopupManager();
this.notificationsManager = new NotificationsManager();
this.navigationManager = new NavigationManager(history);
}
public render() {
const providerContext: ContextApis = {
notifications: this.notificationsManager,
popup: this.popupManager,
navigation: this.navigationManager,
history
};
return (
<Provider value={providerContext}>
<AppRouter history={history} notificationsManager={this.notificationsManager} popupManager={this.popupManager} />
</Provider>
);
}
public getChildContext() {
return {
history,
apis: {
popup: this.popupManager,
notifications: this.notificationsManager
}
};
}
}