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
import { realTimeDb } from "../firebase"; | |
export const createCometChatGroup = async ({ cometChat, guid, name }) => { | |
const groupType = cometChat.GROUP_TYPE.PUBLIC; | |
const password = ""; | |
const group = new cometChat.Group(guid, name, groupType, password); | |
await cometChat.createGroup(group); | |
}; | |
export const showNotification = message => { |
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
... | |
const initCometChat = async () => { | |
const { CometChat } = await import('@cometchat-pro/chat'); | |
const appID = `${process.env.REACT_APP_COMETCHAT_APP_ID}`; | |
const region = `${process.env.REACT_APP_COMETCHAT_REGION}`; | |
const appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build(); | |
CometChat.init(appID, appSetting).then( | |
() => { | |
setCometChat(() => CometChat); | |
}, |
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
import firebase from "firebase"; | |
import "firebase/storage"; | |
const firebaseConfig = { | |
apiKey: `${process.env.REACT_APP_FIREBASE_API_KEY}`, | |
authDomain: `${process.env.REACT_APP_FIREBASE_AUTH_DOMAIN}`, | |
databaseURL: `${process.env.REACT_APP_FIREBASE_DATABASE_URL}`, | |
projectId: `${process.env.REACT_APP_FIREBASE_PROJECT_ID}`, | |
storageBucket: `${process.env.REACT_APP_FIREBASE_STORAGE_BUCKET}`, | |
messagingSenderId: `${process.env.REACT_APP_FIREABSE_MESSAGING_SENDER_ID}`, |
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
... | |
const [isLoading, setIsLoading] = useState(false); | |
const [user, setUser] = useState(null); | |
const [cometChat, setCometChat] = useState(null); | |
// menu id. | |
const [id, setId] = useState(null); | |
// chose meeting. | |
const [meeting, setMeeting] = useState(null); | |
// detect whether a new meeting was created so the list of meetings will be refreshed. | |
const [hasNewMeeting, setHasNewMeeting] = useState(false); |
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
import { useEffect, useRef, useContext, useCallback } from "react"; | |
import validator from "validator"; | |
import { useHistory } from 'react-router-dom'; | |
import withModal from "../common/Modal"; | |
import SignUp from "../register/SignUp"; | |
import Context from "../../context"; | |
import { auth, realTimeDb } from "../../firebase"; |
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
... | |
const loginWithCometChat = async (user) => { | |
if (!user) return; | |
const authKey = `${process.env.REACT_APP_COMETCHAT_AUTH_KEY}`; | |
const cometChatUser = await cometChat.login(user.id, authKey); | |
if (cometChatUser) { | |
... | |
} | |
}; | |
... |
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
import { useState } from 'react'; | |
const withModal = ModalComponent => WrapperComponent => { | |
return function () { | |
const [isModalShown, setIsModalShown] = useState(false); | |
return ( | |
<> | |
<WrapperComponent toggleModal={setIsModalShown}/> | |
{isModalShown && <ModalComponent toggleModal={setIsModalShown} />} |
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
import { useContext } from 'react'; | |
import { useHistory } from 'react-router'; | |
import Context from '../../context'; | |
import { saveDataToLocalStorage, navigate } from '../../services/common'; | |
const withMeeting = WrapperComponent => { | |
return function (props) { | |
const { setMeeting } = useContext(Context); |
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
import { useRef, useContext } from "react"; | |
import validator from "validator"; | |
import { v4 as uuidv4 } from "uuid"; | |
import Context from "../../context"; | |
import { auth } from "../../firebase"; | |
import { showNotification, insertFirebaseDatabase } from "../../services/common"; |
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
... | |
const createCometChatAccount = async ({ id, fullname, avatar }) => { | |
const authKey = `${process.env.REACT_APP_COMETCHAT_AUTH_KEY}`; | |
const user = new cometChat.User(id); | |
user.setName(fullname); | |
user.setAvatar(avatar); | |
return await cometChat.createUser(user, authKey); | |
}; | |
... |
OlderNewer