Changeset View
Changeset View
Standalone View
Standalone View
native/components/thread-avatar.react.js
// @flow | // @flow | ||||
import * as React from 'react'; | import * as React from 'react'; | ||||
import { | import { | ||||
useGetAvatarForThread, | useAvatarForThread, | ||||
useENSResolvedAvatar, | useENSResolvedAvatar, | ||||
} from 'lib/shared/avatar-utils.js'; | } from 'lib/shared/avatar-utils.js'; | ||||
import { getSingleOtherUser } from 'lib/shared/thread-utils.js'; | import { getSingleOtherUser } from 'lib/shared/thread-utils.js'; | ||||
import { | import { | ||||
threadTypes, | threadTypes, | ||||
type RawThreadInfo, | type RawThreadInfo, | ||||
type ThreadInfo, | type ThreadInfo, | ||||
} from 'lib/types/thread-types.js'; | } from 'lib/types/thread-types.js'; | ||||
import Avatar from './avatar.react.js'; | import Avatar from './avatar.react.js'; | ||||
import { useSelector } from '../redux/redux-utils.js'; | import { useSelector } from '../redux/redux-utils.js'; | ||||
type Props = { | type Props = { | ||||
+threadInfo: RawThreadInfo | ThreadInfo, | +threadInfo: RawThreadInfo | ThreadInfo, | ||||
+size: 'micro' | 'small' | 'large' | 'profile', | +size: 'micro' | 'small' | 'large' | 'profile', | ||||
}; | }; | ||||
function ThreadAvatar(props: Props): React.Node { | function ThreadAvatar(props: Props): React.Node { | ||||
const { threadInfo, size } = props; | const { threadInfo, size } = props; | ||||
const avatarInfo = useGetAvatarForThread(threadInfo); | const avatarInfo = useAvatarForThread(threadInfo); | ||||
const viewerID = useSelector( | const viewerID = useSelector( | ||||
state => state.currentUserInfo && state.currentUserInfo.id, | state => state.currentUserInfo && state.currentUserInfo.id, | ||||
); | ); | ||||
let displayUserIDForThread; | let displayUserIDForThread; | ||||
if (threadInfo.type === threadTypes.PRIVATE) { | if (threadInfo.type === threadTypes.PRIVATE) { | ||||
displayUserIDForThread = viewerID; | displayUserIDForThread = viewerID; | ||||
Show All 16 Lines |