fix: nits

This commit is contained in:
Akuoko Daniel Jnr 2021-02-09 17:55:38 +00:00
parent 09a962257f
commit ff521612b9
No known key found for this signature in database
GPG Key ID: 1C95803CACD3E9DC
2 changed files with 19 additions and 16 deletions

View File

@ -242,6 +242,8 @@ function UserEntry({
checkStatus,
showStatusIndicator,
}) {
const isOnline = checkStatus({ id: user.id });
return (
<div key={user.username} css={STYLES_USER_ENTRY}>
{external ? (
@ -254,8 +256,8 @@ function UserEntry({
<div
css={STYLES_DIRECTORY_STATUS_INDICATOR}
style={{
borderColor: checkStatus(user.id) && `${Constants.system.active}`,
backgroundColor: checkStatus(user.id) && `${Constants.system.active}`,
borderColor: isOnline && `${Constants.system.active}`,
backgroundColor: isOnline && `${Constants.system.active}`,
}}
/>
)}
@ -274,8 +276,8 @@ function UserEntry({
<div
css={STYLES_DIRECTORY_STATUS_INDICATOR}
style={{
borderColor: checkStatus(user.id) && `${Constants.system.active}`,
backgroundColor: checkStatus(user.id) && `${Constants.system.active}`,
borderColor: isOnline && `${Constants.system.active}`,
backgroundColor: isOnline && `${Constants.system.active}`,
}}
/>
</div>
@ -402,10 +404,9 @@ export default class Profile extends React.Component {
});
};
checkStatus = (userId) => {
const activeUsers = this.props.activeUsers;
return activeUsers && activeUsers.includes(userId);
checkStatus = ({ id }) => {
const { activeUsers } = this.props;
return activeUsers && activeUsers.includes(id);
};
render() {
@ -580,9 +581,9 @@ export default class Profile extends React.Component {
css={STYLES_STATUS_INDICATOR}
style={{
borderColor:
this.checkStatus(this.props.data?.id) && `${Constants.system.active}`,
this.checkStatus({ id: this.props.data?.id }) && `${Constants.system.active}`,
backgroundColor:
this.checkStatus(this.props.data?.id) && `${Constants.system.active}`,
this.checkStatus({ id: this.props.data?.id }) && `${Constants.system.active}`,
}}
/>
)}

View File

@ -113,6 +113,8 @@ const STYLES_NAME = css`
`;
function UserEntry({ user, button, onClick, message, checkStatus }) {
const isOnline = checkStatus({ id: user.id });
return (
<div key={user.username} css={STYLES_USER_ENTRY}>
<div css={STYLES_USER} onClick={onClick}>
@ -120,8 +122,8 @@ function UserEntry({ user, button, onClick, message, checkStatus }) {
<div
css={STYLES_STATUS_INDICATOR}
style={{
borderColor: checkStatus(user.id) && `${Constants.system.active}`,
backgroundColor: checkStatus(user.id) && `${Constants.system.active}`,
borderColor: isOnline && `${Constants.system.active}`,
backgroundColor: isOnline && `${Constants.system.active}`,
}}
/>
</div>
@ -191,10 +193,10 @@ export default class SceneDirectory extends React.Component {
});
};
checkStatus = (userId) => {
const activeUsers = this.props.activeUsers;
checkStatus = ({ id }) => {
const { activeUsers } = this.props;
return activeUsers && activeUsers.includes(userId);
return activeUsers && activeUsers.includes(id);
};
render() {
@ -283,7 +285,7 @@ export default class SceneDirectory extends React.Component {
key={relation.id}
user={relation.owner}
button={button}
userOnline={this.checkStatus(relation.id)}
checkStatus={this.checkStatus}
onClick={() => {
this.props.onAction({
type: "NAVIGATE",