Allow adding extra icons to the room header (#11799)
* Allow adding extra icons to the room header Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net> * Apply PR feedback Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net> * Apply PR feedback Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net> * Apply PR feedback Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net> * Apply PR feedback Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net> * Apply PR feedback Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net> --------- Signed-off-by: Charly Nguyen <charly.nguyen@nordeck.net>
This commit is contained in:
parent
9496097143
commit
01e7e01153
14 changed files with 210 additions and 7 deletions
|
@ -20,6 +20,8 @@ import classNames from "classnames";
|
|||
import { throttle } from "lodash";
|
||||
import { RoomStateEvent, ISearchResults } from "matrix-js-sdk/src/matrix";
|
||||
import { CallType } from "matrix-js-sdk/src/webrtc/call";
|
||||
import { IconButton, Tooltip } from "@vector-im/compound-web";
|
||||
import { ViewRoomOpts } from "@matrix-org/react-sdk-module-api/lib/lifecycles/RoomViewLifecycle";
|
||||
|
||||
import type { MatrixEvent, Room } from "matrix-js-sdk/src/matrix";
|
||||
import { _t } from "../../../languageHandler";
|
||||
|
@ -476,6 +478,7 @@ export interface IProps {
|
|||
enableRoomOptionsMenu?: boolean;
|
||||
viewingCall: boolean;
|
||||
activeCall: Call | null;
|
||||
additionalButtons?: ViewRoomOpts["buttons"];
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
@ -669,6 +672,23 @@ export default class RoomHeader extends React.Component<IProps, IState> {
|
|||
|
||||
return (
|
||||
<>
|
||||
{this.props.additionalButtons?.map((props) => {
|
||||
const label = props.label();
|
||||
|
||||
return (
|
||||
<Tooltip label={label} key={props.id}>
|
||||
<IconButton
|
||||
onClick={() => {
|
||||
props.onClick();
|
||||
this.forceUpdate();
|
||||
}}
|
||||
title={label}
|
||||
>
|
||||
{props.icon}
|
||||
</IconButton>
|
||||
</Tooltip>
|
||||
);
|
||||
})}
|
||||
{startButtons}
|
||||
<RoomHeaderButtons
|
||||
room={this.props.room}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue