From 9766cb2ca2fb338a207aa1968663161923d26c20 Mon Sep 17 00:00:00 2001 From: Johannes Marbach Date: Tue, 10 Sep 2024 13:33:12 +0200 Subject: [PATCH] Add button to remove call from recents Fixes: #2243 Signed-off-by: Johannes Marbach --- src/home/CallList.tsx | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/home/CallList.tsx b/src/home/CallList.tsx index aa6db6f3..cda6f3a7 100644 --- a/src/home/CallList.tsx +++ b/src/home/CallList.tsx @@ -9,7 +9,10 @@ import { Link } from "react-router-dom"; import { MatrixClient } from "matrix-js-sdk/src/client"; import { RoomMember } from "matrix-js-sdk/src/models/room-member"; import { Room } from "matrix-js-sdk/src/models/room"; -import { FC } from "react"; +import { FC, useCallback, MouseEvent } from "react"; +import { t } from "i18next"; +import { IconButton } from "@vector-im/compound-web"; +import { DeleteIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; import { Avatar, Size } from "../Avatar"; import styles from "./CallList.module.css"; @@ -55,8 +58,16 @@ interface CallTileProps { client: MatrixClient; } -const CallTile: FC = ({ name, avatarUrl, room }) => { +const CallTile: FC = ({ name, avatarUrl, room, client }) => { const roomEncryptionSystem = useRoomEncryptionSystem(room.roomId); + const onRemove = useCallback( + (e: MouseEvent) => { + e.stopPropagation(); + e.preventDefault(); + void client.leave(room.roomId); + }, + [room, client], + ); return (
= ({ name, avatarUrl, room }) => { {name}
-
+ + +
);