2022-05-04 17:09:48 +01:00
|
|
|
/*
|
2023-05-05 11:44:35 +02:00
|
|
|
Copyright 2022 - 2023 New Vector Ltd
|
2022-05-04 17:09:48 +01:00
|
|
|
|
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
|
you may not use this file except in compliance with the License.
|
|
|
|
|
You may obtain a copy of the License at
|
|
|
|
|
|
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
|
|
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
|
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
|
See the License for the specific language governing permissions and
|
|
|
|
|
limitations under the License.
|
|
|
|
|
*/
|
|
|
|
|
|
2022-09-14 19:05:05 -04:00
|
|
|
import { ResizeObserver } from "@juggle/resize-observer";
|
2023-06-02 14:49:11 +02:00
|
|
|
import {
|
2023-06-26 13:48:41 -04:00
|
|
|
RoomAudioRenderer,
|
|
|
|
|
RoomContext,
|
2023-06-02 14:49:11 +02:00
|
|
|
useLocalParticipant,
|
|
|
|
|
useParticipants,
|
|
|
|
|
useTracks,
|
|
|
|
|
} from "@livekit/components-react";
|
2023-06-05 20:51:01 +02:00
|
|
|
import { usePreventScroll } from "@react-aria/overlays";
|
2023-09-12 11:30:46 +01:00
|
|
|
import { ConnectionState, Room, Track } from "livekit-client";
|
2023-06-05 20:51:01 +02:00
|
|
|
import { MatrixClient } from "matrix-js-sdk/src/client";
|
|
|
|
|
import { RoomMember } from "matrix-js-sdk/src/models/room-member";
|
2023-08-25 13:19:23 +01:00
|
|
|
import { Room as MatrixRoom } from "matrix-js-sdk/src/models/room";
|
2023-09-22 18:05:13 -04:00
|
|
|
import {
|
|
|
|
|
FC,
|
|
|
|
|
ReactNode,
|
|
|
|
|
Ref,
|
|
|
|
|
useCallback,
|
|
|
|
|
useEffect,
|
|
|
|
|
useMemo,
|
|
|
|
|
useRef,
|
|
|
|
|
useState,
|
|
|
|
|
} from "react";
|
2023-06-05 20:51:01 +02:00
|
|
|
import { useTranslation } from "react-i18next";
|
|
|
|
|
import useMeasure from "react-use-measure";
|
2023-07-20 17:55:50 +01:00
|
|
|
import { logger } from "matrix-js-sdk/src/logger";
|
2023-08-16 18:41:27 +01:00
|
|
|
import { MatrixRTCSession } from "matrix-js-sdk/src/matrixrtc/MatrixRTCSession";
|
2023-10-26 19:33:59 +02:00
|
|
|
import classNames from "classnames";
|
2022-08-02 00:46:16 +02:00
|
|
|
|
2023-09-27 19:06:10 -04:00
|
|
|
import LogoMark from "../icons/LogoMark.svg?react";
|
|
|
|
|
import LogoType from "../icons/LogoType.svg?react";
|
2022-09-09 02:10:45 -04:00
|
|
|
import type { IWidgetApiRequest } from "matrix-widget-api";
|
2022-01-05 15:06:51 -08:00
|
|
|
import {
|
|
|
|
|
HangupButton,
|
|
|
|
|
MicButton,
|
|
|
|
|
VideoButton,
|
|
|
|
|
ScreenshareButton,
|
2023-05-05 11:44:35 +02:00
|
|
|
SettingsButton,
|
2022-01-05 15:06:51 -08:00
|
|
|
} from "../button";
|
2023-08-16 18:41:27 +01:00
|
|
|
import { Header, LeftNav, RightNav, RoomHeaderInfo } from "../Header";
|
2023-02-13 21:57:57 -05:00
|
|
|
import {
|
|
|
|
|
useVideoGridLayout,
|
2023-06-09 17:22:34 -04:00
|
|
|
TileDescriptor,
|
2023-07-03 10:03:24 +02:00
|
|
|
VideoGrid,
|
2023-02-13 21:57:57 -05:00
|
|
|
} from "../video-grid/VideoGrid";
|
2023-08-16 18:41:27 +01:00
|
|
|
import { useShowConnectionStats } from "../settings/useSetting";
|
2023-03-01 13:47:36 +01:00
|
|
|
import { PosthogAnalytics } from "../analytics/PosthogAnalytics";
|
2022-10-14 16:17:50 +02:00
|
|
|
import { useUrlParams } from "../UrlParams";
|
2023-06-05 20:51:01 +02:00
|
|
|
import { useCallViewKeyboardShortcuts } from "../useCallViewKeyboardShortcuts";
|
|
|
|
|
import { usePrefersReducedMotion } from "../usePrefersReducedMotion";
|
|
|
|
|
import { ElementWidgetActions, widget } from "../widget";
|
|
|
|
|
import styles from "./InCallView.module.css";
|
2023-06-30 16:43:28 +01:00
|
|
|
import { ItemData, TileContent, VideoTile } from "../video-grid/VideoTile";
|
2023-01-18 10:52:12 -05:00
|
|
|
import { NewVideoGrid } from "../video-grid/NewVideoGrid";
|
2023-03-16 14:41:55 +00:00
|
|
|
import { OTelGroupCallMembership } from "../otel/OTelGroupCallMembership";
|
2023-05-05 11:44:35 +02:00
|
|
|
import { SettingsModal } from "../settings/SettingsModal";
|
2023-05-22 15:30:29 -04:00
|
|
|
import { useRageshakeRequestModal } from "../settings/submit-rageshake";
|
|
|
|
|
import { RageshakeRequestModal } from "./RageshakeRequestModal";
|
2023-11-24 17:53:15 +01:00
|
|
|
import { E2EEConfig } from "../livekit/useLiveKit";
|
2023-06-26 13:48:41 -04:00
|
|
|
import { useFullscreen } from "./useFullscreen";
|
2023-06-28 10:59:36 -04:00
|
|
|
import { useLayoutStates } from "../video-grid/Layout";
|
2023-07-21 00:51:07 -04:00
|
|
|
import { useWakeLock } from "../useWakeLock";
|
2023-08-02 15:29:37 -04:00
|
|
|
import { useMergedRefs } from "../useMergedRefs";
|
|
|
|
|
import { MuteStates } from "./MuteStates";
|
2023-09-08 15:39:10 -04:00
|
|
|
import { MatrixInfo } from "./VideoPreview";
|
2023-09-27 15:17:04 -04:00
|
|
|
import { InviteButton } from "../button/InviteButton";
|
2023-09-08 15:39:10 -04:00
|
|
|
import { LayoutToggle } from "./LayoutToggle";
|
2023-09-04 12:46:06 +01:00
|
|
|
import {
|
|
|
|
|
ECAddonConnectionState,
|
|
|
|
|
ECConnectionState,
|
|
|
|
|
} from "../livekit/useECConnectionState";
|
2022-01-05 15:06:51 -08:00
|
|
|
|
2022-07-03 10:36:16 -04:00
|
|
|
const canScreenshare = "getDisplayMedia" in (navigator.mediaDevices ?? {});
|
2022-01-05 15:06:51 -08:00
|
|
|
const isSafari = /^((?!chrome|android).)*safari/i.test(navigator.userAgent);
|
|
|
|
|
|
2023-09-04 12:46:06 +01:00
|
|
|
// How long we wait after a focus switch before showing the real participant list again
|
|
|
|
|
const POST_FOCUS_PARTICIPANT_UPDATE_DELAY_MS = 3000;
|
|
|
|
|
|
2023-11-24 17:53:15 +01:00
|
|
|
export interface ActiveCallProps extends InCallViewProps {
|
2023-11-10 11:54:59 +00:00
|
|
|
e2eeConfig: E2EEConfig;
|
2023-06-16 18:07:13 +02:00
|
|
|
}
|
|
|
|
|
|
2023-09-22 18:05:13 -04:00
|
|
|
export const ActiveCall: FC<ActiveCallProps> = (props) => {
|
2023-11-24 17:53:15 +01:00
|
|
|
if (!props.livekitRoom) {
|
2023-06-30 16:43:28 +01:00
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-26 13:48:41 -04:00
|
|
|
return (
|
2023-11-24 17:53:15 +01:00
|
|
|
<RoomContext.Provider value={props.livekitRoom}>
|
|
|
|
|
<InCallView
|
|
|
|
|
{...props}
|
|
|
|
|
livekitRoom={props.livekitRoom}
|
|
|
|
|
connState={props.connState}
|
|
|
|
|
/>
|
2023-06-30 16:43:28 +01:00
|
|
|
</RoomContext.Provider>
|
2023-06-26 13:48:41 -04:00
|
|
|
);
|
2023-09-22 18:05:13 -04:00
|
|
|
};
|
2023-06-12 15:35:54 +02:00
|
|
|
|
2023-07-05 13:12:37 +01:00
|
|
|
export interface InCallViewProps {
|
2022-08-02 00:46:16 +02:00
|
|
|
client: MatrixClient;
|
2023-09-08 15:39:10 -04:00
|
|
|
matrixInfo: MatrixInfo;
|
2023-08-16 18:41:27 +01:00
|
|
|
rtcSession: MatrixRTCSession;
|
2023-06-16 18:07:13 +02:00
|
|
|
livekitRoom: Room;
|
2023-08-02 15:29:37 -04:00
|
|
|
muteStates: MuteStates;
|
2023-09-27 18:12:04 -04:00
|
|
|
participantCount: number;
|
2023-07-20 17:55:50 +01:00
|
|
|
onLeave: (error?: Error) => void;
|
2022-09-09 02:04:53 -04:00
|
|
|
hideHeader: boolean;
|
2023-06-30 16:43:28 +01:00
|
|
|
otelGroupCallMembership?: OTelGroupCallMembership;
|
2023-08-29 12:44:30 +01:00
|
|
|
connState: ECConnectionState;
|
2023-09-08 15:39:10 -04:00
|
|
|
onShareClick: (() => void) | null;
|
2022-08-02 00:46:16 +02:00
|
|
|
}
|
2022-08-08 20:01:58 +02:00
|
|
|
|
2023-09-22 18:05:13 -04:00
|
|
|
export const InCallView: FC<InCallViewProps> = ({
|
2022-01-05 15:06:51 -08:00
|
|
|
client,
|
2023-09-08 15:39:10 -04:00
|
|
|
matrixInfo,
|
2023-08-16 18:41:27 +01:00
|
|
|
rtcSession,
|
2023-06-16 18:07:13 +02:00
|
|
|
livekitRoom,
|
2023-08-02 15:29:37 -04:00
|
|
|
muteStates,
|
2023-09-27 18:12:04 -04:00
|
|
|
participantCount,
|
2022-01-05 15:06:51 -08:00
|
|
|
onLeave,
|
2022-09-09 02:04:53 -04:00
|
|
|
hideHeader,
|
2023-03-16 14:41:55 +00:00
|
|
|
otelGroupCallMembership,
|
2023-08-29 12:44:30 +01:00
|
|
|
connState,
|
2023-09-08 15:39:10 -04:00
|
|
|
onShareClick,
|
2023-09-22 18:05:13 -04:00
|
|
|
}) => {
|
2022-10-10 09:19:10 -04:00
|
|
|
const { t } = useTranslation();
|
2022-02-16 11:17:33 -08:00
|
|
|
usePreventScroll();
|
2023-07-21 00:51:07 -04:00
|
|
|
useWakeLock();
|
2022-10-14 09:40:21 -04:00
|
|
|
|
2023-08-29 12:44:30 +01:00
|
|
|
useEffect(() => {
|
|
|
|
|
if (connState === ConnectionState.Disconnected) {
|
|
|
|
|
// annoyingly we don't get the disconnection reason this way,
|
|
|
|
|
// only by listening for the emitted event
|
|
|
|
|
onLeave(new Error("Disconnected from call server"));
|
|
|
|
|
}
|
|
|
|
|
}, [connState, onLeave]);
|
|
|
|
|
|
2022-09-14 19:05:05 -04:00
|
|
|
const containerRef1 = useRef<HTMLDivElement | null>(null);
|
|
|
|
|
const [containerRef2, bounds] = useMeasure({ polyfill: ResizeObserver });
|
2022-11-02 22:37:36 -04:00
|
|
|
const boundsValid = bounds.height > 0;
|
2022-09-14 19:05:05 -04:00
|
|
|
// Merge the refs so they can attach to the same element
|
2023-08-02 15:29:37 -04:00
|
|
|
const containerRef = useMergedRefs(containerRef1, containerRef2);
|
2023-06-02 14:49:11 +02:00
|
|
|
|
|
|
|
|
const screenSharingTracks = useTracks(
|
|
|
|
|
[{ source: Track.Source.ScreenShare, withPlaceholder: false }],
|
|
|
|
|
{
|
|
|
|
|
room: livekitRoom,
|
2023-10-11 10:42:04 -04:00
|
|
|
},
|
2023-06-02 14:49:11 +02:00
|
|
|
);
|
|
|
|
|
const { layout, setLayout } = useVideoGridLayout(
|
2023-10-11 10:42:04 -04:00
|
|
|
screenSharingTracks.length > 0,
|
2023-06-02 14:49:11 +02:00
|
|
|
);
|
2022-08-12 09:53:44 +02:00
|
|
|
|
2023-06-16 10:59:57 -04:00
|
|
|
const [showConnectionStats] = useShowConnectionStats();
|
2022-05-31 10:43:05 -04:00
|
|
|
|
2023-10-26 19:33:59 +02:00
|
|
|
const { hideScreensharing, showControls } = useUrlParams();
|
2022-10-14 16:17:50 +02:00
|
|
|
|
2023-08-02 15:29:37 -04:00
|
|
|
const { isScreenShareEnabled, localParticipant } = useLocalParticipant({
|
|
|
|
|
room: livekitRoom,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const toggleMicrophone = useCallback(
|
|
|
|
|
() => muteStates.audio.setEnabled?.((e) => !e),
|
2023-10-11 10:42:04 -04:00
|
|
|
[muteStates],
|
2023-08-02 15:29:37 -04:00
|
|
|
);
|
|
|
|
|
const toggleCamera = useCallback(
|
|
|
|
|
() => muteStates.video.setEnabled?.((e) => !e),
|
2023-10-11 10:42:04 -04:00
|
|
|
[muteStates],
|
2023-08-02 15:29:37 -04:00
|
|
|
);
|
2023-06-02 14:49:11 +02:00
|
|
|
|
2023-06-16 18:07:13 +02:00
|
|
|
// This function incorrectly assumes that there is a camera and microphone, which is not always the case.
|
|
|
|
|
// TODO: Make sure that this module is resilient when it comes to camera/microphone availability!
|
2023-01-13 11:52:40 +00:00
|
|
|
useCallViewKeyboardShortcuts(
|
2023-04-19 15:51:44 -04:00
|
|
|
containerRef1,
|
2023-06-02 14:49:11 +02:00
|
|
|
toggleMicrophone,
|
2023-06-02 21:29:22 +02:00
|
|
|
toggleCamera,
|
2023-10-11 10:42:04 -04:00
|
|
|
(muted) => muteStates.audio.setEnabled?.(!muted),
|
2023-01-12 17:31:19 +00:00
|
|
|
);
|
|
|
|
|
|
2023-07-20 17:55:50 +01:00
|
|
|
const onLeavePress = useCallback(() => {
|
2023-11-15 16:20:28 +00:00
|
|
|
// Disconnect from the room. We don't do this in onLeave because that's
|
|
|
|
|
// also called on an unintentional disconnect. Plus we don't have the
|
|
|
|
|
// livekit room in onLeave anyway.
|
2023-11-10 15:24:43 +00:00
|
|
|
livekitRoom.disconnect();
|
2023-07-20 17:55:50 +01:00
|
|
|
onLeave();
|
2023-11-10 15:24:43 +00:00
|
|
|
}, [livekitRoom, onLeave]);
|
2023-07-20 17:55:50 +01:00
|
|
|
|
2022-09-09 02:10:45 -04:00
|
|
|
useEffect(() => {
|
|
|
|
|
widget?.api.transport.send(
|
2023-09-08 15:39:10 -04:00
|
|
|
layout === "grid"
|
2022-09-09 02:10:45 -04:00
|
|
|
? ElementWidgetActions.TileLayout
|
|
|
|
|
: ElementWidgetActions.SpotlightLayout,
|
2023-10-11 10:42:04 -04:00
|
|
|
{},
|
2022-09-09 02:10:45 -04:00
|
|
|
);
|
|
|
|
|
}, [layout]);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (widget) {
|
2023-09-22 18:05:13 -04:00
|
|
|
const onTileLayout = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
2023-09-08 15:39:10 -04:00
|
|
|
setLayout("grid");
|
2023-09-22 18:05:13 -04:00
|
|
|
widget!.api.transport.reply(ev.detail, {});
|
2022-09-09 02:10:45 -04:00
|
|
|
};
|
2023-09-22 18:05:13 -04:00
|
|
|
const onSpotlightLayout = (ev: CustomEvent<IWidgetApiRequest>): void => {
|
2022-09-09 02:10:45 -04:00
|
|
|
setLayout("spotlight");
|
2023-09-22 18:05:13 -04:00
|
|
|
widget!.api.transport.reply(ev.detail, {});
|
2022-09-09 02:10:45 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
widget.lazyActions.on(ElementWidgetActions.TileLayout, onTileLayout);
|
|
|
|
|
widget.lazyActions.on(
|
|
|
|
|
ElementWidgetActions.SpotlightLayout,
|
2023-10-11 10:42:04 -04:00
|
|
|
onSpotlightLayout,
|
2022-09-09 02:10:45 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
return () => {
|
2023-07-04 11:26:54 +01:00
|
|
|
widget!.lazyActions.off(ElementWidgetActions.TileLayout, onTileLayout);
|
|
|
|
|
widget!.lazyActions.off(
|
2022-09-09 02:10:45 -04:00
|
|
|
ElementWidgetActions.SpotlightLayout,
|
2023-10-11 10:42:04 -04:00
|
|
|
onSpotlightLayout,
|
2022-09-09 02:10:45 -04:00
|
|
|
);
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
}, [setLayout]);
|
|
|
|
|
|
2023-09-08 15:39:10 -04:00
|
|
|
const mobile = boundsValid && bounds.width <= 660;
|
|
|
|
|
const reducedControls = boundsValid && bounds.width <= 340;
|
2022-12-13 18:20:13 -05:00
|
|
|
const noControls = reducedControls && bounds.height <= 400;
|
|
|
|
|
|
2023-09-04 12:46:06 +01:00
|
|
|
const items = useParticipantTiles(livekitRoom, rtcSession.room, connState);
|
2023-06-26 13:48:41 -04:00
|
|
|
const { fullscreenItem, toggleFullscreen, exitFullscreen } =
|
|
|
|
|
useFullscreen(items);
|
2023-06-06 13:16:36 +02:00
|
|
|
|
2023-06-26 13:48:41 -04:00
|
|
|
// The maximised participant: either the participant that the user has
|
|
|
|
|
// manually put in fullscreen, or the focused (active) participant if the
|
2022-09-14 19:05:05 -04:00
|
|
|
// window is too small to show everyone
|
|
|
|
|
const maximisedParticipant = useMemo(
|
|
|
|
|
() =>
|
2023-06-26 13:48:41 -04:00
|
|
|
fullscreenItem ??
|
|
|
|
|
(noControls
|
|
|
|
|
? items.find((item) => item.isSpeaker) ?? items.at(0) ?? null
|
|
|
|
|
: null),
|
2023-10-11 10:42:04 -04:00
|
|
|
[fullscreenItem, noControls, items],
|
2022-09-14 19:05:05 -04:00
|
|
|
);
|
2022-01-05 15:06:51 -08:00
|
|
|
|
2023-06-13 12:47:45 -04:00
|
|
|
const Grid =
|
2023-09-08 15:39:10 -04:00
|
|
|
items.length > 12 && layout === "grid" ? NewVideoGrid : VideoGrid;
|
2023-06-14 17:12:03 +02:00
|
|
|
|
2022-10-31 11:46:17 -04:00
|
|
|
const prefersReducedMotion = usePrefersReducedMotion();
|
|
|
|
|
|
2023-06-27 12:19:06 -04:00
|
|
|
// This state is lifted out of NewVideoGrid so that layout states can be
|
|
|
|
|
// restored after a layout switch or upon exiting fullscreen
|
|
|
|
|
const layoutStates = useLayoutStates();
|
|
|
|
|
|
2022-09-14 19:05:05 -04:00
|
|
|
const renderContent = (): JSX.Element => {
|
2022-08-07 19:09:45 +02:00
|
|
|
if (items.length === 0) {
|
|
|
|
|
return (
|
|
|
|
|
<div className={styles.centerMessage}>
|
```
move "{{count, number}}_one" "participant_count_one"
move "{{count, number}}_other" "participant_count_other"
move "{{count}} stars_one" "star_rating_input_label_one"
move "{{count}} stars_other" "star_rating_input_label_other"
move "{{displayName}} is presenting" "video_tile.presenter_label"
move "{{displayName}}, your call has ended." "call_ended_view.headline"
move "<0></0><1></1>You may withdraw consent by unchecking this box. If you are currently in a call, this setting will take effect at the end of the call." "settings.opt_in_description"
move "<0>Already have an account?</0><1><0>Log in</0> Or <2>Access as a guest</2></1>" "register_auth_links"
move "<0>Create an account</0> Or <2>Access as a guest</2>" "login_auth_links"
move "<0>Oops, something's gone wrong.</0>" "full_screen_view_h1"
move "<0>Submitting debug logs will help us track down the problem.</0>" "full_screen_view_description"
move "<0>Thanks for your feedback!</0>" "call_ended_view.feedback_done"
move "<0>We'd love to hear your feedback so we can improve your experience.</0>" "call_ended_view.feedback_prompt"
move "<0>Why not finish by setting up a password to keep your account?</0><1>You'll be able to keep your name and set an avatar for use on future calls</1>" "call_ended_view.create_account_prompt"
move "Another user on this call is having an issue. In order to better diagnose these issues we'd like to collect a debug log." "rageshake_request_modal.body"
move "Back to recents" "lobby.leave_button"
move "By participating in this beta, you consent to the collection of anonymous data, which we use to improve the product. You can find more information about which data we track in our <2>Privacy Policy</2> and our <5>Cookie Policy</5>." "analytics_notice"
move "Call not found" "group_call_loader_failed_heading"
move "Calls are now end-to-end encrypted and need to be created from the home page. This helps make sure everyone's using the same encryption key." "group_call_loader_failed_text"
move "Confirm password" "register_confirm_password_label"
move "Connectivity to the server has been lost." "disconnected_banner"
move "Continue in browser" "app_selection_modal.continue_in_browser"
move "Create account" "call_ended_view.create_account_button"
move "Debug log request" "rageshake_request_modal.title"
move "Developer" "settings.developer_tab_title"
move "Developer Settings" "settings.developer_settings_label"
move "Element Call Home" "header_label"
move "End call" "hangup_button_label"
move "Full screen" "fullscreen_button_label"
move "Exit full screen" "exit_fullscreen_button_label"
move "Expose developer settings in the settings window." "settings.developer_settings_label_description"
move "Feedback" "settings.feedback_tab_title"
move "Grid" "layout_grid_label"
move "Spotlight" "layout_spotlight_label"
move "How did it go?" "call_ended_view.survey_prompt"
move "If you are experiencing issues or simply would like to provide some feedback, please send us a short description below." "settings.feedback_tab_body"
move "Include debug logs" "settings.feedback_tab_send_logs_label"
move "Invite to this call" "invite_modal.title"
move "Join call" "lobby.join_button"
move "Join call now" "room_auth_view_join_button"
move "Join existing call?" "join_existing_call_modal.title"
move "Link copied to clipboard" "invite_modal.link_copied_toast"
move "Local volume" "local_volume_label"
move "Logging in…" "logging_in"
move "Login" "login_title"
move "Login to your account" "unauthenticated_view_login_button"
move "Microphone off" "microphone_off"
move "Microphone on" "microphone_on"
move "More" "settings.more_tab_title"
move "Mute microphone" "mute_microphone_button_label"
move "Name of call" "call_name"
move "Not now, return to home screen" "call_ended_view.not_now_button"
move "Open in the app" "app_selection_modal.open_in_app"
move "Not registered yet? <2>Create an account</2>" "unauthenticated_view_body"
move "Participants" "header_participants_label"
move "Passwords must match" "register.passwords_must_match"
move "Ready to join?" "app_selection_modal.text"
move "Recaptcha dismissed" "recaptcha_dismissed"
move "Recaptcha not loaded" "recaptcha_not_loaded"
move "Reconnect" "call_ended_view.reconnect_button"
move "Registering…" "register.registering"
move "Retry sending logs" "rageshake_button_error_caption"
move "Return to home screen" "return_home_button"
move "Select an option" "select_input_unset_button"
move "Select app" "app_selection_modal.title"
move "Send debug logs" "rageshake_send_logs"
move "Sending debug logs…" "rageshake_sending_logs"
move "Sending…" "rageshake_sending"
move "Share screen" "screenshare_button_label"
move "Sharing screen" "stop_screenshare_button_label"
move "Show connection stats" "settings.show_connection_stats_label"
move "Speaker" "settings.speaker_device_selection_label"
move "Start new call" "start_new_call"
move "Start video" "start_video_button_label"
move "Stop video" "stop_video_button_label"
move "Submit feedback" "settings.feedback_tab_h4"
move "Submitting…" "submitting"
move "Thanks, we received your feedback!" "settings.feedback_tab_thank_you"
move "Thanks!" "rageshake_sent"
move "This application has been opened in another tab." "application_opened_another_tab"
move "This call already exists, would you like to join?" "join_existing_call_modal.text"
move "Unmute microphone" "unmute_microphone_button_label"
move "Version: {{version}}" "version"
move "Waiting for other participants…" "waiting_for_participants"
move "Yes, join call" "join_existing_call_modal.join_button"
move "You" "video_tile.sfu_participant_local"
move "You were disconnected from the call" "call_ended_view.body"
move "Your feedback" "settings.feedback_tab_description_label"
move "Your web browser does not support media end-to-end encryption. Supported Browsers are Chrome, Safari, Firefox >=117" "browser_media_e2ee_unsupported"
move "By clicking \"Go\", you agree to our <2>End User Licensing Agreement (EULA)</2>" "unauthenticated_view_eula_caption"
move "By clicking \"Join call now\", you agree to our <2>End User Licensing Agreement (EULA)</2>" "room_auth_view_eula_caption"
move "This site is protected by ReCAPTCHA and the Google <2>Privacy Policy</2> and <6>Terms of Service</6> apply.<9></9>By clicking \"Register\", you agree to our <12>End User Licensing Agreement (EULA)</12>" "register.recaptcha_caption"
```
2023-11-20 13:00:43 +00:00
|
|
|
<p>{t("waiting_for_participants")}</p>
|
2022-08-07 19:09:45 +02:00
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|
2022-09-14 19:05:05 -04:00
|
|
|
if (maximisedParticipant) {
|
2022-08-07 19:09:45 +02:00
|
|
|
return (
|
2023-06-12 18:06:18 -04:00
|
|
|
<VideoTile
|
2023-06-26 13:48:41 -04:00
|
|
|
maximised={true}
|
|
|
|
|
fullscreen={maximisedParticipant === fullscreenItem}
|
|
|
|
|
onToggleFullscreen={toggleFullscreen}
|
2023-02-13 21:57:57 -05:00
|
|
|
targetHeight={bounds.height}
|
|
|
|
|
targetWidth={bounds.width}
|
2022-09-14 19:05:05 -04:00
|
|
|
key={maximisedParticipant.id}
|
2023-06-13 12:33:46 -04:00
|
|
|
data={maximisedParticipant.data}
|
2023-06-16 10:35:29 -04:00
|
|
|
showSpeakingIndicator={false}
|
2023-06-16 10:59:57 -04:00
|
|
|
showConnectionStats={showConnectionStats}
|
2023-11-20 19:04:53 -05:00
|
|
|
matrixInfo={matrixInfo}
|
2022-08-07 19:09:45 +02:00
|
|
|
/>
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return (
|
2023-02-13 20:36:42 -05:00
|
|
|
<Grid
|
2022-10-31 11:46:17 -04:00
|
|
|
items={items}
|
|
|
|
|
layout={layout}
|
|
|
|
|
disableAnimations={prefersReducedMotion || isSafari}
|
2023-06-27 12:19:06 -04:00
|
|
|
layoutStates={layoutStates}
|
2022-10-31 11:46:17 -04:00
|
|
|
>
|
2023-09-22 18:05:13 -04:00
|
|
|
{(props): ReactNode => (
|
2023-06-16 10:35:29 -04:00
|
|
|
<VideoTile
|
2023-06-26 13:48:41 -04:00
|
|
|
maximised={false}
|
|
|
|
|
fullscreen={false}
|
|
|
|
|
onToggleFullscreen={toggleFullscreen}
|
2023-06-16 10:35:29 -04:00
|
|
|
showSpeakingIndicator={items.length > 2}
|
2023-06-16 10:59:57 -04:00
|
|
|
showConnectionStats={showConnectionStats}
|
2023-11-20 19:04:53 -05:00
|
|
|
matrixInfo={matrixInfo}
|
2023-06-16 10:35:29 -04:00
|
|
|
{...props}
|
|
|
|
|
ref={props.ref as Ref<HTMLDivElement>}
|
|
|
|
|
/>
|
2022-08-07 19:09:45 +02:00
|
|
|
)}
|
2023-02-13 20:36:42 -05:00
|
|
|
</Grid>
|
2022-08-07 19:09:45 +02:00
|
|
|
);
|
2022-09-14 19:05:05 -04:00
|
|
|
};
|
2022-08-07 19:09:45 +02:00
|
|
|
|
2023-09-17 14:35:35 -04:00
|
|
|
const rageshakeRequestModalProps = useRageshakeRequestModal(
|
2023-10-11 10:42:04 -04:00
|
|
|
rtcSession.room.roomId,
|
2023-09-17 14:35:35 -04:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
const [settingsModalOpen, setSettingsModalOpen] = useState(false);
|
|
|
|
|
|
|
|
|
|
const openSettings = useCallback(
|
|
|
|
|
() => setSettingsModalOpen(true),
|
2023-10-11 10:42:04 -04:00
|
|
|
[setSettingsModalOpen],
|
2023-09-17 14:35:35 -04:00
|
|
|
);
|
|
|
|
|
const closeSettings = useCallback(
|
|
|
|
|
() => setSettingsModalOpen(false),
|
2023-10-11 10:42:04 -04:00
|
|
|
[setSettingsModalOpen],
|
2023-09-17 14:35:35 -04:00
|
|
|
);
|
2023-05-05 11:44:35 +02:00
|
|
|
|
2023-06-26 13:48:41 -04:00
|
|
|
const toggleScreensharing = useCallback(async () => {
|
|
|
|
|
exitFullscreen();
|
2023-07-10 11:27:06 +02:00
|
|
|
await localParticipant.setScreenShareEnabled(!isScreenShareEnabled, {
|
|
|
|
|
audio: true,
|
|
|
|
|
selfBrowserSurface: "include",
|
|
|
|
|
surfaceSwitching: "include",
|
|
|
|
|
systemAudio: "include",
|
|
|
|
|
});
|
2023-06-26 13:48:41 -04:00
|
|
|
}, [localParticipant, isScreenShareEnabled, exitFullscreen]);
|
|
|
|
|
|
2022-12-13 18:20:13 -05:00
|
|
|
let footer: JSX.Element | null;
|
|
|
|
|
|
|
|
|
|
if (noControls) {
|
|
|
|
|
footer = null;
|
|
|
|
|
} else {
|
2023-03-02 18:48:32 +01:00
|
|
|
const buttons: JSX.Element[] = [];
|
|
|
|
|
|
|
|
|
|
buttons.push(
|
2023-08-30 21:58:29 -04:00
|
|
|
<MicButton
|
|
|
|
|
key="1"
|
|
|
|
|
muted={!muteStates.audio.enabled}
|
|
|
|
|
onPress={toggleMicrophone}
|
|
|
|
|
disabled={muteStates.audio.setEnabled === null}
|
|
|
|
|
data-testid="incall_mute"
|
2023-09-25 10:39:18 -04:00
|
|
|
/>,
|
|
|
|
|
<VideoButton
|
|
|
|
|
key="2"
|
|
|
|
|
muted={!muteStates.video.enabled}
|
|
|
|
|
onPress={toggleCamera}
|
|
|
|
|
disabled={muteStates.video.setEnabled === null}
|
|
|
|
|
data-testid="incall_videomute"
|
2023-10-11 10:42:04 -04:00
|
|
|
/>,
|
2023-03-02 18:48:32 +01:00
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if (!reducedControls) {
|
2023-10-13 11:02:20 +01:00
|
|
|
if (canScreenshare && !hideScreensharing) {
|
2023-03-02 18:48:32 +01:00
|
|
|
buttons.push(
|
2022-12-13 18:20:13 -05:00
|
|
|
<ScreenshareButton
|
2023-03-02 18:48:32 +01:00
|
|
|
key="3"
|
2023-06-02 14:49:11 +02:00
|
|
|
enabled={isScreenShareEnabled}
|
2022-12-13 18:20:13 -05:00
|
|
|
onPress={toggleScreensharing}
|
2023-04-25 16:42:27 +01:00
|
|
|
data-testid="incall_screenshare"
|
2023-10-11 10:42:04 -04:00
|
|
|
/>,
|
2023-03-02 18:48:32 +01:00
|
|
|
);
|
|
|
|
|
}
|
2023-06-26 13:48:41 -04:00
|
|
|
buttons.push(<SettingsButton key="4" onPress={openSettings} />);
|
2023-03-02 18:48:32 +01:00
|
|
|
}
|
|
|
|
|
|
2023-05-12 16:25:24 +01:00
|
|
|
buttons.push(
|
2023-10-11 10:42:04 -04:00
|
|
|
<HangupButton
|
|
|
|
|
key="6"
|
|
|
|
|
onPress={onLeavePress}
|
|
|
|
|
data-testid="incall_leave"
|
|
|
|
|
/>,
|
2022-12-13 18:20:13 -05:00
|
|
|
);
|
2023-09-08 15:39:10 -04:00
|
|
|
footer = (
|
2023-10-26 19:33:59 +02:00
|
|
|
<div
|
|
|
|
|
className={classNames(
|
|
|
|
|
showControls
|
2023-10-31 16:04:22 +01:00
|
|
|
? styles.footer
|
|
|
|
|
: hideHeader
|
|
|
|
|
? [styles.footer, styles.footerHidden]
|
|
|
|
|
: [styles.footer, styles.footerThin],
|
2023-10-26 19:33:59 +02:00
|
|
|
)}
|
|
|
|
|
>
|
2023-09-08 15:39:10 -04:00
|
|
|
{!mobile && !hideHeader && (
|
|
|
|
|
<div className={styles.logo}>
|
2023-09-13 16:17:37 -04:00
|
|
|
<LogoMark width={24} height={24} aria-hidden />
|
|
|
|
|
<LogoType
|
|
|
|
|
width={80}
|
|
|
|
|
height={11}
|
|
|
|
|
aria-label={import.meta.env.VITE_PRODUCT_NAME || "Element Call"}
|
|
|
|
|
/>
|
2023-09-08 15:39:10 -04:00
|
|
|
</div>
|
|
|
|
|
)}
|
2023-10-31 13:47:24 +01:00
|
|
|
{showControls && <div className={styles.buttons}>{buttons}</div>}
|
|
|
|
|
{!mobile && !hideHeader && showControls && (
|
2023-09-08 15:39:10 -04:00
|
|
|
<LayoutToggle
|
|
|
|
|
className={styles.layout}
|
|
|
|
|
layout={layout}
|
|
|
|
|
setLayout={setLayout}
|
|
|
|
|
/>
|
|
|
|
|
)}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
2022-12-13 18:20:13 -05:00
|
|
|
}
|
|
|
|
|
|
2022-01-05 15:06:51 -08:00
|
|
|
return (
|
2023-09-08 15:39:10 -04:00
|
|
|
<div className={styles.inRoom} ref={containerRef}>
|
2023-06-26 13:48:41 -04:00
|
|
|
{!hideHeader && maximisedParticipant === null && (
|
2022-08-07 19:09:45 +02:00
|
|
|
<Header>
|
|
|
|
|
<LeftNav>
|
2023-09-08 15:39:10 -04:00
|
|
|
<RoomHeaderInfo
|
|
|
|
|
id={matrixInfo.roomId}
|
|
|
|
|
name={matrixInfo.roomName}
|
|
|
|
|
avatarUrl={matrixInfo.roomAvatar}
|
|
|
|
|
encrypted={matrixInfo.roomEncrypted}
|
2023-09-27 18:12:04 -04:00
|
|
|
participantCount={participantCount}
|
2022-01-07 16:20:55 -08:00
|
|
|
/>
|
2022-08-07 19:09:45 +02:00
|
|
|
</LeftNav>
|
|
|
|
|
<RightNav>
|
2023-10-31 13:47:24 +01:00
|
|
|
{!reducedControls && showControls && onShareClick !== null && (
|
2023-09-27 15:17:04 -04:00
|
|
|
<InviteButton onClick={onShareClick} />
|
2023-05-05 11:44:35 +02:00
|
|
|
)}
|
2022-08-07 19:09:45 +02:00
|
|
|
</RightNav>
|
|
|
|
|
</Header>
|
2022-01-05 15:06:51 -08:00
|
|
|
)}
|
2023-04-19 14:43:37 -04:00
|
|
|
<div className={styles.controlsOverlay}>
|
2023-06-26 13:48:41 -04:00
|
|
|
<RoomAudioRenderer />
|
2023-04-19 14:43:37 -04:00
|
|
|
{renderContent()}
|
|
|
|
|
{footer}
|
|
|
|
|
</div>
|
2023-09-17 14:35:35 -04:00
|
|
|
{!noControls && <RageshakeRequestModal {...rageshakeRequestModalProps} />}
|
|
|
|
|
<SettingsModal
|
|
|
|
|
client={client}
|
|
|
|
|
roomId={rtcSession.room.roomId}
|
|
|
|
|
open={settingsModalOpen}
|
|
|
|
|
onDismiss={closeSettings}
|
|
|
|
|
/>
|
2022-01-05 15:06:51 -08:00
|
|
|
</div>
|
|
|
|
|
);
|
2023-09-22 18:05:13 -04:00
|
|
|
};
|
2023-06-05 20:51:01 +02:00
|
|
|
|
2023-08-25 13:19:23 +01:00
|
|
|
function findMatrixMember(
|
|
|
|
|
room: MatrixRoom,
|
2023-10-11 10:42:04 -04:00
|
|
|
id: string,
|
2023-08-25 13:19:23 +01:00
|
|
|
): RoomMember | undefined {
|
2023-08-29 12:44:30 +01:00
|
|
|
if (!id) return undefined;
|
|
|
|
|
|
2023-08-25 13:19:23 +01:00
|
|
|
const parts = id.split(":");
|
2023-09-06 09:12:04 +01:00
|
|
|
// must be at least 3 parts because we know the first part is a userId which must necessarily contain a colon
|
|
|
|
|
if (parts.length < 3) {
|
2023-08-25 13:19:23 +01:00
|
|
|
logger.warn(
|
2023-10-11 10:42:04 -04:00
|
|
|
"Livekit participants ID doesn't look like a userId:deviceId combination",
|
2023-08-25 13:19:23 +01:00
|
|
|
);
|
|
|
|
|
return undefined;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
parts.pop();
|
|
|
|
|
const userId = parts.join(":");
|
|
|
|
|
|
|
|
|
|
return room.getMember(userId) ?? undefined;
|
|
|
|
|
}
|
|
|
|
|
|
2023-06-05 20:51:01 +02:00
|
|
|
function useParticipantTiles(
|
|
|
|
|
livekitRoom: Room,
|
2023-09-04 12:46:06 +01:00
|
|
|
matrixRoom: MatrixRoom,
|
2023-10-11 10:42:04 -04:00
|
|
|
connState: ECConnectionState,
|
2023-06-05 20:51:01 +02:00
|
|
|
): TileDescriptor<ItemData>[] {
|
2023-09-04 12:46:06 +01:00
|
|
|
const previousTiles = useRef<TileDescriptor<ItemData>[]>([]);
|
|
|
|
|
|
2023-06-05 20:51:01 +02:00
|
|
|
const sfuParticipants = useParticipants({
|
|
|
|
|
room: livekitRoom,
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
const items = useMemo(() => {
|
2023-06-18 14:26:27 -04:00
|
|
|
let allGhosts = true;
|
2023-06-14 22:14:06 +02:00
|
|
|
|
2023-06-16 18:57:47 +02:00
|
|
|
const speakActiveTime = new Date();
|
|
|
|
|
speakActiveTime.setSeconds(speakActiveTime.getSeconds() - 10);
|
2023-06-12 19:58:06 +02:00
|
|
|
// Iterate over SFU participants (those who actually are present from the SFU perspective) and create tiles for them.
|
|
|
|
|
const tiles: TileDescriptor<ItemData>[] = sfuParticipants.flatMap(
|
|
|
|
|
(sfuParticipant) => {
|
2023-11-20 13:33:45 -05:00
|
|
|
const spokeRecently =
|
|
|
|
|
sfuParticipant.lastSpokeAt !== undefined &&
|
|
|
|
|
sfuParticipant.lastSpokeAt > speakActiveTime;
|
2023-06-16 18:57:47 +02:00
|
|
|
|
2023-06-12 19:58:06 +02:00
|
|
|
const id = sfuParticipant.identity;
|
2023-08-25 13:19:23 +01:00
|
|
|
const member = findMatrixMember(matrixRoom, id);
|
|
|
|
|
// We always start with a local participant wit the empty string as their ID before we're
|
|
|
|
|
// connected, this is fine and we'll be in "all ghosts" mode.
|
|
|
|
|
if (id !== "" && member === undefined) {
|
2023-08-23 15:04:41 +01:00
|
|
|
logger.warn(
|
2023-10-11 10:42:04 -04:00
|
|
|
`Ruh, roh! No matrix member found for SFU participant '${id}': creating g-g-g-ghost!`,
|
2023-08-23 15:04:41 +01:00
|
|
|
);
|
|
|
|
|
}
|
2023-06-18 14:26:27 -04:00
|
|
|
allGhosts &&= member === undefined;
|
|
|
|
|
|
2023-06-06 13:16:36 +02:00
|
|
|
const userMediaTile = {
|
2023-06-05 20:51:01 +02:00
|
|
|
id,
|
2023-06-16 18:57:47 +02:00
|
|
|
focused: false,
|
|
|
|
|
isPresenter: sfuParticipant.isScreenShareEnabled,
|
|
|
|
|
isSpeaker:
|
2023-11-20 13:33:45 -05:00
|
|
|
(sfuParticipant.isSpeaking || spokeRecently) &&
|
2023-06-16 18:57:47 +02:00
|
|
|
!sfuParticipant.isLocal,
|
|
|
|
|
hasVideo: sfuParticipant.isCameraEnabled,
|
2023-06-06 13:16:36 +02:00
|
|
|
local: sfuParticipant.isLocal,
|
2023-06-18 01:13:45 -04:00
|
|
|
largeBaseSize: false,
|
2023-06-05 20:51:01 +02:00
|
|
|
data: {
|
2023-06-26 13:48:41 -04:00
|
|
|
id,
|
2023-06-05 20:51:01 +02:00
|
|
|
member,
|
|
|
|
|
sfuParticipant,
|
2023-06-06 13:16:36 +02:00
|
|
|
content: TileContent.UserMedia,
|
2023-06-05 20:51:01 +02:00
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
|
2023-06-06 13:16:36 +02:00
|
|
|
// If there is a screen sharing enabled for this participant, create a tile for it as well.
|
2023-06-12 19:58:06 +02:00
|
|
|
let screenShareTile: TileDescriptor<ItemData> | undefined;
|
2023-06-06 13:16:36 +02:00
|
|
|
if (sfuParticipant.isScreenShareEnabled) {
|
2023-06-26 13:48:41 -04:00
|
|
|
const screenShareId = `${id}:screen-share`;
|
2023-06-12 19:58:06 +02:00
|
|
|
screenShareTile = {
|
2023-06-06 13:16:36 +02:00
|
|
|
...userMediaTile,
|
2023-06-26 13:48:41 -04:00
|
|
|
id: screenShareId,
|
2023-06-06 13:16:36 +02:00
|
|
|
focused: true,
|
2023-06-18 01:13:45 -04:00
|
|
|
largeBaseSize: true,
|
|
|
|
|
placeNear: id,
|
2023-06-06 13:16:36 +02:00
|
|
|
data: {
|
|
|
|
|
...userMediaTile.data,
|
2023-06-26 13:48:41 -04:00
|
|
|
id: screenShareId,
|
2023-06-06 13:16:36 +02:00
|
|
|
content: TileContent.ScreenShare,
|
|
|
|
|
},
|
|
|
|
|
};
|
|
|
|
|
}
|
2023-06-12 19:58:06 +02:00
|
|
|
|
|
|
|
|
return screenShareTile
|
|
|
|
|
? [userMediaTile, screenShareTile]
|
|
|
|
|
: [userMediaTile];
|
2023-10-11 10:42:04 -04:00
|
|
|
},
|
2023-06-12 19:58:06 +02:00
|
|
|
);
|
2023-06-05 20:51:01 +02:00
|
|
|
|
|
|
|
|
PosthogAnalytics.instance.eventCallEnded.cacheParticipantCountChanged(
|
2023-10-11 10:42:04 -04:00
|
|
|
tiles.length,
|
2023-06-05 20:51:01 +02:00
|
|
|
);
|
|
|
|
|
|
2023-06-18 14:26:27 -04:00
|
|
|
// If every item is a ghost, that probably means we're still connecting and
|
|
|
|
|
// shouldn't bother showing anything yet
|
|
|
|
|
return allGhosts ? [] : tiles;
|
2023-08-25 13:19:23 +01:00
|
|
|
}, [matrixRoom, sfuParticipants]);
|
2023-06-05 20:51:01 +02:00
|
|
|
|
2023-09-04 12:46:06 +01:00
|
|
|
// We carry over old tiles from the previous focus for some time after a focus switch
|
|
|
|
|
// so that the video tiles don't all disappear and reappear.
|
2023-09-13 15:03:54 +01:00
|
|
|
// This is set to true when the state transitions to Switching Focus and remains
|
|
|
|
|
// true for a short time after it changes (ie. connState is only switching focus for
|
|
|
|
|
// the time it takes us to reconnect to the conference).
|
|
|
|
|
// If there are still members that haven't reconnected after that time, they'll just
|
|
|
|
|
// appear to disconnect and will reappear once they reconnect.
|
2023-09-04 12:46:06 +01:00
|
|
|
const [isSwitchingFocus, setIsSwitchingFocus] = useState(false);
|
|
|
|
|
|
|
|
|
|
useEffect(() => {
|
|
|
|
|
if (connState === ECAddonConnectionState.ECSwitchingFocus) {
|
|
|
|
|
setIsSwitchingFocus(true);
|
|
|
|
|
} else if (isSwitchingFocus) {
|
|
|
|
|
setTimeout(() => {
|
|
|
|
|
setIsSwitchingFocus(false);
|
|
|
|
|
}, POST_FOCUS_PARTICIPANT_UPDATE_DELAY_MS);
|
|
|
|
|
}
|
|
|
|
|
}, [connState, setIsSwitchingFocus, isSwitchingFocus]);
|
|
|
|
|
|
|
|
|
|
if (
|
|
|
|
|
connState === ECAddonConnectionState.ECSwitchingFocus ||
|
|
|
|
|
isSwitchingFocus
|
|
|
|
|
) {
|
|
|
|
|
logger.debug("Switching focus: injecting previous tiles");
|
|
|
|
|
|
|
|
|
|
// inject the previous tile for members that haven't rejoined yet
|
|
|
|
|
const newItems = items.slice(0);
|
|
|
|
|
const rejoined = new Set(newItems.map((p) => p.id));
|
|
|
|
|
|
|
|
|
|
for (const prevTile of previousTiles.current) {
|
|
|
|
|
if (!rejoined.has(prevTile.id)) {
|
|
|
|
|
newItems.push(prevTile);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return newItems;
|
2023-09-13 14:32:21 +01:00
|
|
|
} else {
|
2023-09-13 15:03:54 +01:00
|
|
|
previousTiles.current = items;
|
|
|
|
|
return items;
|
|
|
|
|
}
|
2023-06-05 20:51:01 +02:00
|
|
|
}
|