2024-11-11 12:07:02 +00:00
|
|
|
/*
|
|
|
|
|
Copyright 2024 New Vector Ltd.
|
|
|
|
|
|
2025-02-18 17:59:58 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-11-11 12:07:02 +00:00
|
|
|
Please see LICENSE in the repository root for full details.
|
|
|
|
|
*/
|
|
|
|
|
|
2024-12-19 15:54:28 +00:00
|
|
|
import { type ReactNode } from "react";
|
2024-11-11 12:07:02 +00:00
|
|
|
|
|
|
|
|
import styles from "./ReactionsOverlay.module.css";
|
2025-11-07 14:04:40 +01:00
|
|
|
import { type CallViewModel } from "../state/CallViewModel/CallViewModel";
|
2025-06-18 18:33:35 -04:00
|
|
|
import { useBehavior } from "../useBehavior";
|
2024-11-11 12:07:02 +00:00
|
|
|
|
2024-12-19 15:54:28 +00:00
|
|
|
export function ReactionsOverlay({ vm }: { vm: CallViewModel }): ReactNode {
|
2025-06-18 18:33:35 -04:00
|
|
|
const reactionsIcons = useBehavior(vm.visibleReactions$);
|
2024-11-11 12:07:02 +00:00
|
|
|
return (
|
|
|
|
|
<div className={styles.container}>
|
2025-06-18 18:33:35 -04:00
|
|
|
{reactionsIcons.map(({ sender, emoji, startX }) => (
|
2024-11-11 12:07:02 +00:00
|
|
|
<span
|
|
|
|
|
// Reactions effects are considered presentation elements. The reaction
|
|
|
|
|
// is also present on the sender's tile, which assistive technology can
|
|
|
|
|
// read from instead.
|
|
|
|
|
role="presentation"
|
|
|
|
|
style={{ left: `${startX}vw` }}
|
|
|
|
|
className={styles.reaction}
|
|
|
|
|
// A sender can only send one emoji at a time.
|
|
|
|
|
key={sender}
|
|
|
|
|
>
|
|
|
|
|
{emoji}
|
|
|
|
|
</span>
|
|
|
|
|
))}
|
|
|
|
|
</div>
|
|
|
|
|
);
|
|
|
|
|
}
|