Files
element-call/src/room/GroupCallLoader.jsx

30 lines
662 B
React
Raw Normal View History

2022-01-05 15:35:12 -08:00
import React from "react";
2022-01-05 16:51:24 -08:00
import { useLoadGroupCall } from "./useLoadGroupCall";
2022-01-05 15:35:12 -08:00
import { ErrorView, FullScreenView } from "../FullScreenView";
2022-02-02 15:02:40 -08:00
import { usePageTitle } from "../usePageTitle";
2022-01-05 15:35:12 -08:00
export function GroupCallLoader({ client, roomId, viaServers, children }) {
const { loading, error, groupCall } = useLoadGroupCall(
2022-01-05 15:35:12 -08:00
client,
roomId,
viaServers,
true
2022-01-05 15:35:12 -08:00
);
2022-02-02 15:02:40 -08:00
usePageTitle(groupCall ? groupCall.room.name : "Loading...");
2022-01-05 15:35:12 -08:00
if (loading) {
return (
<FullScreenView>
<h1>Loading room...</h1>
</FullScreenView>
);
}
if (error) {
return <ErrorView error={error} />;
}
return children(groupCall);
}