jitsi-roomsv2/frontend/src/components/meeting/Meeting.tsx

65 lines
1.9 KiB
TypeScript
Raw Normal View History

2023-04-10 23:28:28 +02:00
import { ConferenceData } from '../../background/jitsi/eventListeners'
import { UsersData } from '../../background/types/roomData'
2023-04-10 23:28:28 +02:00
import useMeetingStarted from '../../hooks/useMeetingStarted'
import { useRoomName } from '../../hooks/useRoomName'
import JitsiEntrypoint from '../jitsi/JitsiEntrypoint'
import { UserInfo } from '../jitsi/types'
import MeetingNameInput from './MeetingNameInput'
import './Meeting.css'
2023-01-07 19:06:04 +01:00
2023-02-07 20:31:07 +01:00
interface Props {
2023-04-10 23:28:28 +02:00
conferenceData: ConferenceData | undefined
setConferenceData: (newData: ConferenceData) => void
userInfo: UserInfo
usersData: UsersData
2023-02-07 20:31:07 +01:00
}
function Meeting(props: Props) {
const { conferenceData, setConferenceData, userInfo, usersData } = props
console.log("[Rooms] meeting usersData", props)
2023-04-10 23:37:30 +02:00
const [meetingStarted] = useMeetingStarted()
2023-04-08 15:58:11 +02:00
const { roomName } = useRoomName()
const [_, setMeetingStarted] = useMeetingStarted()
const { updateAndSubmitRoomName: updateAndSubmitRoomName } = useRoomName()
2023-01-07 19:06:04 +01:00
if (meetingStarted) {
2023-02-07 20:31:07 +01:00
return (
<JitsiEntrypoint
2023-02-12 15:28:53 +01:00
conferenceData={conferenceData}
2023-02-07 20:31:07 +01:00
roomName={roomName}
userInfo={userInfo}
setConferenceData={setConferenceData}
/>
2023-04-10 23:28:28 +02:00
)
2023-01-07 19:06:04 +01:00
}
return (
<div>
<MeetingNameInput roomName={roomName} currentUser={userInfo.displayName} />
<div className="meeting-quickjoin">
{usersData?.roomsData.map((roomData) => {
return (
<>
<h3>
<a
href="#"
onClick={() => {
updateAndSubmitRoomName(roomData.roomName)
setMeetingStarted(true)
}}
>
{roomData.roomName}
</a>
</h3>
{roomData.participants.map((participant) => (
<div key={participant.jid}> {participant.displayName} </div>
))}
</>
)
})}
</div>
</div>)
2023-01-07 19:06:04 +01:00
}
2023-04-10 23:28:28 +02:00
export default Meeting