mirror of
https://github.com/vector-im/element-call.git
synced 2026-08-08 20:09:19 +00:00
review: smaller changes
- use correct button styles - move overrides to options - add flex-wrap: nowrap
This commit is contained in:
@@ -16,7 +16,7 @@ import {
|
|||||||
useMemo,
|
useMemo,
|
||||||
useState,
|
useState,
|
||||||
} from "react";
|
} from "react";
|
||||||
import { Button, Heading, IconButton, Tooltip } from "@vector-im/compound-web";
|
import { Heading, IconButton, Tooltip } from "@vector-im/compound-web";
|
||||||
import { CollapseIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
import { CollapseIcon } from "@vector-im/compound-design-tokens/assets/web/icons";
|
||||||
import { useTranslation } from "react-i18next";
|
import { useTranslation } from "react-i18next";
|
||||||
|
|
||||||
|
|||||||
@@ -130,9 +130,24 @@ export const EndCallButton: FC<EndCallButtonProps> = ({
|
|||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
interface SettingsIconButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
|
kind?: "secondary" | "primary";
|
||||||
|
}
|
||||||
|
export const SettingsIconButton: FC<SettingsIconButtonProps> = (props) => {
|
||||||
|
const { t } = useTranslation();
|
||||||
|
const Icon =
|
||||||
|
platform === "android" ? OverflowVerticalIcon : OverflowHorizontalIcon;
|
||||||
|
return (
|
||||||
|
<Tooltip label={t("common.settings")}>
|
||||||
|
<IconButton {...props}>
|
||||||
|
<Icon />
|
||||||
|
</IconButton>
|
||||||
|
</Tooltip>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
interface SettingsButtonProps extends ComponentPropsWithoutRef<"button"> {
|
interface SettingsButtonProps extends ComponentPropsWithoutRef<"button"> {
|
||||||
size?: "sm" | "lg";
|
size?: "sm" | "lg";
|
||||||
forAppBar?: boolean;
|
|
||||||
}
|
}
|
||||||
export const SettingsButton: FC<SettingsButtonProps> = (props) => {
|
export const SettingsButton: FC<SettingsButtonProps> = (props) => {
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
@@ -140,14 +155,7 @@ export const SettingsButton: FC<SettingsButtonProps> = (props) => {
|
|||||||
platform === "android" ? OverflowVerticalIcon : OverflowHorizontalIcon;
|
platform === "android" ? OverflowVerticalIcon : OverflowHorizontalIcon;
|
||||||
return (
|
return (
|
||||||
<Tooltip label={t("common.settings")}>
|
<Tooltip label={t("common.settings")}>
|
||||||
{!props.forAppBar && (
|
<CpdButton iconOnly Icon={Icon} kind="secondary" {...props} />
|
||||||
<CpdButton iconOnly Icon={Icon} kind="tertiary" {...props} />
|
|
||||||
)}
|
|
||||||
{props.forAppBar && (
|
|
||||||
<IconButton {...props}>
|
|
||||||
<Icon />
|
|
||||||
</IconButton>
|
|
||||||
)}
|
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ Please see LICENSE in the repository root for full details.
|
|||||||
display: flex;
|
display: flex;
|
||||||
gap: var(--cpd-space-4x);
|
gap: var(--cpd-space-4x);
|
||||||
flex-direction: row;
|
flex-direction: row;
|
||||||
|
flex-wrap: nowrap;
|
||||||
}
|
}
|
||||||
|
|
||||||
.logo {
|
.logo {
|
||||||
|
|||||||
@@ -113,8 +113,7 @@ function createInCallView(args: CreateInCallViewArgs = {}): RenderResult & {
|
|||||||
const { vm, rtcSession } = getBasicCallViewModelEnvironment(
|
const { vm, rtcSession } = getBasicCallViewModelEnvironment(
|
||||||
[local, alice],
|
[local, alice],
|
||||||
undefined,
|
undefined,
|
||||||
{},
|
{ mediaDeviceOverride: args.mediaDevices },
|
||||||
args.mediaDevices,
|
|
||||||
);
|
);
|
||||||
|
|
||||||
rtcSession.joined = true;
|
rtcSession.joined = true;
|
||||||
|
|||||||
@@ -38,8 +38,8 @@ import {
|
|||||||
MicButton,
|
MicButton,
|
||||||
VideoButton,
|
VideoButton,
|
||||||
ShareScreenButton,
|
ShareScreenButton,
|
||||||
SettingsButton,
|
|
||||||
ReactionToggleButton,
|
ReactionToggleButton,
|
||||||
|
SettingsIconButton,
|
||||||
} from "../button";
|
} 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";
|
||||||
@@ -645,7 +645,7 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
if (audioOutputButton) buttons.push(audioOutputButton);
|
if (audioOutputButton) buttons.push(audioOutputButton);
|
||||||
|
|
||||||
useAppBarSecondaryButton(
|
useAppBarSecondaryButton(
|
||||||
<SettingsButton forAppBar key="settings" onClick={openSettings} />,
|
<SettingsIconButton key="settings" onClick={openSettings} />,
|
||||||
);
|
);
|
||||||
|
|
||||||
buttons.push(
|
buttons.push(
|
||||||
@@ -686,7 +686,11 @@ export const InCallView: FC<InCallViewProps> = ({
|
|||||||
// Settings button is also shown in the app bar if present
|
// Settings button is also shown in the app bar if present
|
||||||
headerStyle !== HeaderStyle.AppBar &&
|
headerStyle !== HeaderStyle.AppBar &&
|
||||||
layout.type !== "pip" && (
|
layout.type !== "pip" && (
|
||||||
<SettingsButton key="settings" onClick={openSettings} />
|
<SettingsIconButton
|
||||||
|
kind="secondary"
|
||||||
|
key="settings"
|
||||||
|
onClick={openSettings}
|
||||||
|
/>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{headerStyle !== "none" && logo}
|
{headerStyle !== "none" && logo}
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ import { InviteButton } from "../button/InviteButton";
|
|||||||
import {
|
import {
|
||||||
EndCallButton,
|
EndCallButton,
|
||||||
MicButton,
|
MicButton,
|
||||||
SettingsButton,
|
SettingsIconButton,
|
||||||
VideoButton,
|
VideoButton,
|
||||||
} from "../button/Button";
|
} from "../button/Button";
|
||||||
import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal";
|
import { SettingsModal, defaultSettingsTab } from "../settings/SettingsModal";
|
||||||
@@ -228,7 +228,7 @@ export const LobbyView: FC<Props> = ({
|
|||||||
</div>
|
</div>
|
||||||
<div className={inCallStyles.footer}>
|
<div className={inCallStyles.footer}>
|
||||||
{recentsButtonInFooter && recentsButton}
|
{recentsButtonInFooter && recentsButton}
|
||||||
<SettingsButton onClick={openSettings} />
|
<SettingsIconButton kind="secondary" onClick={openSettings} />
|
||||||
<div className={inCallStyles.buttons}>
|
<div className={inCallStyles.buttons}>
|
||||||
<MicButton
|
<MicButton
|
||||||
enabled={audioEnabled}
|
enabled={audioEnabled}
|
||||||
|
|||||||
@@ -172,6 +172,7 @@ export interface CallViewModelOptions {
|
|||||||
windowSize$?: Behavior<{ width: number; height: number }>;
|
windowSize$?: Behavior<{ width: number; height: number }>;
|
||||||
/** The version & compatibility mode of MatrixRTC that we should use. */
|
/** The version & compatibility mode of MatrixRTC that we should use. */
|
||||||
matrixRTCMode$?: Behavior<MatrixRTCMode>;
|
matrixRTCMode$?: Behavior<MatrixRTCMode>;
|
||||||
|
mediaDeviceOverride?: MediaDevices;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do not play any sounds if the participant count has exceeded this
|
// Do not play any sounds if the participant count has exceeded this
|
||||||
|
|||||||
@@ -34,7 +34,6 @@ import {
|
|||||||
MockRTCSession,
|
MockRTCSession,
|
||||||
testScope,
|
testScope,
|
||||||
} from "./test";
|
} from "./test";
|
||||||
import { type MediaDevices } from "../state/MediaDevices";
|
|
||||||
import { aliceRtcMember, localRtcMember } from "./test-fixtures";
|
import { aliceRtcMember, localRtcMember } from "./test-fixtures";
|
||||||
import { type RaisedHandInfo, type ReactionInfo } from "../reactions";
|
import { type RaisedHandInfo, type ReactionInfo } from "../reactions";
|
||||||
import { constant } from "../state/Behavior";
|
import { constant } from "../state/Behavior";
|
||||||
@@ -133,7 +132,6 @@ export function getBasicCallViewModelEnvironment(
|
|||||||
members: RoomMember[],
|
members: RoomMember[],
|
||||||
initialRtcMemberships: CallMembership[] = [localRtcMember, aliceRtcMember],
|
initialRtcMemberships: CallMembership[] = [localRtcMember, aliceRtcMember],
|
||||||
callViewModelOptions: Partial<CallViewModelOptions> = {},
|
callViewModelOptions: Partial<CallViewModelOptions> = {},
|
||||||
mediaDevicesOverride?: MediaDevices,
|
|
||||||
): {
|
): {
|
||||||
vm: CallViewModel;
|
vm: CallViewModel;
|
||||||
rtcMemberships$: BehaviorSubject<CallMembership[]>;
|
rtcMemberships$: BehaviorSubject<CallMembership[]>;
|
||||||
@@ -154,7 +152,7 @@ export function getBasicCallViewModelEnvironment(
|
|||||||
testScope(),
|
testScope(),
|
||||||
rtcSession.asMockedSession(),
|
rtcSession.asMockedSession(),
|
||||||
matrixRoom,
|
matrixRoom,
|
||||||
mediaDevicesOverride ?? mockMediaDevices({}),
|
callViewModelOptions.mediaDeviceOverride ?? mockMediaDevices({}),
|
||||||
mockMuteStates(),
|
mockMuteStates(),
|
||||||
{
|
{
|
||||||
encryptionSystem: { kind: E2eeType.PER_PARTICIPANT },
|
encryptionSystem: { kind: E2eeType.PER_PARTICIPANT },
|
||||||
|
|||||||
Reference in New Issue
Block a user