From 0082ade23459fdf68d5a8c27313793201112386e Mon Sep 17 00:00:00 2001 From: Timo K Date: Wed, 13 May 2026 13:16:24 +0200 Subject: [PATCH] reuse exisng mute buttons (fixes most playwright issues) --- src/components/CallFooter.tsx | 1 - src/components/MediaMuteAndSwitchButton.tsx | 137 ++++++++++---------- 2 files changed, 72 insertions(+), 66 deletions(-) diff --git a/src/components/CallFooter.tsx b/src/components/CallFooter.tsx index 082d9c71..99af4257 100644 --- a/src/components/CallFooter.tsx +++ b/src/components/CallFooter.tsx @@ -180,7 +180,6 @@ export const CallFooter: FC = ({ ref, children, vm }) => { iconsAndLabels="video" enabled={videoEnabled ?? false} onMuteClick={toggleVideo} - data-testid="incall_videomute" options={videoOptions} toggles={videoToggles} selectedOption={selectedVideo} diff --git a/src/components/MediaMuteAndSwitchButton.tsx b/src/components/MediaMuteAndSwitchButton.tsx index 418480f6..e25f23f1 100644 --- a/src/components/MediaMuteAndSwitchButton.tsx +++ b/src/components/MediaMuteAndSwitchButton.tsx @@ -17,18 +17,14 @@ import { CheckIcon, ChevronUpIcon, ChevronDownIcon, - MicOffSolidIcon, MicOnIcon, - MicOnSolidIcon, SpinnerIcon, VideoCallIcon, - VideoCallOffSolidIcon, - VideoCallSolidIcon, } from "@vector-im/compound-design-tokens/assets/web/icons"; import classNames from "classnames"; -import { logger } from "matrix-js-sdk/lib/logger"; import styles from "./MediaMuteAndSwitchButton.module.css"; +import { MicButton, VideoButton } from "../button"; export interface MenuOptions { label: string; @@ -81,7 +77,7 @@ export const MediaMuteAndSwitchButton: FC = ({ title, enabled, onMuteClick, - iconsAndLabels: iconsAndLabelsWithDefaultCases, + iconsAndLabels, options, selectedOption, toggles, @@ -89,58 +85,82 @@ export const MediaMuteAndSwitchButton: FC = ({ }) => { const [plannedSelection, setPlannedSelection] = useState(null); const [menuOpen, setMenuOpen] = useState(false); - let iconsAndLabels: IconsAndLabels | undefined; - switch (iconsAndLabelsWithDefaultCases) { + + let button; + switch (iconsAndLabels) { case "video": - iconsAndLabels = { - IconEnabled: VideoCallSolidIcon, - IconDisabled: VideoCallOffSolidIcon, - IconOptions: VideoCallIcon, - disabledLabel: t("stop_video_button_label"), - enabledLabel: t("start_video_button_label"), - optionsButtonLabel: t("settings.devices.camera"), - }; + button = ( + { + onMuteClick?.(); + e.preventDefault(); + e.stopPropagation(); + }} + disabled={onMuteClick === undefined} + data-testid="incall_videomute" + /> + ); break; case "audio": - iconsAndLabels = { - IconEnabled: MicOnSolidIcon, - IconDisabled: MicOffSolidIcon, - IconOptions: MicOnIcon, - disabledLabel: t("mute_microphone_button_label"), - enabledLabel: t("unmute_microphone_button_label"), - optionsButtonLabel: t("settings.devices.microphone"), - }; + button = ( + { + onMuteClick?.(); + e.preventDefault(); + e.stopPropagation(); + }} + disabled={onMuteClick === undefined} + data-testid="incall_mute" + /> + ); break; default: - iconsAndLabels = iconsAndLabelsWithDefaultCases; + button = ( +