import React from 'react' ; import ReactDOM from 'react-dom' ; import { Router } from 'react-router-dom' ; import { AppMountParameters } from 'kibana/public' ; import { KibanaContextProvider , KibanaThemeProvider } from '../../../kibana_react/public' ; import { VisualizeApp } from './app' ; import { VisualizeServices } from './types' ; import { addHelpMenuToAppChrome , addBadgeToAppChrome } from './utils' ; export const renderApp = ( { element , onAppLeave } , services ) => { addHelpMenuToAppChrome ( services . chrome , services . docLinks ) ; if ( ! services . visualizeCapabilities . save ) { addBadgeToAppChrome ( services . chrome ) ; } const app = ( < KibanaThemeProvider theme$ = { services . theme . theme$ } > < Router history = { services . history } > < KibanaContextProvider services = { services } > < services . presentationUtil . ContextProvider > < services . i18n . Context > < VisualizeApp onAppLeave = { onAppLeave } /> < /services.i18n.Context> < /services.presentationUtil.ContextProvider> < /KibanaContextProvider> < /Router> < /KibanaThemeProvider>); ReactDOM . render ( app , element ) ; return ( ) => ReactDOM . unmountComponentAtNode ( element ) ; } ;