Page MenuHomePhabricator

D7273.diff
No OneTemporary

D7273.diff

diff --git a/web/components/user-avatar.react.js b/web/components/user-avatar.react.js
new file mode 100644
--- /dev/null
+++ b/web/components/user-avatar.react.js
@@ -0,0 +1,31 @@
+// @flow
+
+import * as React from 'react';
+
+import {
+ getAvatarForUser,
+ useENSResolvedAvatar,
+} from 'lib/shared/avatar-utils.js';
+
+import Avatar from './avatar.react.js';
+import { useSelector } from '../redux/redux-utils.js';
+
+type Props = {
+ +userID: ?string,
+ +size: 'micro' | 'small' | 'large' | 'profile',
+};
+
+function UserAvatar(props: Props): React.Node {
+ const { userID, size } = props;
+
+ const userInfo = useSelector(state =>
+ userID ? state.userStore.userInfos[userID] : null,
+ );
+ const avatarInfo = getAvatarForUser(userInfo);
+
+ const resolvedUserAvatar = useENSResolvedAvatar(avatarInfo, userInfo);
+
+ return <Avatar size={size} avatarInfo={resolvedUserAvatar} />;
+}
+
+export default UserAvatar;

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 12:08 AM (15 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2697470
Default Alt Text
D7273.diff (934 B)

Event Timeline