Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Make UserOnlineDot more generic
Browse files Browse the repository at this point in the history
  • Loading branch information
t3chguy committed Dec 26, 2019
1 parent db069b9 commit 1f59363
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 14 deletions.
8 changes: 0 additions & 8 deletions res/css/views/rooms/_RoomTile.scss
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,6 @@ limitations under the License.
min-width: 0;
}

.mx_RoomTile_online_dot {
border-radius: 50%;
background-color: $accent-color;
height: 5px;
width: 5px;
display: inline-block;
}

.mx_RoomTile_subtext {
display: inline-block;
font-size: 11px;
Expand Down
23 changes: 23 additions & 0 deletions res/css/views/rooms/_UserOnlineDot.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
Copyright 2019 The Matrix.org Foundation C.I.C.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

.mx_UserOnlineDot {
border-radius: 50%;
background-color: $accent-color;
height: 5px;
width: 5px;
display: inline-block;
}
4 changes: 2 additions & 2 deletions src/components/views/rooms/RoomTile.js
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,8 @@ module.exports = createReactClass({
/>;

if (this.props.room.getMember(dmUserId).membership === "join") {
const RoomTileOnlineDot = sdk.getComponent('rooms.RoomTileOnlineDot');
dmOnline = <RoomTileOnlineDot userId={dmUserId} />;
const UserOnlineDot = sdk.getComponent('rooms.UserOnlineDot');
dmOnline = <UserOnlineDot userId={dmUserId} />;
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import PropTypes from "prop-types";
import {useEventEmitter} from "../../../hooks/useEventEmitter";
import MatrixClientContext from "../../../contexts/MatrixClientContext";

const RoomTileOnlineDot = ({userId}) => {
const UserOnlineDot = ({userId}) => {
const cli = useContext(MatrixClientContext);
const user = useMemo(() => cli.getUser(userId), [cli, userId]);

Expand All @@ -38,11 +38,11 @@ const RoomTileOnlineDot = ({userId}) => {
useEventEmitter(user, "User.currentlyActive", currentlyActiveHandler);
useEventEmitter(user, "User.presence", currentlyActiveHandler);

return isOnline ? <span className="mx_RoomTile_online_dot" /> : null;
return isOnline ? <span className="mx_UserOnlineDot" /> : null;
};

RoomTileOnlineDot.propTypes = {
UserOnlineDot.propTypes = {
userId: PropTypes.string.isRequired,
};

export default RoomTileOnlineDot;
export default UserOnlineDot;

0 comments on commit 1f59363

Please sign in to comment.