Skip to content

Commit 42de0a1

Browse files
committed
Include room area in window subtitle
1 parent 7718743 commit 42de0a1

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

src/App.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,14 @@ function setWindowSubtitle(subtitle?: string) {
3030
document.title = subtitle ? `${WINDOW_TITLE} - ${subtitle}` : WINDOW_TITLE;
3131
}
3232

33+
function getRoomSubtitle(roomInfo: GMCPMessageRoomInfo): string | undefined {
34+
if (roomInfo.area && roomInfo.name) {
35+
return `${roomInfo.area}: ${roomInfo.name}`;
36+
}
37+
38+
return roomInfo.name || roomInfo.area || undefined;
39+
}
40+
3341
function App() {
3442
const [client, setClient] = useState<MudClient | null>(null);
3543
const [showSidebar, setShowSidebar] = useState<boolean>(false);
@@ -189,7 +197,7 @@ function App() {
189197
}
190198

191199
const handleRoomInfo = (roomInfo: GMCPMessageRoomInfo) => {
192-
setWindowSubtitle(roomInfo.name);
200+
setWindowSubtitle(getRoomSubtitle(roomInfo));
193201
};
194202
const handleDisconnect = () => {
195203
setWindowSubtitle();

0 commit comments

Comments
 (0)