2023-06-23 16:18:51 -04:00
|
|
|
/*
|
2024-09-06 10:22:13 +02:00
|
|
|
Copyright 2022-2024 New Vector Ltd.
|
2023-06-23 16:18:51 -04:00
|
|
|
|
2025-02-18 17:59:58 +00:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial
|
2024-09-06 10:22:13 +02:00
|
|
|
Please see LICENSE in the repository root for full details.
|
2023-06-23 16:18:51 -04:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
import { useCallback } from "react";
|
2025-03-13 13:58:43 +01:00
|
|
|
import { type Room } from "matrix-js-sdk";
|
2023-06-23 16:18:51 -04:00
|
|
|
|
|
|
|
|
import { useRoomState } from "./useRoomState";
|
|
|
|
|
|
2023-09-22 18:05:13 -04:00
|
|
|
export function useRoomAvatar(room: Room): string | null {
|
|
|
|
|
return useRoomState(
|
2023-06-23 16:18:51 -04:00
|
|
|
room,
|
2023-10-11 10:42:04 -04:00
|
|
|
useCallback(() => room.getMxcAvatarUrl(), [room]),
|
2023-06-23 16:18:51 -04:00
|
|
|
);
|
2023-09-22 18:05:13 -04:00
|
|
|
}
|