Skip to content

Commit

Permalink
Set the document title to the current call name. (#2928)
Browse files Browse the repository at this point in the history
Co-authored-by: Hugh Nimmo-Smith <[email protected]>
Co-authored-by: Hugh Nimmo-Smith <[email protected]>
  • Loading branch information
3 people authored Jan 8, 2025
1 parent 00759e2 commit 7e507d6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/room/GroupCallView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ import { Link } from "../button/Link";
import { useAudioContext } from "../useAudioContext";
import { callEventAudioSounds } from "./CallEventAudioRenderer";
import { useLatest } from "../useLatest";
import { usePageTitle } from "../usePageTitle";

declare global {
interface Window {
Expand Down Expand Up @@ -123,6 +124,7 @@ export const GroupCallView: FC<Props> = ({
const roomAvatar = useRoomAvatar(rtcSession.room);
const { perParticipantE2EE, returnToLobby } = useUrlParams();
const e2eeSystem = useRoomEncryptionSystem(rtcSession.room.roomId);
usePageTitle(roomName);

const matrixInfo = useMemo((): MatrixInfo => {
return {
Expand Down
2 changes: 2 additions & 0 deletions src/room/LobbyView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import { Link } from "../button/Link";
import { useMediaDevices } from "../livekit/MediaDevicesContext";
import { useInitial } from "../useInitial";
import { useSwitchCamera } from "./useSwitchCamera";
import { usePageTitle } from "../usePageTitle";

interface Props {
client: MatrixClient;
Expand Down Expand Up @@ -64,6 +65,7 @@ export const LobbyView: FC<Props> = ({
waitingForInvite,
}) => {
const { t } = useTranslation();
usePageTitle(matrixInfo.roomName);

const onAudioPress = useCallback(
() => muteStates.audio.setEnabled?.((e) => !e),
Expand Down
2 changes: 1 addition & 1 deletion src/usePageTitle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Please see LICENSE in the repository root for full details.

import { useEffect } from "react";

export function usePageTitle(title: string): void {
export function usePageTitle(title?: string): void {
useEffect(() => {
const productName = import.meta.env.VITE_PRODUCT_NAME || "Element Call";
document.title = title ? `${productName} | ${title}` : productName;
Expand Down

0 comments on commit 7e507d6

Please sign in to comment.