Skip to content

Commit

Permalink
[desk-tool] Render user avatar in annotation tooltips
Browse files Browse the repository at this point in the history
  • Loading branch information
rexxars committed Oct 6, 2020
1 parent b8b3246 commit dcff35a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import React from 'react'
import {useUser, LOADING_USER} from '@sanity/react-hooks'
import {Tooltip} from 'react-tippy'
import {UserAvatar} from '@sanity/components/presence'
import {Annotation, AnnotationChanged} from '../../panes/documentPane/history/types'

import styles from './annotationTooltip.css'
Expand Down Expand Up @@ -35,9 +37,10 @@ function AnnotationTooltipContent(props: {annotation: AnnotationChanged}) {
}

function UserItem(props: {userId: string}) {
const user = useUser(props.userId)
return (
<div className={styles.userItem}>
<code>userId={props.userId}</code>
{user && user !== LOADING_USER ? <UserAvatar user={user} /> : '…'}
</div>
)
}

0 comments on commit dcff35a

Please sign in to comment.