├── frontend ├── src │ ├── redux │ │ ├── noteRedux.js │ │ ├── apiCalls.js │ │ ├── store.js │ │ └── userRedux.js │ ├── pages │ │ ├── home │ │ │ ├── right │ │ │ │ ├── Right.jsx │ │ │ │ └── right.css │ │ │ ├── center │ │ │ │ ├── Homepost.js │ │ │ │ └── RenderPost.js │ │ │ ├── Home.css │ │ │ ├── Home.jsx │ │ │ └── left │ │ │ │ ├── HomeProfile.css │ │ │ │ └── Homeprofile.jsx │ │ ├── searchUserPage │ │ │ └── SearchUserPage.jsx │ │ ├── messenger │ │ │ ├── messenger.css │ │ │ └── messenger.jsx │ │ ├── login │ │ │ └── Login.jsx │ │ ├── register │ │ │ └── Register.jsx │ │ └── profile │ │ │ ├── Profile.css │ │ │ └── Profile.js │ ├── component │ │ ├── BuildConversation │ │ │ ├── BuildConversation.css │ │ │ └── BuildConversation.jsx │ │ ├── CircularLoader.jsx │ │ ├── message │ │ │ ├── Message.jsx │ │ │ └── message.css │ │ ├── chatOnline │ │ │ ├── chatOnline.css │ │ │ └── chatOnline.jsx │ │ ├── conversations │ │ │ ├── conversation.css │ │ │ └── Conversation.jsx │ │ ├── comment │ │ │ ├── CommentBox.css │ │ │ ├── CommentBox.js │ │ │ ├── Comment.css │ │ │ └── Comment.js │ │ ├── TopNavbar │ │ │ ├── TopNavbar.jsx │ │ │ └── Navbar.style.js │ │ ├── updatepost │ │ │ ├── UpdatePost.css │ │ │ └── UpdatePost.js │ │ ├── footer │ │ │ ├── Footer.jsx │ │ │ └── Footer.css │ │ ├── banner │ │ │ ├── Banner.css │ │ │ └── Banner.jsx │ │ ├── Author │ │ │ ├── Author.css │ │ │ └── Author.jsx │ │ ├── SearchedUser │ │ │ └── SearchedUser.jsx │ │ ├── uploadNote │ │ │ ├── UploadNote.css │ │ │ └── UploadNote.js │ │ ├── updateUser │ │ │ ├── UpdateUser.css │ │ │ └── UpdateUser.js │ │ ├── topbar │ │ │ ├── Topbar.jsx │ │ │ └── Topbar.css │ │ ├── post │ │ │ ├── Post.css │ │ │ └── Post.js │ │ └── Navbar.jsx │ ├── responsive.js │ ├── requestMethods.js │ ├── index.js │ ├── loader │ │ └── Loader.js │ └── App.js ├── .env ├── public │ ├── image │ │ ├── chat.png │ │ ├── home.png │ │ ├── searchuser.png │ │ ├── uploadform.png │ │ ├── userprofile.png │ │ ├── icons8-like-64.png │ │ ├── icons8-view-50.png │ │ ├── icons8-view-64.png │ │ ├── icons8-delete-90.png │ │ ├── icons8-edit-100.png │ │ ├── icons8-like-post.png │ │ ├── fast-forward-button.png │ │ ├── icons8-comment-64.png │ │ ├── icons8-liked-post.png │ │ ├── icons8-chat-bubble-90.png │ │ ├── icons8-vertical-line.png │ │ └── icons8-microsoft-publisher-50.png │ ├── music │ │ ├── like.wav │ │ ├── delete.wav │ │ ├── error.wav │ │ ├── follow.wav │ │ ├── update.wav │ │ ├── comment.wav │ │ └── mixkit-positive-interface-click-1112.wav │ └── index.html ├── .gitignore ├── README.md └── package.json ├── backend ├── .gitignore ├── public │ └── images │ │ ├── DefaultBoy.jpg │ │ ├── DefaultGirl.jpg │ │ ├── DefaultPic.png │ │ └── images-notes.jpg ├── .env ├── model │ ├── Conversation.js │ ├── Message.js │ ├── Commentschema.js │ ├── Noteschema.js │ └── Userschema.js ├── database │ └── db.js ├── package.json ├── routes │ ├── message.js │ ├── comment.js │ ├── auth.js │ ├── conversation.js │ ├── users.js │ └── notes.js └── index.js ├── socket ├── README.md ├── router.js ├── .gitignore ├── package.json └── index.js ├── LICENSE └── README.md /frontend/src/redux/noteRedux.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /backend/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | -------------------------------------------------------------------------------- /frontend/src/pages/home/right/Right.jsx: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/pages/home/right/right.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/src/component/BuildConversation/BuildConversation.css: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /frontend/.env: -------------------------------------------------------------------------------- 1 | REACT_APP_PUBLIC_FOLDER="https://notesharingbackend-ankitkr437.onrender.com/images/" -------------------------------------------------------------------------------- /socket/README.md: -------------------------------------------------------------------------------- 1 | # Handnote-Socket 2 | #### Main route of this server "https://handnotesocket.herokuapp.com/" 3 | -------------------------------------------------------------------------------- /frontend/public/image/chat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/chat.png -------------------------------------------------------------------------------- /frontend/public/image/home.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/home.png -------------------------------------------------------------------------------- /frontend/public/music/like.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/music/like.wav -------------------------------------------------------------------------------- /frontend/public/music/delete.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/music/delete.wav -------------------------------------------------------------------------------- /frontend/public/music/error.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/music/error.wav -------------------------------------------------------------------------------- /frontend/public/music/follow.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/music/follow.wav -------------------------------------------------------------------------------- /frontend/public/music/update.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/music/update.wav -------------------------------------------------------------------------------- /frontend/public/music/comment.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/music/comment.wav -------------------------------------------------------------------------------- /backend/public/images/DefaultBoy.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/backend/public/images/DefaultBoy.jpg -------------------------------------------------------------------------------- /backend/public/images/DefaultGirl.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/backend/public/images/DefaultGirl.jpg -------------------------------------------------------------------------------- /backend/public/images/DefaultPic.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/backend/public/images/DefaultPic.png -------------------------------------------------------------------------------- /frontend/public/image/searchuser.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/searchuser.png -------------------------------------------------------------------------------- /frontend/public/image/uploadform.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/uploadform.png -------------------------------------------------------------------------------- /frontend/public/image/userprofile.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/userprofile.png -------------------------------------------------------------------------------- /backend/public/images/images-notes.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/backend/public/images/images-notes.jpg -------------------------------------------------------------------------------- /frontend/public/image/icons8-like-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-like-64.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-view-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-view-50.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-view-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-view-64.png -------------------------------------------------------------------------------- /backend/.env: -------------------------------------------------------------------------------- 1 | USERNAME=ankit 2 | PASSWORD=123 3 | URL='mongodb+srv://ankit:123@cluster0.orv6uim.mongodb.net/?retryWrites=true&w=majority' 4 | -------------------------------------------------------------------------------- /frontend/public/image/icons8-delete-90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-delete-90.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-edit-100.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-edit-100.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-like-post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-like-post.png -------------------------------------------------------------------------------- /frontend/public/image/fast-forward-button.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/fast-forward-button.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-comment-64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-comment-64.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-liked-post.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-liked-post.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-chat-bubble-90.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-chat-bubble-90.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-vertical-line.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-vertical-line.png -------------------------------------------------------------------------------- /frontend/public/image/icons8-microsoft-publisher-50.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/image/icons8-microsoft-publisher-50.png -------------------------------------------------------------------------------- /frontend/public/music/mixkit-positive-interface-click-1112.wav: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/ankitkr437/NoteSharing/HEAD/frontend/public/music/mixkit-positive-interface-click-1112.wav -------------------------------------------------------------------------------- /frontend/src/responsive.js: -------------------------------------------------------------------------------- 1 | import { css } from "styled-components"; 2 | 3 | export const mobile = (props) => { 4 | return css` 5 | @media only screen and (max-width: 480px) { 6 | ${props} 7 | } 8 | `; 9 | }; -------------------------------------------------------------------------------- /socket/router.js: -------------------------------------------------------------------------------- 1 | const express = require("express"); 2 | const router = express.Router(); 3 | 4 | router.get("/", (req, res) => { 5 | res.send({ response: "Server is up and running." }).status(200); 6 | }); 7 | 8 | module.exports = router; -------------------------------------------------------------------------------- /backend/model/Conversation.js: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose' 2 | 3 | const ConversationSchema = new mongoose.Schema( 4 | { 5 | members: { 6 | type: Array, 7 | }, 8 | }, 9 | { timestamps: true } 10 | ); 11 | 12 | 13 | const Conversation =mongoose.model("Conversation",ConversationSchema); 14 | export default Conversation ; -------------------------------------------------------------------------------- /backend/model/Message.js: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose' 2 | 3 | const MessageSchema = new mongoose.Schema( 4 | { 5 | conversationId: { 6 | type: String, 7 | }, 8 | sender: { 9 | type: String, 10 | }, 11 | text: { 12 | type: String, 13 | }, 14 | }, 15 | { timestamps: true } 16 | ); 17 | 18 | const Message= mongoose.model("Message", MessageSchema); 19 | export default Message -------------------------------------------------------------------------------- /socket/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /frontend/src/requestMethods.js: -------------------------------------------------------------------------------- 1 | import axios from "axios"; 2 | const LocalBASE_URL="http://localhost:8000/api/"; 3 | const BASE_URL = "https://notesharingbackend-ankitkr437.onrender.com/api/"; 4 | 5 | export const pf="https://notesharingbackend-ankitkr437.onrender.com/images"; 6 | 7 | export const publicRequest = axios.create({ 8 | baseURL: BASE_URL, 9 | }); 10 | 11 | export const userRequest = axios.create({ 12 | baseURL: BASE_URL, 13 | }); -------------------------------------------------------------------------------- /socket/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server", 3 | "version": "1.0.0", 4 | "description": "socket server for handnote", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1", 8 | "start": "nodemon index.js" 9 | }, 10 | "author": "", 11 | "license": "ISC", 12 | "dependencies": { 13 | "cors": "^2.8.5", 14 | "express": "^4.17.1", 15 | "nodemon": "^2.0.12", 16 | "socket.io": "^4.1.3" 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /backend/model/Commentschema.js: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose' 2 | 3 | const CommentSchema = new mongoose.Schema( 4 | { 5 | userId: { 6 | type: String, 7 | }, 8 | noteId:{ 9 | type: String, 10 | }, 11 | text:{ 12 | type:String, 13 | }, 14 | likes: { 15 | type: Array, 16 | default: [], 17 | }, 18 | 19 | }, 20 | { timestamps: true } 21 | ); 22 | 23 | const Comment = mongoose.model("Comment", CommentSchema); 24 | export default Comment; 25 | -------------------------------------------------------------------------------- /frontend/src/component/CircularLoader.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import {CircularProgress} from '@material-ui/core'; 3 | const Loader = ({item}) => { 4 | 5 | return ( 6 |
7 | 8 | { 9 | item!=="redirecting" && 10 |

Fetching the {item}...

11 | } 12 |
13 | ) 14 | } 15 | 16 | export default Loader -------------------------------------------------------------------------------- /backend/database/db.js: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose'; 2 | import dotenv from 'dotenv'; 3 | dotenv.config(); 4 | 5 | const connection= async (URL)=>{ 6 | try { 7 | // const URL='mongodb+srv://ankit:123@cluster0.szlik.mongodb.net/myFirstDatabase?retryWrites=true&w=majority'; 8 | await mongoose.connect(URL, { useUnifiedTopology: true, useNewUrlParser: true}); 9 | console.log('Database Connected Succesfully'); 10 | } catch(error) { 11 | console.log('Error: ', error.message); 12 | } 13 | } 14 | export default connection; -------------------------------------------------------------------------------- /frontend/README.md: -------------------------------------------------------------------------------- 1 | 2 | # This website is live(better to open in pc) 3 | https://handnote.netlify.app/ 4 | 5 | ### Note sharing website integrated with real time chat . 6 | ##### one can upload own notes,see all other available notes and can search for a particular note. can like ,follow,unfollow,comment on any post ,can communicate with any user. 7 | 8 | ### Want to run the project on your local machine:- 9 | 10 | #### Step 1: clone this project 11 | #### Step 2: open terminal and type "npm install" 12 | #### Step 3: type "npm start" 13 | #### Step 4: open "http://localhost:3000/" in new tab 14 | -------------------------------------------------------------------------------- /frontend/src/index.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import ReactDOM from 'react-dom'; 3 | import App from './App'; 4 | import {BrowserRouter as Router} from "react-router-dom"; 5 | import { Provider } from "react-redux"; 6 | import { store, persistor } from "./redux/store"; 7 | import { PersistGate } from 'redux-persist/integration/react' 8 | ReactDOM.render( 9 | 10 | 11 | 12 | 13 | 14 | 15 | , 16 | document.getElementById('root') 17 | ); 18 | 19 | 20 | -------------------------------------------------------------------------------- /frontend/src/loader/Loader.js: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | import 3 | { 4 | Card, 5 | CardHeader, 6 | CardContent, 7 | CardMedia, 8 | Avatar, 9 | Typography, 10 | IconButton 11 | } from "@material-ui/core"; 12 | import { Skeleton 13 | } from "@material-ui/lab"; 14 | import MoreVertIcon from '@material-ui/icons/MoreVert'; 15 | 16 | 17 | 18 | function Media() { 19 | const loading=true; 20 | 21 | return ( 22 | <> 23 | 24 | 25 | 26 | 27 | ); 28 | } 29 | 30 | export default Media; 31 | -------------------------------------------------------------------------------- /frontend/src/component/message/Message.jsx: -------------------------------------------------------------------------------- 1 | import "./message.css"; 2 | import { format } from "timeago.js"; 3 | 4 | export default function Message({ message, own }) { 5 | const pf="https://notesharingbackend-ankitkr437.onrender.com/images/"; 6 | return ( 7 |
8 |
9 | 14 |

