This file contains hidden or 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
const SubHeader = (props) => { | |
const { title } = props; | |
return ( | |
<div className="friends__sub-header"> | |
<span>{title}</span> | |
</div> | |
); | |
}; | |
export default SubHeader; |
This file contains hidden or 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
const Pending = (props) => { | |
const { user, onAccepted, onRejected } = props; | |
const accept = () => { | |
onAccepted(user); | |
}; | |
const reject = () => { | |
onRejected(user); | |
}; |
This file contains hidden or 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
... | |
const loginCometChat = (user) => { | |
const authKey = `${process.env.REACT_APP_COMETCHAT_AUTH_KEY}`; | |
cometChat.login(user.id, authKey).then( | |
User => { | |
localStorage.setItem('auth', JSON.stringify(user)); | |
setUser(user); | |
setIsLoading(false); |
This file contains hidden or 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
const createCometChatAccount = ({ userUuid, fullname, userAvatar }) => { | |
const authKey = `${process.env.REACT_APP_COMETCHAT_AUTH_KEY}`; | |
const user = new cometChat.User(userUuid); | |
user.setName(fullname); | |
user.setAvatar(userAvatar); | |
cometChat.createUser(user, authKey).then( | |
user => { | |
setIsLoading(false); | |
}, error => { |
This file contains hidden or 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
... | |
const sendCustomMessage = ({ message, type, receiverId }) => { | |
const receiverID = receiverId; | |
const customType = type; | |
const receiverType = cometChat.RECEIVER_TYPE.USER; | |
const customData = { | |
message | |
}; | |
const customMessage = new cometChat.CustomMessage( | |
receiverID, |
This file contains hidden or 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
import { useEffect, useContext } from 'react'; | |
import Sidebars from './Sidebars'; | |
import Main from './Main'; | |
import Context from '../../context'; | |
const Server = () => { | |
const { setSelectedChannel } = useContext(Context); | |
useEffect(() => { | |
return () => { |
This file contains hidden or 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
import { useState } from "react"; | |
import Channel from './Channel'; | |
const Channels = (props) => { | |
const { title, channelType, channels, onItemClicked } = props; | |
const [isExpanded, setIsExpanded] = useState(false); | |
const toggleExpand = () => { | |
setIsExpanded(previous => !previous); |