Skip to content

Commit

Permalink
Add In-App Chat into greenroom
Browse files Browse the repository at this point in the history
Allowing presenter to chat with participants
  • Loading branch information
sidmohanty11 authored Mar 12, 2022
1 parent a6b9dd9 commit a6e9464
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/.env.local.sample
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,6 @@ COOKIE_SECRET_PREVIOUS=
# for development http://localhost:3000
NEXT_PUBLIC_ROCKET_CHAT_HOST=required
# id of the room where conf will take place
NEXT_PUBLIC_ROCKET_CHAT_CONF_RID=required
NEXT_PUBLIC_ROCKET_CHAT_CONF_RID=required
# id of the greenroom
NEXT_PUBLIC_ROCKET_CHAT_GREENROOM_RID=required
34 changes: 32 additions & 2 deletions app/pages/virtualconf/greenroom/index.js
Original file line number Diff line number Diff line change
@@ -1,29 +1,59 @@
import { useState } from "react";
import Head from "next/head";
import Script from "next/script";
import styles from "../../../styles/Mainstage.module.css";
import { Container, Row, Col } from "react-bootstrap";
import Jitsibroadcaster from '../../../components/clientsideonly/jitsibroadcaster'
import InAppChat from "../../../components/inappchat/inappchat";
import { Button } from "react-bootstrap";

const Greenroom = () => {
const greenroom_rid = process.env.NEXT_PUBLIC_ROCKET_CHAT_GREENROOM_RID;

const Greenroom = ({ cookies }) => {
const [openChat, setOpenChat] = useState(false);

const handleOpenChat = () => {
setOpenChat((prevState) => !prevState);
};
return (
<>
<Head>
<title>Conference Green Room</title>
</Head>
<Script
src="https://cdn.jsdelivr.net/npm/[email protected]/lib/js/joypixels.min.js"
strategy="afterInteractive"
onLoad={() =>
console.log(`script loaded correctly, joypixels`)
}
/>
<main className={styles.main}>
<div className={styles.container}>
</div>
{openChat ? (
<InAppChat closeChat={handleOpenChat} cookies={cookies} rid={greenroom_rid} />
) : (
<Button style={{ float: 'right' }} onClick={handleOpenChat}>Open Chat</Button>
)}
<Container>
<Row>
<Col>
<Jitsibroadcaster />
</Col>
</Row>
</Container>

</main>
</>

)
}

export default Greenroom;

Greenroom.getInitialProps = ({ req }) => {
const cookies = req.cookies;

return {
cookies,
};
};

0 comments on commit a6e9464

Please sign in to comment.