2020-06-03 04:26:07 +03:00
|
|
|
/*
|
|
|
|
Copyright 2020 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.
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
limitations under the License.
|
|
|
|
*/
|
|
|
|
|
|
|
|
import * as React from "react";
|
2020-06-24 05:59:26 +03:00
|
|
|
import { createRef } from "react";
|
2020-06-03 04:26:07 +03:00
|
|
|
import TagPanel from "./TagPanel";
|
|
|
|
import classNames from "classnames";
|
|
|
|
import dis from "../../dispatcher/dispatcher";
|
|
|
|
import { _t } from "../../languageHandler";
|
2020-07-18 00:27:49 +03:00
|
|
|
import RoomList from "../views/rooms/RoomList";
|
2020-07-08 16:11:47 +03:00
|
|
|
import { HEADER_HEIGHT } from "../views/rooms/RoomSublist2";
|
2020-06-03 04:26:07 +03:00
|
|
|
import { Action } from "../../dispatcher/actions";
|
2020-06-26 04:38:11 +03:00
|
|
|
import UserMenu from "./UserMenu";
|
2020-06-09 05:33:21 +03:00
|
|
|
import RoomSearch from "./RoomSearch";
|
2020-06-09 02:11:58 +03:00
|
|
|
import RoomBreadcrumbs2 from "../views/rooms/RoomBreadcrumbs2";
|
|
|
|
import { BreadcrumbsStore } from "../../stores/BreadcrumbsStore";
|
|
|
|
import { UPDATE_EVENT } from "../../stores/AsyncStore";
|
2020-06-22 22:09:42 +03:00
|
|
|
import ResizeNotifier from "../../utils/ResizeNotifier";
|
2020-06-26 05:35:40 +03:00
|
|
|
import SettingsStore from "../../settings/SettingsStore";
|
2020-07-18 00:11:34 +03:00
|
|
|
import RoomListStore, { LISTS_UPDATE_EVENT } from "../../stores/room-list/RoomListStore";
|
2020-07-03 00:21:10 +03:00
|
|
|
import {Key} from "../../Keyboard";
|
2020-07-06 23:32:46 +03:00
|
|
|
import IndicatorScrollbar from "../structures/IndicatorScrollbar";
|
2020-07-17 20:57:38 +03:00
|
|
|
import AccessibleTooltipButton from "../views/elements/AccessibleTooltipButton";
|
2020-06-03 04:26:07 +03:00
|
|
|
|
|
|
|
interface IProps {
|
2020-06-11 23:39:28 +03:00
|
|
|
isMinimized: boolean;
|
2020-06-22 22:09:42 +03:00
|
|
|
resizeNotifier: ResizeNotifier;
|
2020-06-03 04:26:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
interface IState {
|
2020-06-29 05:03:04 +03:00
|
|
|
searchFilter: string;
|
2020-06-09 02:11:58 +03:00
|
|
|
showBreadcrumbs: boolean;
|
2020-06-26 05:35:40 +03:00
|
|
|
showTagPanel: boolean;
|
2020-06-03 04:26:07 +03:00
|
|
|
}
|
|
|
|
|
2020-07-06 03:14:02 +03:00
|
|
|
// List of CSS classes which should be included in keyboard navigation within the room list
|
|
|
|
const cssClasses = [
|
|
|
|
"mx_RoomSearch_input",
|
|
|
|
"mx_RoomSearch_icon", // minimized <RoomSearch />
|
|
|
|
"mx_RoomSublist2_headerText",
|
|
|
|
"mx_RoomTile2",
|
|
|
|
"mx_RoomSublist2_showNButton",
|
|
|
|
];
|
|
|
|
|
2020-07-18 00:22:18 +03:00
|
|
|
export default class LeftPanel extends React.Component<IProps, IState> {
|
2020-06-22 22:09:42 +03:00
|
|
|
private listContainerRef: React.RefObject<HTMLDivElement> = createRef();
|
2020-06-26 05:35:40 +03:00
|
|
|
private tagPanelWatcherRef: string;
|
2020-07-03 00:21:10 +03:00
|
|
|
private focusedElement = null;
|
2020-07-07 20:33:32 +03:00
|
|
|
private isDoingStickyHeaders = false;
|
2020-06-22 22:09:42 +03:00
|
|
|
|
2020-06-03 04:26:07 +03:00
|
|
|
constructor(props: IProps) {
|
|
|
|
super(props);
|
|
|
|
|
|
|
|
this.state = {
|
|
|
|
searchFilter: "",
|
2020-06-09 02:11:58 +03:00
|
|
|
showBreadcrumbs: BreadcrumbsStore.instance.visible,
|
2020-06-26 05:35:40 +03:00
|
|
|
showTagPanel: SettingsStore.getValue('TagPanel.enableTagPanel'),
|
2020-06-03 04:26:07 +03:00
|
|
|
};
|
2020-06-09 02:11:58 +03:00
|
|
|
|
|
|
|
BreadcrumbsStore.instance.on(UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
2020-07-01 18:05:27 +03:00
|
|
|
RoomListStore.instance.on(LISTS_UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
2020-06-26 05:35:40 +03:00
|
|
|
this.tagPanelWatcherRef = SettingsStore.watchSetting("TagPanel.enableTagPanel", null, () => {
|
|
|
|
this.setState({showTagPanel: SettingsStore.getValue("TagPanel.enableTagPanel")});
|
|
|
|
});
|
2020-06-22 22:09:42 +03:00
|
|
|
|
|
|
|
// We watch the middle panel because we don't actually get resized, the middle panel does.
|
|
|
|
// We listen to the noisy channel to avoid choppy reaction times.
|
|
|
|
this.props.resizeNotifier.on("middlePanelResizedNoisy", this.onResize);
|
2020-06-09 02:11:58 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
public componentWillUnmount() {
|
2020-06-26 05:35:40 +03:00
|
|
|
SettingsStore.unwatchSetting(this.tagPanelWatcherRef);
|
2020-06-09 02:11:58 +03:00
|
|
|
BreadcrumbsStore.instance.off(UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
2020-07-01 18:05:27 +03:00
|
|
|
RoomListStore.instance.off(LISTS_UPDATE_EVENT, this.onBreadcrumbsUpdate);
|
2020-06-22 22:09:42 +03:00
|
|
|
this.props.resizeNotifier.off("middlePanelResizedNoisy", this.onResize);
|
2020-06-03 04:26:07 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
private onSearch = (term: string): void => {
|
|
|
|
this.setState({searchFilter: term});
|
|
|
|
};
|
|
|
|
|
2020-06-09 05:33:21 +03:00
|
|
|
private onExplore = () => {
|
|
|
|
dis.fire(Action.ViewRoomDirectory);
|
2020-06-03 04:26:07 +03:00
|
|
|
};
|
|
|
|
|
2020-06-09 02:11:58 +03:00
|
|
|
private onBreadcrumbsUpdate = () => {
|
|
|
|
const newVal = BreadcrumbsStore.instance.visible;
|
|
|
|
if (newVal !== this.state.showBreadcrumbs) {
|
|
|
|
this.setState({showBreadcrumbs: newVal});
|
2020-07-14 05:08:12 +03:00
|
|
|
|
|
|
|
// Update the sticky headers too as the breadcrumbs will be popping in or out.
|
|
|
|
if (!this.listContainerRef.current) return; // ignore: no headers to sticky
|
|
|
|
this.handleStickyHeaders(this.listContainerRef.current);
|
2020-06-09 02:11:58 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-06-22 22:09:42 +03:00
|
|
|
private handleStickyHeaders(list: HTMLDivElement) {
|
2020-07-07 20:33:32 +03:00
|
|
|
if (this.isDoingStickyHeaders) return;
|
|
|
|
this.isDoingStickyHeaders = true;
|
2020-07-08 21:17:51 +03:00
|
|
|
window.requestAnimationFrame(() => {
|
2020-07-07 20:33:32 +03:00
|
|
|
this.doStickyHeaders(list);
|
|
|
|
this.isDoingStickyHeaders = false;
|
2020-07-08 21:17:51 +03:00
|
|
|
});
|
2020-07-07 20:33:32 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
private doStickyHeaders(list: HTMLDivElement) {
|
2020-07-08 23:36:55 +03:00
|
|
|
const topEdge = list.scrollTop;
|
|
|
|
const bottomEdge = list.offsetHeight + list.scrollTop;
|
2020-06-13 20:54:40 +03:00
|
|
|
const sublists = list.querySelectorAll<HTMLDivElement>(".mx_RoomSublist2");
|
|
|
|
|
2020-07-08 23:36:55 +03:00
|
|
|
const headerRightMargin = 16; // calculated from margins and widths to align with non-sticky tiles
|
|
|
|
const headerStickyWidth = list.clientWidth - headerRightMargin;
|
2020-06-13 20:54:40 +03:00
|
|
|
|
2020-07-08 23:53:52 +03:00
|
|
|
// We track which styles we want on a target before making the changes to avoid
|
|
|
|
// excessive layout updates.
|
|
|
|
const targetStyles = new Map<HTMLDivElement, {
|
|
|
|
stickyTop?: boolean;
|
|
|
|
stickyBottom?: boolean;
|
|
|
|
makeInvisible?: boolean;
|
|
|
|
}>();
|
|
|
|
|
2020-07-03 13:17:54 +03:00
|
|
|
let lastTopHeader;
|
2020-07-08 23:36:55 +03:00
|
|
|
let firstBottomHeader;
|
2020-06-13 20:54:40 +03:00
|
|
|
for (const sublist of sublists) {
|
2020-06-14 04:07:19 +03:00
|
|
|
const header = sublist.querySelector<HTMLDivElement>(".mx_RoomSublist2_stickable");
|
2020-07-08 11:21:33 +03:00
|
|
|
header.style.removeProperty("display"); // always clear display:none first
|
2020-06-13 20:54:40 +03:00
|
|
|
|
2020-07-08 23:36:55 +03:00
|
|
|
// When an element is <=40% off screen, make it take over
|
|
|
|
const offScreenFactor = 0.4;
|
|
|
|
const isOffTop = (sublist.offsetTop + (offScreenFactor * HEADER_HEIGHT)) <= topEdge;
|
|
|
|
const isOffBottom = (sublist.offsetTop + (offScreenFactor * HEADER_HEIGHT)) >= bottomEdge;
|
|
|
|
|
|
|
|
if (isOffTop || sublist === sublists[0]) {
|
2020-07-08 23:53:52 +03:00
|
|
|
targetStyles.set(header, { stickyTop: true });
|
2020-07-03 13:17:54 +03:00
|
|
|
if (lastTopHeader) {
|
|
|
|
lastTopHeader.style.display = "none";
|
2020-07-08 23:53:52 +03:00
|
|
|
targetStyles.set(lastTopHeader, { makeInvisible: true });
|
2020-07-03 13:17:54 +03:00
|
|
|
}
|
|
|
|
lastTopHeader = header;
|
2020-07-08 23:36:55 +03:00
|
|
|
} else if (isOffBottom && !firstBottomHeader) {
|
2020-07-08 23:53:52 +03:00
|
|
|
targetStyles.set(header, { stickyBottom: true });
|
2020-07-08 23:36:55 +03:00
|
|
|
firstBottomHeader = header;
|
2020-06-13 20:54:40 +03:00
|
|
|
} else {
|
2020-07-08 23:53:52 +03:00
|
|
|
targetStyles.set(header, {}); // nothing == clear
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Run over the style changes and make them reality. We check to see if we're about to
|
|
|
|
// cause a no-op update, as adding/removing properties that are/aren't there cause
|
|
|
|
// layout updates.
|
|
|
|
for (const header of targetStyles.keys()) {
|
|
|
|
const style = targetStyles.get(header);
|
|
|
|
|
|
|
|
if (style.makeInvisible) {
|
|
|
|
// we will have already removed the 'display: none', so add it back.
|
|
|
|
header.style.display = "none";
|
|
|
|
continue; // nothing else to do, even if sticky somehow
|
|
|
|
}
|
|
|
|
|
|
|
|
if (style.stickyTop) {
|
|
|
|
if (!header.classList.contains("mx_RoomSublist2_headerContainer_stickyTop")) {
|
|
|
|
header.classList.add("mx_RoomSublist2_headerContainer_stickyTop");
|
|
|
|
}
|
|
|
|
|
|
|
|
const newTop = `${list.parentElement.offsetTop}px`;
|
|
|
|
if (header.style.top !== newTop) {
|
|
|
|
header.style.top = newTop;
|
|
|
|
}
|
2020-07-13 23:24:43 +03:00
|
|
|
} else {
|
|
|
|
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyTop")) {
|
|
|
|
header.classList.remove("mx_RoomSublist2_headerContainer_stickyTop");
|
|
|
|
}
|
|
|
|
if (header.style.top) {
|
|
|
|
header.style.removeProperty('top');
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (style.stickyBottom) {
|
2020-07-08 23:53:52 +03:00
|
|
|
if (!header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) {
|
|
|
|
header.classList.add("mx_RoomSublist2_headerContainer_stickyBottom");
|
|
|
|
}
|
2020-07-13 23:24:43 +03:00
|
|
|
} else {
|
|
|
|
if (header.classList.contains("mx_RoomSublist2_headerContainer_stickyBottom")) {
|
|
|
|
header.classList.remove("mx_RoomSublist2_headerContainer_stickyBottom");
|
|
|
|
}
|
2020-07-08 23:53:52 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
if (style.stickyTop || style.stickyBottom) {
|
|
|
|
if (!header.classList.contains("mx_RoomSublist2_headerContainer_sticky")) {
|
|
|
|
header.classList.add("mx_RoomSublist2_headerContainer_sticky");
|
|
|
|
}
|
|
|
|
|
|
|
|
const newWidth = `${headerStickyWidth}px`;
|
|
|
|
if (header.style.width !== newWidth) {
|
|
|
|
header.style.width = newWidth;
|
|
|
|
}
|
|
|
|
} else if (!style.stickyTop && !style.stickyBottom) {
|
|
|
|
if (header.classList.contains("mx_RoomSublist2_headerContainer_sticky")) {
|
|
|
|
header.classList.remove("mx_RoomSublist2_headerContainer_sticky");
|
|
|
|
}
|
|
|
|
if (header.style.width) {
|
|
|
|
header.style.removeProperty('width');
|
|
|
|
}
|
2020-06-13 20:54:40 +03:00
|
|
|
}
|
|
|
|
}
|
2020-07-08 15:49:38 +03:00
|
|
|
|
|
|
|
// add appropriate sticky classes to wrapper so it has
|
|
|
|
// the necessary top/bottom padding to put the sticky header in
|
2020-07-18 00:22:18 +03:00
|
|
|
const listWrapper = list.parentElement; // .mx_LeftPanel_roomListWrapper
|
2020-07-08 15:49:38 +03:00
|
|
|
if (lastTopHeader) {
|
2020-07-18 00:22:18 +03:00
|
|
|
listWrapper.classList.add("mx_LeftPanel_roomListWrapper_stickyTop");
|
2020-07-08 15:49:38 +03:00
|
|
|
} else {
|
2020-07-18 00:22:18 +03:00
|
|
|
listWrapper.classList.remove("mx_LeftPanel_roomListWrapper_stickyTop");
|
2020-07-08 15:49:38 +03:00
|
|
|
}
|
2020-07-08 23:36:55 +03:00
|
|
|
if (firstBottomHeader) {
|
2020-07-18 00:22:18 +03:00
|
|
|
listWrapper.classList.add("mx_LeftPanel_roomListWrapper_stickyBottom");
|
2020-07-08 23:36:55 +03:00
|
|
|
} else {
|
2020-07-18 00:22:18 +03:00
|
|
|
listWrapper.classList.remove("mx_LeftPanel_roomListWrapper_stickyBottom");
|
2020-07-08 15:49:38 +03:00
|
|
|
}
|
2020-06-22 22:09:42 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
private onScroll = (ev: React.MouseEvent<HTMLDivElement>) => {
|
|
|
|
const list = ev.target as HTMLDivElement;
|
|
|
|
this.handleStickyHeaders(list);
|
|
|
|
};
|
|
|
|
|
|
|
|
private onResize = () => {
|
|
|
|
if (!this.listContainerRef.current) return; // ignore: no headers to sticky
|
|
|
|
this.handleStickyHeaders(this.listContainerRef.current);
|
2020-06-13 20:54:40 +03:00
|
|
|
};
|
|
|
|
|
2020-07-03 00:21:10 +03:00
|
|
|
private onFocus = (ev: React.FocusEvent) => {
|
|
|
|
this.focusedElement = ev.target;
|
|
|
|
};
|
|
|
|
|
|
|
|
private onBlur = () => {
|
|
|
|
this.focusedElement = null;
|
|
|
|
};
|
|
|
|
|
|
|
|
private onKeyDown = (ev: React.KeyboardEvent) => {
|
|
|
|
if (!this.focusedElement) return;
|
|
|
|
|
|
|
|
switch (ev.key) {
|
|
|
|
case Key.ARROW_UP:
|
|
|
|
case Key.ARROW_DOWN:
|
2020-07-03 16:49:25 +03:00
|
|
|
ev.stopPropagation();
|
|
|
|
ev.preventDefault();
|
|
|
|
this.onMoveFocus(ev.key === Key.ARROW_UP);
|
2020-07-03 00:21:10 +03:00
|
|
|
break;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-07-12 21:06:47 +03:00
|
|
|
private onEnter = () => {
|
|
|
|
const firstRoom = this.listContainerRef.current.querySelector<HTMLDivElement>(".mx_RoomTile2");
|
|
|
|
if (firstRoom) {
|
|
|
|
firstRoom.click();
|
2020-07-16 08:31:06 +03:00
|
|
|
return true; // to get the field to clear
|
2020-07-12 21:06:47 +03:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-07-03 16:49:25 +03:00
|
|
|
private onMoveFocus = (up: boolean) => {
|
2020-07-03 00:21:10 +03:00
|
|
|
let element = this.focusedElement;
|
|
|
|
|
|
|
|
let descending = false; // are we currently descending or ascending through the DOM tree?
|
2020-07-03 16:49:25 +03:00
|
|
|
let classes: DOMTokenList;
|
2020-07-03 00:21:10 +03:00
|
|
|
|
|
|
|
do {
|
|
|
|
const child = up ? element.lastElementChild : element.firstElementChild;
|
|
|
|
const sibling = up ? element.previousElementSibling : element.nextElementSibling;
|
|
|
|
|
|
|
|
if (descending) {
|
|
|
|
if (child) {
|
|
|
|
element = child;
|
|
|
|
} else if (sibling) {
|
|
|
|
element = sibling;
|
|
|
|
} else {
|
|
|
|
descending = false;
|
|
|
|
element = element.parentElement;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
if (sibling) {
|
|
|
|
element = sibling;
|
|
|
|
descending = true;
|
|
|
|
} else {
|
|
|
|
element = element.parentElement;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (element) {
|
|
|
|
classes = element.classList;
|
|
|
|
}
|
2020-07-06 03:14:02 +03:00
|
|
|
} while (element && !cssClasses.some(c => classes.contains(c)));
|
2020-07-03 00:21:10 +03:00
|
|
|
|
|
|
|
if (element) {
|
|
|
|
element.focus();
|
|
|
|
this.focusedElement = element;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2020-06-05 01:34:04 +03:00
|
|
|
private renderHeader(): React.ReactNode {
|
2020-07-13 15:52:50 +03:00
|
|
|
return (
|
2020-07-18 00:22:18 +03:00
|
|
|
<div className="mx_LeftPanel_userHeader">
|
2020-07-13 15:52:50 +03:00
|
|
|
<UserMenu isMinimized={this.props.isMinimized} />
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
private renderBreadcrumbs(): React.ReactNode {
|
2020-07-06 23:32:46 +03:00
|
|
|
if (this.state.showBreadcrumbs && !this.props.isMinimized) {
|
2020-07-13 15:52:50 +03:00
|
|
|
return (
|
2020-07-06 23:32:46 +03:00
|
|
|
<IndicatorScrollbar
|
2020-07-18 00:22:18 +03:00
|
|
|
className="mx_LeftPanel_breadcrumbsContainer mx_AutoHideScrollbar"
|
2020-07-06 23:32:46 +03:00
|
|
|
verticalScrollsHorizontally={true}
|
|
|
|
>
|
|
|
|
<RoomBreadcrumbs2 />
|
|
|
|
</IndicatorScrollbar>
|
2020-06-09 02:11:58 +03:00
|
|
|
);
|
|
|
|
}
|
2020-06-05 01:34:04 +03:00
|
|
|
}
|
2020-06-03 04:26:07 +03:00
|
|
|
|
2020-06-09 05:33:21 +03:00
|
|
|
private renderSearchExplore(): React.ReactNode {
|
|
|
|
return (
|
2020-07-05 03:07:46 +03:00
|
|
|
<div
|
2020-07-18 00:22:18 +03:00
|
|
|
className="mx_LeftPanel_filterContainer"
|
2020-07-05 03:07:46 +03:00
|
|
|
onFocus={this.onFocus}
|
|
|
|
onBlur={this.onBlur}
|
|
|
|
onKeyDown={this.onKeyDown}
|
|
|
|
>
|
2020-07-03 00:21:10 +03:00
|
|
|
<RoomSearch
|
|
|
|
onQueryUpdate={this.onSearch}
|
|
|
|
isMinimized={this.props.isMinimized}
|
|
|
|
onVerticalArrow={this.onKeyDown}
|
2020-07-12 21:06:47 +03:00
|
|
|
onEnter={this.onEnter}
|
2020-07-03 00:21:10 +03:00
|
|
|
/>
|
2020-07-17 20:57:38 +03:00
|
|
|
<AccessibleTooltipButton
|
2020-07-18 00:22:18 +03:00
|
|
|
className="mx_LeftPanel_exploreButton"
|
2020-06-09 05:33:21 +03:00
|
|
|
onClick={this.onExplore}
|
2020-07-05 03:07:46 +03:00
|
|
|
title={_t("Explore rooms")}
|
2020-06-09 05:33:21 +03:00
|
|
|
/>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2020-06-05 01:34:04 +03:00
|
|
|
public render(): React.ReactNode {
|
2020-06-26 05:35:40 +03:00
|
|
|
const tagPanel = !this.state.showTagPanel ? null : (
|
2020-07-18 00:22:18 +03:00
|
|
|
<div className="mx_LeftPanel_tagPanelContainer">
|
2020-06-05 01:34:04 +03:00
|
|
|
<TagPanel/>
|
2020-06-03 04:26:07 +03:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
|
2020-07-18 00:27:49 +03:00
|
|
|
const roomList = <RoomList
|
2020-07-03 00:21:10 +03:00
|
|
|
onKeyDown={this.onKeyDown}
|
2020-06-03 04:26:07 +03:00
|
|
|
resizeNotifier={null}
|
|
|
|
collapsed={false}
|
|
|
|
searchFilter={this.state.searchFilter}
|
2020-07-03 00:21:10 +03:00
|
|
|
onFocus={this.onFocus}
|
|
|
|
onBlur={this.onBlur}
|
2020-06-11 23:39:28 +03:00
|
|
|
isMinimized={this.props.isMinimized}
|
2020-07-06 23:05:06 +03:00
|
|
|
onResize={this.onResize}
|
2020-06-03 04:26:07 +03:00
|
|
|
/>;
|
|
|
|
|
|
|
|
const containerClasses = classNames({
|
2020-07-18 00:22:18 +03:00
|
|
|
"mx_LeftPanel": true,
|
|
|
|
"mx_LeftPanel_hasTagPanel": !!tagPanel,
|
|
|
|
"mx_LeftPanel_minimized": this.props.isMinimized,
|
2020-06-03 04:26:07 +03:00
|
|
|
});
|
|
|
|
|
2020-07-01 17:15:18 +03:00
|
|
|
const roomListClasses = classNames(
|
2020-07-18 00:22:18 +03:00
|
|
|
"mx_LeftPanel_actualRoomListContainer",
|
2020-07-01 01:52:13 +03:00
|
|
|
"mx_AutoHideScrollbar",
|
|
|
|
);
|
|
|
|
|
2020-06-03 04:26:07 +03:00
|
|
|
return (
|
|
|
|
<div className={containerClasses}>
|
|
|
|
{tagPanel}
|
2020-07-18 00:22:18 +03:00
|
|
|
<aside className="mx_LeftPanel_roomListContainer">
|
2020-06-05 01:34:04 +03:00
|
|
|
{this.renderHeader()}
|
2020-06-09 05:33:21 +03:00
|
|
|
{this.renderSearchExplore()}
|
2020-07-13 15:52:50 +03:00
|
|
|
{this.renderBreadcrumbs()}
|
2020-07-18 00:22:18 +03:00
|
|
|
<div className="mx_LeftPanel_roomListWrapper">
|
2020-07-08 15:49:04 +03:00
|
|
|
<div
|
|
|
|
className={roomListClasses}
|
|
|
|
onScroll={this.onScroll}
|
|
|
|
ref={this.listContainerRef}
|
|
|
|
// Firefox sometimes makes this element focusable due to
|
|
|
|
// overflow:scroll;, so force it out of tab order.
|
|
|
|
tabIndex={-1}
|
|
|
|
>
|
|
|
|
{roomList}
|
|
|
|
</div>
|
2020-07-03 00:21:10 +03:00
|
|
|
</div>
|
2020-06-03 04:26:07 +03:00
|
|
|
</aside>
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|