Repository: WebDevSimplified/Whatsapp-Clone
Branch: master
Commit: df4cfbfbfa6a
Files: 23
Total size: 21.6 KB
Directory structure:
gitextract_8mbsqtrl/
├── client/
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public/
│ │ ├── index.html
│ │ ├── manifest.json
│ │ └── robots.txt
│ └── src/
│ ├── components/
│ │ ├── App.js
│ │ ├── Contacts.js
│ │ ├── Conversations.js
│ │ ├── Dashboard.js
│ │ ├── Login.js
│ │ ├── NewContactModal.js
│ │ ├── NewConversationModal.js
│ │ ├── OpenConversation.js
│ │ └── Sidebar.js
│ ├── contexts/
│ │ ├── ContactsProvider.js
│ │ ├── ConversationsProvider.js
│ │ └── SocketProvider.js
│ ├── hooks/
│ │ └── useLocalStorage.js
│ └── index.js
└── server/
├── .gitignore
├── package.json
└── server.js
================================================
FILE CONTENTS
================================================
================================================
FILE: client/.gitignore
================================================
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
# dependencies
/node_modules
/.pnp
.pnp.js
# testing
/coverage
# production
/build
# misc
.DS_Store
.env.local
.env.development.local
.env.test.local
.env.production.local
npm-debug.log*
yarn-debug.log*
yarn-error.log*
================================================
FILE: client/README.md
================================================
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `npm start`
Runs the app in the development mode.<br />
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.
The page will reload if you make edits.<br />
You will also see any lint errors in the console.
### `npm test`
Launches the test runner in the interactive watch mode.<br />
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.
### `npm run build`
Builds the app for production to the `build` folder.<br />
It correctly bundles React in production mode and optimizes the build for the best performance.
The build is minified and the filenames include the hashes.<br />
Your app is ready to be deployed!
See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.
### `npm run eject`
**Note: this is a one-way operation. Once you `eject`, you can’t go back!**
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.
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.
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.
## Learn More
You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).
To learn React, check out the [React documentation](https://reactjs.org/).
### Code Splitting
This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting
### Analyzing the Bundle Size
This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size
### Making a Progressive Web App
This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app
### Advanced Configuration
This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration
### Deployment
This section has moved here: https://facebook.github.io/create-react-app/docs/deployment
### `npm run build` fails to minify
This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify
================================================
FILE: client/package.json
================================================
{
"name": "client",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"bootstrap": "^4.5.2",
"react": "^16.13.1",
"react-bootstrap": "^1.3.0",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3",
"socket.io-client": "^2.3.0",
"uuid": "^8.3.0"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
================================================
FILE: client/public/index.html
================================================
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="%PUBLIC_URL%/logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
================================================
FILE: client/public/manifest.json
================================================
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
================================================
FILE: client/public/robots.txt
================================================
# https://www.robotstxt.org/robotstxt.html
User-agent: *
Disallow:
================================================
FILE: client/src/components/App.js
================================================
import React from 'react'
import Login from './Login'
import useLocalStorage from '../hooks/useLocalStorage';
import Dashboard from './Dashboard'
import { ContactsProvider } from '../contexts/ContactsProvider'
import { ConversationsProvider } from '../contexts/ConversationsProvider';
import { SocketProvider } from '../contexts/SocketProvider';
function App() {
const [id, setId] = useLocalStorage('id')
const dashboard = (
<SocketProvider id={id}>
<ContactsProvider>
<ConversationsProvider id={id}>
<Dashboard id={id} />
</ConversationsProvider>
</ContactsProvider>
</SocketProvider>
)
return (
id ? dashboard : <Login onIdSubmit={setId} />
)
}
export default App;
================================================
FILE: client/src/components/Contacts.js
================================================
import React from 'react'
import { ListGroup } from 'react-bootstrap'
import { useContacts } from '../contexts/ContactsProvider';
export default function Contacts() {
const { contacts } = useContacts()
return (
<ListGroup variant="flush">
{contacts.map(contact => (
<ListGroup.Item key={contact.id}>
{contact.name}
</ListGroup.Item>
))}
</ListGroup>
)
}
================================================
FILE: client/src/components/Conversations.js
================================================
import React from 'react'
import { ListGroup } from 'react-bootstrap'
import { useConversations } from '../contexts/ConversationsProvider';
export default function Conversations() {
const { conversations, selectConversationIndex } = useConversations()
return (
<ListGroup variant="flush">
{conversations.map((conversation, index) => (
<ListGroup.Item
key={index}
action
onClick={() => selectConversationIndex(index)}
active={conversation.selected}
>
{conversation.recipients.map(r => r.name).join(', ')}
</ListGroup.Item>
))}
</ListGroup>
)
}
================================================
FILE: client/src/components/Dashboard.js
================================================
import React from 'react'
import Sidebar from './Sidebar';
import OpenConversation from './OpenConversation';
import { useConversations } from '../contexts/ConversationsProvider';
export default function Dashboard({ id }) {
const { selectedConversation } = useConversations()
return (
<div className="d-flex" style={{ height: '100vh' }}>
<Sidebar id={id} />
{selectedConversation && <OpenConversation />}
</div>
)
}
================================================
FILE: client/src/components/Login.js
================================================
import React, { useRef } from 'react'
import { Container, Form, Button } from 'react-bootstrap'
import { v4 as uuidV4 } from 'uuid'
export default function Login({ onIdSubmit }) {
const idRef = useRef()
function handleSubmit(e) {
e.preventDefault()
onIdSubmit(idRef.current.value)
}
function createNewId() {
onIdSubmit(uuidV4())
}
return (
<Container className="align-items-center d-flex" style={{ height: '100vh' }}>
<Form onSubmit={handleSubmit} className="w-100">
<Form.Group>
<Form.Label>Enter Your Id</Form.Label>
<Form.Control type="text" ref={idRef} required />
</Form.Group>
<Button type="submit" className="mr-2">Login</Button>
<Button onClick={createNewId} variant="secondary">Create A New Id</Button>
</Form>
</Container>
)
}
================================================
FILE: client/src/components/NewContactModal.js
================================================
import React, { useRef } from 'react'
import { Modal, Form, Button } from 'react-bootstrap'
import { useContacts } from '../contexts/ContactsProvider'
export default function NewContactModal({ closeModal }) {
const idRef = useRef()
const nameRef = useRef()
const { createContact } = useContacts()
function handleSubmit(e) {
e.preventDefault()
createContact(idRef.current.value, nameRef.current.value)
closeModal()
}
return (
<>
<Modal.Header closeButton>Create Contact</Modal.Header>
<Modal.Body>
<Form onSubmit={handleSubmit}>
<Form.Group>
<Form.Label>Id</Form.Label>
<Form.Control type="text" ref={idRef} required />
</Form.Group>
<Form.Group>
<Form.Label>Name</Form.Label>
<Form.Control type="text" ref={nameRef} required />
</Form.Group>
<Button type="submit">Create</Button>
</Form>
</Modal.Body>
</>
)
}
================================================
FILE: client/src/components/NewConversationModal.js
================================================
import React, { useState } from 'react'
import { Modal, Form, Button } from 'react-bootstrap'
import { useContacts } from '../contexts/ContactsProvider'
import { useConversations } from '../contexts/ConversationsProvider'
export default function NewConversationModal({ closeModal }) {
const [selectedContactIds, setSelectedContactIds] = useState([])
const { contacts } = useContacts()
const { createConversation } = useConversations()
function handleSubmit(e) {
e.preventDefault()
createConversation(selectedContactIds)
closeModal()
}
function handleCheckboxChange(contactId) {
setSelectedContactIds(prevSelectedContactIds => {
if (prevSelectedContactIds.includes(contactId)) {
return prevSelectedContactIds.filter(prevId => {
return contactId !== prevId
})
} else {
return [...prevSelectedContactIds, contactId]
}
})
}
return (
<>
<Modal.Header closeButton>Create Conversation</Modal.Header>
<Modal.Body>
<Form onSubmit={handleSubmit}>
{contacts.map(contact => (
<Form.Group controlId={contact.id} key={contact.id}>
<Form.Check
type="checkbox"
value={selectedContactIds.includes(contact.id)}
label={contact.name}
onChange={() => handleCheckboxChange(contact.id)}
/>
</Form.Group>
))}
<Button type="submit">Create</Button>
</Form>
</Modal.Body>
</>
)
}
================================================
FILE: client/src/components/OpenConversation.js
================================================
import React, { useState, useCallback } from 'react'
import { Form, InputGroup, Button } from 'react-bootstrap'
import { useConversations } from '../contexts/ConversationsProvider';
export default function OpenConversation() {
const [text, setText] = useState('')
const setRef = useCallback(node => {
if (node) {
node.scrollIntoView({ smooth: true })
}
}, [])
const { sendMessage, selectedConversation } = useConversations()
function handleSubmit(e) {
e.preventDefault()
sendMessage(
selectedConversation.recipients.map(r => r.id),
text
)
setText('')
}
return (
<div className="d-flex flex-column flex-grow-1">
<div className="flex-grow-1 overflow-auto">
<div className="d-flex flex-column align-items-start justify-content-end px-3">
{selectedConversation.messages.map((message, index) => {
const lastMessage = selectedConversation.messages.length - 1 === index
return (
<div
ref={lastMessage ? setRef : null}
key={index}
className={`my-1 d-flex flex-column ${message.fromMe ? 'align-self-end align-items-end' : 'align-items-start'}`}
>
<div
className={`rounded px-2 py-1 ${message.fromMe ? 'bg-primary text-white' : 'border'}`}>
{message.text}
</div>
<div className={`text-muted small ${message.fromMe ? 'text-right' : ''}`}>
{message.fromMe ? 'You' : message.senderName}
</div>
</div>
)
})}
</div>
</div>
<Form onSubmit={handleSubmit}>
<Form.Group className="m-2">
<InputGroup>
<Form.Control
as="textarea"
required
value={text}
onChange={e => setText(e.target.value)}
style={{ height: '75px', resize: 'none' }}
/>
<InputGroup.Append>
<Button type="submit">Send</Button>
</InputGroup.Append>
</InputGroup>
</Form.Group>
</Form>
</div>
)
}
================================================
FILE: client/src/components/Sidebar.js
================================================
import React, { useState } from 'react'
import { Tab, Nav, Button, Modal } from 'react-bootstrap'
import Conversations from './Conversations'
import Contacts from './Contacts'
import NewContactModal from './NewContactModal'
import NewConversationModal from './NewConversationModal'
const CONVERSATIONS_KEY = 'conversations'
const CONTACTS_KEY = 'contacts'
export default function Sidebar({ id }) {
const [activeKey, setActiveKey] = useState(CONVERSATIONS_KEY)
const [modalOpen, setModalOpen] = useState(false)
const conversationsOpen = activeKey === CONVERSATIONS_KEY
function closeModal() {
setModalOpen(false)
}
return (
<div style={{ width: '250px' }} className="d-flex flex-column">
<Tab.Container activeKey={activeKey} onSelect={setActiveKey}>
<Nav variant="tabs" className="justify-content-center">
<Nav.Item>
<Nav.Link eventKey={CONVERSATIONS_KEY}>Conversations</Nav.Link>
</Nav.Item>
<Nav.Item>
<Nav.Link eventKey={CONTACTS_KEY}>Contacts</Nav.Link>
</Nav.Item>
</Nav>
<Tab.Content className="border-right overflow-auto flex-grow-1">
<Tab.Pane eventKey={CONVERSATIONS_KEY}>
<Conversations />
</Tab.Pane>
<Tab.Pane eventKey={CONTACTS_KEY}>
<Contacts />
</Tab.Pane>
</Tab.Content>
<div className="p-2 border-top border-right small">
Your Id: <span className="text-muted">{id}</span>
</div>
<Button onClick={() => setModalOpen(true)} className="rounded-0">
New {conversationsOpen ? 'Conversation' : 'Contact'}
</Button>
</Tab.Container>
<Modal show={modalOpen} onHide={closeModal}>
{conversationsOpen ?
<NewConversationModal closeModal={closeModal} /> :
<NewContactModal closeModal={closeModal} />
}
</Modal>
</div>
)
}
================================================
FILE: client/src/contexts/ContactsProvider.js
================================================
import React, { useContext } from 'react'
import useLocalStorage from '../hooks/useLocalStorage';
const ContactsContext = React.createContext()
export function useContacts() {
return useContext(ContactsContext)
}
export function ContactsProvider({ children }) {
const [contacts, setContacts] = useLocalStorage('contacts', [])
function createContact(id, name) {
setContacts(prevContacts => {
return [...prevContacts, { id, name }]
})
}
return (
<ContactsContext.Provider value={{ contacts, createContact }}>
{children}
</ContactsContext.Provider>
)
}
================================================
FILE: client/src/contexts/ConversationsProvider.js
================================================
import React, { useContext, useState, useEffect, useCallback } from 'react'
import useLocalStorage from '../hooks/useLocalStorage';
import { useContacts } from './ContactsProvider';
import { useSocket } from './SocketProvider';
const ConversationsContext = React.createContext()
export function useConversations() {
return useContext(ConversationsContext)
}
export function ConversationsProvider({ id, children }) {
const [conversations, setConversations] = useLocalStorage('conversations', [])
const [selectedConversationIndex, setSelectedConversationIndex] = useState(0)
const { contacts } = useContacts()
const socket = useSocket()
function createConversation(recipients) {
setConversations(prevConversations => {
return [...prevConversations, { recipients, messages: [] }]
})
}
const addMessageToConversation = useCallback(({ recipients, text, sender }) => {
setConversations(prevConversations => {
let madeChange = false
const newMessage = { sender, text }
const newConversations = prevConversations.map(conversation => {
if (arrayEquality(conversation.recipients, recipients)) {
madeChange = true
return {
...conversation,
messages: [...conversation.messages, newMessage]
}
}
return conversation
})
if (madeChange) {
return newConversations
} else {
return [
...prevConversations,
{ recipients, messages: [newMessage] }
]
}
})
}, [setConversations])
useEffect(() => {
if (socket == null) return
socket.on('receive-message', addMessageToConversation)
return () => socket.off('receive-message')
}, [socket, addMessageToConversation])
function sendMessage(recipients, text) {
socket.emit('send-message', { recipients, text })
addMessageToConversation({ recipients, text, sender: id })
}
const formattedConversations = conversations.map((conversation, index) => {
const recipients = conversation.recipients.map(recipient => {
const contact = contacts.find(contact => {
return contact.id === recipient
})
const name = (contact && contact.name) || recipient
return { id: recipient, name }
})
const messages = conversation.messages.map(message => {
const contact = contacts.find(contact => {
return contact.id === message.sender
})
const name = (contact && contact.name) || message.sender
const fromMe = id === message.sender
return { ...message, senderName: name, fromMe }
})
const selected = index === selectedConversationIndex
return { ...conversation, messages, recipients, selected }
})
const value = {
conversations: formattedConversations,
selectedConversation: formattedConversations[selectedConversationIndex],
sendMessage,
selectConversationIndex: setSelectedConversationIndex,
createConversation
}
return (
<ConversationsContext.Provider value={value}>
{children}
</ConversationsContext.Provider>
)
}
function arrayEquality(a, b) {
if (a.length !== b.length) return false
a.sort()
b.sort()
return a.every((element, index) => {
return element === b[index]
})
}
================================================
FILE: client/src/contexts/SocketProvider.js
================================================
import React, { useContext, useEffect, useState } from 'react'
import io from 'socket.io-client'
const SocketContext = React.createContext()
export function useSocket() {
return useContext(SocketContext)
}
export function SocketProvider({ id, children }) {
const [socket, setSocket] = useState()
useEffect(() => {
const newSocket = io(
'http://localhost:5000',
{ query: { id } }
)
setSocket(newSocket)
return () => newSocket.close()
}, [id])
return (
<SocketContext.Provider value={socket}>
{children}
</SocketContext.Provider>
)
}
================================================
FILE: client/src/hooks/useLocalStorage.js
================================================
import { useEffect, useState } from 'react'
const PREFIX = 'whatsapp-clone-'
export default function useLocalStorage(key, initialValue) {
const prefixedKey = PREFIX + key
const [value, setValue] = useState(() => {
const jsonValue = localStorage.getItem(prefixedKey)
if (jsonValue != null) return JSON.parse(jsonValue)
if (typeof initialValue === 'function') {
return initialValue()
} else {
return initialValue
}
})
useEffect(() => {
localStorage.setItem(prefixedKey, JSON.stringify(value))
}, [prefixedKey, value])
return [value, setValue]
}
================================================
FILE: client/src/index.js
================================================
import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App';
import 'bootstrap/dist/css/bootstrap.min.css'
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
================================================
FILE: server/.gitignore
================================================
node_modules
================================================
FILE: server/package.json
================================================
{
"name": "server",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"devStart": "nodemon server.js"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"socket.io": "^2.3.0"
},
"devDependencies": {
"nodemon": "^2.0.4"
}
}
================================================
FILE: server/server.js
================================================
const io = require('socket.io')(5000)
io.on('connection', socket => {
const id = socket.handshake.query.id
socket.join(id)
socket.on('send-message', ({ recipients, text }) => {
recipients.forEach(recipient => {
const newRecipients = recipients.filter(r => r !== recipient)
newRecipients.push(id)
socket.broadcast.to(recipient).emit('receive-message', {
recipients: newRecipients, sender: id, text
})
})
})
})
gitextract_8mbsqtrl/
├── client/
│ ├── .gitignore
│ ├── README.md
│ ├── package.json
│ ├── public/
│ │ ├── index.html
│ │ ├── manifest.json
│ │ └── robots.txt
│ └── src/
│ ├── components/
│ │ ├── App.js
│ │ ├── Contacts.js
│ │ ├── Conversations.js
│ │ ├── Dashboard.js
│ │ ├── Login.js
│ │ ├── NewContactModal.js
│ │ ├── NewConversationModal.js
│ │ ├── OpenConversation.js
│ │ └── Sidebar.js
│ ├── contexts/
│ │ ├── ContactsProvider.js
│ │ ├── ConversationsProvider.js
│ │ └── SocketProvider.js
│ ├── hooks/
│ │ └── useLocalStorage.js
│ └── index.js
└── server/
├── .gitignore
├── package.json
└── server.js
SYMBOL INDEX (20 symbols across 13 files)
FILE: client/src/components/App.js
function App (line 9) | function App() {
FILE: client/src/components/Contacts.js
function Contacts (line 5) | function Contacts() {
FILE: client/src/components/Conversations.js
function Conversations (line 5) | function Conversations() {
FILE: client/src/components/Dashboard.js
function Dashboard (line 6) | function Dashboard({ id }) {
FILE: client/src/components/Login.js
function Login (line 5) | function Login({ onIdSubmit }) {
FILE: client/src/components/NewContactModal.js
function NewContactModal (line 5) | function NewContactModal({ closeModal }) {
FILE: client/src/components/NewConversationModal.js
function NewConversationModal (line 6) | function NewConversationModal({ closeModal }) {
FILE: client/src/components/OpenConversation.js
function OpenConversation (line 5) | function OpenConversation() {
FILE: client/src/components/Sidebar.js
constant CONVERSATIONS_KEY (line 8) | const CONVERSATIONS_KEY = 'conversations'
constant CONTACTS_KEY (line 9) | const CONTACTS_KEY = 'contacts'
function Sidebar (line 11) | function Sidebar({ id }) {
FILE: client/src/contexts/ContactsProvider.js
function useContacts (line 6) | function useContacts() {
function ContactsProvider (line 10) | function ContactsProvider({ children }) {
FILE: client/src/contexts/ConversationsProvider.js
function useConversations (line 8) | function useConversations() {
function ConversationsProvider (line 12) | function ConversationsProvider({ id, children }) {
function arrayEquality (line 102) | function arrayEquality(a, b) {
FILE: client/src/contexts/SocketProvider.js
function useSocket (line 6) | function useSocket() {
function SocketProvider (line 10) | function SocketProvider({ id, children }) {
FILE: client/src/hooks/useLocalStorage.js
constant PREFIX (line 3) | const PREFIX = 'whatsapp-clone-'
function useLocalStorage (line 5) | function useLocalStorage(key, initialValue) {
Condensed preview — 23 files, each showing path, character count, and a content snippet. Download the .json file or copy for the full structured content (24K chars).
[
{
"path": "client/.gitignore",
"chars": 310,
"preview": "# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.\n\n# dependencies\n/node_modules\n/.pn"
},
{
"path": "client/README.md",
"chars": 2877,
"preview": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).\n\n## Available Scrip"
},
{
"path": "client/package.json",
"chars": 858,
"preview": "{\n \"name\": \"client\",\n \"version\": \"0.1.0\",\n \"private\": true,\n \"dependencies\": {\n \"@testing-library/jest-dom\": \"^4."
},
{
"path": "client/public/index.html",
"chars": 1721,
"preview": "<!DOCTYPE html>\n<html lang=\"en\">\n <head>\n <meta charset=\"utf-8\" />\n <link rel=\"icon\" href=\"%PUBLIC_URL%/favicon.i"
},
{
"path": "client/public/manifest.json",
"chars": 492,
"preview": "{\n \"short_name\": \"React App\",\n \"name\": \"Create React App Sample\",\n \"icons\": [\n {\n \"src\": \"favicon.ico\",\n "
},
{
"path": "client/public/robots.txt",
"chars": 67,
"preview": "# https://www.robotstxt.org/robotstxt.html\nUser-agent: *\nDisallow:\n"
},
{
"path": "client/src/components/App.js",
"chars": 731,
"preview": "import React from 'react'\nimport Login from './Login'\nimport useLocalStorage from '../hooks/useLocalStorage';\nimport Das"
},
{
"path": "client/src/components/Contacts.js",
"chars": 408,
"preview": "import React from 'react'\nimport { ListGroup } from 'react-bootstrap'\nimport { useContacts } from '../contexts/ContactsP"
},
{
"path": "client/src/components/Conversations.js",
"chars": 645,
"preview": "import React from 'react'\nimport { ListGroup } from 'react-bootstrap'\nimport { useConversations } from '../contexts/Conv"
},
{
"path": "client/src/components/Dashboard.js",
"chars": 444,
"preview": "import React from 'react'\nimport Sidebar from './Sidebar';\nimport OpenConversation from './OpenConversation';\nimport { u"
},
{
"path": "client/src/components/Login.js",
"chars": 843,
"preview": "import React, { useRef } from 'react'\nimport { Container, Form, Button } from 'react-bootstrap'\nimport { v4 as uuidV4 } "
},
{
"path": "client/src/components/NewContactModal.js",
"chars": 980,
"preview": "import React, { useRef } from 'react'\nimport { Modal, Form, Button } from 'react-bootstrap'\nimport { useContacts } from "
},
{
"path": "client/src/components/NewConversationModal.js",
"chars": 1536,
"preview": "import React, { useState } from 'react'\nimport { Modal, Form, Button } from 'react-bootstrap'\nimport { useContacts } fro"
},
{
"path": "client/src/components/OpenConversation.js",
"chars": 2183,
"preview": "import React, { useState, useCallback } from 'react'\nimport { Form, InputGroup, Button } from 'react-bootstrap'\nimport {"
},
{
"path": "client/src/components/Sidebar.js",
"chars": 1929,
"preview": "import React, { useState } from 'react'\nimport { Tab, Nav, Button, Modal } from 'react-bootstrap'\nimport Conversations f"
},
{
"path": "client/src/contexts/ContactsProvider.js",
"chars": 595,
"preview": "import React, { useContext } from 'react'\nimport useLocalStorage from '../hooks/useLocalStorage';\n\nconst ContactsContext"
},
{
"path": "client/src/contexts/ConversationsProvider.js",
"chars": 3279,
"preview": "import React, { useContext, useState, useEffect, useCallback } from 'react'\nimport useLocalStorage from '../hooks/useLoc"
},
{
"path": "client/src/contexts/SocketProvider.js",
"chars": 592,
"preview": "import React, { useContext, useEffect, useState } from 'react'\nimport io from 'socket.io-client'\n\nconst SocketContext = "
},
{
"path": "client/src/hooks/useLocalStorage.js",
"chars": 595,
"preview": "import { useEffect, useState } from 'react'\n\nconst PREFIX = 'whatsapp-clone-'\n\nexport default function useLocalStorage(k"
},
{
"path": "client/src/index.js",
"chars": 253,
"preview": "import React from 'react';\nimport ReactDOM from 'react-dom';\nimport App from './components/App';\nimport 'bootstrap/dist/"
},
{
"path": "server/.gitignore",
"chars": 12,
"preview": "node_modules"
},
{
"path": "server/package.json",
"chars": 301,
"preview": "{\n \"name\": \"server\",\n \"version\": \"1.0.0\",\n \"description\": \"\",\n \"main\": \"index.js\",\n \"scripts\": {\n \"devStart\": \"n"
},
{
"path": "server/server.js",
"chars": 458,
"preview": "const io = require('socket.io')(5000)\n\nio.on('connection', socket => {\n const id = socket.handshake.query.id\n socket.j"
}
]
About this extraction
This page contains the full source code of the WebDevSimplified/Whatsapp-Clone GitHub repository, extracted and formatted as plain text for AI agents and large language models (LLMs). The extraction includes 23 files (21.6 KB), approximately 5.8k tokens, and a symbol index with 20 extracted functions, classes, methods, constants, and types. Use this with OpenClaw, Claude, ChatGPT, Cursor, Windsurf, or any other AI tool that accepts text input. You can copy the full output to your clipboard or download it as a .txt file.
Extracted by GitExtract — free GitHub repo to text converter for AI. Built by Nikandr Surkov.