Make UserOnlineDot more generic

This commit is contained in:
Michael Telatynski 2019-12-26 18:10:52 +00:00
parent db069b9602
commit 22fe0add3c
5 changed files with 30 additions and 14 deletions

View file

@ -174,6 +174,7 @@
@import "./views/rooms/_SendMessageComposer.scss";
@import "./views/rooms/_Stickers.scss";
@import "./views/rooms/_TopUnreadMessagesBar.scss";
@import "./views/rooms/_UserOnlineDot.scss";
@import "./views/rooms/_WhoIsTypingTile.scss";
@import "./views/settings/_AvatarSetting.scss";
@import "./views/settings/_CrossSigningPanel.scss";

View file

@ -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;

View file

@ -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;
}

View file

@ -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} />;
}
}

View file

@ -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]);
@ -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;