Noop first breadcrumb

pull/21833/head
Jorik Schellekens 2020-07-09 00:43:49 +01:00
parent eb38d80bd5
commit 016710af6a
1 changed files with 7 additions and 5 deletions

View File

@ -16,7 +16,6 @@ limitations under the License.
import React from "react";
import { BreadcrumbsStore } from "../../../stores/BreadcrumbsStore";
import AccessibleButton from "../elements/AccessibleButton";
import DecoratedRoomAvatar from "../avatars/DecoratedRoomAvatar";
import { _t } from "../../../languageHandler";
import { Room } from "matrix-js-sdk/src/models/room";
@ -88,16 +87,19 @@ export default class RoomBreadcrumbs2 extends React.PureComponent<IProps, IState
private viewRoom = (room: Room, index: number) => {
Analytics.trackEvent("Breadcrumbs", "click_node", index);
defaultDispatcher.dispatch({action: "view_room", room_id: room.roomId});
// If we're rendering the first breadcrumb and this is it no-op
if (!this.state.skipFirst && index === 0) {
return;
} else {
defaultDispatcher.dispatch({action: "view_room", room_id: room.roomId});
}
};
public render(): React.ReactElement {
// TODO: Decorate crumbs with icons: https://github.com/vector-im/riot-web/issues/14040
// TODO: Scrolling: https://github.com/vector-im/riot-web/issues/14040
// TODO: Tooltips: https://github.com/vector-im/riot-web/issues/14040
const tiles = BreadcrumbsStore.instance.rooms.map((r, i) => {
const roomTags = RoomListStore.instance.getTagsForRoom(r);
const roomTag = roomTags.includes(DefaultTagID.DM) ? DefaultTagID.DM : roomTags[0];
const anon = () => this.viewRoom(r, i);
return (
<AccessibleTooltipButton
className="mx_RoomBreadcrumbs2_crumb"