Clean up room-related components

This commit is contained in:
Robert Long
2022-01-05 15:06:51 -08:00
parent 8be578763d
commit 550c45b69e
9 changed files with 598 additions and 700 deletions

25
src/room/RoomRedirect.jsx Normal file
View File

@@ -0,0 +1,25 @@
import React, { useEffect } from "react";
import { useLocation, useHistory } from "react-router-dom";
import { defaultHomeserverHost } from "../ConferenceCallManagerHooks";
import { LoadingView } from "../FullScreenView";
export function RoomRedirect() {
const { pathname } = useLocation();
const history = useHistory();
useEffect(() => {
let roomId = pathname;
if (pathname.startsWith("/")) {
roomId = roomId.substr(1, roomId.length);
}
if (!roomId.startsWith("#") && !roomId.startsWith("!")) {
roomId = `#${roomId}:${defaultHomeserverHost}`;
}
history.replace(`/room/${roomId}`);
}, [pathname, history]);
return <LoadingView />;
}