mirror of
https://github.com/vector-im/element-web.git
synced 2024-11-16 21:24:59 +08:00
Noop first breadcrumb
This commit is contained in:
parent
eb38d80bd5
commit
016710af6a
@ -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"
|
||||
|
Loading…
Reference in New Issue
Block a user