import { i18n } from '@kbn/i18n' ; import { VisualizeConstants } from '../../../common/constants' ; const defaultEditText = i18n . translate ( 'visualizations.editor.defaultEditBreadcrumbText' , { defaultMessage : 'Edit visualization' , } ) ; export function getLandingBreadcrumbs ( ) { return [ { text : i18n . translate ( 'visualizations.listing.breadcrumb' , { defaultMessage : 'Visualize Library' , } ) , href : `#${ VisualizeConstants . LANDING_PAGE_PATH }` , } , ] ; } export function getCreateBreadcrumbs ( { byValue , originatingAppName , redirectToOrigin , } ) { return [ ... ( originatingAppName ? [ { text : originatingAppName , onClick : redirectToOrigin } ] : [ ] ) , ... ( ! byValue ? getLandingBreadcrumbs ( ) : [ ] ) , { text : i18n . translate ( 'visualizations.editor.createBreadcrumb' , { defaultMessage : 'Create' , } ) , } , ] ; } export function getEditBreadcrumbs ( { byValue , originatingAppName , redirectToOrigin , } , title = defaultEditText ) { return [ ... ( originatingAppName ? [ { text : originatingAppName , onClick : redirectToOrigin } ] : [ ] ) , ... ( ! byValue ? getLandingBreadcrumbs ( ) : [ ] ) , { text : title , } , ] ; }