2022-09-30 15:26:08 -04:00
|
|
|
/*
|
2024-09-09 14:57:16 +01:00
|
|
|
Copyright 2024 New Vector Ltd.
|
2022-09-30 15:26:08 -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-09-30 15:26:08 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import React, { FC } from "react";
|
|
|
|
|
import classNames from "classnames";
|
|
|
|
|
|
|
|
|
|
import { _t } from "../../../languageHandler";
|
2022-10-06 16:27:12 +02:00
|
|
|
import { Call } from "../../../models/Call";
|
2022-11-28 16:37:32 -05:00
|
|
|
import { useParticipantCount } from "../../../hooks/useCall";
|
2022-09-30 15:26:08 -04:00
|
|
|
|
|
|
|
|
export enum LiveContentType {
|
|
|
|
|
Video,
|
|
|
|
|
// More coming soon
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
interface Props {
|
|
|
|
|
type: LiveContentType;
|
|
|
|
|
text: string;
|
|
|
|
|
active: boolean;
|
|
|
|
|
participantCount: number;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Summary line used to call out live, interactive content such as calls.
|
|
|
|
|
*/
|
|
|
|
|
export const LiveContentSummary: FC<Props> = ({ type, text, active, participantCount }) => (
|
|
|
|
|
<span className="mx_LiveContentSummary">
|
|
|
|
|
<span
|
|
|
|
|
className={classNames("mx_LiveContentSummary_text", {
|
|
|
|
|
mx_LiveContentSummary_text_video: type === LiveContentType.Video,
|
|
|
|
|
mx_LiveContentSummary_text_active: active,
|
|
|
|
|
})}
|
|
|
|
|
>
|
|
|
|
|
{text}
|
|
|
|
|
</span>
|
|
|
|
|
{participantCount > 0 && (
|
|
|
|
|
<>
|
|
|
|
|
{" • "}
|
|
|
|
|
<span
|
|
|
|
|
className="mx_LiveContentSummary_participants"
|
2024-01-29 17:06:12 +01:00
|
|
|
aria-label={_t("voip|n_people_joined", { count: participantCount })}
|
2022-09-30 15:26:08 -04:00
|
|
|
>
|
|
|
|
|
{participantCount}
|
|
|
|
|
</span>
|
|
|
|
|
</>
|
|
|
|
|
)}
|
|
|
|
|
</span>
|
|
|
|
|
);
|
2022-10-06 16:27:12 +02:00
|
|
|
|
|
|
|
|
interface LiveContentSummaryWithCallProps {
|
|
|
|
|
call: Call;
|
|
|
|
|
}
|
|
|
|
|
|
2022-11-28 16:37:32 -05:00
|
|
|
export const LiveContentSummaryWithCall: FC<LiveContentSummaryWithCallProps> = ({ call }) => (
|
|
|
|
|
<LiveContentSummary
|
2022-10-06 16:27:12 +02:00
|
|
|
type={LiveContentType.Video}
|
2023-08-22 18:47:33 +01:00
|
|
|
text={_t("common|video")}
|
2022-10-06 16:27:12 +02:00
|
|
|
active={false}
|
2022-11-28 16:37:32 -05:00
|
|
|
participantCount={useParticipantCount(call)}
|
2022-10-06 16:27:12 +02:00
|
|
|
/>
|
|
|
|
|
);
|