mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Support switching rooms
This commit is contained in:
parent
715dd7e1b6
commit
6bdcbd0f3d
1 changed files with 13 additions and 1 deletions
|
@ -24,6 +24,8 @@ import { RovingTabIndexWrapper } from "../../../accessibility/RovingTabIndex";
|
|||
import AccessibleButton from "../../views/elements/AccessibleButton";
|
||||
import RoomAvatar from "../../views/avatars/RoomAvatar";
|
||||
import Tooltip from "../../views/elements/Tooltip";
|
||||
import dis from '../../../dispatcher';
|
||||
import { Key } from "../../../Keyboard";
|
||||
|
||||
interface IProps {
|
||||
room: Room;
|
||||
|
@ -31,7 +33,6 @@ interface IProps {
|
|||
// TODO: Allow faslifying counts (for invites and stuff)
|
||||
// TODO: Transparency?
|
||||
// TODO: Incoming call?
|
||||
// TODO: onClick
|
||||
}
|
||||
|
||||
interface IState {
|
||||
|
@ -70,6 +71,16 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
|||
this.setState({hover: false});
|
||||
};
|
||||
|
||||
private onTileClick = (ev: React.KeyboardEvent) => {
|
||||
dis.dispatch({
|
||||
action: 'view_room',
|
||||
// TODO: Support show_room_tile in new room list
|
||||
show_room_tile: true, // make sure the room is visible in the list
|
||||
room_id: this.props.room.roomId,
|
||||
clear_search: (ev && (ev.key === Key.ENTER || ev.key === Key.SPACE)),
|
||||
});
|
||||
};
|
||||
|
||||
public render(): React.ReactElement {
|
||||
// TODO: Collapsed state
|
||||
// TODO: Invites
|
||||
|
@ -122,6 +133,7 @@ export default class RoomTile2 extends React.Component<IProps, IState> {
|
|||
className={classes}
|
||||
onMouseEnter={this.onTileMouseEnter}
|
||||
onMouseLeave={this.onTileMouseLeave}
|
||||
onClick={this.onTileClick}
|
||||
role="treeitem"
|
||||
>
|
||||
<div className={avatarClasses}>
|
||||
|
|
Loading…
Reference in a new issue