import React from 'react' ; import { render , unmountComponentAtNode } from 'react-dom' ; import { i18n } from '@osd/i18n' ; import { ScopedHistory , CoreStart } from 'opensearch-dashboards/public' ; import { OpenSearchDashboardsContextProvider } from '../../../opensearch_dashboards_react/public' ; import { HomeApp } from './components/home_app' ; import { getServices } from './opensearch_dashboards_services' ; import './index.scss' ; export const renderApp = async ( element , coreStart , history ) => { const homeTitle = i18n . translate ( 'home.breadcrumbs.homeTitle' , { defaultMessage : 'Home' } ) ; const { featureCatalogue , chrome } = getServices ( ) ; const navLinks = chrome . navLinks . getAll ( ) ; const directories = featureCatalogue . get ( ) ; const solutions = featureCatalogue . getSolutions ( ) . filter ( ( { id } ) => navLinks . find ( ( { category , hidden } ) => ! hidden && category ?. id === id ) ) ; chrome . setBreadcrumbs ( [ { text : homeTitle } ] ) ; const unlisten = history . listen ( ( location ) => { window . dispatchEvent ( new HashChangeEvent ( 'hashchange' ) ) ; } ) ; render ( < OpenSearchDashboardsContextProvider services = { { ... coreStart } } > < HomeApp directories = { directories } solutions = { solutions } / > < /OpenSearchDashboardsContextProvider>, element); return ( ) => { unmountComponentAtNode ( element ) ; unlisten ( ) ; } ; } ;