mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-12 00:15:44 +01:00
display only new annotations
This commit is contained in:
@@ -53,12 +53,29 @@ type Props = {
|
|||||||
source: AnnotatedSource;
|
source: AnnotatedSource;
|
||||||
};
|
};
|
||||||
|
|
||||||
const Author = styled.a`
|
type LineElementProps = {
|
||||||
|
newAnnotation: boolean;
|
||||||
|
};
|
||||||
|
|
||||||
|
const Author = styled.a<LineElementProps>`
|
||||||
width: 8em;
|
width: 8em;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
float: left;
|
float: left;
|
||||||
|
|
||||||
|
visibility: ${({ newAnnotation }) => (newAnnotation ? "visible" : "hidden")};
|
||||||
|
`;
|
||||||
|
|
||||||
|
const When = styled.span<LineElementProps>`
|
||||||
|
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`
|
const LineNumber = styled.span`
|
||||||
@@ -76,19 +93,10 @@ const LineNumber = styled.span`
|
|||||||
padding: 0 0.5em;
|
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<Props> = ({ source }) => {
|
const Annotate: FC<Props> = ({ source }) => {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const defaultRenderer = ({ rows, stylesheet, useInlineStyles }) => {
|
const defaultRenderer = ({ rows, stylesheet, useInlineStyles }) => {
|
||||||
|
let lastRevision = "";
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
return rows.map((node, i) => {
|
return rows.map((node, i) => {
|
||||||
const line = createElement({
|
const line = createElement({
|
||||||
@@ -100,10 +108,12 @@ const Annotate: FC<Props> = ({ source }) => {
|
|||||||
|
|
||||||
if (i + 1 < rows.length) {
|
if (i + 1 < rows.length) {
|
||||||
const annotation = source.lines[i];
|
const annotation = source.lines[i];
|
||||||
|
const newAnnotation = annotation.revision !== lastRevision;
|
||||||
|
lastRevision = annotation.revision;
|
||||||
return (
|
return (
|
||||||
<span>
|
<span>
|
||||||
<Author>{annotation.author.name}</Author>{" "}
|
<Author newAnnotation={newAnnotation}>{annotation.author.name}</Author>{" "}
|
||||||
<When>
|
<When newAnnotation={newAnnotation}>
|
||||||
<DateShort value={annotation.when} />
|
<DateShort value={annotation.when} />
|
||||||
</When>{" "}
|
</When>{" "}
|
||||||
<LineNumber>{i + 1}</LineNumber> {line}
|
<LineNumber>{i + 1}</LineNumber> {line}
|
||||||
|
|||||||
Reference in New Issue
Block a user