From 3b05d14fbd4a7182de3058b126f0994a2541887d Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Fri, 6 Dec 2024 14:43:53 +0200 Subject: [PATCH] web/main: add room name to page title --- web/src/ui/MainScreen.tsx | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/web/src/ui/MainScreen.tsx b/web/src/ui/MainScreen.tsx index cbe4d30..9edecdc 100644 --- a/web/src/ui/MainScreen.tsx +++ b/web/src/ui/MainScreen.tsx @@ -112,6 +112,11 @@ class ContextFields implements MainScreenContextFields { if (pushState) { history.pushState({ room_id: roomID }, "") } + let roomNameForTitle = room?.meta.current.name + if (roomNameForTitle && roomNameForTitle.length > 48) { + roomNameForTitle = roomNameForTitle.slice(0, 45) + "…" + } + document.title = roomNameForTitle ? `${roomNameForTitle} - gomuks web` : "gomuks web" } clickRoom = (evt: React.MouseEvent) => {