-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
201 additions
and
13 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
import React, { useContext } from 'react' | ||
import { Helmet } from 'react-helmet' | ||
import classNames from 'classnames' | ||
import Button from '@material-ui/core/Button' | ||
import Dialog from '@material-ui/core/Dialog' | ||
import DialogTitle from '@material-ui/core/DialogTitle' | ||
import DialogContent from '@material-ui/core/DialogContent' | ||
import DialogActions from '@material-ui/core/DialogActions' | ||
import Typography from '@material-ui/core/Typography' | ||
|
||
import FarmhandContext from '../Farmhand/Farmhand.context' | ||
|
||
import './ChatRoom.sass' | ||
|
||
const chitchatterDomain = 'https://chitchatter.im' | ||
|
||
export const ChatRoom = () => { | ||
const dialogTitleId = 'chat-title' | ||
const dialogContentId = 'chat-content' | ||
|
||
const { | ||
handlers: { handleChatRoomOpenStateChange }, | ||
gameState: { id, isChatOpen, room }, | ||
} = useContext(FarmhandContext) | ||
|
||
const handleChatRoomClose = () => { | ||
handleChatRoomOpenStateChange(false) | ||
} | ||
|
||
const chatRoomComponent = ( | ||
// @ts-ignore | ||
<chat-room | ||
root-url={chitchatterDomain} | ||
room={`__farmhand__${room}`} | ||
user-id={id} | ||
style={{ height: '100%', width: '100%', border: 'none' }} | ||
color-mode="light" | ||
/> | ||
) | ||
|
||
return ( | ||
<> | ||
<Helmet> | ||
<script src={`${chitchatterDomain}/sdk.js`} /> | ||
</Helmet> | ||
<Dialog | ||
{...{ | ||
className: classNames('Farmhand', 'ChatRoom'), | ||
fullWidth: true, | ||
keepMounted: true, | ||
fullScreen: true, | ||
open: isChatOpen, | ||
onClose: handleChatRoomClose, | ||
}} | ||
aria-describedby={dialogTitleId} | ||
aria-labelledby={dialogContentId} | ||
> | ||
<DialogTitle {...{ disableTypography: true }}> | ||
<Typography | ||
{...{ id: dialogTitleId, component: 'h2', variant: 'h6' }} | ||
> | ||
Chat room | ||
</Typography> | ||
</DialogTitle> | ||
<DialogContent {...{ id: dialogContentId }}> | ||
{chatRoomComponent} | ||
</DialogContent> | ||
<DialogActions> | ||
<Button onClick={handleChatRoomClose} color="primary" autoFocus> | ||
Close | ||
</Button> | ||
</DialogActions> | ||
</Dialog> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
.ChatRoom | ||
.MuiDialog-container | ||
padding: 1em | ||
height: calc(100% - 2em) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export * from './ChatRoom' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
eca2881
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
farmhand – ./
www.farmhand.life
farmhand-jeremyckahn.vercel.app
farmhand.vercel.app
farmhand-git-main-jeremyckahn.vercel.app
farmhand.life