2022-06-09 09:19:52 -04:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2022-06-09 09:19:52 -04:00
|
|
|
Copyright 2022 The Matrix.org Foundation C.I.C.
|
|
|
|
|
|
2025-01-06 11:18:54 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-09 14:57:16 +01:00
|
|
|
Please see LICENSE files in the repository root for full details.
|
2022-06-09 09:19:52 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React, { FC } from "react";
|
|
|
|
|
|
2022-08-30 15:13:39 -04:00
|
|
|
import type { Call } from "../../../models/Call";
|
2022-09-30 15:26:08 -04:00
|
|
|
import { _t } from "../../../languageHandler";
|
2022-11-28 16:37:32 -05:00
|
|
|
import { useConnectionState, useParticipantCount } from "../../../hooks/useCall";
|
2022-08-30 15:13:39 -04:00
|
|
|
import { ConnectionState } from "../../../models/Call";
|
2022-09-30 15:26:08 -04:00
|
|
|
import { LiveContentSummary, LiveContentType } from "./LiveContentSummary";
|
2022-06-09 09:19:52 -04:00
|
|
|
|
2022-08-30 15:13:39 -04:00
|
|
|
interface Props {
|
|
|
|
|
call: Call;
|
2022-06-09 09:19:52 -04:00
|
|
|
}
|
|
|
|
|
|
2022-08-30 15:13:39 -04:00
|
|
|
export const RoomTileCallSummary: FC<Props> = ({ call }) => {
|
2022-09-30 15:26:08 -04:00
|
|
|
let text: string;
|
2022-06-09 09:19:52 -04:00
|
|
|
let active: boolean;
|
|
|
|
|
|
2022-11-28 16:37:32 -05:00
|
|
|
switch (useConnectionState(call)) {
|
2022-06-09 09:19:52 -04:00
|
|
|
case ConnectionState.Disconnected:
|
2023-08-22 18:47:33 +01:00
|
|
|
text = _t("common|video");
|
2022-06-09 09:19:52 -04:00
|
|
|
active = false;
|
|
|
|
|
break;
|
2024-01-29 17:06:12 +01:00
|
|
|
case ConnectionState.WidgetLoading:
|
|
|
|
|
text = _t("common|loading");
|
|
|
|
|
active = false;
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionState.Lobby:
|
|
|
|
|
text = _t("common|lobby");
|
|
|
|
|
active = false;
|
|
|
|
|
break;
|
2022-06-09 09:19:52 -04:00
|
|
|
case ConnectionState.Connecting:
|
2023-09-27 17:15:22 +01:00
|
|
|
text = _t("room|joining");
|
2022-06-09 09:19:52 -04:00
|
|
|
active = true;
|
|
|
|
|
break;
|
|
|
|
|
case ConnectionState.Connected:
|
2022-08-30 15:13:39 -04:00
|
|
|
case ConnectionState.Disconnecting:
|
2023-09-29 08:49:26 +01:00
|
|
|
text = _t("common|joined");
|
2022-06-09 09:19:52 -04:00
|
|
|
active = true;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-30 15:26:08 -04:00
|
|
|
return (
|
|
|
|
|
<LiveContentSummary
|
|
|
|
|
type={LiveContentType.Video}
|
|
|
|
|
text={text}
|
|
|
|
|
active={active}
|
2022-11-28 16:37:32 -05:00
|
|
|
participantCount={useParticipantCount(call)}
|
2022-09-30 15:26:08 -04:00
|
|
|
/>
|
|
|
|
|
);
|
2022-06-09 09:19:52 -04:00
|
|
|
};
|