1
0
Fork 0
forked from Mirrors/gomuks

web/roomview: fix placeholder avatars in room view header

This commit is contained in:
Tulir Asokan 2024-10-23 13:37:27 +03:00
parent a7a2fc53f2
commit f0e3ec650d

View file

@ -14,7 +14,7 @@
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.
import { use, useRef } from "react"
import { getMediaURL } from "@/api/media.ts"
import { getAvatarURL } from "@/api/media.ts"
import { RoomStateStore } from "@/api/statestore"
import { EventID } from "@/api/types"
import { useNonNullEventAsState } from "@/util/eventdispatcher.ts"
@ -31,12 +31,14 @@ interface RoomViewProps {
const RoomHeader = ({ room, clearActiveRoom }: RoomViewProps) => {
const roomMeta = useNonNullEventAsState(room.meta)
const avatarSourceID = roomMeta.lazy_load_summary?.heroes?.length === 1
? roomMeta.lazy_load_summary.heroes[0] : room.roomID
return <div className="room-header">
<button className="back" onClick={clearActiveRoom}><BackIcon/></button>
<img
className="avatar"
loading="lazy"
src={getMediaURL(roomMeta.avatar)}
src={getAvatarURL(avatarSourceID, { avatar_url: roomMeta.avatar, displayname: roomMeta.name })}
onClick={use(LightboxContext)!}
alt=""
/>