mirror of https://github.com/vector-im/riot-web
Show room context details in forward dialog (#7162)
parent
14b5ed01d3
commit
cdbe25bd36
|
@ -110,18 +110,28 @@ limitations under the License.
|
||||||
margin-right: 12px;
|
margin-right: 12px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_ForwardList_entry_name {
|
.mx_ForwardList_entry_name,
|
||||||
font-size: $font-15px;
|
.mx_ForwardList_entry_detail {
|
||||||
line-height: 30px;
|
line-height: 30px;
|
||||||
overflow: hidden;
|
overflow: hidden;
|
||||||
white-space: nowrap;
|
white-space: nowrap;
|
||||||
text-overflow: ellipsis;
|
text-overflow: ellipsis;
|
||||||
margin-right: 12px;
|
}
|
||||||
|
|
||||||
|
.mx_ForwardList_entry_name {
|
||||||
|
font-size: $font-15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.mx_ForwardList_entry_detail {
|
||||||
|
font-size: $font-12px;
|
||||||
|
margin-left: 8px;
|
||||||
|
color: $tertiary-content;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.mx_ForwardList_sendButton {
|
.mx_ForwardList_sendButton {
|
||||||
position: relative;
|
position: relative;
|
||||||
|
margin-left: 12px;
|
||||||
|
|
||||||
&:not(.mx_ForwardList_canSend) .mx_ForwardList_sendLabel {
|
&:not(.mx_ForwardList_canSend) .mx_ForwardList_sendLabel {
|
||||||
// Hide the "Send" label while preserving button size
|
// Hide the "Send" label while preserving button size
|
||||||
|
|
22
src/Rooms.ts
22
src/Rooms.ts
|
@ -18,6 +18,9 @@ import { Room } from "matrix-js-sdk/src/models/room";
|
||||||
|
|
||||||
import { MatrixClientPeg } from './MatrixClientPeg';
|
import { MatrixClientPeg } from './MatrixClientPeg';
|
||||||
import AliasCustomisations from './customisations/Alias';
|
import AliasCustomisations from './customisations/Alias';
|
||||||
|
import DMRoomMap from "./utils/DMRoomMap";
|
||||||
|
import SpaceStore from "./stores/spaces/SpaceStore";
|
||||||
|
import { _t } from "./languageHandler";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Given a room object, return the alias we should use for it,
|
* Given a room object, return the alias we should use for it,
|
||||||
|
@ -153,3 +156,22 @@ function guessDMRoomTargetId(room: Room, myUserId: string): string {
|
||||||
if (oldestUser === undefined) return myUserId;
|
if (oldestUser === undefined) return myUserId;
|
||||||
return oldestUser.userId;
|
return oldestUser.userId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function roomContextDetailsText(room: Room): string {
|
||||||
|
if (room.isSpaceRoom()) return undefined;
|
||||||
|
|
||||||
|
const dmPartner = DMRoomMap.shared().getUserIdForRoomId(room.roomId);
|
||||||
|
if (dmPartner) {
|
||||||
|
return room.getMember(dmPartner)?.rawDisplayName;
|
||||||
|
}
|
||||||
|
|
||||||
|
const [parent, ...otherParents] = SpaceStore.instance.getKnownParents(room.roomId);
|
||||||
|
if (parent) {
|
||||||
|
return _t("%(spaceName)s and %(count)s others", {
|
||||||
|
spaceName: room.client.getRoom(parent).name,
|
||||||
|
count: otherParents.length,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
return room.getCanonicalAlias();
|
||||||
|
}
|
||||||
|
|
|
@ -44,6 +44,7 @@ import TruncatedList from "../elements/TruncatedList";
|
||||||
import EntityTile from "../rooms/EntityTile";
|
import EntityTile from "../rooms/EntityTile";
|
||||||
import BaseAvatar from "../avatars/BaseAvatar";
|
import BaseAvatar from "../avatars/BaseAvatar";
|
||||||
import SpaceStore from "../../../stores/spaces/SpaceStore";
|
import SpaceStore from "../../../stores/spaces/SpaceStore";
|
||||||
|
import { roomContextDetailsText } from "../../../Rooms";
|
||||||
|
|
||||||
const AVATAR_SIZE = 30;
|
const AVATAR_SIZE = 30;
|
||||||
|
|
||||||
|
@ -121,6 +122,8 @@ const Entry: React.FC<IEntryProps> = ({ room, event, matrixClient: cli, onFinish
|
||||||
/>;
|
/>;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const detailsText = roomContextDetailsText(room);
|
||||||
|
|
||||||
return <div className="mx_ForwardList_entry">
|
return <div className="mx_ForwardList_entry">
|
||||||
<AccessibleTooltipButton
|
<AccessibleTooltipButton
|
||||||
className="mx_ForwardList_roomButton"
|
className="mx_ForwardList_roomButton"
|
||||||
|
@ -131,6 +134,9 @@ const Entry: React.FC<IEntryProps> = ({ room, event, matrixClient: cli, onFinish
|
||||||
>
|
>
|
||||||
<DecoratedRoomAvatar room={room} avatarSize={32} />
|
<DecoratedRoomAvatar room={room} avatarSize={32} />
|
||||||
<span className="mx_ForwardList_entry_name">{ room.name }</span>
|
<span className="mx_ForwardList_entry_name">{ room.name }</span>
|
||||||
|
{ detailsText && <span className="mx_ForwardList_entry_detail">
|
||||||
|
{ detailsText }
|
||||||
|
</span> }
|
||||||
</AccessibleTooltipButton>
|
</AccessibleTooltipButton>
|
||||||
<AccessibleTooltipButton
|
<AccessibleTooltipButton
|
||||||
kind={sendState === SendState.Failed ? "danger_outline" : "primary_outline"}
|
kind={sendState === SendState.Failed ? "danger_outline" : "primary_outline"}
|
||||||
|
|
|
@ -396,6 +396,9 @@
|
||||||
"Failed to invite users to the room:": "Failed to invite users to the room:",
|
"Failed to invite users to the room:": "Failed to invite users to the room:",
|
||||||
"We sent the others, but the below people couldn't be invited to <RoomName/>": "We sent the others, but the below people couldn't be invited to <RoomName/>",
|
"We sent the others, but the below people couldn't be invited to <RoomName/>": "We sent the others, but the below people couldn't be invited to <RoomName/>",
|
||||||
"Some invites couldn't be sent": "Some invites couldn't be sent",
|
"Some invites couldn't be sent": "Some invites couldn't be sent",
|
||||||
|
"%(spaceName)s and %(count)s others|other": "%(spaceName)s and %(count)s others",
|
||||||
|
"%(spaceName)s and %(count)s others|zero": "%(spaceName)s",
|
||||||
|
"%(spaceName)s and %(count)s others|one": "%(spaceName)s and %(count)s other",
|
||||||
"You need to be logged in.": "You need to be logged in.",
|
"You need to be logged in.": "You need to be logged in.",
|
||||||
"You need to be able to invite users to do that.": "You need to be able to invite users to do that.",
|
"You need to be able to invite users to do that.": "You need to be able to invite users to do that.",
|
||||||
"Unable to create widget.": "Unable to create widget.",
|
"Unable to create widget.": "Unable to create widget.",
|
||||||
|
|
Loading…
Reference in New Issue