mirror of
https://github.com/vector-im/element-call.git
synced 2026-07-30 19:39:22 +00:00
Move footer to storybook
This commit is contained in:
@@ -18,6 +18,7 @@ import {
|
|||||||
ShareScreenSolidIcon,
|
ShareScreenSolidIcon,
|
||||||
OverflowHorizontalIcon,
|
OverflowHorizontalIcon,
|
||||||
OverflowVerticalIcon,
|
OverflowVerticalIcon,
|
||||||
|
VolumeOnSolidIcon,
|
||||||
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||||
|
|
||||||
import styles from "./Button.module.css";
|
import styles from "./Button.module.css";
|
||||||
@@ -126,6 +127,36 @@ export const EndCallButton: FC<EndCallButtonProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface LoudspeakerButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
|
size?: "sm" | "lg";
|
||||||
|
/** The button will be rendered:
|
||||||
|
* true: currently in loudspeaker mode, pressing will switch to earpiece (rendered as enabled)
|
||||||
|
* false: currently in earpiece mode, pressing will switch to loudspeaker (rendered as disabled)
|
||||||
|
*/
|
||||||
|
isEarpieceTarget: boolean;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const LoudspeakerButton: FC<LoudspeakerButtonProps> = (props) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const label = props.isEarpieceTarget
|
||||||
|
? t("settings.devices.handset")
|
||||||
|
: t("settings.devices.loudspeaker");
|
||||||
|
// if the target is the earpice, we are currently in loudspeaker mode.
|
||||||
|
const enabled = props.isEarpieceTarget;
|
||||||
|
return (
|
||||||
|
<Tooltip label={label}>
|
||||||
|
<CpdButton
|
||||||
|
iconOnly
|
||||||
|
Icon={VolumeOnSolidIcon}
|
||||||
|
{...props}
|
||||||
|
kind={enabled ? "primary" : "secondary"}
|
||||||
|
role="switch"
|
||||||
|
aria-checked={enabled}
|
||||||
|
/>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
interface SettingsButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface SettingsButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
size?: "sm" | "lg";
|
size?: "sm" | "lg";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -165,13 +165,13 @@ export function ReactionPopupMenu({
|
|||||||
|
|
||||||
interface ReactionToggleButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface ReactionToggleButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
identifier: string;
|
identifier: string;
|
||||||
vm: CallViewModel;
|
reactionData: Pick<CallViewModel, "handsRaised$" | "reactions$">;
|
||||||
size?: "sm" | "lg";
|
size?: "sm" | "lg";
|
||||||
}
|
}
|
||||||
|
|
||||||
export function ReactionToggleButton({
|
export function ReactionToggleButton({
|
||||||
identifier,
|
identifier,
|
||||||
vm,
|
reactionData,
|
||||||
...props
|
...props
|
||||||
}: ReactionToggleButtonProps): ReactNode {
|
}: ReactionToggleButtonProps): ReactNode {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -180,8 +180,8 @@ export function ReactionToggleButton({
|
|||||||
const [showReactionsMenu, setShowReactionsMenu] = useState(false);
|
const [showReactionsMenu, setShowReactionsMenu] = useState(false);
|
||||||
const [errorText, setErrorText] = useState<string>();
|
const [errorText, setErrorText] = useState<string>();
|
||||||
|
|
||||||
const isHandRaised = !!useBehavior(vm.handsRaised$)[identifier];
|
const isHandRaised = !!useBehavior(reactionData.handsRaised$)[identifier];
|
||||||
const canReact = !useBehavior(vm.reactions$)[identifier];
|
const canReact = !useBehavior(reactionData.reactions$)[identifier];
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// Clear whenever the reactions menu state changes.
|
// Clear whenever the reactions menu state changes.
|
||||||
|
|||||||
132
src/components/InCallFooter.stories.tsx
Normal file
132
src/components/InCallFooter.stories.tsx
Normal file
@@ -0,0 +1,132 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2025 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { fn } from "storybook/test";
|
||||||
|
import { BehaviorSubject } from "rxjs";
|
||||||
|
import { type ReactNode } from "react";
|
||||||
|
|
||||||
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
|
import { InCallFooter, type InCallFooterProps } from "./InCallFooter";
|
||||||
|
import inCallViewStyles from "../room/InCallView.module.css";
|
||||||
|
|
||||||
|
function InCallFooterWrapper(props: InCallFooterProps): ReactNode {
|
||||||
|
return (
|
||||||
|
<div className={inCallViewStyles.inRoom}>
|
||||||
|
<InCallFooter {...props} />
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
component: InCallFooterWrapper,
|
||||||
|
} satisfies Meta<typeof InCallFooterWrapper>;
|
||||||
|
|
||||||
|
export default meta;
|
||||||
|
type Story = StoryObj<typeof meta>;
|
||||||
|
|
||||||
|
export const Default: Story = {
|
||||||
|
args: {
|
||||||
|
asOverlay: false,
|
||||||
|
showFooter: true,
|
||||||
|
showControls: true,
|
||||||
|
showSettingsButton: true,
|
||||||
|
showLogo: false,
|
||||||
|
asPip: false,
|
||||||
|
gridMode: "grid",
|
||||||
|
audioEnabled: true,
|
||||||
|
videoEnabled: true,
|
||||||
|
sharingScreen: false,
|
||||||
|
supportsReactions: false,
|
||||||
|
audioOutputSwitcher: null,
|
||||||
|
debugTileLayout: false,
|
||||||
|
tileStoreGeneration: 0,
|
||||||
|
reactionData: {
|
||||||
|
handsRaised$: new BehaviorSubject({}),
|
||||||
|
reactions$: new BehaviorSubject({}),
|
||||||
|
},
|
||||||
|
reactionIdentifier: "@user:example.com:DEVICE",
|
||||||
|
setGridMode: fn(),
|
||||||
|
openSettings: fn(),
|
||||||
|
toggleAudio: fn(),
|
||||||
|
toggleVideo: fn(),
|
||||||
|
toggleScreenSharing: fn(),
|
||||||
|
hangup: fn(),
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
layout: "fullscreen",
|
||||||
|
},
|
||||||
|
argTypes: {
|
||||||
|
gridMode: { control: "radio", options: ["grid", "spotlight"] },
|
||||||
|
audioOutputSwitcher: {
|
||||||
|
control: "radio",
|
||||||
|
options: ["noOutputSwitcher", "earpiece", "speaker"],
|
||||||
|
mapping: {
|
||||||
|
noOutputSwitcher: null,
|
||||||
|
// This is inverersed (speaker<->earpice) because the switcher object stores the target output, not the current one.
|
||||||
|
earpiece: { targetOutput: "speaker", switch: fn() },
|
||||||
|
speaker: { targetOutput: "earpiece", switch: fn() },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const WithLogo: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
showLogo: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export const WithAudioOutput: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
audioOutputSwitcher: { targetOutput: "speaker", switch: fn() },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export const Pip: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
asPip: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const NoControlsWithLogo: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
showControls: false,
|
||||||
|
showLogo: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DebugData: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
debugTileLayout: true,
|
||||||
|
tileStoreGeneration: 74,
|
||||||
|
audioOutputSwitcher: null,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export const MobileLayout: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
showLogo: true,
|
||||||
|
debugTileLayout: true,
|
||||||
|
tileStoreGeneration: 74,
|
||||||
|
audioOutputSwitcher: null,
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
viewport: { value: "mobile2", isRotated: false },
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
...Default.parameters,
|
||||||
|
},
|
||||||
|
};
|
||||||
202
src/components/InCallFooter.tsx
Normal file
202
src/components/InCallFooter.tsx
Normal file
@@ -0,0 +1,202 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2025 New Vector Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/
|
||||||
|
|
||||||
|
import { type FC, type JSX, type Ref, useMemo } from "react";
|
||||||
|
import classNames from "classnames";
|
||||||
|
|
||||||
|
import LogoMark from "../icons/LogoMark.svg?react";
|
||||||
|
import LogoType from "../icons/LogoType.svg?react";
|
||||||
|
import {
|
||||||
|
EndCallButton,
|
||||||
|
MicButton,
|
||||||
|
VideoButton,
|
||||||
|
ShareScreenButton,
|
||||||
|
SettingsButton,
|
||||||
|
ReactionToggleButton,
|
||||||
|
LoudspeakerButton,
|
||||||
|
} from "../button";
|
||||||
|
import styles from "../room/InCallView.module.css";
|
||||||
|
import { LayoutToggle } from "../room/LayoutToggle";
|
||||||
|
import {
|
||||||
|
type CallViewModel,
|
||||||
|
type GridMode,
|
||||||
|
} from "../state/CallViewModel/CallViewModel";
|
||||||
|
import { useAppBarSecondaryButton } from "../AppBar";
|
||||||
|
|
||||||
|
export interface AudioOutputSwitcher {
|
||||||
|
targetOutput: string;
|
||||||
|
switch: () => void;
|
||||||
|
}
|
||||||
|
|
||||||
|
export interface InCallFooterProps {
|
||||||
|
ref?: Ref<HTMLDivElement>;
|
||||||
|
/* This is needed for WindowMode = "flat" */
|
||||||
|
asOverlay: boolean;
|
||||||
|
showFooter: boolean;
|
||||||
|
showControls: boolean;
|
||||||
|
showSettingsButton: boolean;
|
||||||
|
showLogo: boolean;
|
||||||
|
asPip: boolean;
|
||||||
|
gridMode: GridMode;
|
||||||
|
setGridMode: (mode: GridMode) => void;
|
||||||
|
openSettings: () => void;
|
||||||
|
audioEnabled: boolean;
|
||||||
|
videoEnabled: boolean;
|
||||||
|
toggleAudio?: () => void;
|
||||||
|
toggleVideo?: () => void;
|
||||||
|
sharingScreen: boolean;
|
||||||
|
toggleScreenSharing?: () => void;
|
||||||
|
supportsReactions: boolean;
|
||||||
|
reactionIdentifier: string;
|
||||||
|
reactionData: Pick<CallViewModel, "handsRaised$" | "reactions$">;
|
||||||
|
audioOutputSwitcher: AudioOutputSwitcher | null;
|
||||||
|
hangup: () => void;
|
||||||
|
debugTileLayout: boolean;
|
||||||
|
tileStoreGeneration: number;
|
||||||
|
}
|
||||||
|
|
||||||
|
export const InCallFooter: FC<InCallFooterProps> = ({
|
||||||
|
ref,
|
||||||
|
asOverlay,
|
||||||
|
showFooter,
|
||||||
|
showControls,
|
||||||
|
showSettingsButton,
|
||||||
|
showLogo,
|
||||||
|
asPip,
|
||||||
|
gridMode,
|
||||||
|
setGridMode,
|
||||||
|
openSettings,
|
||||||
|
audioEnabled,
|
||||||
|
videoEnabled,
|
||||||
|
toggleAudio,
|
||||||
|
toggleVideo,
|
||||||
|
sharingScreen,
|
||||||
|
toggleScreenSharing,
|
||||||
|
supportsReactions,
|
||||||
|
reactionIdentifier,
|
||||||
|
reactionData,
|
||||||
|
audioOutputSwitcher,
|
||||||
|
hangup,
|
||||||
|
debugTileLayout,
|
||||||
|
tileStoreGeneration,
|
||||||
|
}) => {
|
||||||
|
const buttons: JSX.Element[] = [];
|
||||||
|
const buttonSize = asPip ? "sm" : "lg";
|
||||||
|
|
||||||
|
buttons.push(
|
||||||
|
<MicButton
|
||||||
|
size={buttonSize}
|
||||||
|
key="audio"
|
||||||
|
enabled={audioEnabled}
|
||||||
|
onClick={toggleAudio ?? undefined}
|
||||||
|
disabled={toggleAudio === null}
|
||||||
|
data-testid="incall_mute"
|
||||||
|
/>,
|
||||||
|
<VideoButton
|
||||||
|
size={buttonSize}
|
||||||
|
key="video"
|
||||||
|
enabled={videoEnabled}
|
||||||
|
onClick={toggleVideo ?? undefined}
|
||||||
|
disabled={toggleVideo === null}
|
||||||
|
data-testid="incall_videomute"
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (toggleScreenSharing !== null) {
|
||||||
|
buttons.push(
|
||||||
|
<ShareScreenButton
|
||||||
|
size={buttonSize}
|
||||||
|
key="share_screen"
|
||||||
|
className={styles.shareScreen}
|
||||||
|
enabled={sharingScreen}
|
||||||
|
onClick={toggleScreenSharing}
|
||||||
|
data-testid="incall_screenshare"
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (supportsReactions) {
|
||||||
|
buttons.push(
|
||||||
|
<ReactionToggleButton
|
||||||
|
size={buttonSize}
|
||||||
|
reactionData={reactionData}
|
||||||
|
key="raise_hand"
|
||||||
|
className={styles.raiseHand}
|
||||||
|
identifier={reactionIdentifier}
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In this PR we just move the button to the bottom bar. We do not yet update its appearance
|
||||||
|
const audioOutputButton = useMemo(() => {
|
||||||
|
if (audioOutputSwitcher === null) return null;
|
||||||
|
return (
|
||||||
|
<LoudspeakerButton
|
||||||
|
size={buttonSize}
|
||||||
|
isEarpieceTarget={audioOutputSwitcher.targetOutput === "earpiece"}
|
||||||
|
/>
|
||||||
|
);
|
||||||
|
}, [audioOutputSwitcher, buttonSize]);
|
||||||
|
|
||||||
|
if (audioOutputButton) buttons.push(audioOutputButton);
|
||||||
|
|
||||||
|
useAppBarSecondaryButton(
|
||||||
|
<SettingsButton key="settings" onClick={openSettings} />,
|
||||||
|
);
|
||||||
|
|
||||||
|
buttons.push(
|
||||||
|
<EndCallButton
|
||||||
|
size={buttonSize}
|
||||||
|
key="end_call"
|
||||||
|
onClick={hangup}
|
||||||
|
data-testid="incall_leave"
|
||||||
|
/>,
|
||||||
|
);
|
||||||
|
|
||||||
|
const logo = (
|
||||||
|
<div className={styles.logo}>
|
||||||
|
{showLogo && (
|
||||||
|
<>
|
||||||
|
<LogoMark width={24} height={24} aria-hidden />
|
||||||
|
<LogoType
|
||||||
|
width={80}
|
||||||
|
height={11}
|
||||||
|
aria-label={import.meta.env.VITE_PRODUCT_NAME || "Element Call"}
|
||||||
|
/>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
|
{debugTileLayout ? `Tiles generation: ${tileStoreGeneration}` : undefined}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
ref={ref}
|
||||||
|
className={classNames(styles.footer, {
|
||||||
|
[styles.overlay]: asOverlay,
|
||||||
|
[styles.hidden]: !showFooter,
|
||||||
|
})}
|
||||||
|
>
|
||||||
|
<div className={styles.settingsLogoContainer}>
|
||||||
|
{showControls && showSettingsButton && !asPip && (
|
||||||
|
<SettingsButton key="settings" onClick={openSettings} />
|
||||||
|
)}
|
||||||
|
|
||||||
|
{(!asPip || (!showLogo && !debugTileLayout)) && logo}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
{showControls && <div className={styles.buttons}>{buttons}</div>}
|
||||||
|
{showControls && !asPip && (
|
||||||
|
<LayoutToggle
|
||||||
|
className={styles.layout}
|
||||||
|
layout={gridMode}
|
||||||
|
setLayout={setGridMode}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
@@ -5,7 +5,6 @@ SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
|||||||
Please see LICENSE in the repository root for full details.
|
Please see LICENSE in the repository root for full details.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { IconButton, Tooltip } from "@vector-im/compound-web";
|
|
||||||
import { type MatrixClient, type Room as MatrixRoom } from "matrix-js-sdk";
|
import { type MatrixClient, type Room as MatrixRoom } from "matrix-js-sdk";
|
||||||
import {
|
import {
|
||||||
type FC,
|
type FC,
|
||||||
@@ -25,22 +24,9 @@ import classNames from "classnames";
|
|||||||
import { BehaviorSubject, map } from "rxjs";
|
import { BehaviorSubject, map } from "rxjs";
|
||||||
import { useObservable } from "observable-hooks";
|
import { useObservable } from "observable-hooks";
|
||||||
import { logger as rootLogger } from "matrix-js-sdk/lib/logger";
|
import { logger as rootLogger } from "matrix-js-sdk/lib/logger";
|
||||||
import {
|
|
||||||
VoiceCallSolidIcon,
|
|
||||||
VolumeOnSolidIcon,
|
|
||||||
} from "@vector-im/compound-design-tokens/assets/web/icons";
|
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
import LogoMark from "../icons/LogoMark.svg?react";
|
import { SettingsButton } from "../button";
|
||||||
import LogoType from "../icons/LogoType.svg?react";
|
|
||||||
import {
|
|
||||||
EndCallButton,
|
|
||||||
MicButton,
|
|
||||||
VideoButton,
|
|
||||||
ShareScreenButton,
|
|
||||||
SettingsButton,
|
|
||||||
ReactionToggleButton,
|
|
||||||
} from "../button";
|
|
||||||
import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header";
|
import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header";
|
||||||
import { HeaderStyle, useUrlParams } from "../UrlParams";
|
import { HeaderStyle, useUrlParams } from "../UrlParams";
|
||||||
import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts";
|
import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts";
|
||||||
@@ -55,7 +41,6 @@ import { useMergedRefs } from "../useMergedRefs";
|
|||||||
import { type MuteStates } from "../state/MuteStates";
|
import { type MuteStates } from "../state/MuteStates";
|
||||||
import { type MatrixInfo } from "./VideoPreview";
|
import { type MatrixInfo } from "./VideoPreview";
|
||||||
import { InviteButton } from "../button/InviteButton";
|
import { InviteButton } from "../button/InviteButton";
|
||||||
import { LayoutToggle } from "./LayoutToggle";
|
|
||||||
import {
|
import {
|
||||||
type CallViewModel,
|
type CallViewModel,
|
||||||
createCallViewModel$,
|
createCallViewModel$,
|
||||||
@@ -106,6 +91,7 @@ import { useTrackProcessorObservable$ } from "../livekit/TrackProcessorContext.t
|
|||||||
import { type Layout } from "../state/layout-types.ts";
|
import { type Layout } from "../state/layout-types.ts";
|
||||||
import { ObservableScope } from "../state/ObservableScope.ts";
|
import { ObservableScope } from "../state/ObservableScope.ts";
|
||||||
import { useLatest } from "../useLatest.ts";
|
import { useLatest } from "../useLatest.ts";
|
||||||
|
import { InCallFooter } from "../components/InCallFooter.tsx";
|
||||||
|
|
||||||
const logger = rootLogger.getChild("[InCallView]");
|
const logger = rootLogger.getChild("[InCallView]");
|
||||||
|
|
||||||
@@ -575,133 +561,38 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
matrixRoom.roomId,
|
matrixRoom.roomId,
|
||||||
);
|
);
|
||||||
|
|
||||||
const buttons: JSX.Element[] = [];
|
|
||||||
|
|
||||||
const buttonSize = layout.type === "pip" ? "sm" : "lg";
|
|
||||||
buttons.push(
|
|
||||||
<MicButton
|
|
||||||
size={buttonSize}
|
|
||||||
key="audio"
|
|
||||||
enabled={audioEnabled}
|
|
||||||
onClick={toggleAudio ?? undefined}
|
|
||||||
disabled={toggleAudio === null}
|
|
||||||
data-testid="incall_mute"
|
|
||||||
/>,
|
|
||||||
<VideoButton
|
|
||||||
size={buttonSize}
|
|
||||||
key="video"
|
|
||||||
enabled={videoEnabled}
|
|
||||||
onClick={toggleVideo ?? undefined}
|
|
||||||
disabled={toggleVideo === null}
|
|
||||||
data-testid="incall_videomute"
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
if (vm.toggleScreenSharing !== null) {
|
|
||||||
buttons.push(
|
|
||||||
<ShareScreenButton
|
|
||||||
size={buttonSize}
|
|
||||||
key="share_screen"
|
|
||||||
className={styles.shareScreen}
|
|
||||||
enabled={sharingScreen}
|
|
||||||
onClick={vm.toggleScreenSharing}
|
|
||||||
data-testid="incall_screenshare"
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (supportsReactions) {
|
|
||||||
buttons.push(
|
|
||||||
<ReactionToggleButton
|
|
||||||
size={buttonSize}
|
|
||||||
vm={vm}
|
|
||||||
key="raise_hand"
|
|
||||||
className={styles.raiseHand}
|
|
||||||
identifier={`${client.getUserId()}:${client.getDeviceId()}`}
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
// In this PR we just move the button ot the bottom bar. We do not yet update its apperance
|
|
||||||
const audioOutputButton = useMemo(() => {
|
|
||||||
if (audioOutputSwitcher === null) return null;
|
|
||||||
const isEarpieceTarget = audioOutputSwitcher.targetOutput === "earpiece";
|
|
||||||
const Icon = isEarpieceTarget ? VoiceCallSolidIcon : VolumeOnSolidIcon;
|
|
||||||
const label = isEarpieceTarget
|
|
||||||
? t("settings.devices.handset")
|
|
||||||
: t("settings.devices.loudspeaker");
|
|
||||||
|
|
||||||
return (
|
|
||||||
<Tooltip label={label}>
|
|
||||||
<IconButton
|
|
||||||
key="audio_output_switcher"
|
|
||||||
onClick={(e) => {
|
|
||||||
audioOutputSwitcher.switch();
|
|
||||||
}}
|
|
||||||
>
|
|
||||||
<Icon />
|
|
||||||
</IconButton>
|
|
||||||
</Tooltip>
|
|
||||||
);
|
|
||||||
}, [t, audioOutputSwitcher]);
|
|
||||||
if (audioOutputButton) buttons.push(audioOutputButton);
|
|
||||||
|
|
||||||
useAppBarSecondaryButton(
|
useAppBarSecondaryButton(
|
||||||
<SettingsButton key="settings" onClick={openSettings} />,
|
<SettingsButton key="settings" onClick={openSettings} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
buttons.push(
|
|
||||||
<EndCallButton
|
|
||||||
size={buttonSize}
|
|
||||||
key="end_call"
|
|
||||||
onClick={function (): void {
|
|
||||||
vm.hangup();
|
|
||||||
}}
|
|
||||||
data-testid="incall_leave"
|
|
||||||
/>,
|
|
||||||
);
|
|
||||||
|
|
||||||
const logo = (
|
|
||||||
<div className={styles.logo}>
|
|
||||||
<LogoMark width={24} height={24} aria-hidden />
|
|
||||||
<LogoType
|
|
||||||
width={80}
|
|
||||||
height={11}
|
|
||||||
aria-label={import.meta.env.VITE_PRODUCT_NAME || "Element Call"}
|
|
||||||
/>
|
|
||||||
{/* Don't mind this odd placement, it's just a little debug label */}
|
|
||||||
{debugTileLayout ? `Tiles generation: ${tileStoreGeneration}` : undefined}
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
|
|
||||||
const footer = (
|
const footer = (
|
||||||
<div
|
<InCallFooter
|
||||||
ref={footerRef}
|
ref={footerRef}
|
||||||
className={classNames(styles.footer, {
|
asOverlay={windowMode === "flat"}
|
||||||
[styles.overlay]: windowMode === "flat",
|
// TODO this should be computed in the view model!
|
||||||
[styles.hidden]:
|
showFooter={!showFooter || (!showControls && headerStyle === "none")}
|
||||||
!showFooter || (!showControls && headerStyle === "none"),
|
showControls={showControls}
|
||||||
})}
|
showLogo={headerStyle !== HeaderStyle.None}
|
||||||
>
|
showSettingsButton={headerStyle !== HeaderStyle.AppBar}
|
||||||
<div className={styles.settingsLogoContainer}>
|
asPip={layout.type === "pip"}
|
||||||
{showControls &&
|
gridMode={gridMode}
|
||||||
headerStyle !== HeaderStyle.AppBar &&
|
setGridMode={setGridMode}
|
||||||
layout.type !== "pip" && (
|
openSettings={openSettings}
|
||||||
<SettingsButton key="settings" onClick={openSettings} />
|
audioEnabled={audioEnabled}
|
||||||
)}
|
videoEnabled={videoEnabled}
|
||||||
|
toggleAudio={toggleAudio ?? undefined}
|
||||||
{headerStyle !== "none" && logo}
|
toggleVideo={toggleVideo ?? undefined}
|
||||||
</div>
|
sharingScreen={sharingScreen}
|
||||||
|
toggleScreenSharing={vm.toggleScreenSharing ?? undefined}
|
||||||
{showControls && <div className={styles.buttons}>{buttons}</div>}
|
supportsReactions={supportsReactions}
|
||||||
{showControls && (
|
reactionIdentifier={`${client.getUserId()}:${client.getDeviceId()}`}
|
||||||
<LayoutToggle
|
reactionData={vm}
|
||||||
className={styles.layout}
|
audioOutputSwitcher={audioOutputSwitcher}
|
||||||
layout={gridMode}
|
hangup={vm.hangup}
|
||||||
setLayout={setGridMode}
|
debugTileLayout={debugTileLayout}
|
||||||
/>
|
tileStoreGeneration={tileStoreGeneration}
|
||||||
)}
|
/>
|
||||||
</div>
|
|
||||||
);
|
);
|
||||||
|
|
||||||
const allConnections = useBehavior(vm.allConnections$);
|
const allConnections = useBehavior(vm.allConnections$);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Reference in New Issue
Block a user