(props: Props)
| 29 | }; |
| 30 | |
| 31 | function ThreadAvatar(props: Props): React.Node { |
| 32 | const { threadInfo, size, showSpinner } = props; |
| 33 | |
| 34 | const avatarInfo = useAvatarForThread(threadInfo); |
| 35 | |
| 36 | const viewerID = useSelector( |
| 37 | state => state.currentUserInfo && state.currentUserInfo.id, |
| 38 | ); |
| 39 | |
| 40 | const communityID = getCommunity(threadInfo); |
| 41 | const communityInfo: ?CommunityInfo = useSelector(state => { |
| 42 | if (!communityID) { |
| 43 | return null; |
| 44 | } |
| 45 | return state.communityStore.communityInfos[communityID]; |
| 46 | }); |
| 47 | |
| 48 | let displayUserIDForThread; |
| 49 | if (threadTypeIsPrivate(threadInfo.type)) { |
| 50 | displayUserIDForThread = viewerID; |
| 51 | } else if (threadTypeIsPersonal(threadInfo.type)) { |
| 52 | displayUserIDForThread = getSingleOtherUser(threadInfo, viewerID); |
| 53 | } |
| 54 | |
| 55 | const userInfos = useSelector(state => state.userStore.userInfos); |
| 56 | const auxUserInfos = useSelector(state => state.auxUserStore.auxUserInfos); |
| 57 | |
| 58 | const displayUser = useDisplayUserForThread( |
| 59 | displayUserIDForThread, |
| 60 | userInfos, |
| 61 | auxUserInfos, |
| 62 | ); |
| 63 | |
| 64 | const resolvedThreadAvatar = useResolvedThreadAvatar(avatarInfo, { |
| 65 | userProfileInfo: displayUser, |
| 66 | channelInfo: { fcChannelID: communityInfo?.farcasterChannelID }, |
| 67 | }); |
| 68 | |
| 69 | return ( |
| 70 | <Avatar |
| 71 | size={size} |
| 72 | avatarInfo={resolvedThreadAvatar} |
| 73 | showSpinner={showSpinner} |
| 74 | /> |
| 75 | ); |
| 76 | } |
| 77 | |
| 78 | export default ThreadAvatar; |
nothing calls this directly
no test coverage detected