Skip to content

Commit b85f464

Browse files
committed
fixup! ♻️(frontend) add user avatar to thread comments
1 parent b279da9 commit b85f464

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

src/frontend/apps/impress/src/features/docs/doc-editor/components/BlockNoteEditor.tsx

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import { BlockNoteView } from '@blocknote/mantine';
1212
import '@blocknote/mantine/style.css';
1313
import { useCreateBlockNote } from '@blocknote/react';
1414
import { HocuspocusProvider } from '@hocuspocus/provider';
15-
import { useEffect, useRef } from 'react';
15+
import { useEffect, useMemo, useRef } from 'react';
1616
import { useTranslation } from 'react-i18next';
1717
import { css } from 'styled-components';
1818
import * as Y from 'yjs';
@@ -101,6 +101,13 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
101101

102102
const threadStore = useComments(doc.id, canSeeComment, user);
103103

104+
const currentUserAvatarUrl = useMemo(() => {
105+
if (!canSeeComment) {
106+
return undefined;
107+
}
108+
return avatarUrlFromName(collabName, themeTokens?.font?.families?.base);
109+
}, [canSeeComment, collabName, themeTokens?.font?.families?.base]);
110+
104111
const editor: DocsBlockNoteEditor = useCreateBlockNote(
105112
{
106113
collaboration: {
@@ -201,7 +208,7 @@ export const BlockNoteEditor = ({ doc, provider }: BlockNoteEditorProps) => {
201208
ref={refEditorContainer}
202209
$css={css`
203210
${cssEditor};
204-
${cssComments(canSeeComment)}
211+
${cssComments(canSeeComment, currentUserAvatarUrl)}
205212
`}
206213
>
207214
{errorAttachment && (

0 commit comments

Comments
 (0)