import React from 'react'; import { useParams } from 'react-router-dom'; import { Bullseye, EmptyStateBody, Spinner, Content, ContentVariants, } from '@patternfly/react-core'; import { useComponentV2 } from '~/hooks/useComponentsV2'; import { getErrorState } from '~/shared/utils/error-utils'; import emptyStateImgUrl from '../../../assets/Components.svg'; import { FeatureFlagIndicator } from '../../../feature-flags/FeatureFlagIndicator'; import { FLAGS } from '../../../feature-flags/flags'; import { IfFeature } from '../../../feature-flags/hooks'; import { COMPONENTS_PATH, COMPONENT_DETAILS_V2_PATH } from '../../../routes/paths'; import { RouterParams } from '../../../routes/utils'; import AppEmptyState from '../../../shared/components/empty-state/AppEmptyState'; import { useNamespace } from '../../../shared/providers/Namespace/useNamespaceInfo'; import { DetailsPage } from '../../DetailsPage'; import GitRepoLink from '../../GitLink/GitRepoLink'; export const COMPONENTS_GS_LOCAL_STORAGE_KEY = 'components-getting-started-modal'; const ComponentDetailsView: React.FC = () => { const { componentName } = useParams(); const namespace = useNamespace(); const [component, loaded, componentError] = useComponentV2(namespace, componentName); if (!loaded) { return ( ); } if (componentError) { return getErrorState(componentError, loaded, 'component'); } return ( {`To view this page, enable the "${FLAGS['component-model'].description}" feature flag.`} } > {component.metadata.name} } description={} breadcrumbs={[ { path: COMPONENTS_PATH.createPath({ workspaceName: namespace }), name: 'Components', }, { path: COMPONENT_DETAILS_V2_PATH.createPath({ workspaceName: namespace, componentName, }), name: component.metadata.name, }, ]} baseURL={COMPONENT_DETAILS_V2_PATH.createPath({ workspaceName: namespace, componentName, })} tabs={[ { key: 'index', label: 'Overview', isFilled: true, }, { key: 'activity', label: 'Activity', }, { key: 'versions', label: 'Versions', }, { key: 'dep-updates', label: 'Dependency updates', }, ]} /> ); }; export default ComponentDetailsView;