/* Copyright 2024 New Vector Ltd. Copyright 2017-2019 , 2021 The Matrix.org Foundation C.I.C. SPDX-License-Identifier: AGPL-3.0-only OR GPL-3.0-only OR LicenseRef-Element-Commercial Please see LICENSE files in the repository root for full details. */ import React, { type ReactElement, useContext } from "react"; import classNames from "classnames"; import { type Room, type RoomMember } from "matrix-js-sdk/src/matrix"; import { Tooltip } from "@vector-im/compound-web"; import { LinkIcon, UserSolidIcon } from "@vector-im/compound-design-tokens/assets/web/icons"; import MatrixClientContext from "../../../contexts/MatrixClientContext"; import { usePermalink } from "../../../hooks/usePermalink"; import RoomAvatar from "../avatars/RoomAvatar"; import MemberAvatar from "../avatars/MemberAvatar"; import { _t } from "../../../languageHandler"; export enum PillType { UserMention = "TYPE_USER_MENTION", RoomMention = "TYPE_ROOM_MENTION", AtRoomMention = "TYPE_AT_ROOM_MENTION", // '@room' mention EventInSameRoom = "TYPE_EVENT_IN_SAME_ROOM", EventInOtherRoom = "TYPE_EVENT_IN_OTHER_ROOM", Keyword = "TYPE_KEYWORD", // Used to highlight keywords that triggered a notification rule } const linkIcon = ; const PillRoomAvatar: React.FC<{ shouldShowPillAvatar: boolean; room: Room | null; }> = ({ shouldShowPillAvatar, room }) => { if (!shouldShowPillAvatar) { return null; } if (room) { return