├── README.md
├── package-lock.json
├── package.json
├── public
├── favicon.ico
├── images
│ ├── Ellipse.png
│ ├── Logo.png
│ ├── avatar.png
│ ├── cover.png
│ ├── footerlogo.png
│ ├── icon1.png
│ ├── icon2.png
│ ├── p1.png
│ ├── p2.png
│ ├── p3.png
│ ├── post1.png
│ ├── profile.png
│ └── profilecover.png
├── index.html
├── logo192.png
├── logo512.png
├── manifest.json
└── robots.txt
├── src
├── App.js
├── compnents
│ ├── Container.js
│ ├── ContainerL.js
│ ├── Footer.js
│ ├── Friend.js
│ ├── FriendRequest.js
│ ├── From.js
│ ├── Navbar.js
│ ├── NewsFeed.js
│ ├── Profile.js
│ ├── Project.js
│ └── UserList.js
├── firebaseConfig.js
├── index.css
├── index.js
├── pages
│ ├── Home.js
│ ├── Login.js
│ ├── Profile.js
│ └── Sinup.js
├── slices
│ └── userSlice.js
└── store.js
└── tailwind.config.js
/README.md:
--------------------------------------------------------------------------------
1 | # Getting Started with Create React App
2 |
3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 |
5 | ## Available Scripts
6 |
7 | In the project directory, you can run:
8 |
9 | ### `npm start`
10 |
11 | Runs the app in the development mode.\
12 | Open [http://localhost:3000](http://localhost:3000) to view it in your browser.
13 |
14 | The page will reload when you make changes.\
15 | You may also see any lint errors in the console.
16 |
17 | ### `npm test`
18 |
19 | Launches the test runner in the interactive watch mode.\
20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
21 |
22 | ### `npm run build`
23 |
24 | Builds the app for production to the `build` folder.\
25 | It correctly bundles React in production mode and optimizes the build for the best performance.
26 |
27 | The build is minified and the filenames include the hashes.\
28 | Your app is ready to be deployed!
29 |
30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
31 |
32 | ### `npm run eject`
33 |
34 | **Note: this is a one-way operation. Once you `eject`, you can't go back!**
35 |
36 | If you aren't satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.
37 |
38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you're on your own.
39 |
40 | You don't have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn't feel obligated to use this feature. However we understand that this tool wouldn't be useful if you couldn't customize it when you are ready for it.
41 |
42 | ## Learn More
43 |
44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
45 |
46 | To learn React, check out the [React documentation](https://reactjs.org/).
47 |
48 | ### Code Splitting
49 |
50 | This section has moved here: [https://facebook.github.io/create-react-app/docs/code-splitting](https://facebook.github.io/create-react-app/docs/code-splitting)
51 |
52 | ### Analyzing the Bundle Size
53 |
54 | This section has moved here: [https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size](https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size)
55 |
56 | ### Making a Progressive Web App
57 |
58 | This section has moved here: [https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app](https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app)
59 |
60 | ### Advanced Configuration
61 |
62 | This section has moved here: [https://facebook.github.io/create-react-app/docs/advanced-configuration](https://facebook.github.io/create-react-app/docs/advanced-configuration)
63 |
64 | ### Deployment
65 |
66 | This section has moved here: [https://facebook.github.io/create-react-app/docs/deployment](https://facebook.github.io/create-react-app/docs/deployment)
67 |
68 | ### `npm run build` fails to minify
69 |
70 | This section has moved here: [https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify](https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify)
71 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "linkdin",
3 | "version": "0.1.0",
4 | "private": true,
5 | "dependencies": {
6 | "@reduxjs/toolkit": "^1.9.1",
7 | "@testing-library/jest-dom": "^5.16.5",
8 | "@testing-library/react": "^13.4.0",
9 | "@testing-library/user-event": "^13.5.0",
10 | "firebase": "^9.16.0",
11 | "flowbite": "^1.6.3",
12 | "flowbite-react": "^0.3.8",
13 | "moment": "^2.29.4",
14 | "react": "^18.2.0",
15 | "react-cropper": "^2.1.8",
16 | "react-dom": "^18.2.0",
17 | "react-icons": "^4.7.1",
18 | "react-loader-spinner": "^5.3.4",
19 | "react-redux": "^8.0.5",
20 | "react-router-dom": "^6.8.0",
21 | "react-scripts": "5.0.1",
22 | "react-toastify": "^9.1.1",
23 | "tw-elements": "^1.0.0-alpha13",
24 | "web-vitals": "^2.1.4"
25 | },
26 | "scripts": {
27 | "start": "react-scripts start",
28 | "build": "react-scripts build",
29 | "test": "react-scripts test",
30 | "eject": "react-scripts eject"
31 | },
32 | "eslintConfig": {
33 | "extends": [
34 | "react-app",
35 | "react-app/jest"
36 | ]
37 | },
38 | "browserslist": {
39 | "production": [
40 | ">0.2%",
41 | "not dead",
42 | "not op_mini all"
43 | ],
44 | "development": [
45 | "last 1 chrome version",
46 | "last 1 firefox version",
47 | "last 1 safari version"
48 | ]
49 | },
50 | "devDependencies": {
51 | "tailwindcss": "^3.2.4"
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/favicon.ico
--------------------------------------------------------------------------------
/public/images/Ellipse.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/Ellipse.png
--------------------------------------------------------------------------------
/public/images/Logo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/Logo.png
--------------------------------------------------------------------------------
/public/images/avatar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/avatar.png
--------------------------------------------------------------------------------
/public/images/cover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/cover.png
--------------------------------------------------------------------------------
/public/images/footerlogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/footerlogo.png
--------------------------------------------------------------------------------
/public/images/icon1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/icon1.png
--------------------------------------------------------------------------------
/public/images/icon2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/icon2.png
--------------------------------------------------------------------------------
/public/images/p1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/p1.png
--------------------------------------------------------------------------------
/public/images/p2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/p2.png
--------------------------------------------------------------------------------
/public/images/p3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/p3.png
--------------------------------------------------------------------------------
/public/images/post1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/post1.png
--------------------------------------------------------------------------------
/public/images/profile.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/profile.png
--------------------------------------------------------------------------------
/public/images/profilecover.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/images/profilecover.png
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
12 |
13 |
17 |
18 |
27 | React App
28 |
29 |
30 |
31 |
32 |
33 | You need to enable JavaScript to run this app.
34 |
35 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/logo192.png
--------------------------------------------------------------------------------
/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mdwasim2/LinkdinUpdate/5ef4191191762802f05d9396b57d19336ebceba5/public/logo512.png
--------------------------------------------------------------------------------
/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/src/App.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 | import Login from './pages/Login'
3 |
4 | const App = () => {
5 | return (
6 | <>
7 |
8 | >
9 | )
10 | }
11 |
12 | export default App
--------------------------------------------------------------------------------
/src/compnents/Container.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const Container = ({children}) => {
4 | return (
5 | {children}
6 | )
7 | }
8 |
9 | export default Container
--------------------------------------------------------------------------------
/src/compnents/ContainerL.js:
--------------------------------------------------------------------------------
1 | import React from 'react'
2 |
3 | const ContainerL = ({children}) => {
4 | return (
5 | {children}
6 | )
7 | }
8 |
9 | export default ContainerL
--------------------------------------------------------------------------------
/src/compnents/Footer.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import { Link } from 'react-router-dom'
3 | import {FaQuestion} from 'react-icons/fa'
4 | import {AiFillSetting} from 'react-icons/ai'
5 | import { useDispatch } from 'react-redux'
6 | import {userLoginInfo} from '../slices/userSlice'
7 | import { useNavigate } from 'react-router-dom'
8 | import { getAuth, signOut, updateProfile } from "firebase/auth";
9 |
10 | const Footer = () => {
11 | const auth = getAuth();
12 | let dispatch=useDispatch()
13 | let navigate=useNavigate()
14 | let [setting,setSetting]=useState(false)
15 |
16 | let handleSettingShow=()=>{
17 | setSetting(true)
18 | }
19 | let handleLogOut=()=>{
20 | signOut(auth)
21 | .then(() => {
22 | navigate('/login')
23 | dispatch(userLoginInfo(null))
24 | localStorage.removeItem('userInformation')
25 | })
26 | .catch((error) => {
27 | // An error happened.
28 | });
29 |
30 |
31 | }
32 | return (
33 | <>
34 | {setting
35 | ?
36 |
37 |
38 |
LogOut
39 | LogOut
40 | setSetting(false)} className='font-nunito py-3 px-5 bg-red-500 rounded-bl-lg text-xl text-white ml-5 mt-5 inline-block'>Cancel
41 |
42 |
43 | :
44 |
45 |
46 |
47 |
48 |
49 |
Navigation
50 |
51 | About
52 | Careers
53 | Advertising
54 | Small Business
55 |
56 |
57 |
58 |
59 |
60 |
61 | Talent Solutions
62 | Marketing Solutions
63 | Sales Solutions
64 | Safery Center
65 |
66 |
67 |
68 |
69 |
70 |
71 | Community Guidelines
72 | Privacy & Terms
73 | Mobile App
74 |
75 |
76 |
77 |
78 |
Fast access
79 |
Questions
80 |
81 |
82 |
85 |
86 |
87 |
88 |
89 | }
90 | >
91 | )
92 | }
93 |
94 | export default Footer
--------------------------------------------------------------------------------
/src/compnents/Friend.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react'
2 | import { getDatabase, ref, onValue,set,push, remove} from "firebase/database";
3 | import { useSelector } from 'react-redux'
4 |
5 | const Friend = () => {
6 | const db = getDatabase();
7 | let data=useSelector((state)=>state.userLoginInfo.userInformation)
8 | let [friendList,setFriendList]=useState([])
9 |
10 | useEffect(()=>{
11 | const starCountRef = ref(db, 'friend/');
12 | onValue(starCountRef, (snapshot) => {
13 | let arr=[]
14 | snapshot.forEach((item)=>{
15 | if(data.uid==item.val().senderid||data.uid==item.val().reciverid){
16 | arr.push({...item.val(),id:item.key})
17 | }
18 | })
19 | setFriendList(arr)
20 | });
21 | },[])
22 |
23 | let handleUnfriend=(item)=>{
24 | remove(ref(db, 'friend/'+item.id))
25 | }
26 | return (
27 |
28 |
29 | {friendList.length==0
30 | ?
31 |
No Friend Available
32 | :
33 | friendList.map((item)=>(
34 |
35 |
36 |
37 |
38 |
39 | {data.uid==item.senderid
40 | ?
41 |
{item.recivername}
42 | :
43 | {item.sendername}
44 | }
45 |
46 | email
47 |
48 |
49 | handleUnfriend(item)} className='font-nunito font-semibold text-xl bg-primary p-2 text-white rounded-br-xl ml-5 drop-shadow-md '>Unfriend
50 |
51 |
52 |
53 | ))
54 | }
55 | {}
56 |
57 |
58 |
59 | )
60 | }
61 |
62 | export default Friend
--------------------------------------------------------------------------------
/src/compnents/FriendRequest.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react'
2 | import { getDatabase, ref, onValue,set,push, remove} from "firebase/database";
3 | import { useSelector } from 'react-redux'
4 |
5 | const FriendRequest = () => {
6 | const db = getDatabase();
7 | let data=useSelector((state)=>state.userLoginInfo.userInformation)
8 | let [friendRequestList,setFriendRequestList]=useState([])
9 |
10 | useEffect(()=>{
11 | const starCountRef = ref(db, 'friendrequest/');
12 | onValue(starCountRef, (snapshot) => {
13 | let arr=[]
14 | snapshot.forEach((item)=>{
15 | if(data.uid==item.val().reciverid){
16 | arr.push({...item.val(),id:item.key})
17 | }
18 | })
19 | setFriendRequestList(arr)
20 | });
21 | },[])
22 |
23 |
24 | let handleFriendRequest=(item)=>{
25 | set(push(ref(db, 'friend/')), {
26 | ...item
27 | }).then(()=>{
28 | remove(ref(db, 'friendrequest/'+item.id))
29 | })
30 | }
31 | return (
32 |
33 |
34 | {friendRequestList.length==0
35 | ?
36 |
No Friend Request Available
37 | :
38 | friendRequestList.map((item)=>(
39 |
40 |
41 |
42 |
43 |
44 |
45 |
{item.sendername}
46 |
47 | {item.senderemail}
48 |
49 |
50 | handleFriendRequest(item)} className='font-nunito font-semibold text-xl bg-primary p-2 text-white rounded-br-xl ml-5 drop-shadow-md '>Add
51 |
52 |
53 |
54 | ))
55 | }
56 |
57 |
58 |
59 | )
60 | }
61 |
62 | export default FriendRequest
--------------------------------------------------------------------------------
/src/compnents/From.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import { useSelector } from 'react-redux'
3 | import { getDatabase, ref, set ,push} from "firebase/database";
4 | import { useNavigate } from 'react-router-dom';
5 | import { ProgressBar } from 'react-loader-spinner'
6 | import { getAuth } from 'firebase/auth';
7 |
8 | const From = () => {
9 | const auth = getAuth();
10 | const db = getDatabase();
11 | let navigate=useNavigate()
12 | console.log(auth.currentUser)
13 | let [phoneNumber,setPhoneNumber]=useState('')
14 | let [title,setTitle]=useState('')
15 | let [addres,setAddres]=useState('')
16 | let [about,setAbout]=useState('')
17 | let [experience,setExperience]=useState('')
18 | let [experienceTitle,setExperienceTitle]=useState('')
19 | let [degree,setDegree]=useState('')
20 | let [schoolName,setSchollName]=useState('')
21 | let [loader,setLoader]=useState(false)
22 |
23 | let handleTitle=(e)=>{
24 | setTitle(e.target.value)
25 | }
26 | let handleAddres=(e)=>{
27 | setAddres(e.target.value)
28 | }
29 | let handleSubmit=(e)=>{
30 | e.preventDefault()
31 | set(push(ref(db, 'userInfo/')), {
32 | admin:auth.currentUser.displayName,
33 | adminid:auth.currentUser.uid,
34 | email: auth.currentUser.email,
35 | title : title,
36 | addres:addres,
37 | about:about,
38 | experience:experience,
39 | experienceTitle:experienceTitle,
40 | degree:degree,
41 | schoolName:schoolName,
42 | phone:phoneNumber,
43 | }).then(()=>{
44 | setLoader(true)
45 | setTitle('')
46 | setAddres('')
47 | setTimeout(() => {
48 | navigate('/login')
49 |
50 | }, 2000);
51 |
52 | })
53 | }
54 | return (
55 |
119 | )
120 | }
121 |
122 | export default From
--------------------------------------------------------------------------------
/src/compnents/Navbar.js:
--------------------------------------------------------------------------------
1 | import React,{useState,useEffect} from 'react'
2 | import {BiSearchAlt2} from 'react-icons/bi'
3 | import ContainerL from './ContainerL'
4 | import { useSelector } from 'react-redux'
5 | import { getDatabase, push, ref, set,onValue } from "firebase/database";
6 | import { Link } from 'react-router-dom';
7 |
8 | const Navbar = () => {
9 | const db = getDatabase();
10 | let [postlist,setPostList]=useState([])
11 | let [filterPost,setFilterPost]=useState([])
12 | let data=useSelector((state)=>state.userLoginInfo.userInformation)
13 |
14 |
15 | useEffect(()=>{
16 | const starCountRef = ref(db, 'post/' );
17 | onValue(starCountRef, (snapshot) => {
18 | let arr=[]
19 | snapshot.forEach((item)=>{
20 | arr.push({...item.val(),id:item.key})
21 | })
22 | setPostList(arr)
23 | });
24 | },[])
25 |
26 | let handleSearch=(e)=>{
27 | let arr=[]
28 | postlist.filter((item)=>{
29 | if(item.post.toLowerCase().includes(e.target.value.toLowerCase())){
30 | setFilterPost(item)
31 | }else{
32 | setFilterPost([])
33 | }
34 |
35 |
36 | })
37 | }
38 |
39 | return (
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
51 |
52 |
53 |
54 | {data &&
55 |
56 | }
57 |
58 | {data &&
59 |
{data.displayName}
60 | }
61 |
YOU
62 |
63 |
64 |
65 |
66 | )
67 | }
68 |
69 | export default Navbar
--------------------------------------------------------------------------------
/src/compnents/NewsFeed.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react'
2 | import {GrGallery,GrSend} from 'react-icons/gr'
3 | import {BsThreeDots} from 'react-icons/bs'
4 | import { useSelector } from 'react-redux'
5 | import { getDatabase, push, ref, set,onValue } from "firebase/database";
6 | import { getStorage, ref as iref, uploadString ,getDownloadURL,uploadBytes } from "firebase/storage";
7 | import moment from 'moment/moment';
8 | import { Button } from 'flowbite-react';
9 |
10 |
11 | const NewsFeed = () => {
12 | const storage = getStorage();
13 | const db = getDatabase();
14 | let [textPost,setTextpost]=useState('')
15 | let [textPosterr,setTextposterr]=useState('')
16 | let [titleList, setTitleList] = useState([])
17 | let [postlist,setPostList]=useState([])
18 | let [photoPostModal,setPhotoPostModal]=useState(false)
19 | let [settingShow,setSettingShow]=useState(false)
20 | let [photoPostFile,setPhotoPostFile]=useState(null)
21 | let [photoPostTitle,setPhotoPostTitle]=useState('')
22 | let data=useSelector((state)=>state.userLoginInfo.userInformation)
23 |
24 | let handlePostBox=(e)=>{
25 | setTextpost(e.target.value)
26 |
27 | }
28 | let handlePostSubmit=()=>{
29 | if(!textPost){
30 | // setTextposterr('Plase write some text or send Img Then Post ')
31 | }else{
32 | set(push(ref(db, 'post/')), {
33 | admin:data.displayName,
34 | adminid:data.uid,
35 | post:textPost,
36 | date:`${new Date().getFullYear()}-${new Date().getMonth()+1}-${new Date().getDate()}- ${new Date().getHours()} ${new Date().getMinutes()}`
37 | }).then(()=>{
38 | setTextpost('')
39 | })
40 |
41 | }
42 |
43 | }
44 | let handlephotoPostModal=()=>{
45 | setPhotoPostModal(true)
46 | }
47 | let hanldePhotoPostFIle=(e)=>{
48 | console.log(e.target.files[0].name)
49 | const storageRef = iref(storage, e.target.files[0].name);
50 | uploadBytes(storageRef, e.target.files[0]).then((snapshot) => {
51 | getDownloadURL(storageRef).then((downloadURL) => {
52 | setPhotoPostFile(downloadURL)
53 | });
54 | });
55 | }
56 | let photoPostsend=(e)=>{
57 | set(push(ref(db, 'post/')), {
58 | admin:data.displayName,
59 | adminid:data.uid,
60 | img:photoPostFile,
61 | post:photoPostTitle,
62 | date:`${new Date().getFullYear()}-${new Date().getMonth()+1}-${new Date().getDate()}- ${new Date().getHours()} ${new Date().getMinutes()}`
63 |
64 | }).then(()=>{
65 | setPhotoPostModal(false)
66 | })
67 | }
68 |
69 | useEffect(()=>{
70 | const starCountRef = ref(db, 'post/' );
71 | onValue(starCountRef, (snapshot) => {
72 | let arr=[]
73 | snapshot.forEach((item)=>{
74 | arr.push({...item.val(),id:item.key})
75 | })
76 | setPostList(arr)
77 | });
78 | },[])
79 |
80 | useEffect(() => {
81 | const starCountRef = ref(db, 'userInfo/');
82 | onValue(starCountRef, (snapshot) => {
83 | let arr = []
84 | snapshot.forEach((item) => {
85 | if (data.uid == item.val().adminid) {
86 |
87 | arr.push(item.val())
88 | }
89 | })
90 | setTitleList(arr)
91 | });
92 | }, [])
93 |
94 | return (
95 | <>
96 | {photoPostModal
97 | ?
98 |
99 |
100 |
Photo Post
101 |
102 |
Photo Title
103 |
setPhotoPostTitle(e.target.value)} className='font-nunito w-full py-3 border border-solid rounded-md border-primary text-xl px-5 text-primary block mt-5 mb-5' type='input' placeholder='Headding'/>
104 |
105 |
Upload
106 |
setPhotoPostModal(false)} className='font-nunito py-3 px-5 bg-red-500 rounded-bl-lg text-xl text-white ml-5 mt-5 inline-block'>Cancel
107 |
108 |
109 | :
110 |
111 |
112 |
New Post
113 |
114 |
115 |
116 |
117 |
118 |
119 |
120 | {/* all post text */}
121 | {postlist.length==0
122 | ?
123 |
No Friend Request Available
124 | :
125 | postlist.map((item)=>(
126 |
127 |
128 |
129 |
130 |
{item.admin}
131 | {titleList.map((item)=>(
132 |
{item.title}
133 |
134 | ))}
135 |
{moment(item.date, "YYYYMMDD hh:mm").fromNow()}
136 |
137 |
138 |
139 |
140 |
141 |
{item.post}
142 |
143 |
144 |
145 | ))}
146 |
147 |
148 |
149 |
150 | }
151 | >
152 | )
153 | }
154 |
155 | export default NewsFeed
--------------------------------------------------------------------------------
/src/compnents/Profile.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react'
2 | import {IoLogoLinkedin} from 'react-icons/io'
3 | import {MdOutlineCloudUpload} from 'react-icons/md'
4 | import { useSelector ,useDispatch} from 'react-redux'
5 | import { getDatabase, ref, onValue,set} from "firebase/database";
6 | import { useNavigate } from 'react-router-dom';
7 |
8 |
9 | const Profile = () => {
10 | let navigate=useNavigate()
11 | let [titleList,setTitleList]=useState([])
12 | let [coverList,setCoverList]=useState([])
13 | const db = getDatabase();
14 | let data=useSelector((state)=>state.userLoginInfo.userInformation)
15 |
16 | useEffect(()=>{
17 | const starCountRef = ref(db, 'userInfo/');
18 | onValue(starCountRef, (snapshot) => {
19 | let arr=[]
20 | snapshot.forEach((item)=>{
21 | if(data.uid==item.val().adminid){
22 |
23 | arr.push(item.val())
24 | }
25 | })
26 | setTitleList(arr)
27 | });
28 | },[])
29 |
30 | useEffect(()=>{
31 | const starCountRef = ref(db, 'coverPhoto/');
32 | onValue(starCountRef, (snapshot) => {
33 | let arr=[]
34 | snapshot.forEach((item)=>{
35 |
36 | if(data.uid==item.key){
37 |
38 | arr.push(item.val())
39 | }
40 |
41 | })
42 | setCoverList(arr)
43 | });
44 | },[])
45 |
46 | let handleMyprofile=()=>{
47 | navigate('/profile')
48 | }
49 | return (
50 |
51 |
52 | {coverList.length==0
53 | ?
54 |
55 | :
56 | coverList.map((item)=>(
57 |
58 | ))
59 | }
60 |
61 |
62 |
63 |
64 |
65 |
66 |
67 |
{data.displayName}
68 | {titleList.map((item)=>(
69 |
{item.title}
70 | ))}
71 |
72 |
73 |
74 | )
75 | }
76 |
77 | export default Profile
--------------------------------------------------------------------------------
/src/compnents/Project.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react'
2 | import { MdOutlineCloudUpload ,MdOutlineCloseFullscreen} from 'react-icons/md'
3 | import { getStorage, ref, uploadBytes,getDownloadURL } from "firebase/storage";
4 | import { getDatabase, push, ref as dref, set ,onValue} from "firebase/database";
5 | import { useSelector } from 'react-redux';
6 |
7 |
8 | const Project = () => {
9 | const db = getDatabase();
10 | const storage = getStorage();
11 | let [projectModal,setProjectModal]=useState(false)
12 | let [porjectImg,setProjectImg]=useState(null)
13 | let [porjectList,setProjectList]=useState([])
14 | let data = useSelector((state) => state.userLoginInfo.userInformation)
15 |
16 | let handleProjectFile=(e)=>{
17 | const storageRef = ref(storage, e.target.files[0].name);
18 | uploadBytes(storageRef, e.target.files[0]).then((snapshot) => {
19 | getDownloadURL(storageRef).then((downloadURL) => {
20 | setProjectImg(downloadURL)
21 | });
22 | });
23 | }
24 |
25 | let handleUploadProject=()=>{
26 | set(push(dref(db, 'project/')), {
27 | admin:data.displayName,
28 | adminid:data.uid,
29 | porjectimg:porjectImg,
30 | }).then(()=>{
31 | setProjectModal(false)
32 | })
33 | }
34 | useEffect(()=>{
35 | const starCountRef = dref(db, 'project/');
36 | onValue(starCountRef, (snapshot) => {
37 | let arr=[]
38 | snapshot.forEach((item)=>{
39 | if(data.uid==item.val().adminid){
40 | arr.push({...item.val(),id:item.key})
41 | }
42 | })
43 | setProjectList(arr)
44 | });
45 | },[])
46 | return (
47 |
48 |
49 |
Project
50 |
3 of 12
51 |
52 |
53 |
54 |
55 |
56 |
57 |
58 | setProjectModal(true)} className='text-3xl text-white ' />
59 |
60 |
61 |
62 |
Upload Your Project
63 |
64 |
65 |
66 |
67 |
68 | {porjectList.map((item)=>(
69 |
70 |
71 |
72 |
73 |
74 |
75 |
76 |
77 | ))}
78 | {/*
79 |
80 |
81 |
82 |
setProjectModal(true)} className='w-full h-0 group-hover:h-full bg-[rgba(0,0,0,.7)] absolute top-0 left-0 flex justify-center items-center ease-linear duration-300'>
83 |
84 |
85 |
86 |
87 |
88 |
*/}
89 |
90 |
91 | {projectModal &&
92 |
93 |
setProjectModal(false)} className='text-red-500 text-3xl absolute top-3 right-3'/>
94 |
95 |
Upload Your Project
96 |
97 |
98 |
99 |
Upload
100 |
101 |
102 | }
103 |
104 |
Show all (12)
105 |
106 | )
107 | }
108 |
109 | export default Project
--------------------------------------------------------------------------------
/src/compnents/UserList.js:
--------------------------------------------------------------------------------
1 | import React, { useEffect, useState } from 'react'
2 | import { getDatabase, ref, onValue,set,push} from "firebase/database";
3 | import { useSelector } from 'react-redux'
4 |
5 |
6 | const UserList = () => {
7 | const db = getDatabase();
8 | let data=useSelector((state)=>state.userLoginInfo.userInformation)
9 | let [userList,setUserList]=useState([])
10 | let [friendRequestList,setFriendRequestList]=useState([])
11 | let [friendList,setFriendList]=useState([])
12 | let [filterUserlist,setFilterUserlist]=useState([])
13 |
14 |
15 |
16 | useEffect(()=>{
17 | const starCountRef = ref(db, 'user/');
18 | onValue(starCountRef, (snapshot) => {
19 | let arr=[]
20 | snapshot.forEach((item)=>{
21 | if(data.uid!=item.key){
22 | arr.push({...item.val(),id:item.key})
23 |
24 | }
25 | })
26 | setUserList(arr)
27 | });
28 | },[])
29 |
30 |
31 |
32 | let handleFriendRequest=(item)=>{
33 | set(push(ref(db, 'friendrequest/')), {
34 | senderid:data.uid,
35 | sendername:data.displayName,
36 | senderemail:data.email,
37 | reciverid:item.id,
38 | recivername:item.name,
39 | reciveremail:item.email,
40 | });
41 | }
42 |
43 |
44 |
45 | useEffect(()=>{
46 | const starCountRef = ref(db, 'friendrequest/');
47 | onValue(starCountRef, (snapshot) => {
48 | let arr=[]
49 | snapshot.forEach((item)=>{
50 | arr.push(item.val().senderid+item.val().reciverid)
51 | })
52 | setFriendRequestList(arr)
53 | });
54 | },[])
55 | useEffect(()=>{
56 | const starCountRef = ref(db, 'friend/');
57 | onValue(starCountRef, (snapshot) => {
58 | let arr=[]
59 | snapshot.forEach((item)=>{
60 | arr.push(item.val().senderid+item.val().reciverid)
61 | })
62 | setFriendList(arr)
63 | });
64 | },[])
65 |
66 | let handleSearch=(e)=>{
67 | let arr=[]
68 | userList.filter((item)=>{
69 | if(item.name.toLowerCase().includes(e.target.value)){
70 | arr.push(item)
71 | }
72 | setFilterUserlist(arr)
73 | })
74 | }
75 |
76 |
77 |
78 | return (
79 |
80 |
User List
81 |
82 |
83 |
84 | {filterUserlist.length==0?
85 | userList.map((item)=>(
86 |
87 |
88 |
89 |
90 |
91 |
{item.name}
92 | {item.email}
93 |
94 |
95 | {friendList.includes(data.uid+item.id )|| friendList.includes(item.id+data.uid)
96 | ?
97 | F
98 | :
99 | friendRequestList.includes(data.uid+item.id )|| friendRequestList.includes(item.id+data.uid)
100 | ?
101 | p
102 | :
103 | handleFriendRequest(item)} className='font-nunito font-semibold text-xl bg-primary p-2 text-white rounded-br-xl ml-5 drop-shadow-md '>Add
104 |
105 | }
106 |
107 |
108 |
109 | ))
110 | :
111 | filterUserlist.map((item)=>(
112 |
113 |
114 |
115 |
116 |
117 |
{item.name}
118 | {item.email}
119 |
120 |
121 | {friendList.includes(data.uid+item.id )|| friendList.includes(item.id+data.uid)
122 | ?
123 | F
124 | :
125 | friendRequestList.includes(data.uid+item.id )|| friendRequestList.includes(item.id+data.uid)
126 | ?
127 | p
128 | :
129 | handleFriendRequest(item)} className='font-nunito font-semibold text-xl bg-primary p-2 text-white rounded-br-xl ml-5 drop-shadow-md '>Add
130 |
131 | }
132 |
133 |
134 |
135 | ))
136 |
137 | }
138 |
139 |
140 |
141 | )
142 | }
143 |
144 | export default UserList
--------------------------------------------------------------------------------
/src/firebaseConfig.js:
--------------------------------------------------------------------------------
1 | // Import the functions you need from the SDKs you need
2 | import { initializeApp } from "firebase/app";
3 | // TODO: Add SDKs for Firebase products that you want to use
4 | // https://firebase.google.com/docs/web/setup#available-libraries
5 |
6 | // Your web app's Firebase configuration
7 | const firebaseConfig = {
8 | apiKey: "AIzaSyAXvNkijgbP6ctjP5B0IMtQdnS5FrkqPM8",
9 | authDomain: "linkdin-ab33e.firebaseapp.com",
10 | projectId: "linkdin-ab33e",
11 | storageBucket: "linkdin-ab33e.appspot.com",
12 | messagingSenderId: "730110464743",
13 | appId: "1:730110464743:web:90839fc944f348064e8842"
14 | };
15 |
16 | // Initialize Firebase
17 | const app = initializeApp(firebaseConfig);
18 | export default firebaseConfig;
--------------------------------------------------------------------------------
/src/index.css:
--------------------------------------------------------------------------------
1 | @tailwind base;
2 | @tailwind components;
3 | @tailwind utilities;
4 |
--------------------------------------------------------------------------------
/src/index.js:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css'
4 | import App from './App';
5 | import { createRoot } from "react-dom/client";
6 | import firebaseConfig from './firebaseConfig';
7 | import 'tw-elements';
8 | import {
9 | createBrowserRouter,
10 | RouterProvider,
11 | Route,
12 | Link,
13 | } from "react-router-dom";
14 | import Login from './pages/Login';
15 | import Sinup from './pages/Sinup';
16 | import Home from './pages/Home';
17 | import From from './compnents/From';
18 | import store from './store'
19 | import { Provider } from 'react-redux'
20 | import Profile from './pages/Profile';
21 |
22 | const router = createBrowserRouter([
23 | {
24 | path: "/",
25 | element: (
26 |
27 |
28 |
29 | ),
30 | },
31 | {
32 | path: "/login",
33 | element: (
34 |
35 |
36 |
37 | ),
38 | },
39 | {
40 | path: "/home",
41 | element: (
42 |
43 | ),
44 | },
45 | {
46 | path: "/form",
47 | element: (
48 |
49 | ),
50 | },
51 | {
52 | path: "/profile",
53 | element: (
54 |
55 | ),
56 | },
57 |
58 | ]);
59 |
60 | const root = ReactDOM.createRoot(document.getElementById('root'));
61 | root.render(
62 |
63 |
64 |
65 | );
66 |
67 |
--------------------------------------------------------------------------------
/src/pages/Home.js:
--------------------------------------------------------------------------------
1 | import React,{useState,useEffect} from 'react'
2 | import Container from '../compnents/Container'
3 | import Footer from '../compnents/Footer'
4 | import Navbar from '../compnents/Navbar'
5 | import NewsFeed from '../compnents/NewsFeed'
6 | import Profile from '../compnents/Profile'
7 | import { getAuth, onAuthStateChanged, } from "firebase/auth";
8 | import { userLoginInfo } from '../slices/userSlice';
9 | import { useDispatch, useSelector} from 'react-redux'
10 | import { useNavigate } from 'react-router-dom'
11 | import UserList from '../compnents/UserList'
12 |
13 | const Home = () => {
14 | const auth = getAuth();
15 | let navigate=useNavigate()
16 | let [verify,setVerify]=useState(false )
17 | let dispatch=useDispatch()
18 | let data=useSelector((state)=>state.userLoginInfo.userInformation)
19 |
20 | onAuthStateChanged(auth, (user) => {
21 | if(user.emailVerified==true){
22 | setVerify(true)
23 | // dispatch(userLoginInfo(user))
24 | // localStorage.setItem('userInformation',JSON.stringify(user))
25 | }
26 | });
27 |
28 | useEffect(()=>{
29 | if(!data){
30 | navigate('/login')
31 | }
32 | },[])
33 | return (
34 | <>
35 | {verify
36 | ?
37 | <>
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
49 |
50 |
51 | >
52 | :
53 |
54 |
Please Verify Your Email
55 |
56 | }
57 |
58 | >
59 | )
60 | }
61 |
62 | export default Home
--------------------------------------------------------------------------------
/src/pages/Login.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import { getAuth, signInWithEmailAndPassword } from "firebase/auth";
3 | import { useNavigate } from 'react-router-dom';
4 | import { ProgressBar } from 'react-loader-spinner'
5 | import { useDispatch } from 'react-redux';
6 | import {userLoginInfo} from '../slices/userSlice'
7 | import {AiFillEyeInvisible,AiFillEye} from 'react-icons/ai'
8 | import { Link } from 'react-router-dom';
9 | import 'react-toastify/dist/ReactToastify.css';
10 | import { ToastContainer, toast } from 'react-toastify';
11 |
12 |
13 | const Login = () => {
14 | const auth = getAuth();
15 | let dispatch=useDispatch()
16 | let navigate=useNavigate()
17 | let [email,setEmail]=useState('')
18 | let [password,setPassword]=useState('')
19 | let [emailerr,setEmailerr]=useState('')
20 | let [passworderr,setPassworderr]=useState('')
21 | let [loader,setLoader]=useState(false)
22 | let [passwordShow,setPasswordShow]=useState(false)
23 | let handleEmail=(e)=>{
24 | setEmail(e.target.value)
25 | setEmailerr('')
26 | }
27 |
28 | let handlePassword=(e)=>{
29 | setPassword(e.target.value)
30 | setPassworderr('')
31 | }
32 | let handleSubmit=()=>{
33 | if(!email){
34 | setEmailerr('Email Is Required')
35 | }else if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
36 | setEmailerr('Invalid Email')
37 | }
38 | if(!password){
39 | setPassworderr('Password Is Required')
40 | }
41 | if(email && password &&/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) ){
42 | signInWithEmailAndPassword(auth, email, password)
43 | .then((user) => {
44 | toast.success("Login Successful ");
45 | dispatch(userLoginInfo(user.user))
46 | localStorage.setItem('userInformation',JSON.stringify(user.user))
47 | setLoader(true)
48 | console.log(user)
49 | setTimeout(() => {
50 | navigate('/home')
51 |
52 | }, 2000);
53 | })
54 | .catch((error) => {
55 | console.log(error.code)
56 | if(error.code.includes('auth/wrong-password')){
57 | setPassworderr('Wrong Password')
58 | }
59 | if(error.code.includes('auth/user-not-found')){
60 | setEmailerr('Email Not Found Please Singup')
61 | }
62 | });
63 | }
64 | }
65 |
66 | return (
67 |
68 |
80 |
81 |
82 |
Login
83 |
Free register and you can enjoy it
84 |
85 |
86 | {emailerr &&
87 |
{emailerr}
88 | }
89 | Email Addres
90 |
91 |
92 |
93 |
94 | {passworderr &&
95 |
{passworderr}
96 | }
97 |
Password
98 | {passwordShow ?
99 |
setPasswordShow(!passwordShow)} className='absolute top-7 right-4 text-xl'/>
100 | :
101 | setPasswordShow(!passwordShow)} className='absolute top-7 right-4 text-xl'/>
102 | }
103 |
104 | {loader
105 | ?
106 |
107 |
118 | :
119 |
Sign In
120 | }
121 |
Already have an account ? SingUp
122 |
123 |
124 | )
125 | }
126 |
127 | export default Login
--------------------------------------------------------------------------------
/src/pages/Profile.js:
--------------------------------------------------------------------------------
1 | import React, { useState, useEffect } from 'react'
2 | import Navbar from '../compnents/Navbar'
3 | import Container from '../compnents/Container'
4 | import Footer from '../compnents/Footer'
5 | import { ImRocket } from 'react-icons/im'
6 | import { MdOutlineCloudUpload } from 'react-icons/md'
7 | import { useSelector, useDispatch } from 'react-redux'
8 | import { getDatabase, ref, onValue, set, update } from "firebase/database";
9 | import { getStorage, ref as iref, uploadString, getDownloadURL, uploadBytes } from "firebase/storage";
10 | import { getAuth, onAuthStateChanged, signOut, updateProfile, } from "firebase/auth";
11 | import { userLoginInfo } from '../slices/userSlice';
12 | import { useNavigate } from 'react-router-dom'
13 | import Cropper from "react-cropper";
14 | import "cropperjs/dist/cropper.css";
15 | import moment from 'moment/moment';
16 | import { BsThreeDots } from 'react-icons/bs'
17 | import { BiEdit } from 'react-icons/bi'
18 | import { GrClose } from 'react-icons/gr'
19 | import Project from '../compnents/Project'
20 | import FriendRequest from './../compnents/FriendRequest';
21 | import Friend from '../compnents/Friend'
22 |
23 | import { RotatingLines } from 'react-loader-spinner'
24 | import {AiOutlineCloudUpload} from 'react-icons/ai'
25 |
26 | const Profile = () => {
27 | const db = getDatabase();
28 | const auth = getAuth();
29 | let navigate = useNavigate()
30 | const storage = getStorage();
31 | let dispatch = useDispatch()
32 | let [coverList, setCoverList] = useState([])
33 | let [expriList, setExpriList] = useState([])
34 | let [eduiList, setEduiList] = useState([])
35 | let [titleList, setTitleList] = useState([])
36 | let [postlist, setPostList] = useState([])
37 | let data = useSelector((state) => state.userLoginInfo.userInformation)
38 | // let [verify, setVerify] = useState(false)
39 | let [modalShow, setModalshow] = useState(false)
40 | let [CoverImg, setCoverImg] = useState(null)
41 | let [expriImg, setExpriImg] = useState(null)
42 | let [eduImg, setEduImg] = useState(null)
43 | let [coverModalShow, setCoverModalShow] = useState(false)
44 | let [contactShow, setContactShow] = useState(false)
45 | let [titleModalShow, setTitleModalShow] = useState(false)
46 | let [editInfo, setEditInfo] = useState(false)
47 | let [aboutChange, setAboutChange] = useState('')
48 | let [id, setId] = useState('')
49 | let [profileTitle, setProfileTitle] = useState('')
50 | let [profileAbout, setProfileAbout] = useState('')
51 | let [phoneChange, setPhoneChange] = useState('')
52 | let [addressChange, setAddressChange] = useState('')
53 | let [experienceChange, setExperienceChange] = useState('')
54 | let [experienceTitleChange, setExperienceTitleChange] = useState('')
55 | let [schoolChange, setSchoolChange] = useState('')
56 | let [degreeChange, setDegreeChange] = useState('')
57 | let [loder, setLoader] = useState(false)
58 | let [expriShow, setExpriShow] = useState(false)
59 | let [eduShow, setEduShow] = useState(false)
60 |
61 |
62 | useEffect(() => {
63 | if (!data) {
64 | navigate('/login')
65 | }
66 | }, [])
67 | // useEffect(() => {
68 | // if (data.emailVerified) {
69 | // setVerify(true)
70 | // }
71 | // }, [])
72 |
73 | onAuthStateChanged(auth, (user) => {
74 | // if(user.emailVerified){
75 | // setVerify(true)
76 | // }
77 | dispatch(userLoginInfo(user))
78 | localStorage.setItem('userInformation', JSON.stringify(user))
79 | });
80 |
81 |
82 | const [image, setImage] = useState();
83 | const [cropData, setCropData] = useState('');
84 | const [cropper, setCropper] = useState();
85 |
86 | const onChange = (e) => {
87 | e.preventDefault();
88 | let files;
89 | if (e.dataTransfer) {
90 | files = e.dataTransfer.files;
91 | } else if (e.target) {
92 | files = e.target.files;
93 | }
94 | const reader = new FileReader();
95 | reader.onload = () => {
96 | setImage(reader.result);
97 | };
98 | reader.readAsDataURL(files[0]);
99 | };
100 |
101 | const getCropData = () => {
102 | setLoader(true)
103 | if (typeof cropper !== "undefined") {
104 | setCropData(cropper.getCroppedCanvas().toDataURL());
105 | const message4 = cropper.getCroppedCanvas().toDataURL();
106 | const storageRef = iref(storage, auth.currentUser.uid);
107 | uploadString(storageRef, message4, 'data_url').then((snapshot) => {
108 | getDownloadURL(storageRef).then((downloadURL) => {
109 | updateProfile(auth.currentUser, {
110 | photoURL: downloadURL
111 | }).then(() => {
112 | setModalshow(false)
113 | setLoader(false)
114 | })
115 | });
116 | });
117 | }
118 | };
119 |
120 | let coverImgInfo = (e) => {
121 | const storageRef = iref(storage, 'some-child');
122 | uploadBytes(storageRef, e.target.files[0]).then((snapshot) => {
123 | getDownloadURL(storageRef).then((downloadURL) => {
124 | setCoverImg(downloadURL)
125 | });
126 | });
127 | }
128 | let coverImgSubmit = (e) => {
129 | set(ref(db, 'coverPhoto/' + data.uid), {
130 | coverimg: CoverImg,
131 | admin: data.displayName,
132 | }).then(() => {
133 | setCoverModalShow(false)
134 | })
135 | }
136 | let expriImgInfo = (e) => {
137 | const storageRef = iref(storage, e.target.files[0].name);
138 | uploadBytes(storageRef, e.target.files[0]).then((snapshot) => {
139 | getDownloadURL(storageRef).then((downloadURL) => {
140 | setExpriImg(downloadURL)
141 | });
142 | });
143 | }
144 | let handleExpriImgSubmit = (e) => {
145 | set(ref(db, 'exprianceimg/' + data.uid), {
146 | expriImg: expriImg,
147 | admin: data.displayName,
148 | }).then(() => {
149 | setExpriShow(false)
150 | })
151 | }
152 | let eduImgInfo = (e) => {
153 | const storageRef = iref(storage, e.target.files[0].name);
154 | uploadBytes(storageRef, e.target.files[0]).then((snapshot) => {
155 | getDownloadURL(storageRef).then((downloadURL) => {
156 | setEduImg(downloadURL)
157 | });
158 | });
159 | }
160 | let handleEduimgSubmit = (e) => {
161 | set(ref(db, 'eduimg/' + data.uid), {
162 | eduImg: eduImg,
163 | admin: data.displayName,
164 | }).then(() => {
165 | setEduShow(false)
166 | })
167 | }
168 |
169 | useEffect(() => {
170 | const starCountRef = ref(db, 'userInfo/');
171 | onValue(starCountRef, (snapshot) => {
172 | let arr = []
173 | snapshot.forEach((item) => {
174 | if (data.uid == item.val().adminid) {
175 |
176 | arr.push({ ...item.val(), id: item.key })
177 | }
178 | })
179 | setTitleList(arr)
180 | });
181 | }, [])
182 |
183 | useEffect(() => {
184 | const starCountRef = ref(db, 'coverPhoto/');
185 | onValue(starCountRef, (snapshot) => {
186 | let arr = []
187 | snapshot.forEach((item) => {
188 |
189 | if (data.uid == item.key) {
190 |
191 | arr.push(item.val())
192 | }
193 |
194 | })
195 | setCoverList(arr)
196 | });
197 | }, [])
198 | useEffect(() => {
199 | const starCountRef = ref(db, 'exprianceimg/');
200 | onValue(starCountRef, (snapshot) => {
201 | let arr = []
202 | snapshot.forEach((item) => {
203 |
204 | if (data.uid == item.key) {
205 |
206 | arr.push(item.val())
207 | }
208 |
209 | })
210 | setExpriList(arr)
211 | });
212 | }, [])
213 | useEffect(() => {
214 | const starCountRef = ref(db, 'eduimg/');
215 | onValue(starCountRef, (snapshot) => {
216 | let arr = []
217 | snapshot.forEach((item) => {
218 |
219 | if (data.uid == item.key) {
220 |
221 | arr.push(item.val())
222 | }
223 |
224 | })
225 | setEduiList(arr)
226 | });
227 | }, [])
228 |
229 | useEffect(() => {
230 | const starCountRef = ref(db, 'post/');
231 | onValue(starCountRef, (snapshot) => {
232 | let arr = []
233 | snapshot.forEach((item) => {
234 | if (data.uid == item.val().adminid) {
235 | arr.push(item.val())
236 |
237 | }
238 | })
239 | setPostList(arr)
240 | });
241 | }, [])
242 |
243 | let handleTitleUpdate = () => {
244 | update(ref(db, 'userInfo/' + id), {
245 | about: aboutChange,
246 | }).then(() => {
247 | setTitleModalShow(false)
248 | })
249 | }
250 | let handelSetId = (item) => {
251 | setId(item.id)
252 | setTitleModalShow(true)
253 | }
254 |
255 | let handleEditProfile = (item) => {
256 | setId(item.id)
257 | setEditInfo(true)
258 | }
259 | let handleProfileUpdate = (e) => {
260 | e.preventDefault()
261 | update(ref(db, 'userInfo/' + id), {
262 | about: profileAbout,
263 | title: profileTitle,
264 | phone: phoneChange,
265 | addres: addressChange,
266 | degree: degreeChange,
267 | schoolName: schoolChange,
268 | experience: experienceChange,
269 | experienceTitle: experienceTitleChange,
270 |
271 | }).then(() => {
272 | setEditInfo(false)
273 | })
274 | }
275 | return (
276 |
277 | <>
278 | {coverModalShow
279 | ?
280 | (
281 |
282 |
Upload Your Profile Photo
283 |
284 |
285 |
Upload
286 |
setCoverModalShow(false)} className='font-nunito py-3 px-5 bg-red-500 rounded-bl-lg text-xl text-white ml-5 mt-5 inline-block'>Cancel
287 |
288 |
)
289 | : modalShow ?
290 | (
291 |
292 |
Upload Your Profile Photo
293 |
294 |
295 | {image ?
296 |
297 | :
298 |
299 | }
300 |
301 | {image &&
302 |
303 | {
317 | setCropper(instance);
318 | }}
319 | guides={true}
320 | />
321 |
322 | }
323 |
324 | {loder ?
325 |
332 | :
333 | Upload
334 | }
335 | setModalshow(false)} className='font-nunito py-3 px-5 bg-red-500 rounded-bl-lg text-xl text-white ml-5 mt-5 inline-block'>Cancel
336 |
337 |
338 |
)
339 | :
340 | (<>
341 |
342 |
343 |
344 |
345 |
346 | {coverList.length == 0
347 | ?
348 |
349 | :
350 | coverList.map((item) => (
351 |
352 | ))
353 | }
354 |
355 |
setCoverModalShow(true)} className='w-full h-[0%] group-hover:h-[100%] bg-[rgba(0,0,0,.5)] absolute top-0 left-0 ease-in-out duration-300 flex justify-center items-center'>
356 |
357 |
358 |
359 | {/* profile and cover start */}
360 |
361 |
362 | {data &&
363 |
364 | }
365 |
setModalshow(true)} className='w-full h-[0%] group-hover:h-[100%] bg-[rgba(0,0,0,.5)] absolute top-0 left-0 ease-in-out duration-300 flex justify-center items-center'>
366 |
367 |
368 |
369 |
370 | {data &&
371 |
{data.displayName}
372 | }
373 | {titleList.map((item) => (
374 |
375 |
376 |
{item.title}
377 |
378 |
{item.addres}
379 |
380 |
381 |
382 | ))}
383 |
384 |
setContactShow(!contactShow)} className='font-nunito font-normal text-xl bg-[#0274AF] w-[170px] py-2 text-white rounded-md mt-3 mb-8'>Contact info
385 | {titleList.map((item) => (
386 |
handleEditProfile(item)} className='font-nunito font-normal text-xl bg-[#0274AF] w-[170px] py-2 text-white rounded-md mt-3 mb-8 ml-5'>Edit Profile
387 |
388 | ))}
389 | {contactShow
390 | &&
391 | titleList.map((item) => (
392 |
393 |
394 |
Phone:{item.phone}
395 | Email: {item.email}
396 |
397 | ))
398 | }
399 |
400 |
401 |
402 | {/* fsafhdsahdhf */}
403 |
404 |
481 |
482 |
483 |
484 |
About
485 |
486 | {titleList.map((item) => (
487 |
488 |
{item.about}
489 |
handelSetId(item)} className='bg-[#dad5d5] border border-solid border-black p-3 flex gap-x-2 absolute top-5 left-32 rounded-br-xl items-center hover:bg-primary hover:text-white ease-in-out duration-300' >
490 | Edit
491 |
492 |
493 |
494 | ))}
495 |
496 |
See more
497 |
498 |
499 |
504 |
505 | {postlist.length==0
506 | ?
507 |
No Post Available
508 | :
509 | postlist.map((item) => (
510 |
511 |
512 |
513 |
514 |
{item.admin}
515 |
516 | {titleList.map((item) => (
517 |
{item.title}
518 |
519 | ))}
520 |
{moment(item.date, "YYYYMMDD hh:mm").fromNow()}
521 |
522 |
523 |
524 |
525 |
{item.post}
526 |
527 |
528 |
529 | ))}
530 |
531 |
532 |
533 | {/*
No Friend available */}
534 |
535 |
536 |
537 |
538 |
539 |
540 | {/* fsafhdsahdhf */}
541 |
542 | {/* experience start */}
543 |
544 |
Experience
545 |
546 |
547 | {expriList.length==0
548 | ?
549 |
550 | :
551 | expriList.map((item)=>(
552 |
553 | ))
554 | }
555 |
setExpriShow(true)} className='w-full h-0 group-hover:h-full ease-in-out duration-300 bg-[rgba(0,0,0,.6)] absolute
556 | top-0 left-0 flex justify-center items-center '>
557 |
558 |
559 |
560 |
561 | {titleList.map((item) => (
562 |
563 |
{item.experience}
564 | {item.experienceTitle}
565 |
566 |
567 | ))}
568 |
569 |
570 |
571 |
572 | {/* experience start */}
573 |
574 |
Education
575 |
576 |
577 | {eduiList.length==0
578 | ?
579 |
580 | :
581 | eduiList.map((item)=>(
582 |
583 | ))
584 | }
585 |
586 |
setEduShow(true)} className='w-full h-0 group-hover:h-full ease-in-out duration-300 bg-[rgba(0,0,0,.6)] absolute
587 | top-0 left-0 flex justify-center items-center '>
588 |
589 |
590 |
591 |
592 | {titleList.map((item) => (
593 |
594 |
595 |
{item.schoolName}
596 |
{item.degree}
597 |
Additional English classes and UX profile courses.
598 |
599 | ))}
600 |
601 |
602 |
603 |
604 |
605 |
606 |
607 | >)
608 | }
609 | {/* modal title start */}
610 | {titleModalShow &&
611 |
612 |
613 |
Update BIO
614 | {titleList.map((item) => (
615 | setAboutChange(e.target.value)} className='border border-solid border-black rounded-md w-full py-3 px-5 mb-5' defaultValue={item.about} />
616 |
617 | ))}
618 | Update
619 | setTitleModalShow(false)} className='bg-red-500 text-xl font-nunito p-3 text-white rounded-md ml-2'>Cancle
620 |
621 |
622 |
623 | }
624 | {/* modal title end */}
625 | {editInfo &&
626 | titleList.map((item) => (
627 |
628 |
setEditInfo(false)} className='ml-auto mt-10 mr-10 text-2xl ' />
629 |
677 |
678 | ))
679 | }
680 | {expriShow &&
681 |
683 |
684 |
Upload Your Experiance Image
685 |
686 |
687 | {expriImg?
688 |
689 | :
690 |
691 | }
692 |
693 |
694 |
Upload
695 |
setExpriShow(false)} className='font-nunito py-3 px-5 bg-red-500 rounded-bl-lg text-xl text-white ml-5 mt-5 inline-block'>Cancel
696 |
697 |
698 | }
699 | {eduShow &&
700 |
702 |
703 |
Upload Your Education Image
704 |
705 |
706 | {eduImg?
707 |
708 | :
709 |
710 | }
711 |
712 |
713 |
Upload
714 |
setEduShow(false)} className='font-nunito py-3 px-5 bg-red-500 rounded-bl-lg text-xl text-white ml-5 mt-5 inline-block'>Cancel
715 |
716 |
717 | }
718 | >
719 | )
720 | }
721 |
722 | export default Profile
--------------------------------------------------------------------------------
/src/pages/Sinup.js:
--------------------------------------------------------------------------------
1 | import React, { useState } from 'react'
2 | import { getAuth, createUserWithEmailAndPassword,sendEmailVerification,updateProfile } from "firebase/auth";
3 | import { useNavigate } from 'react-router-dom';
4 | import { useDispatch } from 'react-redux';
5 | import { Link } from 'react-router-dom';
6 | import { getDatabase, ref, set ,push} from "firebase/database";
7 | import { ProgressBar } from 'react-loader-spinner'
8 | import {AiFillEyeInvisible,AiFillEye} from 'react-icons/ai'
9 | import { ToastContainer, toast } from 'react-toastify';
10 | import 'react-toastify/dist/ReactToastify.css';
11 |
12 | const Sinup = () => {
13 | const auth = getAuth();
14 | const db = getDatabase();
15 |
16 | let navigate=useNavigate()
17 | let [email,setEmail]=useState('')
18 | let [password,setPassword]=useState('')
19 | let [name,setName]=useState('')
20 | let [nameerr,setNameerr]=useState('')
21 | let [emailerr,setEmailerr]=useState('')
22 | let [passworderr,setPassworderr]=useState('')
23 | let [loader,setLoader]=useState(false)
24 | let [passwordShow,setPasswordShow]=useState(false)
25 |
26 | let handleEmail=(e)=>{
27 | setEmail(e.target.value)
28 | setEmailerr('')
29 | }
30 | let handleFullname=(e)=>{
31 | setName(e.target.value)
32 | setNameerr('')
33 | }
34 |
35 | let handlePassword=(e)=>{
36 | setPassword(e.target.value)
37 | setPassworderr('')
38 | }
39 | let handleSubmit=()=>{
40 | if(!email){
41 | setEmailerr('Email Is Required')
42 | }else if(!/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email)){
43 | setEmailerr('Invalid Email')
44 | }
45 | if(!password){
46 | setPassworderr('Password Is Required')
47 | }
48 | if(!name){
49 | setNameerr('Name Is Required')
50 | }
51 | if(email && password && name&&/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(email) ){
52 | createUserWithEmailAndPassword(auth, email, password)
53 | .then((user) => {
54 | sendEmailVerification(auth.currentUser)
55 | .then(() => {
56 | updateProfile(auth.currentUser, {
57 | displayName: name, photoURL: 'images/profile.png'
58 | }).then(() => {
59 | toast.success("Registration Successful ");
60 | setLoader(true)
61 | setEmail('')
62 | setPassword('')
63 | setName('')
64 | setTimeout(() => {
65 | navigate('/form')
66 |
67 | }, 2000);
68 |
69 | set(ref(db, 'user/'+user.user.uid), {
70 | name:name,
71 | email:email,
72 | })
73 | }).catch((error) => {
74 | console.log(error.code)
75 | });
76 |
77 | });
78 |
79 |
80 | })
81 | .catch((error) => {
82 | if(error.code.includes('auth/email-already-in-use')){
83 | setEmailerr('Email Already In use')
84 | }
85 | console.log(error.code)
86 | });
87 | }
88 | }
89 | return (
90 |
91 |
103 |
104 |
105 |
Get started with easily register
106 |
Free register and you can enjoy it
107 |
108 |
109 | {emailerr &&
110 |
{emailerr}
111 | }
112 | Email Addres
113 |
114 |
115 |
116 | {nameerr &&
117 |
{nameerr}
118 | }
119 | Full name
120 |
121 |
122 |
123 | {passworderr &&
124 |
{passworderr}
125 | }
126 |
Password
127 | {passwordShow ?
128 |
setPasswordShow(!passwordShow)} className='absolute top-7 right-4 text-xl'/>
129 | :
130 | setPasswordShow(!passwordShow)} className='absolute top-7 right-4 text-xl'/>
131 | }
132 |
133 | {loader
134 | ?
135 |
146 | :
147 |
Sign up
148 | }
149 |
Already have an account ? Sign In
150 |
151 |
152 | )
153 | }
154 |
155 | export default Sinup
--------------------------------------------------------------------------------
/src/slices/userSlice.js:
--------------------------------------------------------------------------------
1 | import { createSlice } from '@reduxjs/toolkit'
2 |
3 | export const userSlice = createSlice({
4 | name: 'user',
5 | initialState: {
6 | userInformation: localStorage.getItem('userInformation')?JSON.parse(localStorage.getItem('userInformation')):null,
7 | },
8 | reducers: {
9 | userLoginInfo: (state,action) => {
10 | state.userInformation=action.payload
11 | },
12 |
13 | },
14 | })
15 |
16 | export const { userLoginInfo} = userSlice.actions
17 |
18 | export default userSlice.reducer
--------------------------------------------------------------------------------
/src/store.js:
--------------------------------------------------------------------------------
1 | import { configureStore } from '@reduxjs/toolkit'
2 | import userSlice from './slices/userSlice'
3 |
4 | export default configureStore({
5 | reducer: {
6 | userLoginInfo:userSlice
7 | },
8 | })
--------------------------------------------------------------------------------
/tailwind.config.js:
--------------------------------------------------------------------------------
1 | /** @type {import('tailwindcss').Config} */
2 | module.exports = {
3 | content: [ "./src/**/*.{js,jsx,ts,tsx}",
4 | './src/**/*.{html,js}', './node_modules/tw-elements/dist/js/**/*.js',
5 |
6 | ],
7 | theme: {
8 | extend: {
9 | fontFamily: {
10 | nunito: ['Nunito','sans-serif'],
11 | },
12 | colors: {
13 | primary: '#11175D',
14 | },
15 | maxWidth: {
16 | containerfluid: '1404px',
17 | container:'1320px'
18 | }
19 |
20 | },
21 | },
22 | plugins: [
23 | require('tw-elements/dist/plugin')
24 | ],
25 | }
26 |
--------------------------------------------------------------------------------