Browse Source

Refactoring

develop
Ezerous 4 years ago
parent
commit
bd7454dce7
  1. 6
      packages/concordia-app/src/components/PostList/PostListRow/index.jsx
  2. 18
      packages/concordia-app/src/components/ProfileImage.jsx
  3. 6
      packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx
  4. 4
      packages/concordia-app/src/views/Profile/GeneralTab/index.jsx

6
packages/concordia-app/src/components/PostList/PostListRow/index.jsx

@ -108,9 +108,9 @@ const PostListRow = (props) => {
<Ref innerRef={focusRef}>
<Feed.Label className="post-profile-picture">
<ProfileImage
topicAuthorAddress={postAuthorAddress}
topicAuthor={postAuthor}
topicAuthorMeta={postAuthorMeta}
profileAddress={postAuthorAddress}
profileUsername={postAuthor}
profileUserMeta={postAuthorMeta}
size="42"
link
/>

18
packages/concordia-app/src/components/ProfileImage.jsx

@ -6,7 +6,7 @@ import { USER_PROFILE_PICTURE } from '../constants/orbit/UserDatabaseKeys';
const ProfileImage = (props) => {
const {
topicAuthorAddress, topicAuthor, topicAuthorMeta, avatarUrl, size, link,
profileAddress, profileUsername, topicAuthorMeta, avatarUrl, size, link,
} = props;
const stopClickPropagation = (event) => {
@ -20,30 +20,30 @@ const ProfileImage = (props) => {
return (
<Avatar
name={topicAuthor}
name={profileUsername}
size={size}
round
src={profileImageUrl}
/>
);
}, [avatarUrl, size, topicAuthor, topicAuthorMeta]);
}, [avatarUrl, size, profileUsername, topicAuthorMeta]);
return useMemo(() => {
if (link && topicAuthorAddress) {
if (link && profileAddress) {
return (
<Link to={`/users/${topicAuthorAddress}`} onClick={stopClickPropagation}>
<Link to={`/users/${profileAddress}`} onClick={stopClickPropagation}>
{authorAvatar}
</Link>
);
}
return authorAvatar;
}, [authorAvatar, link, topicAuthorAddress]);
}, [authorAvatar, link, profileAddress]);
};
ProfileImage.propTypes = {
topicAuthorAddress: PropTypes.string,
topicAuthor: PropTypes.string,
topicAuthorMeta: PropTypes.shape({ id: PropTypes.string, profile_picture: PropTypes.string }),
profileAddress: PropTypes.string,
profileUsername: PropTypes.string,
profileUserMeta: PropTypes.shape({ id: PropTypes.string, profile_picture: PropTypes.string }),
avatarUrl: PropTypes.string,
size: PropTypes.string,
link: PropTypes.bool,

6
packages/concordia-app/src/components/TopicList/TopicListRow/index.jsx

@ -105,9 +105,9 @@ const TopicListRow = (props) => {
<Grid.Column width={1} className="topic-row-avatar">
<Item>
<ProfileImage
topicAuthorAddress={topicAuthorAddress}
topicAuthor={topicAuthor}
topicAuthorMeta={topicAuthorMeta}
profileAddress={topicAuthorAddress}
profileUsername={topicAuthor}
profileUserMeta={topicAuthorMeta}
size="65"
link
/>

4
packages/concordia-app/src/views/Profile/GeneralTab/index.jsx

@ -108,8 +108,8 @@ const GeneralTab = (props) => {
<Table.Row textAlign="center">
<Table.Cell colSpan="3" className="profile-image">
<ProfileImage
topicAuthorAddress={profileAddress}
topicAuthor={username}
profileAddress={profileAddress}
profileUsername={username}
avatarUrl={userAvatarUrl}
size="160"
/>

Loading…
Cancel
Save