Add chat button on new room header for maximised widgets (#12882)
* Add chat button to new room header for video room & maximised widgets Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Delint Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Iterate Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update snapshot Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> * Update screenshot Signed-off-by: Michael Telatynski <7t3chguy@gmail.com> --------- Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
0e37c09042
commit
eacb22eac7
4 changed files with 18 additions and 6 deletions
Binary file not shown.
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 4.8 KiB |
|
@ -161,7 +161,7 @@ interface IRoomProps {
|
||||||
|
|
||||||
// This defines the content of the mainSplit.
|
// This defines the content of the mainSplit.
|
||||||
// If the mainSplit does not contain the Timeline, the chat is shown in the right panel.
|
// If the mainSplit does not contain the Timeline, the chat is shown in the right panel.
|
||||||
enum MainSplitContentType {
|
export enum MainSplitContentType {
|
||||||
Timeline,
|
Timeline,
|
||||||
MaximisedWidget,
|
MaximisedWidget,
|
||||||
Call,
|
Call,
|
||||||
|
|
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import React, { useCallback, useMemo, useState } from "react";
|
import React, { useCallback, useContext, useMemo, useState } from "react";
|
||||||
import { Body as BodyText, Button, IconButton, Menu, MenuItem, Tooltip } from "@vector-im/compound-web";
|
import { Body as BodyText, Button, IconButton, Menu, MenuItem, Tooltip } from "@vector-im/compound-web";
|
||||||
import { Icon as VideoCallIcon } from "@vector-im/compound-design-tokens/icons/video-call-solid.svg";
|
import { Icon as VideoCallIcon } from "@vector-im/compound-design-tokens/icons/video-call-solid.svg";
|
||||||
import { Icon as VoiceCallIcon } from "@vector-im/compound-design-tokens/icons/voice-call.svg";
|
import { Icon as VoiceCallIcon } from "@vector-im/compound-design-tokens/icons/voice-call.svg";
|
||||||
|
@ -50,7 +50,7 @@ import RightPanelStore from "../../../stores/right-panel/RightPanelStore";
|
||||||
import PosthogTrackers from "../../../PosthogTrackers";
|
import PosthogTrackers from "../../../PosthogTrackers";
|
||||||
import { VideoRoomChatButton } from "./RoomHeader/VideoRoomChatButton";
|
import { VideoRoomChatButton } from "./RoomHeader/VideoRoomChatButton";
|
||||||
import { RoomKnocksBar } from "./RoomKnocksBar";
|
import { RoomKnocksBar } from "./RoomKnocksBar";
|
||||||
import { isVideoRoom } from "../../../utils/video-rooms";
|
import { useIsVideoRoom } from "../../../utils/video-rooms";
|
||||||
import { notificationLevelToIndicator } from "../../../utils/notifications";
|
import { notificationLevelToIndicator } from "../../../utils/notifications";
|
||||||
import { CallGuestLinkButton } from "./RoomHeader/CallGuestLinkButton";
|
import { CallGuestLinkButton } from "./RoomHeader/CallGuestLinkButton";
|
||||||
import { ButtonEvent } from "../elements/AccessibleButton";
|
import { ButtonEvent } from "../elements/AccessibleButton";
|
||||||
|
@ -59,6 +59,8 @@ import { useIsReleaseAnnouncementOpen } from "../../../hooks/useIsReleaseAnnounc
|
||||||
import { ReleaseAnnouncementStore } from "../../../stores/ReleaseAnnouncementStore";
|
import { ReleaseAnnouncementStore } from "../../../stores/ReleaseAnnouncementStore";
|
||||||
import WithPresenceIndicator, { useDmMember } from "../avatars/WithPresenceIndicator";
|
import WithPresenceIndicator, { useDmMember } from "../avatars/WithPresenceIndicator";
|
||||||
import { IOOBData } from "../../../stores/ThreepidInviteStore";
|
import { IOOBData } from "../../../stores/ThreepidInviteStore";
|
||||||
|
import RoomContext from "../../../contexts/RoomContext";
|
||||||
|
import { MainSplitContentType } from "../../structures/RoomView";
|
||||||
|
|
||||||
export default function RoomHeader({
|
export default function RoomHeader({
|
||||||
room,
|
room,
|
||||||
|
@ -233,6 +235,13 @@ export default function RoomHeader({
|
||||||
|
|
||||||
const isReleaseAnnouncementOpen = useIsReleaseAnnouncementOpen("newRoomHeader");
|
const isReleaseAnnouncementOpen = useIsReleaseAnnouncementOpen("newRoomHeader");
|
||||||
|
|
||||||
|
const roomContext = useContext(RoomContext);
|
||||||
|
const isVideoRoom = useIsVideoRoom(room);
|
||||||
|
const showChatButton =
|
||||||
|
isVideoRoom ||
|
||||||
|
roomContext.mainSplitContentType === MainSplitContentType.MaximisedWidget ||
|
||||||
|
roomContext.mainSplitContentType === MainSplitContentType.Call;
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Flex as="header" align="center" gap="var(--cpd-space-3x)" className="mx_RoomHeader light-panel">
|
<Flex as="header" align="center" gap="var(--cpd-space-3x)" className="mx_RoomHeader light-panel">
|
||||||
|
@ -325,14 +334,13 @@ export default function RoomHeader({
|
||||||
})}
|
})}
|
||||||
|
|
||||||
{isViewingCall && <CallGuestLinkButton room={room} />}
|
{isViewingCall && <CallGuestLinkButton room={room} />}
|
||||||
{((isConnectedToCall && isViewingCall) || isVideoRoom(room)) && <VideoRoomChatButton room={room} />}
|
|
||||||
|
|
||||||
{hasActiveCallSession && !isConnectedToCall && !isViewingCall ? (
|
{hasActiveCallSession && !isConnectedToCall && !isViewingCall ? (
|
||||||
joinCallButton
|
joinCallButton
|
||||||
) : (
|
) : (
|
||||||
<>
|
<>
|
||||||
{!isVideoRoom(room) && videoCallButton}
|
{!isVideoRoom && videoCallButton}
|
||||||
{!useElementCallExclusively && !isVideoRoom(room) && voiceCallButton}
|
{!useElementCallExclusively && !isVideoRoom && voiceCallButton}
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
@ -347,6 +355,9 @@ export default function RoomHeader({
|
||||||
<RoomInfoIcon />
|
<RoomInfoIcon />
|
||||||
</IconButton>
|
</IconButton>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
|
|
||||||
|
{showChatButton && <VideoRoomChatButton room={room} />}
|
||||||
|
|
||||||
<Tooltip label={_t("common|threads")}>
|
<Tooltip label={_t("common|threads")}>
|
||||||
<IconButton
|
<IconButton
|
||||||
indicator={notificationLevelToIndicator(threadNotifications)}
|
indicator={notificationLevelToIndicator(threadNotifications)}
|
||||||
|
|
|
@ -617,6 +617,7 @@ describe("RoomHeader", () => {
|
||||||
},
|
},
|
||||||
]);
|
]);
|
||||||
jest.spyOn(client, "isCryptoEnabled").mockReturnValue(true);
|
jest.spyOn(client, "isCryptoEnabled").mockReturnValue(true);
|
||||||
|
jest.spyOn(ShieldUtils, "shieldStatusForRoom").mockResolvedValue(ShieldUtils.E2EStatus.Normal);
|
||||||
});
|
});
|
||||||
|
|
||||||
it.each([
|
it.each([
|
||||||
|
|
Loading…
Reference in a new issue