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}> <Ref innerRef={focusRef}>
<Feed.Label className="post-profile-picture"> <Feed.Label className="post-profile-picture">
<ProfileImage <ProfileImage
topicAuthorAddress={postAuthorAddress} profileAddress={postAuthorAddress}
topicAuthor={postAuthor} profileUsername={postAuthor}
topicAuthorMeta={postAuthorMeta} profileUserMeta={postAuthorMeta}
size="42" size="42"
link 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 ProfileImage = (props) => {
const { const {
topicAuthorAddress, topicAuthor, topicAuthorMeta, avatarUrl, size, link, profileAddress, profileUsername, topicAuthorMeta, avatarUrl, size, link,
} = props; } = props;
const stopClickPropagation = (event) => { const stopClickPropagation = (event) => {
@ -20,30 +20,30 @@ const ProfileImage = (props) => {
return ( return (
<Avatar <Avatar
name={topicAuthor} name={profileUsername}
size={size} size={size}
round round
src={profileImageUrl} src={profileImageUrl}
/> />
); );
}, [avatarUrl, size, topicAuthor, topicAuthorMeta]); }, [avatarUrl, size, profileUsername, topicAuthorMeta]);
return useMemo(() => { return useMemo(() => {
if (link && topicAuthorAddress) { if (link && profileAddress) {
return ( return (
<Link to={`/users/${topicAuthorAddress}`} onClick={stopClickPropagation}> <Link to={`/users/${profileAddress}`} onClick={stopClickPropagation}>
{authorAvatar} {authorAvatar}
</Link> </Link>
); );
} }
return authorAvatar; return authorAvatar;
}, [authorAvatar, link, topicAuthorAddress]); }, [authorAvatar, link, profileAddress]);
}; };
ProfileImage.propTypes = { ProfileImage.propTypes = {
topicAuthorAddress: PropTypes.string, profileAddress: PropTypes.string,
topicAuthor: PropTypes.string, profileUsername: PropTypes.string,
topicAuthorMeta: PropTypes.shape({ id: PropTypes.string, profile_picture: PropTypes.string }), profileUserMeta: PropTypes.shape({ id: PropTypes.string, profile_picture: PropTypes.string }),
avatarUrl: PropTypes.string, avatarUrl: PropTypes.string,
size: PropTypes.string, size: PropTypes.string,
link: PropTypes.bool, 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"> <Grid.Column width={1} className="topic-row-avatar">
<Item> <Item>
<ProfileImage <ProfileImage
topicAuthorAddress={topicAuthorAddress} profileAddress={topicAuthorAddress}
topicAuthor={topicAuthor} profileUsername={topicAuthor}
topicAuthorMeta={topicAuthorMeta} profileUserMeta={topicAuthorMeta}
size="65" size="65"
link link
/> />

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

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

Loading…
Cancel
Save