import React from 'react' ; import { Entity } from '@backstage/catalog-model' ; import { Routes , Route } from 'react-router-dom' ; import { TravisCIBuildsPage } from './components/TravisCiBuildsPage' ; import { TRAVIS_ANNOTATION } from './hooks/useTravisRepoData' ; import { MissingAnnotationEmptyState } from '@backstage/core-components' ; import { useEntity } from "@backstage/plugin-catalog-react" ; export const isTravisciAvailable = ( entity ) => Boolean ( entity ?. metadata . annotations ?. [ TRAVIS_ANNOTATION ] ) ; type Props = { deprecated entity ? : Entity ; } ; export const Router = ( _props ) => { const { entity } = useEntity ( ) ; return ! isTravisciAvailable ( entity ) ? ( < MissingAnnotationEmptyState annotation = { TRAVIS_ANNOTATION } / > ) : ( < Routes > < Route path = "/" element = { < TravisCIBuildsPage entity = { entity } / > } /> < /Routes>); } ;