import { UISref } from '@uirouter/react'; import { UIRouterContext } from '@uirouter/react-hybrid'; import React from 'react'; import { Tooltip } from '../../presentation'; import './projectSummaryPod.less'; export interface IProjectSummaryPodProps { id: string; projectName: string; applications: string[]; onRemoveProject?: (projectName: string) => void; onResultClick: (categoryName: string) => void; } @UIRouterContext export class ProjectSummaryPod extends React.Component { private handleRemoveClicked = (evt: React.MouseEvent) => { evt.preventDefault(); this.props.onRemoveProject(this.props.id); }; private handleResultClick = (): void => { if (this.props.onResultClick) { this.props.onResultClick('projects'); } }; public render() { const { projectName, applications, onRemoveProject } = this.props; const showRemoveButton = !!onRemoveProject; return (
{projectName} {showRemoveButton && ( )}
{applications.length || 0} Application {applications.length !== 1 ? 's' : ''}
); } }