Files
element-call/src/CallList.jsx

58 lines
1.6 KiB
React
Raw Normal View History

2021-12-10 13:44:06 -08:00
import React, { useMemo } from "react";
2021-12-07 17:59:55 -08:00
import { Link } from "react-router-dom";
import { CopyButton } from "./button";
import { Facepile } from "./Facepile";
import { Avatar } from "./Avatar";
import { ReactComponent as VideoIcon } from "./icons/Video.svg";
2021-12-09 12:58:30 -08:00
import styles from "./CallList.module.css";
2021-12-10 13:44:06 -08:00
import { getRoomUrl } from "./ConferenceCallManagerHooks";
2021-12-07 17:59:55 -08:00
2021-12-20 09:12:28 -08:00
export function CallList({ title, rooms, client }) {
2021-12-09 12:58:30 -08:00
return (
<>
<h3>{title}</h3>
<div className={styles.callList}>
2021-12-10 13:44:06 -08:00
{rooms.map(({ roomId, roomName, avatarUrl, participants }) => (
2021-12-09 12:58:30 -08:00
<CallTile
key={roomId}
2021-12-20 09:12:28 -08:00
client={client}
2021-12-09 12:58:30 -08:00
name={roomName}
avatarUrl={avatarUrl}
2021-12-10 13:44:06 -08:00
roomId={roomId}
2021-12-09 12:58:30 -08:00
participants={participants}
/>
))}
</div>
</>
);
}
2021-12-20 09:12:28 -08:00
function CallTile({ name, avatarUrl, roomId, participants, client }) {
2021-12-07 17:59:55 -08:00
return (
2021-12-10 14:01:55 -08:00
<div className={styles.callTile}>
<Link to={`/room/${roomId}`} className={styles.callTileLink}>
<Avatar
size="md"
bgKey={name}
src={avatarUrl}
fallback={<VideoIcon width={16} height={16} />}
className={styles.avatar}
/>
<div className={styles.callInfo}>
<h5>{name}</h5>
2021-12-13 12:41:31 -08:00
<p>{getRoomUrl(roomId)}</p>
2021-12-20 09:12:28 -08:00
{participants && (
<Facepile client={client} participants={participants} />
)}
2021-12-10 14:01:55 -08:00
</div>
<div className={styles.copyButtonSpacer} />
</Link>
2021-12-07 17:59:55 -08:00
<CopyButton
className={styles.copyButton}
variant="icon"
2021-12-10 13:44:06 -08:00
value={getRoomUrl(roomId)}
2021-12-07 17:59:55 -08:00
/>
2021-12-10 14:01:55 -08:00
</div>
2021-12-07 17:59:55 -08:00
);
}