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
... | |
useEffect(() => { | |
// init cometchat pro. | |
initCometChat(); | |
}, []); | |
/** | |
* init comet chat. | |
*/ | |
const initCometChat = async () => { |
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 firebase from "firebase"; | |
import "firebase/storage"; | |
const firebaseConfig = { | |
apiKey: `${process.env.NEXT_PUBLIC_FIREBASE_API_KEY}`, | |
authDomain: `${process.env.NEXT_PUBLIC_FIREBASE_AUTH_DOMAIN}`, | |
databaseURL: `${process.env.NEXT_PUBLIC_FIREBASE_DATABASE_URL}`, | |
projectId: `${process.env.NEXT_PUBLIC_FIREBASE_PROJECT_ID}`, | |
storageBucket: `${process.env.NEXT_PUBLIC_FIREBASE_STORAGE_BUCKET}`, | |
messagingSenderId: `${process.env.NEXT_PUBLIC_FIREABSE_MESSAGING_SENDER_ID}`, |
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 useRef and useContext | |
import { useRef, useContext } from "react"; | |
// import Context to get shared data from React context. | |
import Context from "../Context"; | |
// import firebase authentication and real time database. | |
import { auth, realTimeDb } from "../firebase"; | |
// import validator to validate user's credentials. | |
import validator from "validator"; | |
// import custom componnets. | |
import withModal from "./Modal"; |
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 useRef, useContext | |
import { useRef, useContext } from "react"; | |
// import Context to get shared data. | |
import Context from "../Context"; | |
// import validator to validate user's information. | |
import validator from "validator"; | |
// import firebase authentication. | |
import { auth, realTimeDb } from "../firebase"; | |
// import uuid to generate id for users. | |
import { v4 as uuidv4 } from "uuid"; |
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, useRef, useContext to get shared data from react context. | |
import { useState, useRef, useContext } from "react"; | |
// import Context to get shared data. | |
import Context from "../Context"; | |
// import real time databse firebase. | |
import { realTimeDb } from "../firebase"; | |
// import custom components. | |
import HeaderIcon from "./HeaderIcon"; | |
import HeaderRightIcon from "./HeaderRightIcon"; |
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
function HeaderIcon({active, icon, onClick }) { | |
const handleClick = () => { | |
if (onClick) { | |
onClick(); | |
} | |
} | |
return ( | |
<div className={`${active ? 'icon--active' : ''} header__icon`} onClick={handleClick}> | |
{icon} | |
</div> |
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
function HeaderRightIcon({icon, onClick}) { | |
const handleClick = () => { | |
if (onClick) { | |
onClick(); | |
} | |
} | |
return ( | |
<div className="header__ricon" onClick={handleClick}> | |
{icon} | |
</div> |
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 custom components. | |
import StoryCard from "./StoryCard"; | |
const stories = [ | |
{ | |
name: "Bill Gates", | |
src: "https://links.papareact.com/4u4", | |
profile: "https://links.papareact.com/zvy", | |
}, | |
{ |
OlderNewer