Skip to content

Commit

Permalink
Merge pull request #42 from Rituraj67/master
Browse files Browse the repository at this point in the history
welcome page
  • Loading branch information
imdeveshshukla authored Aug 18, 2024
2 parents 0d62e5e + fd0c69c commit 479365e
Show file tree
Hide file tree
Showing 16 changed files with 495 additions and 314 deletions.
17 changes: 15 additions & 2 deletions backend/src/controller/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -128,14 +128,17 @@ const signup = async (req, res) => {
});
}
};



const varifyOtp = async (req, res) => {
try {
// console.log("Remaining = "+(req.rateLimit.remaining));
if(req.rateLimit.remaining <= 1)
{
return res.status(425).send({message:"Too Many requests, please try again after some minutes"});
}
const { userID, otp } = req.body;
const { userID, otp, email } = req.body;
if (userID == "" || otp == "") {
throw Error(" credetials cannot be empty");
} else {
Expand All @@ -161,6 +164,10 @@ const varifyOtp = async (req, res) => {
if (!validOtp) {
return res.status(401).json({ msg: "Invalid Otp" });
}

var token = jwt.sign({ userId:userID,email: email }, process.env.SECRET_KEY, {
expiresIn: 24 * 60 * 60,
});
const updateUser = await prisma.user.update({
where: {
userID: userID,
Expand All @@ -176,12 +183,18 @@ const varifyOtp = async (req, res) => {
},
});

return res.status(202).json({ msg: "User successfully Varified" });
return res.cookie(updateUser.userID, token, {
path: "/",
expires: new Date(Date.now() + 1000 * 1 * 24 * 60 * 60),
httpOnly: true,
sameSite: "lax",
}).status(202).send(email);
}
} catch (error) {
console.log(error);
}
};

const resendOtp = async (req, res) => {
console.log(req.body);
try {
Expand Down
57 changes: 49 additions & 8 deletions frontend/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,26 @@
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>quIET</title>
<link rel="apple-touch-icon" sizes="72x72" href="./src/assets/favicon/apple-icon-72x72.png" />
<link rel="apple-touch-icon" sizes="57x57" href="./src/assets/favicon/apple-icon-57x57.png" />
<link rel="apple-touch-icon" sizes="60x60" href="./src/assets/favicon/apple-icon-60x60.png" />
<link rel="apple-touch-icon" sizes="76x76" href="./src/assets/favicon/apple-icon-76x76.png" />
<link
rel="apple-touch-icon"
sizes="72x72"
href="./src/assets/favicon/apple-icon-72x72.png"
/>
<link
rel="apple-touch-icon"
sizes="57x57"
href="./src/assets/favicon/apple-icon-57x57.png"
/>
<link
rel="apple-touch-icon"
sizes="60x60"
href="./src/assets/favicon/apple-icon-60x60.png"
/>
<link
rel="apple-touch-icon"
sizes="76x76"
href="./src/assets/favicon/apple-icon-76x76.png"
/>
<link
rel="apple-touch-icon"
sizes="114x114"
Expand Down Expand Up @@ -39,13 +55,38 @@
sizes="192x192"
href="./src/assets/favicon/android-icon-192x192.png"
/>
<link rel="icon" type="image/png" sizes="32x32" href="./src/assets/favicon/favicon-32x32.png" />
<link rel="icon" type="image/png" sizes="96x96" href="./src/assets/favicon/favicon-96x96.png" />
<link rel="icon" type="image/png" sizes="16x16" href="./src/assets/favicon/favicon-16x16.png" />
<link
rel="icon"
type="image/png"
sizes="32x32"
href="./src/assets/favicon/favicon-32x32.png"
/>
<link
rel="icon"
type="image/png"
sizes="96x96"
href="./src/assets/favicon/favicon-96x96.png"
/>
<link
rel="icon"
type="image/png"
sizes="16x16"
href="./src/assets/favicon/favicon-16x16.png"
/>
<link rel="manifest" href="./src/assets/favicon/manifest.json" />
<meta name="msapplication-TileColor" content="#ffffff" />
<meta name="msapplication-TileImage" content="./src/assets/favicon/ms-icon-144x144.png" />
<meta
name="msapplication-TileImage"
content="./src/assets/favicon/ms-icon-144x144.png"
/>
<meta name="theme-color" content="#ffffff" />

<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,100..900;1,100..900&family=Open+Sans:ital,wght@0,300..800;1,300..800&family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&family=Roboto:ital,wght@0,100;0,300;0,400;0,500;0,700;0,900;1,100;1,300;1,400;1,500;1,700;1,900&family=Ubuntu:ital,wght@0,300;0,400;0,500;0,700;1,300;1,400;1,500;1,700&display=swap"
rel="stylesheet"
/>
</head>
<body>
<div id="root"></div>
Expand Down
1 change: 0 additions & 1 deletion frontend/public/vite.svg

This file was deleted.

60 changes: 43 additions & 17 deletions frontend/src/App.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ import NotFound from './pages/NotFound'
import Popular from './pages/Popular'
import ForbiddenPage from './pages/ForbiddenPage'
import loading from './redux/loading'
import About from './components/About'
import { hide } from './redux/welcome'



Expand All @@ -65,10 +67,12 @@ function App() {
const isLogin = useSelector((state) => state.login.value);
const userInfo = useSelector(state => state.user.userInfo);
const searchRef = useRef(null)
const welcomeRef = useRef(null)
const posts = useSelector(state => state.post.posts)
const location = useLocation();
const isSkelton = useSelector(state => state.skelton.value);
const showSearch = useSelector(state => state.search.value)
const showWelcome= useSelector(state=> state.welcome.value)
const navigate= useNavigate()


Expand All @@ -88,22 +92,7 @@ function App() {



const getUserData = async (email) => {
setLoading(true);
try {
const res = await axios.get(`${baseAddress}u/${email}`, { withCredentials: true });
if (res.status == 200) {
dispatch(setUserInfo(res.data.user));
console.log(res);


}
} catch (error) {
console.log(error);

}
setLoading(false);
}



Expand All @@ -129,11 +118,12 @@ function App() {
try {
const res = await axios.post(`${baseAddress}auth/refreshsignin`, { withCredentials: true });
if (res.status == 200) {

await getUserData({email:res.data, dispatch});
toast("Loggin Session Restored", {
icon: 'ℹ️',
})
dispatch(login());
getUserData(res.data);
getUserNotification();
}
} catch (error) {
Expand Down Expand Up @@ -167,6 +157,9 @@ function App() {
if (searchRef.current && !searchRef.current.contains(event.target)) {
dispatch(setShowSearch(false))
}
if (welcomeRef.current && !welcomeRef.current.contains(event.target)) {
dispatch(hide())
}
};


Expand Down Expand Up @@ -266,8 +259,41 @@ function App() {
</>
)}

{showWelcome && <>
<div className='fixed top-[74.46px] z-50 left-0 w-[100vw] h-[calc(100vh-74.46px)] bg-black bg-opacity-50 backdrop-blur-sm '>

<span ref={welcomeRef} className='fixed left-[50%] top-[50%] translate-x-[-50%] translate-y-[-50%]'>
<About />
</span>
</div>
</>}



</>
)
}

export default App
export default App


export const getUserData=async({email, dispatch})=>{
toast.dismiss()
toast.loading("Signing In")

dispatch(setSkeltonLoader())

try {
const res= await axios.get(`${baseAddress}u/${email}`, {withCredentials:true});

if(res.status==200){
console.log(res);
dispatch(setUserInfo(res.data.user));
}
} catch (error) {
console.log(error);
}

dispatch(setSkeltonLoader())
toast.dismiss()
}
2 changes: 1 addition & 1 deletion frontend/src/assets/Greencheck.jsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@

const Greencheck = () => (
<svg height="16" width="16" aria-hidden="true" focusable="false" data-prefix="far" data-icon="check" class="svg-inline--fa fa-check " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" color="#068927" d="M441 103c9.4 9.4 9.4 24.6 0 33.9L177 401c-9.4 9.4-24.6 9.4-33.9 0L7 265c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l119 119L407 103c9.4-9.4 24.6-9.4 33.9 0z"></path></svg>
<svg height="16" width="16" aria-hidden="true" focusable="false" data-prefix="far" data-icon="check" className="svg-inline--fa fa-check " role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512"><path fill="currentColor" color="#068927" d="M441 103c9.4 9.4 9.4 24.6 0 33.9L177 401c-9.4 9.4-24.6 9.4-33.9 0L7 265c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0l119 119L407 103c9.4-9.4 24.6-9.4 33.9 0z"></path></svg>
)


Expand Down
2 changes: 1 addition & 1 deletion frontend/src/assets/LeetCodeLogo.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react'

const LeetCodeLogo = () => {
return (
<svg width="28" height="28" viewBox="0 0 95 111" fill="none" xmlns="http://www.w3.org/2000/svg" class="h-full w-auto max-w-none"><path d="M68.0063 83.0664C70.5 80.5764 74.5366 80.5829 77.0223 83.0809C79.508 85.579 79.5015 89.6226 77.0078 92.1127L65.9346 103.17C55.7187 113.371 39.06 113.519 28.6718 103.513C28.6117 103.456 23.9861 98.9201 8.72653 83.957C-1.42528 74.0029 -2.43665 58.0749 7.11648 47.8464L24.9282 28.7745C34.4095 18.6219 51.887 17.5122 62.7275 26.2789L78.9048 39.362C81.6444 41.5776 82.0723 45.5985 79.8606 48.3429C77.6488 51.0873 73.635 51.5159 70.8954 49.3003L54.7182 36.2173C49.0488 31.6325 39.1314 32.2622 34.2394 37.5006L16.4274 56.5727C11.7767 61.5522 12.2861 69.574 17.6456 74.8292C28.851 85.8169 37.4869 94.2846 37.4969 94.2942C42.8977 99.496 51.6304 99.4184 56.9331 94.1234L68.0063 83.0664Z" fill="#FFA116"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M41.1067 72.0014C37.5858 72.0014 34.7314 69.1421 34.7314 65.615C34.7314 62.0879 37.5858 59.2286 41.1067 59.2286H88.1245C91.6454 59.2286 94.4997 62.0879 94.4997 65.615C94.4997 69.1421 91.6454 72.0014 88.1245 72.0014H41.1067Z" fill="#B3B3B3"></path><path fill-rule="evenodd" clip-rule="evenodd" d="M49.9118 2.02335C52.3173 -0.55232 56.3517 -0.686894 58.9228 1.72277C61.494 4.13244 61.6284 8.17385 59.2229 10.7495L16.4276 56.5729C11.7768 61.552 12.2861 69.5738 17.6453 74.8292L37.4088 94.2091C39.9249 96.6764 39.968 100.72 37.505 103.24C35.042 105.761 31.0056 105.804 28.4895 103.337L8.72593 83.9567C-1.42529 74.0021 -2.43665 58.0741 7.1169 47.8463L49.9118 2.02335Z" fill="white"></path></svg>
<svg width="28" height="28" viewBox="0 0 95 111" fill="none" xmlns="http://www.w3.org/2000/svg" className="h-full w-auto max-w-none"><path d="M68.0063 83.0664C70.5 80.5764 74.5366 80.5829 77.0223 83.0809C79.508 85.579 79.5015 89.6226 77.0078 92.1127L65.9346 103.17C55.7187 113.371 39.06 113.519 28.6718 103.513C28.6117 103.456 23.9861 98.9201 8.72653 83.957C-1.42528 74.0029 -2.43665 58.0749 7.11648 47.8464L24.9282 28.7745C34.4095 18.6219 51.887 17.5122 62.7275 26.2789L78.9048 39.362C81.6444 41.5776 82.0723 45.5985 79.8606 48.3429C77.6488 51.0873 73.635 51.5159 70.8954 49.3003L54.7182 36.2173C49.0488 31.6325 39.1314 32.2622 34.2394 37.5006L16.4274 56.5727C11.7767 61.5522 12.2861 69.574 17.6456 74.8292C28.851 85.8169 37.4869 94.2846 37.4969 94.2942C42.8977 99.496 51.6304 99.4184 56.9331 94.1234L68.0063 83.0664Z" fill="#FFA116"></path><path fillRule="evenodd" clipRule="evenodd" d="M41.1067 72.0014C37.5858 72.0014 34.7314 69.1421 34.7314 65.615C34.7314 62.0879 37.5858 59.2286 41.1067 59.2286H88.1245C91.6454 59.2286 94.4997 62.0879 94.4997 65.615C94.4997 69.1421 91.6454 72.0014 88.1245 72.0014H41.1067Z" fill="#B3B3B3"></path><path fillRule="evenodd" clipRule="evenodd" d="M49.9118 2.02335C52.3173 -0.55232 56.3517 -0.686894 58.9228 1.72277C61.494 4.13244 61.6284 8.17385 59.2229 10.7495L16.4276 56.5729C11.7768 61.552 12.2861 69.5738 17.6453 74.8292L37.4088 94.2091C39.9249 96.6764 39.968 100.72 37.505 103.24C35.042 105.761 31.0056 105.804 28.4895 103.337L8.72593 83.9567C-1.42529 74.0021 -2.43665 58.0741 7.1169 47.8463L49.9118 2.02335Z" fill="white"></path></svg>
)
}

Expand Down
60 changes: 60 additions & 0 deletions frontend/src/components/About.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
import React from 'react'
import { IoIosSend } from "react-icons/io";
import { MdCancelPresentation } from "react-icons/md";
import { useDispatch } from 'react-redux';
import {hide} from '../redux/welcome'

const About = () => {
const dispatch= useDispatch();
return (
<>
<div className=' animate-slideInFromBehind relative flex flex-col gap-4 p-4 rounded-lg shadow-2xl bg-[#c8cc83] w-[80vw] 1_5md:w-[60vw] overflow-auto scrollable-box max-h-[80vh]'>
<div onClick={()=>dispatch(hide())} className=' absolute right-4 top-4 text-2xl'><MdCancelPresentation/></div>
<header className=' w-full text-center text-[#5d610bf8] text-xl xs:text-2xl font-bold font-roboto'>
<span className=''>Welcome to quIET</span>
</header>
<main className=' flex flex-col gap-2 text-[#3e4202f8] font-ubuntu text-sm xs:text-base'>
<div className=''>
Welcome to quIET, a social media platform designed for those who value their privacy and the freedom to express themselves without fear of judgment. We’re thrilled to have you join our community where your thoughts, ideas, and experiences can be shared freely and anonymously.
</div>
<div>
<div className=' xs:text-lg font-semibold'>What is quIET?</div>
<div>
quIET is an anonymous social media platform where users can interact, post comments, and engage in discussions without revealing their true identity as users often face the challenge of balancing their public image with their true thoughts and feelings. In this digital age, where personal data is often at risk, quIET provides a sanctuary where you can be yourself without the pressure of maintaining a public persona. Here, every user is assigned a randomly generated username, ensuring that your real name and email address remain completely private.
</div>
</div>
<div>
<div className=' xs:text-lg font-semibold'>Key Features</div>
<ul className=' list-disc pl-8'>
<li>Each user is given a unique, randomly generated username. Your real name and email address are never displayed, ensuring complete anonymity.</li>

<li>
Discuss anything from college life and societal critiques to personal stories, or just engage in some light-hearted gossip and observations without the fear of judgment and burden of revealing your identity.
</li>

<li>
Interact with others, comment on posts, and participate in discussions in a community that values privacy and authenticity.
</li>

</ul>


</div>

<div className=''>
<div className=' xs:text-lg font-semibold'>A Glimpse Into the quIET Experience</div>
<div>
As a new user, you’ll find that quIET is not just another social media platform. It’s a space where the usual constraints of identity and reputation are lifted, allowing for more genuine and diverse conversations. Whether you’re here to share your thoughts on the latest trends, vent about college life, or engage in serious discussions about social issues, quIET welcomes you with open arms.
</div>
</div>
</main>

<footer className=' text-[#3e4202f8] flex items-start'>
<div ><span>Thank you for joining quIET. We hope you enjoy your journey of anonymous interaction, where your voice can be as loud or as soft as you want it to be</span> <span className=' font-bold'><span>—just stay quIET</span><IoIosSend className=' inline-block text-xl'/></span>.</div>
</footer>
</div>
</>
)
}

export default About
1 change: 1 addition & 0 deletions frontend/src/components/AddMemBox.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import SmoothLoader from "../assets/SmoothLoader";
import axios from "axios";
import baseAddress from "../utils/localhost";
import toast from "react-hot-toast";
import dp from '../assets/dummydp.png'
import { useDebounce } from '../hooks/useDebounce';
import { fetchUsers } from "./Search";
import { v4 as uuidv4 } from "uuid";
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ const Home = () => {


return (
<div className=' min-h-screen xxs:pl-0'>
<div className=' min-h-screen xs:pl-8 sm:pl-16'>
<InfiniteScroll
dataLength={posts.length}
next={fetchMoreData}
Expand Down
Loading

0 comments on commit 479365e

Please sign in to comment.