Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[NEW] inappchat in greenroom #86

Merged
merged 1 commit into from
Mar 12, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,
};
};