From ae17cd3ec6a3da53e8506b8109b8c8b7292b6a0a Mon Sep 17 00:00:00 2001 From: Michael Telatynski <7t3chguy@gmail.com> Date: Wed, 15 Jul 2020 16:46:39 +0100 Subject: [PATCH] Add tooltip to Room Tile Icon Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --- src/components/views/rooms/RoomTileIcon.tsx | 21 ++++++++++++++++++++- src/i18n/strings/en_EN.json | 2 ++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/components/views/rooms/RoomTileIcon.tsx b/src/components/views/rooms/RoomTileIcon.tsx index b0cf10e313..725ef570a0 100644 --- a/src/components/views/rooms/RoomTileIcon.tsx +++ b/src/components/views/rooms/RoomTileIcon.tsx @@ -22,6 +22,8 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event"; import DMRoomMap from "../../../utils/DMRoomMap"; import { MatrixClientPeg } from "../../../MatrixClientPeg"; import { isPresenceEnabled } from "../../../utils/presence"; +import { _t } from "../../../languageHandler"; +import TextWithTooltip from "../elements/TextWithTooltip"; enum Icon { // Note: the names here are used in CSS class names @@ -32,6 +34,19 @@ enum Icon { PresenceOffline = "OFFLINE", } +function tooltipText(variant: Icon) { + switch (variant) { + case Icon.Globe: + return _t("Public Room"); + case Icon.PresenceOnline: + return _t("Online"); + case Icon.PresenceAway: + return _t("Away"); + case Icon.PresenceOffline: + return _t("Offline"); + } +} + interface IProps { room: Room; tag: TagID; @@ -145,6 +160,10 @@ export default class RoomTileIcon extends React.Component { public render(): React.ReactElement { if (this.state.icon === Icon.None) return null; - return ; + return ; } } diff --git a/src/i18n/strings/en_EN.json b/src/i18n/strings/en_EN.json index 11115ac4fe..5085506601 100644 --- a/src/i18n/strings/en_EN.json +++ b/src/i18n/strings/en_EN.json @@ -1239,6 +1239,8 @@ "Leave Room": "Leave Room", "Forget Room": "Forget Room", "Room options": "Room options", + "Public Room": "Public Room", + "Away": "Away", "Add a topic": "Add a topic", "Upgrading this room will shut down the current instance of the room and create an upgraded room with the same name.": "Upgrading this room will shut down the current instance of the room and create an upgraded room with the same name.", "This room has already been upgraded.": "This room has already been upgraded.",