Skip to content

Commit

Permalink
display creator name in annotationCard
Browse files Browse the repository at this point in the history
  • Loading branch information
arthur-lemeur committed Oct 14, 2024
1 parent 0a3626b commit b3933e2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/renderer/assets/icons/avatar-icon.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 7 additions & 0 deletions src/renderer/assets/styles/components/annotations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,13 @@
justify-content: space-between;
padding: 0 5px;

p {
padding-left: 0;
max-width: 100px;
overflow: hidden;
text-overflow: ellipsis;
}

>div {
display: inherit;
align-items: center;
Expand Down
12 changes: 12 additions & 0 deletions src/renderer/reader/components/ReaderMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ import * as HighLightIcon from "readium-desktop/renderer/assets/icons/highlight-
import * as UnderLineIcon from "readium-desktop/renderer/assets/icons/underline-icon.svg";
import * as TextStrikeThroughtIcon from "readium-desktop/renderer/assets/icons/TextStrikethrough-icon.svg";
import * as TextOutlineIcon from "readium-desktop/renderer/assets/icons/TextOutline-icon.svg";
import * as AvatarIcon from "readium-desktop/renderer/assets/icons/avatar-icon.svg";
// import * as DuplicateIcon from "readium-desktop/renderer/assets/icons/duplicate-icon.svg";

import * as Tabs from "@radix-ui/react-tabs";
Expand Down Expand Up @@ -449,6 +450,7 @@ const AnnotationCard: React.FC<{ timestamp: number, annotation: IAnnotationState
const tagName = tagsStringArray[0] || "";
const dockedEditAnnotation = isEdited && dockedMode;
const annotationColor = rgbToHex(annotation.color);
const creatorMyself = useSelector((state: IReaderRootState) => state.creator);

const dispatch = useDispatch();
const [__] = useTranslator();
Expand Down Expand Up @@ -491,6 +493,8 @@ const AnnotationCard: React.FC<{ timestamp: number, annotation: IAnnotationState
if (!uuid) {
return <></>;
}

const creatorName = (annotation.creator?.id !== creatorMyself.id ? annotation.creator?.name : creatorMyself.name) || "";

return (<div
className={stylesAnnotations.annotations_line}
Expand Down Expand Up @@ -587,6 +591,14 @@ const AnnotationCard: React.FC<{ timestamp: number, annotation: IAnnotationState
<SVG ariaHidden svg={BookOpenIcon} />
<p>{bprogression}</p>
</div>
{creatorName
?
<div>
<SVG ariaHidden svg={AvatarIcon} />
<p>{creatorName}</p>
</div>
: <></>
}
</div>
<div className={stylesAnnotations.annotation_actions_buttons}>
<button
Expand Down

0 comments on commit b3933e2

Please sign in to comment.