Fix room join spinner in room list header (#7364)

This commit is contained in:
Michael Telatynski 2021-12-14 16:07:00 +00:00 committed by GitHub
parent cc689f95d8
commit 1d9906c3fa
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License. limitations under the License.
*/ */
import React, { useContext, useEffect, useState } from "react"; import React, { ComponentProps, useContext, useEffect, useState } from "react";
import { Room } from "matrix-js-sdk/src/models/room"; import { Room } from "matrix-js-sdk/src/models/room";
import { EventType } from "matrix-js-sdk/src/@types/event"; import { EventType } from "matrix-js-sdk/src/@types/event";
@ -41,7 +41,6 @@ import ErrorDialog from "../dialogs/ErrorDialog";
import { showCommunityInviteDialog } from "../../../RoomInvite"; import { showCommunityInviteDialog } from "../../../RoomInvite";
import { useDispatcher } from "../../../hooks/useDispatcher"; import { useDispatcher } from "../../../hooks/useDispatcher";
import InlineSpinner from "../elements/InlineSpinner"; import InlineSpinner from "../elements/InlineSpinner";
import TooltipButton from "../elements/TooltipButton";
import MatrixClientContext from "../../../contexts/MatrixClientContext"; import MatrixClientContext from "../../../contexts/MatrixClientContext";
import RoomListStore, { LISTS_UPDATE_EVENT } from "../../../stores/room-list/RoomListStore"; import RoomListStore, { LISTS_UPDATE_EVENT } from "../../../stores/room-list/RoomListStore";
import { import {
@ -51,6 +50,7 @@ import {
UPDATE_HOME_BEHAVIOUR, UPDATE_HOME_BEHAVIOUR,
UPDATE_SELECTED_SPACE, UPDATE_SELECTED_SPACE,
} from "../../../stores/spaces"; } from "../../../stores/spaces";
import TooltipTarget from "../elements/TooltipTarget";
const contextMenuBelow = (elementRect: DOMRect) => { const contextMenuBelow = (elementRect: DOMRect) => {
// align the context menu's icons with the icon which opened the context menu // align the context menu's icons with the icon which opened the context menu
@ -60,7 +60,7 @@ const contextMenuBelow = (elementRect: DOMRect) => {
return { left, top, chevronFace }; return { left, top, chevronFace };
}; };
const PrototypeCommunityContextMenu = (props) => { const PrototypeCommunityContextMenu = (props: ComponentProps<typeof SpaceContextMenu>) => {
const communityId = CommunityPrototypeStore.instance.getSelectedCommunityId(); const communityId = CommunityPrototypeStore.instance.getSelectedCommunityId();
let settingsOption; let settingsOption;
@ -327,14 +327,13 @@ const RoomListHeader = ({ spacePanelDisabled, onVisibilityChange }: IProps) => {
title = getMetaSpaceName(spaceKey as MetaSpace, allRoomsInHome); title = getMetaSpaceName(spaceKey as MetaSpace, allRoomsInHome);
} }
let pendingRoomJoinSpinner; let pendingRoomJoinSpinner: JSX.Element;
if (joiningRooms.size) { if (joiningRooms.size) {
pendingRoomJoinSpinner = <InlineSpinner> pendingRoomJoinSpinner = <TooltipTarget
<TooltipButton helpText={_t( label={_t("Currently joining %(count)s rooms", { count: joiningRooms.size })}
"Currently joining %(count)s rooms", >
{ count: joiningRooms.size }, <InlineSpinner />
)} /> </TooltipTarget>;
</InlineSpinner>;
} }
let contextMenuButton: JSX.Element = <div className="mx_RoomListHeader_contextLessTitle">{ title }</div>; let contextMenuButton: JSX.Element = <div className="mx_RoomListHeader_contextLessTitle">{ title }</div>;