{message.text}

15 |
16 |
{format(message.createdAt)}
17 |
18 | ); 19 | } -------------------------------------------------------------------------------- /frontend/src/pages/searchUserPage/SearchUserPage.jsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import styled from "styled-components"; 3 | import { useSelector, useDispatch } from "react-redux"; 4 | import { mobile } from "../../responsive" 5 | import BuildConversation from '../../component/BuildConversation/BuildConversation' 6 | import Navbar from "../../component/Navbar"; 7 | 8 | const Container = styled.div` 9 | width: 100%; 10 | margin-top: 3vh; 11 | padding: 20px; 12 | `; 13 | const SearchUserPage = () => { 14 | return ( 15 | <> 16 | 17 | 18 | 19 | 20 | 21 | ) 22 | } 23 | 24 | export default SearchUserPage -------------------------------------------------------------------------------- /frontend/src/redux/apiCalls.js: -------------------------------------------------------------------------------- 1 | import {registerFailure, registerStart, registerSuccess, loginFailure, loginStart, loginSuccess } from "./userRedux"; 2 | import { publicRequest } from "../requestMethods"; 3 | 4 | export const login = async (dispatch, user) => { 5 | dispatch(loginStart()); 6 | try { 7 | const res = await publicRequest.post("/auth/login", user); 8 | dispatch(loginSuccess(res.data)); 9 | } catch (err) { 10 | dispatch(loginFailure(err)); 11 | } 12 | }; 13 | 14 | export const register= async (dispatch, user) => { 15 | dispatch(registerStart()); 16 | try { 17 | const res = await publicRequest.post("/auth/register", user); 18 | dispatch(registerSuccess(res.data)); 19 | } catch (err) { 20 | dispatch(registerFailure()); 21 | } 22 | }; -------------------------------------------------------------------------------- /backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "server", 3 | "version": "1.0.0", 4 | "description": "server for hand notes", 5 | "main": "index.js", 6 | "type": "module", 7 | "scripts": { 8 | "test": "echo \"Error: no test specified\" && exit 1", 9 | "start": "nodemon index.js" 10 | }, 11 | "author": "ankit kumar", 12 | "license": "ISC", 13 | "dependencies": { 14 | "axios": "^0.24.0", 15 | "bcrypt": "^5.0.1", 16 | "body-parser": "^1.19.1", 17 | "cors": "^2.8.5", 18 | "dotenv": "^10.0.0", 19 | "express": "^4.17.2", 20 | "express-fileupload": "^1.2.1", 21 | "helmet": "^5.0.1", 22 | "mongoose": "^6.1.5", 23 | "morgan": "^1.10.0", 24 | "multer": "^1.4.5-lts.1", 25 | "nodemon": "^2.0.15", 26 | "path": "^0.12.7" 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /frontend/src/pages/home/center/Homepost.js: -------------------------------------------------------------------------------- 1 | import React, { useContext, useRef } from "react"; 2 | import { useState, useEffect } from "react"; 3 | import Post from "../../../component/post/Post"; 4 | import { publicRequest } from "../../../requestMethods"; 5 | const HomePost = ({ x }) => { 6 | const [postuser, setpostuser] = useState(null); 7 | 8 | useEffect(() => { 9 | const fetchuser = async (req, res) => { 10 | try { 11 | const res = await publicRequest.get("users/" +x.userId); 12 | setpostuser(res.data); 13 | } catch (err) { 14 | console.log(err); 15 | } 16 | }; 17 | fetchuser(); 18 | }, []); 19 | 20 | return ( 21 | <> 22 | 23 | 24 | ); 25 | }; 26 | 27 | export default HomePost; 28 | -------------------------------------------------------------------------------- /frontend/src/component/chatOnline/chatOnline.css: -------------------------------------------------------------------------------- 1 | .chatOnlineFriend { 2 | display: flex; 3 | align-items: center; 4 | font-weight: 500; 5 | cursor: pointer; 6 | margin-top: 10px; 7 | } 8 | 9 | .chatOnlineImgContainer { 10 | position: relative; 11 | margin-right: 10px; 12 | } 13 | 14 | .chatOnlineImg { 15 | width: 40px; 16 | height: 40px; 17 | border-radius: 50%; 18 | object-fit: cover; 19 | border: 1px solid white; 20 | } 21 | 22 | .chatOnlineBadge { 23 | width: 10px; 24 | height: 10px; 25 | border-radius: 50%; 26 | background-color: limegreen; 27 | position: absolute; 28 | top: 2px; 29 | right: 2px; 30 | } 31 | 32 | @media screen and (max-width: 768px) { 33 | .chatOnlineName { 34 | display: none; 35 | } 36 | } -------------------------------------------------------------------------------- /frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 11 | 12 | 18 | NoteSharing 19 | 20 | 21 | 22 | 23 |
24 | 25 | 26 | -------------------------------------------------------------------------------- /backend/routes/message.js: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | const router =express.Router(); 3 | import Message from '../model/Message.js'; 4 | 5 | //add 6 | 7 | router.post("/", async (req, res) => { 8 | const newMessage = new Message(req.body); 9 | 10 | try { 11 | const savedMessage = await newMessage.save(); 12 | res.status(200).json(savedMessage); 13 | } catch (err) { 14 | res.status(500).json(err); 15 | } 16 | }); 17 | 18 | //get 19 | 20 | router.get("/:conversationId", async (req, res) => { 21 | try { 22 | const messages = await Message.find({ 23 | conversationId: req.params.conversationId, 24 | }); 25 | res.status(200).json(messages); 26 | } catch (err) { 27 | res.status(500).json(err); 28 | } 29 | }); 30 | 31 | export default router -------------------------------------------------------------------------------- /backend/model/Noteschema.js: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose' 2 | 3 | const NoteSchema = new mongoose.Schema( 4 | { 5 | userId: { 6 | type: String, 7 | required: true, 8 | }, 9 | price:{ 10 | type:Number 11 | }, 12 | notename:{ 13 | type: String, 14 | max:15, 15 | }, 16 | desc: { 17 | type: String, 18 | max: 500, 19 | }, 20 | thumbnailfilename:{ 21 | type:String, 22 | }, 23 | notefilename:{ 24 | type:String, 25 | }, 26 | likes: { 27 | type: Array, 28 | default: [], 29 | }, 30 | //buy is actually view 31 | buy: { 32 | type: Array, 33 | default: [], 34 | }, 35 | }, 36 | { timestamps: true } 37 | ); 38 | 39 | const Note = mongoose.model("Note", NoteSchema); 40 | export default Note; 41 | -------------------------------------------------------------------------------- /frontend/src/component/conversations/conversation.css: -------------------------------------------------------------------------------- 1 | .conversation { 2 | display: flex; 3 | align-items: center; 4 | padding: 10px; 5 | cursor: pointer; 6 | margin-top: 20px; 7 | } 8 | .conversation:visited{ 9 | background-color: rgb(245, 243, 243); 10 | } 11 | .conversation:hover { 12 | background-color: rgb(245, 243, 243); 13 | } 14 | 15 | .conversationImg { 16 | width: 40px; 17 | height: 40px; 18 | border-radius: 50%; 19 | object-fit: cover; 20 | margin-right: 20px; 21 | } 22 | 23 | .conversationName { 24 | font-weight: 500; 25 | } 26 | 27 | @media screen and (max-width: 768px) { 28 | .conversation{ 29 | margin-right: 4px; 30 | flex-direction: column; 31 | } 32 | .conversationName { 33 | text-align: center; 34 | } 35 | .conversationImg{ 36 | margin-right: 0; 37 | } 38 | } -------------------------------------------------------------------------------- /frontend/src/component/message/message.css: -------------------------------------------------------------------------------- 1 | .message { 2 | display: flex; 3 | flex-direction: column; 4 | margin-top: 20px; 5 | word-wrap : break-word; 6 | overflow-wrap: break-word; 7 | } 8 | 9 | .messageTop{ 10 | display: flex; 11 | } 12 | 13 | .messageImg { 14 | width: 32px; 15 | height: 32px; 16 | border-radius: 50%; 17 | object-fit: cover; 18 | margin-right: 10px; 19 | } 20 | 21 | .messageText{ 22 | padding: 10px; 23 | border-radius: 20px; 24 | background-color: #1877f2; 25 | color: white; 26 | max-width: 300px; 27 | } 28 | 29 | .messageBottom{ 30 | font-size: 12px; 31 | margin-top: 10px; 32 | } 33 | 34 | .message.own{ 35 | align-items: flex-end; 36 | } 37 | 38 | .message.own .messageText{ 39 | background-color: rgb(245, 241, 241); 40 | color: black; 41 | } -------------------------------------------------------------------------------- /frontend/src/pages/home/Home.css: -------------------------------------------------------------------------------- 1 | .home-container{ 2 | padding: 20px 20px; 3 | } 4 | .main{ 5 | display: flex; 6 | } 7 | .featured-authors-text{ 8 | font-size: 25px; 9 | font-weight: 600; 10 | } 11 | .home-top{ 12 | margin-bottom: 2vh; 13 | } 14 | .center-container{ 15 | display: flex; 16 | flex-direction: column; 17 | flex: 5; 18 | } 19 | .left-container{ 20 | display: flex; 21 | flex-direction: column; 22 | flex: 2; 23 | margin-right: 3vh; 24 | } 25 | .right-container{ 26 | display: flex; 27 | flex-direction: column; 28 | flex: 2.5; 29 | margin-left: 3vh; 30 | } 31 | @media only screen and (max-width: 768px) { 32 | .home-container{ 33 | padding: 10px 10px; 34 | } 35 | .main{ 36 | display: block; 37 | } 38 | .right-container{ 39 | display: none; 40 | } 41 | .left-container{ 42 | display: none; 43 | } 44 | } 45 | 46 | -------------------------------------------------------------------------------- /frontend/src/component/comment/CommentBox.css: -------------------------------------------------------------------------------- 1 | *{ 2 | margin: 0; 3 | padding: 0; 4 | box-sizing: border-box; 5 | } 6 | 7 | .comment-box-container{ 8 | display: flex; 9 | flex-direction: row; 10 | margin-top: 2vh; 11 | } 12 | 13 | .comment-box-img{ 14 | width: 6vh; 15 | height: 6vh; 16 | box-sizing: border-box; 17 | border: 1px solid rgb(50, 104, 101); 18 | border-radius: 50%; 19 | object-fit: cover; 20 | } 21 | 22 | .comment-box-message{ 23 | 24 | width: 100%; 25 | border: 1px solid black; 26 | border-radius: 5px; 27 | background-color: rgb(248, 250, 251); 28 | padding: 7px 10px; 29 | font-size: 12px; 30 | 31 | } 32 | .comment-box-message-name{ 33 | display: flex; 34 | flex-direction: column; 35 | margin-left: 1vh; 36 | } 37 | .comment-box-message-name-value{ 38 | margin: 0; 39 | font-size: 14px; 40 | font-weight: 600; 41 | color: darkblue; 42 | } -------------------------------------------------------------------------------- /frontend/src/redux/store.js: -------------------------------------------------------------------------------- 1 | import { configureStore, combineReducers } from "@reduxjs/toolkit"; 2 | import userReducer from "./userRedux"; 3 | import { 4 | persistStore, 5 | persistReducer, 6 | FLUSH, 7 | REHYDRATE, 8 | PAUSE, 9 | PERSIST, 10 | PURGE, 11 | REGISTER, 12 | } from "redux-persist"; 13 | import storage from "redux-persist/lib/storage"; 14 | 15 | const persistConfig = { 16 | key: "root", 17 | version: 1, 18 | storage, 19 | }; 20 | 21 | const rootReducer = combineReducers({ user: userReducer }); 22 | 23 | const persistedReducer = persistReducer(persistConfig, rootReducer); 24 | 25 | export const store = configureStore({ 26 | reducer: persistedReducer, 27 | middleware: (getDefaultMiddleware) => 28 | getDefaultMiddleware({ 29 | serializableCheck: { 30 | ignoredActions: [FLUSH, REHYDRATE, PAUSE, PERSIST, PURGE, REGISTER], 31 | }, 32 | }), 33 | }); 34 | 35 | export let persistor = persistStore(store); -------------------------------------------------------------------------------- /backend/routes/comment.js: -------------------------------------------------------------------------------- 1 | import express from 'express'; 2 | const router =express.Router(); 3 | 4 | import User from '../model/Userschema.js'; 5 | import Note from '../model/Noteschema.js'; 6 | import Comment from '../model/Commentschema.js'; 7 | 8 | 9 | 10 | //create a comment for a note 11 | //here id is note id 12 | router.post("/:id", async (req, res) => { 13 | const commentinfo={ 14 | userId:req.body.userId, 15 | noteId:req.params.id, 16 | text:req.body.text, 17 | } 18 | 19 | const newComment = new Comment(commentinfo); 20 | try { 21 | const savedComment = await newComment.save(); 22 | res.status(200).json(savedComment); 23 | } catch (err) { 24 | res.status(500).json(err); 25 | } 26 | }); 27 | 28 | 29 | //for getting all the comment for a note 30 | //here a id is noteid 31 | router.get('/:id', async (req,res)=>{ 32 | 33 | try{ 34 | const comment =await Comment.find({ noteId: req.params.id }); 35 | res.status(200).json(comment); 36 | }catch (err) { 37 | res.status(500).json(err); 38 | } 39 | }) 40 | 41 | export default router; -------------------------------------------------------------------------------- /frontend/src/component/conversations/Conversation.jsx: -------------------------------------------------------------------------------- 1 | import { useEffect, useState } from "react"; 2 | import { publicRequest } from "../../requestMethods"; 3 | import "./conversation.css"; 4 | 5 | export default function Conversation({ conversation, currentUser }) { 6 | const [user, setUser] = useState(null); 7 | const PF ="https://notesharingbackend-ankitkr437.onrender.com/images/" 8 | useEffect(() => { 9 | const friendId = conversation.members.find((m) => m !== currentUser._id); 10 | 11 | const getUser = async () => { 12 | try { 13 | const res = await publicRequest("/users/" + friendId); 14 | setUser(res.data); 15 | } catch (err) { 16 | console.log(err); 17 | } 18 | }; 19 | getUser(); 20 | }, [currentUser, conversation]); 21 | 22 | return ( 23 |
24 | 29 | {user?.username} 30 |
31 | ); 32 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2023 ANKIT KUMAR 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /backend/model/Userschema.js: -------------------------------------------------------------------------------- 1 | import mongoose from 'mongoose' 2 | 3 | const UserSchema = new mongoose.Schema( 4 | { 5 | username: { 6 | type: String, 7 | require: true, 8 | unique: true, 9 | }, 10 | firstname: { 11 | type: String, 12 | }, 13 | lastname: { 14 | type: String, 15 | }, 16 | interested:{ 17 | type: String, 18 | }, 19 | email: { 20 | type: String, 21 | required: true, 22 | unique: true, 23 | }, 24 | password: { 25 | type: String, 26 | required: true, 27 | }, 28 | profilePicture: { 29 | type: String, 30 | default: "", 31 | }, 32 | followers: { 33 | type: Array, 34 | default: [], 35 | }, 36 | followings: { 37 | type: Array, 38 | default: [], 39 | }, 40 | isAdmin: { 41 | type: Boolean, 42 | default: false, 43 | }, 44 | institution: { 45 | type: String, 46 | max: 50, 47 | }, 48 | notes:{ 49 | type:Array, 50 | default:[], 51 | }, 52 | }, 53 | { timestamps: true } 54 | ); 55 | 56 | const User =mongoose.model("User", UserSchema); 57 | 58 | export default User ; -------------------------------------------------------------------------------- /frontend/src/pages/home/Home.jsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import Topbar from '../../component/topbar/Topbar'; 3 | import Author from '../../component/Author/Author.jsx'; 4 | import RenderPost from './center/RenderPost.js'; 5 | import Homeprofile from './left/Homeprofile.jsx'; 6 | import './Home.css'; 7 | import UploadNote from '../../component/uploadNote/UploadNote' 8 | import Navbar from '../../component/Navbar'; 9 | import Footer from '../../component/footer/Footer' 10 | import BuildConversation from '../../component/BuildConversation/BuildConversation' 11 | const Home = () => { 12 | 13 | return ( 14 | <> 15 | 16 |
17 |
18 | 19 | 20 |
21 |
22 |
23 | 24 |
25 |
26 | 27 |
28 |
29 | 30 |
31 |
32 | 33 |
34 |