Change spaceroomfacepile tooltip if memberlist is shown (#8571)
This commit is contained in:
parent
997d8ab8b3
commit
d87cfae0c9
3 changed files with 65 additions and 75 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
Copyright 2021 The Matrix.org Foundation C.I.C.
|
||||
Copyright 2021-2022 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.
|
||||
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
|||
limitations under the License.
|
||||
*/
|
||||
|
||||
import React, { FC, HTMLAttributes, ReactNode, useContext } from "react";
|
||||
import React, { FC, HTMLAttributes, useContext } from "react";
|
||||
import { Room } from "matrix-js-sdk/src/models/room";
|
||||
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
||||
import { sortBy } from "lodash";
|
||||
|
@ -60,36 +60,18 @@ const RoomFacePile: FC<IProps> = (
|
|||
// reverse members in tooltip order to make the order between the two match up.
|
||||
const commaSeparatedMembers = shownMembers.map(m => m.name).reverse().join(", ");
|
||||
|
||||
let tooltip: ReactNode;
|
||||
if (props.onClick) {
|
||||
let subText: string;
|
||||
if (isJoined) {
|
||||
subText = _t("Including you, %(commaSeparatedMembers)s", { commaSeparatedMembers });
|
||||
} else {
|
||||
subText = _t("Including %(commaSeparatedMembers)s", { commaSeparatedMembers });
|
||||
}
|
||||
|
||||
tooltip = <div>
|
||||
<div className="mx_Tooltip_title">
|
||||
{ _t("View all %(count)s members", { count }) }
|
||||
</div>
|
||||
<div className="mx_Tooltip_sub">
|
||||
{ subText }
|
||||
</div>
|
||||
</div>;
|
||||
} else {
|
||||
if (isJoined) {
|
||||
tooltip = _t("%(count)s members including you, %(commaSeparatedMembers)s", {
|
||||
count: count - 1,
|
||||
commaSeparatedMembers,
|
||||
});
|
||||
} else {
|
||||
tooltip = _t("%(count)s members including %(commaSeparatedMembers)s", {
|
||||
count,
|
||||
commaSeparatedMembers,
|
||||
});
|
||||
}
|
||||
}
|
||||
const tooltip = <div>
|
||||
<div className="mx_Tooltip_title">
|
||||
{ props.onClick
|
||||
? _t("View all %(count)s members", { count })
|
||||
: _t("%(count)s members", { count }) }
|
||||
</div>
|
||||
<div className="mx_Tooltip_sub">
|
||||
{ isJoined
|
||||
? _t("Including you, %(commaSeparatedMembers)s", { commaSeparatedMembers })
|
||||
: _t("Including %(commaSeparatedMembers)s", { commaSeparatedMembers }) }
|
||||
</div>
|
||||
</div>;
|
||||
|
||||
return <FacePile
|
||||
members={shownMembers}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue