mirror of https://github.com/vector-im/riot-web
Make UserOnlineDot more generic
parent
db069b9602
commit
22fe0add3c
|
@ -174,6 +174,7 @@
|
||||||
@import "./views/rooms/_SendMessageComposer.scss";
|
@import "./views/rooms/_SendMessageComposer.scss";
|
||||||
@import "./views/rooms/_Stickers.scss";
|
@import "./views/rooms/_Stickers.scss";
|
||||||
@import "./views/rooms/_TopUnreadMessagesBar.scss";
|
@import "./views/rooms/_TopUnreadMessagesBar.scss";
|
||||||
|
@import "./views/rooms/_UserOnlineDot.scss";
|
||||||
@import "./views/rooms/_WhoIsTypingTile.scss";
|
@import "./views/rooms/_WhoIsTypingTile.scss";
|
||||||
@import "./views/settings/_AvatarSetting.scss";
|
@import "./views/settings/_AvatarSetting.scss";
|
||||||
@import "./views/settings/_CrossSigningPanel.scss";
|
@import "./views/settings/_CrossSigningPanel.scss";
|
||||||
|
|
|
@ -62,14 +62,6 @@ limitations under the License.
|
||||||
min-width: 0;
|
min-width: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_RoomTile_online_dot {
|
|
||||||
border-radius: 50%;
|
|
||||||
background-color: $accent-color;
|
|
||||||
height: 5px;
|
|
||||||
width: 5px;
|
|
||||||
display: inline-block;
|
|
||||||
}
|
|
||||||
|
|
||||||
.mx_RoomTile_subtext {
|
.mx_RoomTile_subtext {
|
||||||
display: inline-block;
|
display: inline-block;
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
|
|
|
@ -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;
|
||||||
|
}
|
|
@ -380,8 +380,8 @@ module.exports = createReactClass({
|
||||||
/>;
|
/>;
|
||||||
|
|
||||||
if (this.props.room.getMember(dmUserId).membership === "join") {
|
if (this.props.room.getMember(dmUserId).membership === "join") {
|
||||||
const RoomTileOnlineDot = sdk.getComponent('rooms.RoomTileOnlineDot');
|
const UserOnlineDot = sdk.getComponent('rooms.UserOnlineDot');
|
||||||
dmOnline = <RoomTileOnlineDot userId={dmUserId} />;
|
dmOnline = <UserOnlineDot userId={dmUserId} />;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ import PropTypes from "prop-types";
|
||||||
import {useEventEmitter} from "../../../hooks/useEventEmitter";
|
import {useEventEmitter} from "../../../hooks/useEventEmitter";
|
||||||
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
import MatrixClientContext from "../../../contexts/MatrixClientContext";
|
||||||
|
|
||||||
const RoomTileOnlineDot = ({userId}) => {
|
const UserOnlineDot = ({userId}) => {
|
||||||
const cli = useContext(MatrixClientContext);
|
const cli = useContext(MatrixClientContext);
|
||||||
const user = useMemo(() => cli.getUser(userId), [cli, userId]);
|
const user = useMemo(() => cli.getUser(userId), [cli, userId]);
|
||||||
|
|
||||||
|
@ -38,11 +38,11 @@ const RoomTileOnlineDot = ({userId}) => {
|
||||||
useEventEmitter(user, "User.currentlyActive", currentlyActiveHandler);
|
useEventEmitter(user, "User.currentlyActive", currentlyActiveHandler);
|
||||||
useEventEmitter(user, "User.presence", 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,
|
userId: PropTypes.string.isRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
export default RoomTileOnlineDot;
|
export default UserOnlineDot;
|
Loading…
Reference in New Issue