import { Aggregation, getAllCharacteristics, ComponentOperation, CompOpAggCharacteristics, } from '@aws-c2a/models'; import { Box, IconButton, makeStyles, Theme, Tooltip, Typography } from '@material-ui/core'; import { Launch as LaunchIcon } from '@material-ui/icons'; import React from 'react'; import { AppContext } from '../../App'; import ApproveChangeBtn from '../../reusable-components/ApproveChangeBtn'; import CollapsableRow from '../../reusable-components/CollapsableRow'; import ComponentTransitionDetails from '../../reusable-components/ComponentTransitionDetails'; import { mostRecentInTransition, getComponentStructuralPath } from '../../selectors/component-transition-helpers'; import { useIdAssignerHook } from '../../utils/idCreator'; interface props { agg?: Aggregation, } const useStyles = makeStyles((theme: Theme) => ({ root: { margin: 0, display: 'flex', flexDirection: 'column', }, emptyRoot: { display: 'flex', alignItems: 'center', justifyContent: 'center', }, header: { padding: theme.spacing(1), backgroundColor: theme.palette.background.default, }, ocurrencesTitle: { padding: theme.spacing(1, 0, 0, 1), }, occurrences: { overflowX: 'hidden', overflowY: 'auto', height: '100%', }, fillParent: { maxHeight: '100%', width: '100%', maxWidth: '100%', height: '100%', boxSizing: 'border-box', }, mainCharacteristicDescription: { margin: theme.spacing(1), }, characteristicDescription: { margin: theme.spacing(0.5, 1), }, })); export default function ChangeDetailsPane({agg}: props): JSX.Element { const classes = useStyles(); const descriptions = agg && agg.descriptions; const characteristics = agg && getAllCharacteristics(agg); const idAssigner = useIdAssignerHook(); return ( {({showComponentInHierarchy}) => !agg ? Select a set of changes to view their details : {characteristics !== undefined ? <> {(characteristics && characteristics[CompOpAggCharacteristics.OPERATION_TYPE]) ?? 'Changes'} {characteristics && { ` ${characteristics[CompOpAggCharacteristics.COMPONENT_TYPE]}` + ` ${characteristics[CompOpAggCharacteristics.COMPONENT_SUBTYPE] ?? ''}` } } {descriptions && descriptions.length && {descriptions[descriptions.length - 1]} } : Changes } Occurrences ({agg.entities.size}): {[...agg.entities].map((op,i) => showComponentInHierarchy(op.componentTransition)}> } title={{getComponentStructuralPath(mostRecentInTransition(op.componentTransition))}} content={ } />, )} } ); }