Skip to content
This repository was archived by the owner on Jan 19, 2025. It is now read-only.

Commit 4e6b6dd

Browse files
AclrianMasaralars-reimann
authored
feat(gui): Added a user icon for annotations which where added by the current user (#945)
* feat: Added a user icon for annotations which where added by the current user. * feat: Added a robot icon for annotations which where autogenerated. * style: apply automatic fixes of linters * fix(gui): TypeScript error * style: apply automatic fixes of linters Co-authored-by: Arsam Islami <[email protected]> Co-authored-by: Aclrian <[email protected]> Co-authored-by: Lars Reimann <[email protected]> Co-authored-by: lars-reimann <[email protected]>
1 parent 41cb0f4 commit 4e6b6dd

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

api-editor/gui/src/features/annotations/AnnotationView.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Button, ButtonGroup, Icon, IconButton, Stack, Text as ChakraText, Tooltip } from '@chakra-ui/react';
22
import React from 'react';
3-
import { FaCheck, FaFlag, FaQuestion, FaTimes, FaTrash, FaWrench } from 'react-icons/fa';
3+
import { FaCheck, FaFlag, FaQuestion, FaRobot, FaTimes, FaTrash, FaUser, FaWrench } from 'react-icons/fa';
44
import { useAppDispatch, useAppSelector } from '../../app/hooks';
55
import {
66
removeBoundaryAnnotation,
@@ -35,6 +35,7 @@ import {
3535
selectRemoveAnnotation,
3636
selectRenameAnnotation,
3737
selectTodoAnnotation,
38+
selectUsername,
3839
selectUsernameIsValid,
3940
selectValueAnnotation,
4041
} from './annotationSlice';
@@ -332,6 +333,14 @@ const AnnotationTag: React.FC<AnnotationTagProps> = function ({
332333

333334
const authors = annotation.authors ?? [];
334335
const authorText = createAuthorText(authors);
336+
const username = useAppSelector(selectUsername);
337+
338+
let rightIcon;
339+
if (authors.includes(username)) {
340+
rightIcon = <FaUser />;
341+
} else if (authors.length === 1 && authors[0] === '$autogen$') {
342+
rightIcon = <FaRobot />;
343+
}
335344

336345
const isReportable = reportable && authors.length === 1 && authors.includes('$autogen$');
337346

@@ -375,6 +384,7 @@ const AnnotationTag: React.FC<AnnotationTagProps> = function ({
375384
<Tooltip label={`${authorText}Click to change.`}>
376385
<Button
377386
leftIcon={<FaWrench />}
387+
rightIcon={rightIcon}
378388
flexGrow={1}
379389
borderLeft="none"
380390
justifyContent="flex-start"

0 commit comments

Comments
 (0)