Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32088898
thread-avatar.react.js
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
thread-avatar.react.js
View Options
// @flow
import
*
as
React
from
'react'
;
import
{
useAvatarForThread
,
useENSResolvedAvatar
,
}
from
'lib/shared/avatar-utils.js'
;
import
{
getSingleOtherUser
}
from
'lib/shared/thread-utils.js'
;
import
{
threadTypes
}
from
'lib/types/thread-types-enum.js'
;
import
{
type
RawThreadInfo
,
type
ThreadInfo
}
from
'lib/types/thread-types.js'
;
import
Avatar
from
'./avatar.react.js'
;
import
{
useSelector
}
from
'../redux/redux-utils.js'
;
type
Props
=
{
+
threadInfo
:
RawThreadInfo
|
ThreadInfo
,
+
size
:
'micro'
|
'small'
|
'large'
|
'profile'
,
};
function
ThreadAvatar
(
props
:
Props
)
:
React
.
Node
{
const
{
threadInfo
,
size
}
=
props
;
const
avatarInfo
=
useAvatarForThread
(
threadInfo
);
const
viewerID
=
useSelector
(
state
=>
state
.
currentUserInfo
&&
state
.
currentUserInfo
.
id
,
);
let
displayUserIDForThread
;
if
(
threadInfo
.
type
===
threadTypes
.
PRIVATE
)
{
displayUserIDForThread
=
viewerID
;
}
else
if
(
threadInfo
.
type
===
threadTypes
.
PERSONAL
)
{
displayUserIDForThread
=
getSingleOtherUser
(
threadInfo
,
viewerID
);
}
const
displayUser
=
useSelector
(
state
=>
displayUserIDForThread
?
state
.
userStore
.
userInfos
[
displayUserIDForThread
]
:
null
,
);
const
resolvedThreadAvatar
=
useENSResolvedAvatar
(
avatarInfo
,
displayUser
);
return
<
Avatar
size
=
{
size
}
avatarInfo
=
{
resolvedThreadAvatar
}
/>
;
}
export
default
ThreadAvatar
;
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Sun, Dec 7, 7:54 AM (1 d, 16 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5557698
Default Alt Text
thread-avatar.react.js (1 KB)
Attached To
Mode
rCOMM Comm
Attached
Detach File
Event Timeline
Log In to Comment