diff --git a/scm-ui/ui-components/src/Annotate.tsx b/scm-ui/ui-components/src/Annotate.tsx index b71d78023b..e0e1768611 100644 --- a/scm-ui/ui-components/src/Annotate.tsx +++ b/scm-ui/ui-components/src/Annotate.tsx @@ -53,12 +53,29 @@ type Props = { source: AnnotatedSource; }; -const Author = styled.a` +type LineElementProps = { + newAnnotation: boolean; +}; + +const Author = styled.a` width: 8em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; float: left; + + visibility: ${({ newAnnotation }) => (newAnnotation ? "visible" : "hidden")}; +`; + +const When = styled.span` + width: 6.5em; + overflow: hidden; + text-overflow: ellipsis; + white-space: nowrap; + float: left; + + margin: 0 0.5em; + visibility: ${({ newAnnotation }) => (newAnnotation ? "visible" : "hidden")}; `; const LineNumber = styled.span` @@ -76,19 +93,10 @@ const LineNumber = styled.span` padding: 0 0.5em; `; -const When = styled.span` - width: 90px; - overflow: hidden; - text-overflow: ellipsis; - white-space: nowrap; - float: left; - - margin: 0 0.5em; -`; - const Annotate: FC = ({ source }) => { // @ts-ignore const defaultRenderer = ({ rows, stylesheet, useInlineStyles }) => { + let lastRevision = ""; // @ts-ignore return rows.map((node, i) => { const line = createElement({ @@ -100,10 +108,12 @@ const Annotate: FC = ({ source }) => { if (i + 1 < rows.length) { const annotation = source.lines[i]; + const newAnnotation = annotation.revision !== lastRevision; + lastRevision = annotation.revision; return ( - {annotation.author.name}{" "} - + {annotation.author.name}{" "} + {" "} {i + 1} {line}