element-call/src/home/JoinExistingCallModal.tsx

53 lines
1.6 KiB
TypeScript
Raw Normal View History

2022-05-04 17:09:48 +01:00
/*
Copyright 2022 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-07-14 19:20:52 +02:00
import { PressEvent } from "@react-types/shared";
2022-10-10 09:19:10 -04:00
import { useTranslation } from "react-i18next";
2022-07-14 19:20:52 +02:00
2022-01-05 17:00:02 -08:00
import { Modal, ModalContent } from "../Modal";
import { Button } from "../button";
2022-01-05 17:27:01 -08:00
import { FieldRow } from "../input/Input";
2021-12-17 15:01:59 -08:00
import styles from "./JoinExistingCallModal.module.css";
2022-07-29 15:07:35 +02:00
2022-07-14 19:20:52 +02:00
interface Props {
onJoin: (e: PressEvent) => void;
onClose: () => void;
2022-07-28 00:17:09 +02:00
// TODO: add used parameters for <Modal>
2022-07-14 19:20:52 +02:00
[index: string]: unknown;
}
export function JoinExistingCallModal({ onJoin, onClose, ...rest }: Props) {
2022-10-10 09:19:10 -04:00
const { t } = useTranslation();
2021-12-17 15:01:59 -08:00
return (
<Modal
title={t("Join existing call?")}
isDismissable
{...rest}
onClose={onClose}
>
2021-12-17 15:01:59 -08:00
<ModalContent>
2022-10-10 09:19:10 -04:00
<p>{t("This call already exists, would you like to join?")}</p>
2021-12-17 15:01:59 -08:00
<FieldRow rightAlign className={styles.buttons}>
2022-10-10 09:19:10 -04:00
<Button onPress={onClose}>{t("No")}</Button>
2023-05-02 17:33:56 +01:00
<Button onPress={onJoin} data-testid="home_joinExistingRoom">
{t("Yes, join call")}
</Button>
2021-12-17 15:01:59 -08:00
</FieldRow>
</ModalContent>
</Modal>
);
}