jitsi-roomsv2/frontend/src/App.tsx

48 lines
1.5 KiB
TypeScript
Raw Normal View History

2023-04-07 16:21:15 +02:00
import { useState } from "react";
2023-01-07 19:06:04 +01:00
import "./App.css";
import Meeting from "./components/meeting/Meeting";
import Sidebar from "./components/sidebar/Sidebar";
2023-02-07 20:31:07 +01:00
import useBackendData from "./hooks/useBackendData";
import useConferenceData from "./hooks/useConferenceData";
import useLocalUser from "./hooks/useLocalUser";
2023-04-07 16:21:15 +02:00
import { useRoomName } from "./hooks/useRoomName";
2023-01-07 16:15:35 +01:00
function App() {
2023-02-07 20:31:07 +01:00
const { userInfo, setUserInfo } = useLocalUser();
2023-04-07 16:21:15 +02:00
const { roomName, updateRoomName, updateAndSubmitRoomName, submitRoomName } = useRoomName();
2023-02-07 20:31:07 +01:00
const { roomData, sendMessage } = useBackendData(userInfo);
const { conferenceData, setConferenceData } = useConferenceData(
sendMessage,
setUserInfo
2023-01-07 19:06:04 +01:00
);
2023-04-07 16:21:15 +02:00
const [meetingStarted, setMeetingStarted] = useState(false);
2023-02-07 20:31:07 +01:00
console.log(roomData);
if (roomData && userInfo) {
return (
<div className="App">
2023-04-07 16:21:15 +02:00
<Sidebar usersData={roomData}
updateAndSubmitRoomName={(roomName: string) => {
updateAndSubmitRoomName(roomName)
setMeetingStarted(true)
}}
/>
2023-02-12 15:28:53 +01:00
<Meeting
conferenceData={conferenceData}
setConferenceData={setConferenceData}
userInfo={userInfo}
2023-04-07 16:21:15 +02:00
roomName={roomName}
updateRoomName={updateRoomName}
submitRoomName={submitRoomName}
meetingStarted={meetingStarted}
setMeetingStarted={setMeetingStarted}
2023-02-12 15:28:53 +01:00
/>
2023-02-07 20:31:07 +01:00
</div>
);
}
return <h2>🌀 Loading...</h2>;
2023-01-07 16:15:35 +01:00
}
2023-01-07 19:06:04 +01:00
export default App;