Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

correcting some spell issues #49

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion backend/controllers/chatControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const fetchChats = asyncHandler(async (req, res) => {
//@access Protected
const createGroupChat = asyncHandler(async (req, res) => {
if (!req.body.users || !req.body.name) {
return res.status(400).send({ message: "Please Fill all the feilds" });
return res.status(400).send({ message: "Please Fill all the Fields" });
}

var users = JSON.parse(req.body.users);
Expand Down
2 changes: 1 addition & 1 deletion backend/controllers/userControllers.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const registerUser = asyncHandler(async (req, res) => {

if (!name || !email || !password) {
res.status(400);
throw new Error("Please Enter all the Feilds");
throw new Error("Please Enter all the Fields");
}

const userExists = await User.findOne({ email });
Expand Down
8 changes: 4 additions & 4 deletions backend/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,15 +72,15 @@ io.on("connection", (socket) => {
socket.on("typing", (room) => socket.in(room).emit("typing"));
socket.on("stop typing", (room) => socket.in(room).emit("stop typing"));

socket.on("new message", (newMessageRecieved) => {
var chat = newMessageRecieved.chat;
socket.on("new message", (newMessageReceived) => {
var chat = newMessageReceived.chat;

if (!chat.users) return console.log("chat.users not defined");

chat.users.forEach((user) => {
if (user._id == newMessageRecieved.sender._id) return;
if (user._id == newMessageReceived.sender._id) return;

socket.in(user._id).emit("message recieved", newMessageRecieved);
socket.in(user._id).emit("message received", newMessageReceived);
});
});

Expand Down
4 changes: 2 additions & 2 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import "./App.css";
import Homepage from "./Pages/Homepage";
import { Route } from "react-router-dom";
import Chatpage from "./Pages/Chatpage";
import ChatPage from "./Pages/Chatpage";

function App() {
return (
<div className="App">
<Route path="/" component={Homepage} exact />
<Route path="/chats" component={Chatpage} />
<Route path="/chats" component={ChatPage} />
</div>
);
}
Expand Down
8 changes: 4 additions & 4 deletions frontend/src/Pages/Chatpage.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { Box } from "@chakra-ui/layout";
import { useState } from "react";
import Chatbox from "../components/Chatbox";
import ChatBox from "../components/Chatbox";
import MyChats from "../components/MyChats";
import SideDrawer from "../components/miscellaneous/SideDrawer";
import { ChatState } from "../Context/ChatProvider";

const Chatpage = () => {
const ChatPage = () => {
const [fetchAgain, setFetchAgain] = useState(false);
const { user } = ChatState();

Expand All @@ -15,11 +15,11 @@ const Chatpage = () => {
<Box d="flex" justifyContent="space-between" w="100%" h="91.5vh" p="10px">
{user && <MyChats fetchAgain={fetchAgain} />}
{user && (
<Chatbox fetchAgain={fetchAgain} setFetchAgain={setFetchAgain} />
<ChatBox fetchAgain={fetchAgain} setFetchAgain={setFetchAgain} />
)}
</Box>
</div>
);
};

export default Chatpage;
export default ChatPage;
4 changes: 2 additions & 2 deletions frontend/src/components/Authentication/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const Login = () => {
setLoading(true);
if (!email || !password) {
toast({
title: "Please Fill all the Feilds",
title: "Please Fill all the Fields",
status: "warning",
duration: 5000,
isClosable: true,
Expand Down Expand Up @@ -59,7 +59,7 @@ const Login = () => {
history.push("/chats");
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: error.response.data.message,
status: "error",
duration: 5000,
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/components/Authentication/Signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,16 @@ const Signup = () => {

const [name, setName] = useState();
const [email, setEmail] = useState();
const [confirmpassword, setConfirmpassword] = useState();
const [confirmPassword, setConfirmPassword] = useState();
const [password, setPassword] = useState();
const [pic, setPic] = useState();
const [picLoading, setPicLoading] = useState(false);

const submitHandler = async () => {
setPicLoading(true);
if (!name || !email || !password || !confirmpassword) {
if (!name || !email || !password || !confirmPassword) {
toast({
title: "Please Fill all the Feilds",
title: "Please Fill all the Fields",
status: "warning",
duration: 5000,
isClosable: true,
Expand All @@ -33,7 +33,7 @@ const Signup = () => {
setPicLoading(false);
return;
}
if (password !== confirmpassword) {
if (password !== confirmPassword) {
toast({
title: "Passwords Do Not Match",
status: "warning",
Expand Down Expand Up @@ -73,7 +73,7 @@ const Signup = () => {
history.push("/chats");
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: error.response.data.message,
status: "error",
duration: 5000,
Expand Down Expand Up @@ -167,7 +167,7 @@ const Signup = () => {
<Input
type={show ? "text" : "password"}
placeholder="Confirm password"
onChange={(e) => setConfirmpassword(e.target.value)}
onChange={(e) => setConfirmPassword(e.target.value)}
/>
<InputRightElement width="4.5rem">
<Button h="1.75rem" size="sm" onClick={handleClick}>
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/Chatbox.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import "./styles.css";
import SingleChat from "./SingleChat";
import { ChatState } from "../Context/ChatProvider";

const Chatbox = ({ fetchAgain, setFetchAgain }) => {
const ChatBox = ({ fetchAgain, setFetchAgain }) => {
const { selectedChat } = ChatState();

return (
Expand All @@ -22,4 +22,4 @@ const Chatbox = ({ fetchAgain, setFetchAgain }) => {
);
};

export default Chatbox;
export default ChatBox;
2 changes: 1 addition & 1 deletion frontend/src/components/MyChats.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ const MyChats = ({ fetchAgain }) => {
setChats(data);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: "Failed to Load the chats",
status: "error",
duration: 5000,
Expand Down
18 changes: 9 additions & 9 deletions frontend/src/components/SingleChat.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const SingleChat = ({ fetchAgain, setFetchAgain }) => {
const [newMessage, setNewMessage] = useState("");
const [socketConnected, setSocketConnected] = useState(false);
const [typing, setTyping] = useState(false);
const [istyping, setIsTyping] = useState(false);
const [isTyping, setIsTyping] = useState(false);
const toast = useToast();

const defaultOptions = {
Expand Down Expand Up @@ -60,7 +60,7 @@ const SingleChat = ({ fetchAgain, setFetchAgain }) => {
socket.emit("join chat", selectedChat._id);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: "Failed to Load the Messages",
status: "error",
duration: 5000,
Expand Down Expand Up @@ -93,7 +93,7 @@ const SingleChat = ({ fetchAgain, setFetchAgain }) => {
setMessages([...messages, data]);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: "Failed to send the Message",
status: "error",
duration: 5000,
Expand Down Expand Up @@ -122,17 +122,17 @@ const SingleChat = ({ fetchAgain, setFetchAgain }) => {
}, [selectedChat]);

useEffect(() => {
socket.on("message recieved", (newMessageRecieved) => {
socket.on("message received", (newMessageReceived) => {
if (
!selectedChatCompare || // if chat is not selected or doesn't match current chat
selectedChatCompare._id !== newMessageRecieved.chat._id
selectedChatCompare._id !== newMessageReceived.chat._id
) {
if (!notification.includes(newMessageRecieved)) {
setNotification([newMessageRecieved, ...notification]);
if (!notification.includes(newMessageReceived)) {
setNotification([newMessageReceived, ...notification]);
setFetchAgain(!fetchAgain);
}
} else {
setMessages([...messages, newMessageRecieved]);
setMessages([...messages, newMessageReceived]);
}
});
});
Expand Down Expand Up @@ -227,7 +227,7 @@ const SingleChat = ({ fetchAgain, setFetchAgain }) => {
isRequired
mt={3}
>
{istyping ? (
{isTyping ? (
<div>
<Lottie
options={defaultOptions}
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/components/miscellaneous/GroupChatModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ const GroupChatModal = ({ children }) => {
setSearchResult(data);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: "Failed to Load the Search Results",
status: "error",
duration: 5000,
Expand All @@ -81,7 +81,7 @@ const GroupChatModal = ({ children }) => {
const handleSubmit = async () => {
if (!groupChatName || !selectedUsers) {
toast({
title: "Please fill all the feilds",
title: "Please fill all the fields",
status: "warning",
duration: 5000,
isClosable: true,
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/components/miscellaneous/SideDrawer.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function SideDrawer() {
setSearchResult(data);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: "Failed to Load the Search Results",
status: "error",
duration: 5000,
Expand Down
12 changes: 6 additions & 6 deletions frontend/src/components/miscellaneous/UpdateGroupChatModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const UpdateGroupChatModal = ({ fetchMessages, fetchAgain, setFetchAgain }) => {
const [search, setSearch] = useState("");
const [searchResult, setSearchResult] = useState([]);
const [loading, setLoading] = useState(false);
const [renameloading, setRenameLoading] = useState(false);
const [renameLoading, setRenameLoading] = useState(false);
const toast = useToast();

const { selectedChat, setSelectedChat, user } = ChatState();
Expand All @@ -52,7 +52,7 @@ const UpdateGroupChatModal = ({ fetchMessages, fetchAgain, setFetchAgain }) => {
setSearchResult(data);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: "Failed to Load the Search Results",
status: "error",
duration: 5000,
Expand Down Expand Up @@ -89,7 +89,7 @@ const UpdateGroupChatModal = ({ fetchMessages, fetchAgain, setFetchAgain }) => {
setRenameLoading(false);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: error.response.data.message,
status: "error",
duration: 5000,
Expand Down Expand Up @@ -145,7 +145,7 @@ const UpdateGroupChatModal = ({ fetchMessages, fetchAgain, setFetchAgain }) => {
setLoading(false);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: error.response.data.message,
status: "error",
duration: 5000,
Expand Down Expand Up @@ -191,7 +191,7 @@ const UpdateGroupChatModal = ({ fetchMessages, fetchAgain, setFetchAgain }) => {
setLoading(false);
} catch (error) {
toast({
title: "Error Occured!",
title: "Error Occurred!",
description: error.response.data.message,
status: "error",
duration: 5000,
Expand Down Expand Up @@ -242,7 +242,7 @@ const UpdateGroupChatModal = ({ fetchMessages, fetchAgain, setFetchAgain }) => {
variant="solid"
colorScheme="teal"
ml={1}
isLoading={renameloading}
isLoading={renameLoading}
onClick={handleRename}
>
Update
Expand Down