forked from argoproj/argo-workflows
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Tianchu Zhao <[email protected]>
- Loading branch information
Showing
2 changed files
with
19 additions
and
53 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,27 @@ | ||
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; | ||
export const App = () => { | ||
const popupManager: PopupManager = new PopupManager(); | ||
const notificationsManager: NotificationsManager = new NotificationsManager(); | ||
const navigationManager: NavigationManager = new NavigationManager(history); | ||
|
||
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> | ||
); | ||
} | ||
const providerContext: ContextApis = { | ||
notifications: notificationsManager, | ||
popup: popupManager, | ||
navigation: navigationManager, | ||
history | ||
}; | ||
|
||
public getChildContext() { | ||
return { | ||
history, | ||
apis: { | ||
popup: this.popupManager, | ||
notifications: this.notificationsManager | ||
} | ||
}; | ||
} | ||
} | ||
return ( | ||
<Provider value={providerContext}> | ||
<AppRouter history={history} notificationsManager={notificationsManager} popupManager={popupManager} /> | ||
</Provider> | ||
); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters