Also use CallFooter for lobby
This commit is contained in:
+2
-2
@@ -8,8 +8,8 @@ Please see LICENSE in the repository root for full details.
|
|||||||
import type { StorybookConfig } from "@storybook/react-vite";
|
import type { StorybookConfig } from "@storybook/react-vite";
|
||||||
|
|
||||||
const config: StorybookConfig = {
|
const config: StorybookConfig = {
|
||||||
stories: ["../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
stories: ["../src/**/*.mdx", "../src/**/*.stories.@(js|jsx|mjs|ts|tsx)"],
|
||||||
addons: ["@storybook/addon-docs"],
|
addons: ["@storybook/addon-docs", "@storybook/addon-vitest"],
|
||||||
framework: "@storybook/react-vite",
|
framework: "@storybook/react-vite",
|
||||||
};
|
};
|
||||||
export default config;
|
export default config;
|
||||||
|
|||||||
@@ -109,7 +109,7 @@ mobileTest(
|
|||||||
.click();
|
.click();
|
||||||
|
|
||||||
// dismiss settings
|
// dismiss settings
|
||||||
await guestPage.locator("#root").getByLabel("Settings").press("Escape");
|
await guestPage.locator("#root").press("Escape");
|
||||||
|
|
||||||
await guestPage.pause();
|
await guestPage.pause();
|
||||||
await expect(
|
await expect(
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ import {
|
|||||||
} 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";
|
||||||
import inCallFooterStyles from "../components/InCallFooter.module.css";
|
import callFooterStyles from "../components/CallFooter.module.css";
|
||||||
import { platform } from "../Platform";
|
import { platform } from "../Platform";
|
||||||
|
|
||||||
interface MicButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface MicButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
@@ -177,9 +177,9 @@ export const SettingsButton: FC<SettingsButtonProps> = ({
|
|||||||
<Tooltip label={t("common.settings")}>
|
<Tooltip label={t("common.settings")}>
|
||||||
<CpdButton
|
<CpdButton
|
||||||
className={classNames(className, {
|
className={classNames(className, {
|
||||||
[inCallFooterStyles.settingsOnlyShowWide]:
|
[callFooterStyles.settingsOnlyShowWide]:
|
||||||
showForScreenWidth === "wide",
|
showForScreenWidth === "wide",
|
||||||
[inCallFooterStyles.settingsOnlyShowNarrow]:
|
[callFooterStyles.settingsOnlyShowNarrow]:
|
||||||
showForScreenWidth === "narrow",
|
showForScreenWidth === "narrow",
|
||||||
})}
|
})}
|
||||||
iconOnly
|
iconOnly
|
||||||
|
|||||||
@@ -0,0 +1,31 @@
|
|||||||
|
{/*
|
||||||
|
Copyright 2026 Element Creations Ltd.
|
||||||
|
|
||||||
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
||||||
|
Please see LICENSE in the repository root for full details.
|
||||||
|
*/}
|
||||||
|
|
||||||
|
{/*
|
||||||
|
This is a custom doc page overwriting the default autodocs tag.
|
||||||
|
This can be done by using the same filename as the component
|
||||||
|
With the help of Primary, Controls,Stories the overhead is minimal
|
||||||
|
*/}
|
||||||
|
|
||||||
|
import { Meta,Primary,Controls,Stories,Title,Subtitle } from '@storybook/addon-docs/blocks';
|
||||||
|
import * as CallFooterStories from './CallFooter.stories';
|
||||||
|
|
||||||
|
<Meta of={CallFooterStories} />
|
||||||
|
|
||||||
|
<Title> Call Footer </Title>
|
||||||
|
|
||||||
|
The footer compoentn contains all main interactions needed for a call.
|
||||||
|
|
||||||
|
<Subtitle> Mobile layouts </Subtitle>
|
||||||
|
|
||||||
|
This component is reactive. To properly check the mobile layout, you will need to click on the stories in the left sidebar to see the
|
||||||
|
component on a mobile screen.
|
||||||
|
The story summary here does not render the mobile layouts correctly.
|
||||||
|
|
||||||
|
<Primary />
|
||||||
|
<Controls of={CallFooterStories.Primary} />
|
||||||
|
<Stories/>
|
||||||
@@ -51,6 +51,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
|
|
||||||
.settingsLogoContainer {
|
.settingsLogoContainer {
|
||||||
display: flex;
|
display: flex;
|
||||||
|
align-items: center;
|
||||||
gap: var(--cpd-space-4x);
|
gap: var(--cpd-space-4x);
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,232 @@
|
|||||||
|
/*
|
||||||
|
Copyright 2026 Element Creations 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 { Link } from "@vector-im/compound-web";
|
||||||
|
|
||||||
|
import type { Meta, StoryObj } from "@storybook/react-vite";
|
||||||
|
import { CallFooter, type FooterProps } from "./CallFooter";
|
||||||
|
import inCallViewStyles from "../room/InCallView.module.css";
|
||||||
|
import { ReactionsSenderContext } from "../reactions/useReactionsSender";
|
||||||
|
import { type ReactionOption } from "../reactions";
|
||||||
|
|
||||||
|
function CallFooterWrapper(props: FooterProps): ReactNode {
|
||||||
|
return (
|
||||||
|
<div className={inCallViewStyles.inRoom}>
|
||||||
|
<ReactionsSenderContext
|
||||||
|
value={{
|
||||||
|
supportsReactions: false,
|
||||||
|
toggleRaisedHand: async () => Promise.resolve(),
|
||||||
|
sendReaction: async (reaction: ReactionOption) => Promise.resolve(),
|
||||||
|
}}
|
||||||
|
>
|
||||||
|
<CallFooter {...props} />
|
||||||
|
</ReactionsSenderContext>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
const meta = {
|
||||||
|
component: CallFooterWrapper,
|
||||||
|
} satisfies Meta<typeof CallFooterWrapper>;
|
||||||
|
|
||||||
|
export default meta;
|
||||||
|
type Story = StoryObj<typeof meta>;
|
||||||
|
|
||||||
|
const reactionIdentifier = "@user:example.com:DEVICE";
|
||||||
|
const reactionData = {
|
||||||
|
handsRaised$: new BehaviorSubject({}),
|
||||||
|
reactions$: new BehaviorSubject({}),
|
||||||
|
};
|
||||||
|
|
||||||
|
const fnArgType = {
|
||||||
|
control: { type: "select" as const },
|
||||||
|
options: ["MockedCallback", "undefined"],
|
||||||
|
mapping: { MockedCallback: fn(), undefined: undefined },
|
||||||
|
};
|
||||||
|
export const Default: Story = {
|
||||||
|
args: {
|
||||||
|
hideLogo: true,
|
||||||
|
layoutMode: "grid",
|
||||||
|
setLayoutMode: fn(),
|
||||||
|
openSettings: fn(),
|
||||||
|
toggleAudio: fn(),
|
||||||
|
toggleVideo: fn(),
|
||||||
|
toggleScreenSharing: fn(),
|
||||||
|
hangup: fn(),
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
layout: "fullscreen",
|
||||||
|
},
|
||||||
|
argTypes: {
|
||||||
|
layoutMode: { control: "radio", options: ["grid", "spotlight"] },
|
||||||
|
audioOutputSwitcher: {
|
||||||
|
control: "select",
|
||||||
|
options: ["NoOutputCallback", "speaker", "earpiece"],
|
||||||
|
table: { defaultValue: { summary: "NoOutputCallback" } },
|
||||||
|
mapping: {
|
||||||
|
NoOutputCallback: undefined,
|
||||||
|
// This is inverersed (speaker<->earpice) because the switcher object stores the target output, not the current one.
|
||||||
|
speaker: { targetOutput: "speaker", switch: fn() },
|
||||||
|
earpiece: { targetOutput: "earpiece", switch: fn() },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
toggleScreenSharing: fnArgType,
|
||||||
|
setLayoutMode: fnArgType,
|
||||||
|
openSettings: fnArgType,
|
||||||
|
toggleAudio: fnArgType,
|
||||||
|
toggleVideo: fnArgType,
|
||||||
|
hangup: fnArgType,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const WithLogo: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
hideLogo: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const AudioVideoEnabled: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
audioEnabled: true,
|
||||||
|
videoEnabled: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export const WithAudioOutput: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
audioOutputSwitcher: { targetOutput: "speaker", switch: fn() },
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export const WithReactions: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
reactionIdentifier,
|
||||||
|
reactionData,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
export const Pip: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
asPip: true,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const NoControlsWithLogo: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
hideControls: true,
|
||||||
|
hideLogo: false,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const DebugData: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
debugTileLayout: true,
|
||||||
|
tileStoreGeneration: 74,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const UnavailableMediaDevices: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
toggleAudio: undefined,
|
||||||
|
toggleVideo: undefined,
|
||||||
|
audioOutputSwitcher: undefined,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const MobileLayout: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
hideLogo: true,
|
||||||
|
|
||||||
|
audioOutputSwitcher: { targetOutput: "speaker", switch: fn() },
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
viewport: { value: "mobile2", isRotated: false },
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
...Default.parameters,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const Lobby: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
hideLogo: true,
|
||||||
|
openSettings: undefined,
|
||||||
|
setLayoutMode: undefined,
|
||||||
|
toggleScreenSharing: undefined,
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
...Default.parameters,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const LobbyMobile: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
hideLogo: true,
|
||||||
|
|
||||||
|
setLayoutMode: undefined,
|
||||||
|
toggleScreenSharing: undefined,
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
viewport: { value: "mobile2", isRotated: false },
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
...Default.parameters,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const LobbyRecentButton: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
children: <Link>Back To Recents</Link>,
|
||||||
|
hideLogo: true,
|
||||||
|
setLayoutMode: undefined,
|
||||||
|
toggleScreenSharing: undefined,
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
...Default.parameters,
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
export const LobbyRecentButtonMobile: Story = {
|
||||||
|
...Default,
|
||||||
|
args: {
|
||||||
|
...Default.args,
|
||||||
|
children: <Link>Back To Recents</Link>,
|
||||||
|
hideLogo: true,
|
||||||
|
setLayoutMode: undefined,
|
||||||
|
toggleScreenSharing: undefined,
|
||||||
|
},
|
||||||
|
globals: {
|
||||||
|
viewport: { value: "mobile2", isRotated: false },
|
||||||
|
},
|
||||||
|
parameters: {
|
||||||
|
...Default.parameters,
|
||||||
|
},
|
||||||
|
};
|
||||||
@@ -7,6 +7,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
|
|
||||||
import { type FC, type JSX, type Ref, useMemo } from "react";
|
import { type FC, type JSX, type Ref, useMemo } from "react";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
|
import { BehaviorSubject } from "rxjs";
|
||||||
|
|
||||||
import LogoMark from "../icons/LogoMark.svg?react";
|
import LogoMark from "../icons/LogoMark.svg?react";
|
||||||
import LogoType from "../icons/LogoType.svg?react";
|
import LogoType from "../icons/LogoType.svg?react";
|
||||||
@@ -19,7 +20,7 @@ import {
|
|||||||
ReactionToggleButton,
|
ReactionToggleButton,
|
||||||
LoudspeakerButton,
|
LoudspeakerButton,
|
||||||
} from "../button";
|
} from "../button";
|
||||||
import styles from "./InCallFooter.module.css";
|
import styles from "./CallFooter.module.css";
|
||||||
import { LayoutToggle } from "../room/LayoutToggle";
|
import { LayoutToggle } from "../room/LayoutToggle";
|
||||||
import {
|
import {
|
||||||
type CallViewModel,
|
type CallViewModel,
|
||||||
@@ -32,44 +33,60 @@ export interface AudioOutputSwitcher {
|
|||||||
switch: () => void;
|
switch: () => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface InCallFooterProps {
|
export interface FooterProps {
|
||||||
ref?: Ref<HTMLDivElement>;
|
ref?: Ref<HTMLDivElement>;
|
||||||
|
/** Children will only be visible if the component is wider than 5*/
|
||||||
|
children?: JSX.Element | JSX.Element[] | false;
|
||||||
/* This is needed for WindowMode = "flat" */
|
/* This is needed for WindowMode = "flat" */
|
||||||
asOverlay: boolean;
|
hideControls?: boolean;
|
||||||
showFooter: boolean;
|
/** hide the entire footer*/
|
||||||
showControls: boolean;
|
hidden?: boolean;
|
||||||
hideSettingsButton: boolean;
|
|
||||||
hideLogo: boolean;
|
|
||||||
/** Pip controls buttonSize and hides: settings button, layout switcher and logo */
|
/** Pip controls buttonSize and hides: settings button, layout switcher and logo */
|
||||||
asPip: boolean;
|
asPip?: boolean;
|
||||||
gridMode: GridMode;
|
/** The footer should be used as an overlay.
|
||||||
setGridMode: (mode: GridMode) => void;
|
* (Over the Call Grid) This saves spaces on small screens.*/
|
||||||
openSettings: () => void;
|
asOverlay?: boolean;
|
||||||
audioEnabled: boolean;
|
|
||||||
videoEnabled: boolean;
|
layoutMode?: GridMode;
|
||||||
|
/** Also controls if the layout button is visible */
|
||||||
|
setLayoutMode?: (mode: GridMode) => void;
|
||||||
|
|
||||||
|
audioEnabled?: boolean;
|
||||||
|
/** Also controls if the audioMute button is disabled */
|
||||||
toggleAudio?: () => void;
|
toggleAudio?: () => void;
|
||||||
|
videoEnabled?: boolean;
|
||||||
|
/** Also controls if the videoMute button is disabled */
|
||||||
toggleVideo?: () => void;
|
toggleVideo?: () => void;
|
||||||
sharingScreen: boolean;
|
|
||||||
|
sharingScreen?: boolean;
|
||||||
toggleScreenSharing?: () => void;
|
toggleScreenSharing?: () => void;
|
||||||
supportsReactions: boolean;
|
|
||||||
reactionIdentifier: string;
|
/** Also controls if the audio button is visible */
|
||||||
reactionData: Pick<CallViewModel, "handsRaised$" | "reactions$">;
|
audioOutputSwitcher?: AudioOutputSwitcher;
|
||||||
audioOutputSwitcher: AudioOutputSwitcher | null;
|
/** Also controls if the settings button is visible */
|
||||||
hangup: () => void;
|
openSettings?: () => void;
|
||||||
debugTileLayout: boolean;
|
/** Also controls if the hangup button is visible */
|
||||||
tileStoreGeneration: number;
|
hangup?: () => void;
|
||||||
|
|
||||||
|
reactionIdentifier?: string;
|
||||||
|
reactionData?: Pick<CallViewModel, "handsRaised$" | "reactions$">;
|
||||||
|
|
||||||
|
hideLogo?: boolean;
|
||||||
|
// debug stuff
|
||||||
|
debugTileLayout?: boolean;
|
||||||
|
tileStoreGeneration?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const InCallFooter: FC<InCallFooterProps> = ({
|
export const CallFooter: FC<FooterProps> = ({
|
||||||
ref,
|
ref,
|
||||||
|
children,
|
||||||
asOverlay,
|
asOverlay,
|
||||||
showFooter,
|
hidden,
|
||||||
showControls,
|
hideControls,
|
||||||
hideSettingsButton,
|
|
||||||
hideLogo,
|
hideLogo,
|
||||||
asPip,
|
asPip,
|
||||||
gridMode,
|
layoutMode,
|
||||||
setGridMode,
|
setLayoutMode,
|
||||||
openSettings,
|
openSettings,
|
||||||
audioEnabled,
|
audioEnabled,
|
||||||
videoEnabled,
|
videoEnabled,
|
||||||
@@ -77,7 +94,6 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
toggleVideo,
|
toggleVideo,
|
||||||
sharingScreen,
|
sharingScreen,
|
||||||
toggleScreenSharing,
|
toggleScreenSharing,
|
||||||
supportsReactions,
|
|
||||||
reactionIdentifier,
|
reactionIdentifier,
|
||||||
reactionData,
|
reactionData,
|
||||||
audioOutputSwitcher,
|
audioOutputSwitcher,
|
||||||
@@ -87,8 +103,9 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const buttons: JSX.Element[] = [];
|
const buttons: JSX.Element[] = [];
|
||||||
const buttonSize = asPip ? "sm" : "lg";
|
const buttonSize = asPip ? "sm" : "lg";
|
||||||
const showSettingsButton = !hideSettingsButton && !asPip && showControls;
|
const showSettingsButton =
|
||||||
const showLayoutSwitcher = !asPip && showControls;
|
openSettings !== undefined && !asPip && !hideControls;
|
||||||
|
const showLayoutSwitcher = !asPip && !hideControls;
|
||||||
const showLogoDebugContainer = !asPip || (!hideLogo && !debugTileLayout);
|
const showLogoDebugContainer = !asPip || (!hideLogo && !debugTileLayout);
|
||||||
const showLogo = !hideLogo && !asPip;
|
const showLogo = !hideLogo && !asPip;
|
||||||
if (showSettingsButton) {
|
if (showSettingsButton) {
|
||||||
@@ -108,39 +125,45 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
<MicButton
|
<MicButton
|
||||||
size={buttonSize}
|
size={buttonSize}
|
||||||
key="audio"
|
key="audio"
|
||||||
enabled={audioEnabled}
|
enabled={audioEnabled ?? false}
|
||||||
onClick={toggleAudio ?? undefined}
|
onClick={toggleAudio}
|
||||||
disabled={toggleAudio === undefined}
|
disabled={toggleAudio === undefined}
|
||||||
data-testid="incall_mute"
|
data-testid="incall_mute"
|
||||||
/>,
|
/>,
|
||||||
<VideoButton
|
<VideoButton
|
||||||
size={buttonSize}
|
size={buttonSize}
|
||||||
key="video"
|
key="video"
|
||||||
enabled={videoEnabled}
|
enabled={videoEnabled ?? false}
|
||||||
onClick={toggleVideo ?? undefined}
|
onClick={toggleVideo}
|
||||||
disabled={toggleVideo === undefined}
|
disabled={toggleVideo === undefined}
|
||||||
data-testid="incall_videomute"
|
data-testid="incall_videomute"
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
|
|
||||||
if (toggleScreenSharing !== null) {
|
if (toggleScreenSharing !== undefined) {
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<ShareScreenButton
|
<ShareScreenButton
|
||||||
size={buttonSize}
|
size={buttonSize}
|
||||||
key="share_screen"
|
key="share_screen"
|
||||||
className={styles.shareScreen}
|
className={styles.shareScreen}
|
||||||
enabled={sharingScreen}
|
enabled={sharingScreen ?? false}
|
||||||
onClick={toggleScreenSharing}
|
onClick={toggleScreenSharing}
|
||||||
data-testid="incall_screenshare"
|
data-testid="incall_screenshare"
|
||||||
/>,
|
/>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (supportsReactions) {
|
if (reactionIdentifier) {
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<ReactionToggleButton
|
<ReactionToggleButton
|
||||||
size={buttonSize}
|
size={buttonSize}
|
||||||
reactionData={reactionData}
|
reactionData={
|
||||||
|
reactionData ??
|
||||||
|
({
|
||||||
|
handsRaised$: new BehaviorSubject({}),
|
||||||
|
reactions$: new BehaviorSubject({}),
|
||||||
|
} as Pick<CallViewModel, "handsRaised$" | "reactions$">)
|
||||||
|
}
|
||||||
key="raise_hand"
|
key="raise_hand"
|
||||||
className={styles.raiseHand}
|
className={styles.raiseHand}
|
||||||
identifier={reactionIdentifier}
|
identifier={reactionIdentifier}
|
||||||
@@ -150,7 +173,7 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
|
|
||||||
// In this PR we just move the button to the bottom bar. We do not yet update its appearance
|
// In this PR we just move the button to the bottom bar. We do not yet update its appearance
|
||||||
const audioOutputButton = useMemo(() => {
|
const audioOutputButton = useMemo(() => {
|
||||||
if (audioOutputSwitcher === null) return null;
|
if (audioOutputSwitcher === undefined) return null;
|
||||||
return (
|
return (
|
||||||
<LoudspeakerButton
|
<LoudspeakerButton
|
||||||
size={buttonSize}
|
size={buttonSize}
|
||||||
@@ -166,6 +189,7 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
<SettingsButton key="settings" onClick={openSettings} />,
|
<SettingsButton key="settings" onClick={openSettings} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if (hangup)
|
||||||
buttons.push(
|
buttons.push(
|
||||||
<EndCallButton
|
<EndCallButton
|
||||||
size={buttonSize}
|
size={buttonSize}
|
||||||
@@ -196,7 +220,7 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
ref={ref}
|
ref={ref}
|
||||||
className={classNames(styles.footer, {
|
className={classNames(styles.footer, {
|
||||||
[styles.overlay]: asOverlay,
|
[styles.overlay]: asOverlay,
|
||||||
[styles.hidden]: !showFooter,
|
[styles.hidden]: hidden,
|
||||||
})}
|
})}
|
||||||
>
|
>
|
||||||
<div className={styles.settingsLogoContainer}>
|
<div className={styles.settingsLogoContainer}>
|
||||||
@@ -207,16 +231,15 @@ export const InCallFooter: FC<InCallFooterProps> = ({
|
|||||||
onClick={openSettings}
|
onClick={openSettings}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
|
{children}
|
||||||
{showLogoDebugContainer && logoDebugContainer}
|
{showLogoDebugContainer && logoDebugContainer}
|
||||||
</div>
|
</div>
|
||||||
|
{!hideControls && <div className={styles.buttons}>{buttons}</div>}
|
||||||
{showControls && <div className={styles.buttons}>{buttons}</div>}
|
{setLayoutMode && layoutMode && showLayoutSwitcher && (
|
||||||
{showLayoutSwitcher && (
|
|
||||||
<LayoutToggle
|
<LayoutToggle
|
||||||
className={styles.layout}
|
className={styles.layout}
|
||||||
layout={gridMode}
|
layout={layoutMode}
|
||||||
setLayout={setGridMode}
|
setLayout={setLayoutMode}
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
@@ -1,132 +0,0 @@
|
|||||||
/*
|
|
||||||
Copyright 2026 Element Creations 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,
|
|
||||||
hideSettingsButton: false,
|
|
||||||
hideLogo: true,
|
|
||||||
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,
|
|
||||||
hideLogo: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
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,
|
|
||||||
hideLogo: false,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
|
|
||||||
export const DebugData: Story = {
|
|
||||||
...Default,
|
|
||||||
args: {
|
|
||||||
...Default.args,
|
|
||||||
debugTileLayout: true,
|
|
||||||
tileStoreGeneration: 74,
|
|
||||||
audioOutputSwitcher: null,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
export const MobileLayout: Story = {
|
|
||||||
...Default,
|
|
||||||
args: {
|
|
||||||
...Default.args,
|
|
||||||
hideLogo: true,
|
|
||||||
debugTileLayout: true,
|
|
||||||
tileStoreGeneration: 74,
|
|
||||||
audioOutputSwitcher: null,
|
|
||||||
},
|
|
||||||
globals: {
|
|
||||||
viewport: { value: "mobile2", isRotated: false },
|
|
||||||
},
|
|
||||||
parameters: {
|
|
||||||
...Default.parameters,
|
|
||||||
},
|
|
||||||
};
|
|
||||||
@@ -29,7 +29,7 @@ interface ReactionsSenderContextType {
|
|||||||
sendReaction: (reaction: ReactionOption) => Promise<void>;
|
sendReaction: (reaction: ReactionOption) => Promise<void>;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ReactionsSenderContext = createContext<
|
export const ReactionsSenderContext = createContext<
|
||||||
ReactionsSenderContextType | undefined
|
ReactionsSenderContextType | undefined
|
||||||
>(undefined);
|
>(undefined);
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ import { type MediaDevices as ECMediaDevices } from "../state/MediaDevices";
|
|||||||
import { constant } from "../state/Behavior";
|
import { constant } from "../state/Behavior";
|
||||||
import { AppBar } from "../AppBar";
|
import { AppBar } from "../AppBar";
|
||||||
import { initializeWidget } from "../widget";
|
import { initializeWidget } from "../widget";
|
||||||
import inCallFooterStyles from "../components/InCallFooter.module.css";
|
import callFooterStyles from "../components/CallFooter.module.css";
|
||||||
|
|
||||||
initializeWidget();
|
initializeWidget();
|
||||||
vi.hoisted(
|
vi.hoisted(
|
||||||
@@ -211,9 +211,9 @@ describe("InCallView", () => {
|
|||||||
// Their visibility uses @media css queries, which cannot be tested in JSDOM,
|
// Their visibility uses @media css queries, which cannot be tested in JSDOM,
|
||||||
// but we can at least check that both buttons are rendered and have the correct classes.
|
// but we can at least check that both buttons are rendered and have the correct classes.
|
||||||
expect(btnA).toBeInTheDocument();
|
expect(btnA).toBeInTheDocument();
|
||||||
expect(btnA).toHaveClass(inCallFooterStyles.settingsOnlyShowWide);
|
expect(btnA).toHaveClass(callFooterStyles.settingsOnlyShowWide);
|
||||||
expect(btnB).toBeInTheDocument();
|
expect(btnB).toBeInTheDocument();
|
||||||
expect(btnB).toHaveClass(inCallFooterStyles.settingsOnlyShowNarrow);
|
expect(btnB).toHaveClass(callFooterStyles.settingsOnlyShowNarrow);
|
||||||
});
|
});
|
||||||
|
|
||||||
it("is accessible when showHeader is true", () => {
|
it("is accessible when showHeader is true", () => {
|
||||||
|
|||||||
+11
-12
@@ -90,7 +90,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";
|
import { CallFooter } from "../components/CallFooter.tsx";
|
||||||
|
|
||||||
const logger = rootLogger.getChild("[InCallView]");
|
const logger = rootLogger.getChild("[InCallView]");
|
||||||
|
|
||||||
@@ -562,30 +562,29 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
matrixRoom.roomId,
|
matrixRoom.roomId,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Only hide the settings button if we have an AppBar header and we are showing the header
|
||||||
|
const hideSettings = headerStyle === HeaderStyle.AppBar && showHeader;
|
||||||
const footer = (
|
const footer = (
|
||||||
<InCallFooter
|
<CallFooter
|
||||||
ref={footerRef}
|
ref={footerRef}
|
||||||
asOverlay={windowMode === "flat"}
|
asOverlay={windowMode === "flat"}
|
||||||
showFooter={showFooter}
|
hidden={!showFooter}
|
||||||
showControls={showControls}
|
hideControls={!showControls}
|
||||||
// Hide the logo for both embedded solutions. mobile: HeaderStyle.AppBar and desktop: HeaderStyle.None.
|
// Hide the logo for both embedded solutions. mobile: HeaderStyle.AppBar and desktop: HeaderStyle.None.
|
||||||
hideLogo={headerStyle !== HeaderStyle.Standard}
|
hideLogo={headerStyle !== HeaderStyle.Standard}
|
||||||
// Only hide the settings button if we have an AppBar header and we are showing the header
|
|
||||||
hideSettingsButton={headerStyle === HeaderStyle.AppBar && showHeader}
|
|
||||||
asPip={layout.type === "pip"}
|
asPip={layout.type === "pip"}
|
||||||
gridMode={gridMode}
|
layoutMode={gridMode}
|
||||||
setGridMode={setGridMode}
|
setLayoutMode={setGridMode}
|
||||||
openSettings={openSettings}
|
openSettings={hideSettings ? undefined : openSettings}
|
||||||
audioEnabled={audioEnabled}
|
audioEnabled={audioEnabled}
|
||||||
videoEnabled={videoEnabled}
|
videoEnabled={videoEnabled}
|
||||||
toggleAudio={toggleAudio ?? undefined}
|
toggleAudio={toggleAudio ?? undefined}
|
||||||
toggleVideo={toggleVideo ?? undefined}
|
toggleVideo={toggleVideo ?? undefined}
|
||||||
sharingScreen={sharingScreen}
|
sharingScreen={sharingScreen}
|
||||||
toggleScreenSharing={vm.toggleScreenSharing ?? undefined}
|
toggleScreenSharing={vm.toggleScreenSharing ?? undefined}
|
||||||
supportsReactions={supportsReactions}
|
|
||||||
reactionIdentifier={`${client.getUserId()}:${client.getDeviceId()}`}
|
reactionIdentifier={`${client.getUserId()}:${client.getDeviceId()}`}
|
||||||
reactionData={vm}
|
reactionData={supportsReactions ? vm : undefined}
|
||||||
audioOutputSwitcher={audioOutputSwitcher}
|
audioOutputSwitcher={audioOutputSwitcher ?? undefined}
|
||||||
hangup={vm.hangup}
|
hangup={vm.hangup}
|
||||||
debugTileLayout={debugTileLayout}
|
debugTileLayout={debugTileLayout}
|
||||||
tileStoreGeneration={tileStoreGeneration}
|
tileStoreGeneration={tileStoreGeneration}
|
||||||
|
|||||||
+8
-22
@@ -33,12 +33,6 @@ import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header";
|
|||||||
import { type MatrixInfo, VideoPreview } from "./VideoPreview";
|
import { type MatrixInfo, VideoPreview } from "./VideoPreview";
|
||||||
import { type MuteStates } from "../state/MuteStates";
|
import { type MuteStates } from "../state/MuteStates";
|
||||||
import { InviteButton } from "../button/InviteButton";
|
import { InviteButton } from "../button/InviteButton";
|
||||||
import {
|
|
||||||
EndCallButton,
|
|
||||||
MicButton,
|
|
||||||
SettingsButton,
|
|
||||||
VideoButton,
|
|
||||||
} from "../button/Button";
|
|
||||||
import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal";
|
import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal";
|
||||||
import { useMediaQuery } from "../useMediaQuery";
|
import { useMediaQuery } from "../useMediaQuery";
|
||||||
import { E2eeType } from "../e2ee/e2eeType";
|
import { E2eeType } from "../e2ee/e2eeType";
|
||||||
@@ -52,6 +46,7 @@ import {
|
|||||||
import { usePageTitle } from "../usePageTitle";
|
import { usePageTitle } from "../usePageTitle";
|
||||||
import { getValue } from "../utils/observable";
|
import { getValue } from "../utils/observable";
|
||||||
import { useBehavior } from "../useBehavior";
|
import { useBehavior } from "../useBehavior";
|
||||||
|
import { CallFooter } from "../components/CallFooter";
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
client: MatrixClient;
|
client: MatrixClient;
|
||||||
@@ -226,23 +221,14 @@ export const LobbyView: FC<Props> = ({
|
|||||||
</VideoPreview>
|
</VideoPreview>
|
||||||
{!recentsButtonInFooter && recentsButton}
|
{!recentsButtonInFooter && recentsButton}
|
||||||
</div>
|
</div>
|
||||||
<div className={inCallStyles.footer}>
|
<CallFooter
|
||||||
|
toggleAudio={toggleAudio ?? undefined}
|
||||||
|
toggleVideo={toggleVideo ?? undefined}
|
||||||
|
openSettings={openSettings}
|
||||||
|
hangup={!confineToRoom ? onLeaveClick : undefined}
|
||||||
|
>
|
||||||
{recentsButtonInFooter && recentsButton}
|
{recentsButtonInFooter && recentsButton}
|
||||||
<SettingsButton onClick={openSettings} />
|
</CallFooter>
|
||||||
<div className={inCallStyles.buttons}>
|
|
||||||
<MicButton
|
|
||||||
enabled={audioEnabled}
|
|
||||||
onClick={toggleAudio ?? undefined}
|
|
||||||
disabled={toggleAudio === null}
|
|
||||||
/>
|
|
||||||
<VideoButton
|
|
||||||
enabled={videoEnabled}
|
|
||||||
onClick={toggleVideo ?? undefined}
|
|
||||||
disabled={toggleVideo === null}
|
|
||||||
/>
|
|
||||||
{!confineToRoom && <EndCallButton onClick={onLeaveClick} />}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{client && (
|
{client && (
|
||||||
<SettingsModal
|
<SettingsModal
|
||||||
|
|||||||
Reference in New Issue
Block a user