Files
ThreadNet-Web/src/components/views/voip/LegacyCallView/LegacyCallViewHeader.tsx
T
Michael TelatynskiandGitHub 7e5a3a530d Switch from css masks to rendering svg (#31681)
* Switch to Compound icons to replace old icons

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Apply same treatment to missed icons

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Iterate

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update snapshots

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Remove duplicated icon

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update icon

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Update snapshots

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in ImageView

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in ExtensionsCard

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in LegacyRoomListHeader

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in ImageSizePanel

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in LegacyRoomList

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Remove icon from CreateSecretStorageDialog title

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in LiveContentSummary

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in RoomCallBanner

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in NonUrgentEchoFailureToast

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in LegacyCallViewHeader

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

* Switch from css masks to rendering svg in CallEvent

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 screenshots

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>

---------

Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
2026-01-16 09:52:31 +00:00

116 lines
3.7 KiB
TypeScript

/*
Copyright 2021-2024 New Vector Ltd.
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
Please see LICENSE files in the repository root for full details.
*/
import { type Room } from "matrix-js-sdk/src/matrix";
import React from "react";
import {
PopOutIcon,
ExpandIcon,
PinSolidIcon,
VoiceCallSolidIcon,
} from "@vector-im/compound-design-tokens/assets/web/icons";
import { _t } from "../../../../languageHandler";
import RoomAvatar from "../../avatars/RoomAvatar";
import AccessibleButton from "../../elements/AccessibleButton";
interface LegacyCallControlsProps {
onExpand?: () => void;
onPin?: () => void;
onMaximize?: () => void;
}
const LegacyCallViewHeaderControls: React.FC<LegacyCallControlsProps> = ({ onExpand, onPin, onMaximize }) => {
return (
<div className="mx_LegacyCallViewHeader_controls">
{onMaximize && (
<AccessibleButton
className="mx_LegacyCallViewHeader_button"
onClick={onMaximize}
title={_t("voip|maximise")}
>
<ExpandIcon />
</AccessibleButton>
)}
{onPin && (
<AccessibleButton className="mx_LegacyCallViewHeader_button" onClick={onPin} title={_t("action|pin")}>
<PinSolidIcon />
</AccessibleButton>
)}
{onExpand && (
<AccessibleButton
className="mx_LegacyCallViewHeader_button"
onClick={onExpand}
title={_t("voip|expand")}
>
<PopOutIcon />
</AccessibleButton>
)}
</div>
);
};
interface ISecondaryCallInfoProps {
callRoom: Room;
}
const SecondaryCallInfo: React.FC<ISecondaryCallInfoProps> = ({ callRoom }) => {
return (
<span className="mx_LegacyCallViewHeader_secondaryCallInfo">
<RoomAvatar room={callRoom} size="16px" />
<span className="mx_LegacyCallView_secondaryCall_roomName">
{_t("voip|on_hold", { name: callRoom.name })}
</span>
</span>
);
};
interface LegacyCallViewHeaderProps {
pipMode?: boolean;
callRooms: [Room, Room | null];
onPipMouseDown?: (event: React.MouseEvent<Element, MouseEvent>) => void;
onExpand?: () => void;
onPin?: () => void;
onMaximize?: () => void;
}
const LegacyCallViewHeader: React.FC<LegacyCallViewHeaderProps> = ({
pipMode = false,
callRooms,
onPipMouseDown,
onExpand,
onPin,
onMaximize,
}) => {
const [callRoom, onHoldCallRoom] = callRooms;
const callRoomName = callRoom.name;
if (!pipMode) {
return (
<div className="mx_LegacyCallViewHeader">
<div className="mx_LegacyCallViewHeader_icon">
<VoiceCallSolidIcon />
</div>
<span className="mx_LegacyCallViewHeader_text">{_t("action|call")}</span>
<LegacyCallViewHeaderControls onMaximize={onMaximize} />
</div>
);
}
return (
<div className="mx_LegacyCallViewHeader mx_LegacyCallViewHeader_pip" onMouseDown={onPipMouseDown}>
<RoomAvatar room={callRoom} size="32px" />
<div className="mx_LegacyCallViewHeader_callInfo">
<div className="mx_LegacyCallViewHeader_roomName">{callRoomName}</div>
{onHoldCallRoom && <SecondaryCallInfo callRoom={onHoldCallRoom} />}
</div>
<LegacyCallViewHeaderControls onExpand={onExpand} onPin={onPin} onMaximize={onMaximize} />
</div>
);
};
export default LegacyCallViewHeader;