Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add button to remove call from recents #2618

Merged
merged 5 commits into from
Sep 13, 2024
Merged
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 16 additions & 3 deletions src/home/CallList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
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";
Johennes marked this conversation as resolved.
Show resolved Hide resolved
import { IconButton } from "@vector-im/compound-web";
import { CloseIcon } from "@vector-im/compound-design-tokens/assets/web/icons";

import { Avatar, Size } from "../Avatar";
import styles from "./CallList.module.css";
Expand Down Expand Up @@ -55,8 +58,16 @@
client: MatrixClient;
}

const CallTile: FC<CallTileProps> = ({ name, avatarUrl, room }) => {
const CallTile: FC<CallTileProps> = ({ name, avatarUrl, room, client }) => {
const roomEncryptionSystem = useRoomEncryptionSystem(room.roomId);
const onRemove = useCallback(
(e: MouseEvent) => {
e.stopPropagation();
e.preventDefault();
void client.leave(room.roomId);
Johennes marked this conversation as resolved.
Show resolved Hide resolved
},

Check warning on line 68 in src/home/CallList.tsx

View check run for this annotation

Codecov / codecov/patch

src/home/CallList.tsx#L65-L68

Added lines #L65 - L68 were not covered by tests
[room, client],
);
return (
<div className={styles.callTile}>
<Link
Expand All @@ -69,7 +80,9 @@
{name}
</Body>
</div>
<div className={styles.copyButtonSpacer} />
<IconButton onClick={onRemove} aria-label={t("action.remove")}>
<CloseIcon />
</IconButton>
</Link>
</div>
);
Expand Down