From 8ca43994e9bfcbeb4616dc0f7bb7a1b8059a6ef1 Mon Sep 17 00:00:00 2001 From: neeramrutia Date: Sun, 14 Jul 2024 21:46:20 +0530 Subject: [PATCH 1/9] solved show Project bug --- app/showProjects/showAllProjects.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/showProjects/showAllProjects.tsx b/app/showProjects/showAllProjects.tsx index 50cf4a2..8eb950b 100644 --- a/app/showProjects/showAllProjects.tsx +++ b/app/showProjects/showAllProjects.tsx @@ -37,7 +37,7 @@ import { import Link from "next/link"; import { useDisclosure, useIntersection, useMediaQuery } from "@mantine/hooks"; import { FooterLinks } from "../../components/footer/footer"; -let limit = 6; +let limit = 3; let skip = 0; let count = 0; let PROJECTS : any = []; From 4c94d916cfc96c253c33914fbfe3927b5e614c05 Mon Sep 17 00:00:00 2001 From: neeramrutia Date: Sun, 14 Jul 2024 23:31:04 +0530 Subject: [PATCH 2/9] updated analysis --- app/analysis/Analysis.tsx | 27 +++++++++++++++++++-------- app/showProjects/showAllProjects.tsx | 24 ++++++++++-------------- components/footer/headerforHome.tsx | 9 --------- components/signedInNavbar.tsx | 12 ++++++------ components/signedOutNavbar.tsx | 20 ++++++-------------- 5 files changed, 41 insertions(+), 51 deletions(-) diff --git a/app/analysis/Analysis.tsx b/app/analysis/Analysis.tsx index 3973117..b54317d 100644 --- a/app/analysis/Analysis.tsx +++ b/app/analysis/Analysis.tsx @@ -14,6 +14,8 @@ interface d { let data: d[] = []; export default function Analysis() { + //const [maximum , setMaximum] = useState(0); + let maximum = 0; const [loadingOsData, setLoadingOsData] = useState(true); const [loading, setLoading] = useState(true); const [newData, setnewData] = useState([ @@ -39,15 +41,24 @@ export default function Analysis() { setLoading(false); }; const fetchOsData = async () => { - const res = await getOsData().then().catch(console.error); - setOsMonth(res || []); + const res:any = await getOsData().then().catch(console.error); + console.log(res); + for(let i=0;i { - fetchData(); - fetchOsData().then(()=>{setLoadingOsData(false);}); - }, [osMonth , osMonthData]); + async function ASYNC(){ + await fetchData(); + await fetchOsData().then(()=>{setLoadingOsData(false);}); + } + ASYNC(); + },[]); if (!loading) { const stats = newData.map((stat) => ( @@ -67,10 +78,10 @@ export default function Analysis() { )} { - !loadingOsData && + !loading && !loadingOsData && o.desktop))] }} unit=" users" h={300} data={!loadingOsData ? osMonth : []} diff --git a/app/showProjects/showAllProjects.tsx b/app/showProjects/showAllProjects.tsx index 8eb950b..d8313c5 100644 --- a/app/showProjects/showAllProjects.tsx +++ b/app/showProjects/showAllProjects.tsx @@ -37,7 +37,7 @@ import { import Link from "next/link"; import { useDisclosure, useIntersection, useMediaQuery } from "@mantine/hooks"; import { FooterLinks } from "../../components/footer/footer"; -let limit = 3; +let limit = 6; let skip = 0; let count = 0; let PROJECTS : any = []; @@ -55,8 +55,10 @@ const fetcher = async ( count = countData.count; console.log(count); if (query == "") { + console.log("this is fetching when query is null"); const data = await fetch(`api/projects?limit=${limit}&skip=${skip}`); const res = await data.json(); + console.log("res from query null" , res) if (PROJECTS.length == 1) { PROJECTS = [...res]; } else { @@ -118,17 +120,17 @@ export default function ShowAllProjects() { (entry?.isIntersecting && count > skip && !fetching) || (entry?.isIntersecting && count == 0 && !fetching) ) { - setFetching(true) + await setFetching(true) console.log("intersecting"); - fetcher(query, filter.searchBy, limit, skip + limit) + await fetcher(query, filter.searchBy, limit, skip + limit) .then(() => { skip = skip + limit; }) - .then(() => { - setmyData(PROJECTS); - setLoadingProject(false); - setInitialLoading(false); - setFetching(false) + .then(async() => { + await setmyData(PROJECTS); + await setLoadingProject(false); + await setInitialLoading(false); + await setFetching(false) }); } } @@ -202,12 +204,6 @@ export default function ShowAllProjects() { {card.title} - - - - 4.78 - - diff --git a/components/footer/headerforHome.tsx b/components/footer/headerforHome.tsx index 7e075e4..0406a1e 100644 --- a/components/footer/headerforHome.tsx +++ b/components/footer/headerforHome.tsx @@ -25,15 +25,6 @@ export function HeroText() { Discover, Collaborate, Innovate: Your Gateway to Cutting-Edge Projects! - -
- - -
); diff --git a/components/signedInNavbar.tsx b/components/signedInNavbar.tsx index cd1b834..0b50805 100644 --- a/components/signedInNavbar.tsx +++ b/components/signedInNavbar.tsx @@ -234,7 +234,7 @@ export default function SignedInNavbar() { }} color="cyan" /> - } label="Recently uploaded projects" active={9 === active} @@ -243,8 +243,8 @@ export default function SignedInNavbar() { toggle(); }} color="cyan" - /> - */} + {/* } label="Most Liked Projects" active={10 === active} @@ -253,7 +253,7 @@ export default function SignedInNavbar() { toggle(); }} color="cyan" - /> + /> */} } {active == 16 && } {active == 13 && } - {active == 9 && } - {active == 10 && } + {/* {active == 9 && } */} + {/* {active == 10 && } */} {active == 12 && } ) } - - - - - - - - {/* */} - } label="Recently uploaded projects" active={9 === active} onClick={() => {setActive(9);toggle()}} color="cyan" - /> - */} + {/* } label="Most Liked Projects" active={10 === active} onClick={() => {setActive(10);toggle()}} color="cyan" - /> + /> */} {active == 8 && } {active == 0 && } {active == 4 && } - {active == 9 && } - {active == 10 && } + {/* {active == 9 && } */} + {/* {active == 10 && } */} {active == 3 && } From c1f1ec7b25c91a4c9c6879ab10568447dcac9dd7 Mon Sep 17 00:00:00 2001 From: neeramrutia Date: Sun, 14 Jul 2024 23:47:23 +0530 Subject: [PATCH 3/9] added sample projects --- app/showProjects/showAllProjects.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/showProjects/showAllProjects.tsx b/app/showProjects/showAllProjects.tsx index d8313c5..b4f3eae 100644 --- a/app/showProjects/showAllProjects.tsx +++ b/app/showProjects/showAllProjects.tsx @@ -37,7 +37,7 @@ import { import Link from "next/link"; import { useDisclosure, useIntersection, useMediaQuery } from "@mantine/hooks"; import { FooterLinks } from "../../components/footer/footer"; -let limit = 6; +let limit = 3; let skip = 0; let count = 0; let PROJECTS : any = []; @@ -55,7 +55,7 @@ const fetcher = async ( count = countData.count; console.log(count); if (query == "") { - console.log("this is fetching when query is null"); + //console.log("this is fetching when query is null"); const data = await fetch(`api/projects?limit=${limit}&skip=${skip}`); const res = await data.json(); console.log("res from query null" , res) From bbca2b8032b4059fe3857747920a186251dcde8f Mon Sep 17 00:00:00 2001 From: neeramrutia Date: Wed, 17 Jul 2024 01:17:58 +0530 Subject: [PATCH 4/9] added ddu domain as coordinator --- app/api/auth/[...nextauth]/options.ts | 38 +++++++++++++++++---------- 1 file changed, 24 insertions(+), 14 deletions(-) diff --git a/app/api/auth/[...nextauth]/options.ts b/app/api/auth/[...nextauth]/options.ts index 509393d..f744ed6 100644 --- a/app/api/auth/[...nextauth]/options.ts +++ b/app/api/auth/[...nextauth]/options.ts @@ -78,7 +78,6 @@ export const options: NextAuthOptions = { } , async jwt({ token , user} : {token : JWT , user : CustomUser}){ - if(user) { token.role = user.role @@ -115,11 +114,22 @@ export const options: NextAuthOptions = { { var userExist = await User.findOne({email : profile?.email}); if(!userExist){ - const usertobecreated = await User.create({ + if(user.email?.endsWith("@ddu.ac.in")){ + const usertobecreated = await User.create({ email : profile?.email, name : profile?.name, - password : "1234" + password : makeid(10), + role : "Coordinator" }) + } + else{ + const usertobecreated = await User.create({ + email : profile?.email, + name : profile?.name, + password : makeid(10) + }) + } + } return true; } @@ -135,14 +145,14 @@ export const options: NextAuthOptions = { } -// function makeid(length : number) { -// let result = ''; -// const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; -// const charactersLength = characters.length; -// let counter = 0; -// while (counter < length) { -// result += characters.charAt(Math.floor(Math.random() * charactersLength)); -// counter += 1; -// } -// return result; -// } \ No newline at end of file +function makeid(length : number) { + let result = ''; + const characters = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'; + const charactersLength = characters.length; + let counter = 0; + while (counter < length) { + result += characters.charAt(Math.floor(Math.random() * charactersLength)); + counter += 1; + } + return result; +} \ No newline at end of file From 62bcc3d731ff7b82bb7ac78a3205b86d5365e6d1 Mon Sep 17 00:00:00 2001 From: neeramrutia Date: Wed, 17 Jul 2024 01:37:08 +0530 Subject: [PATCH 5/9] added ddu.ac.in domain as coordinator --- app/api/auth/[...nextauth]/options.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/api/auth/[...nextauth]/options.ts b/app/api/auth/[...nextauth]/options.ts index f744ed6..eb75df7 100644 --- a/app/api/auth/[...nextauth]/options.ts +++ b/app/api/auth/[...nextauth]/options.ts @@ -119,7 +119,9 @@ export const options: NextAuthOptions = { email : profile?.email, name : profile?.name, password : makeid(10), - role : "Coordinator" + role : "Coordinator", + isCoordinator : true, + isAdmin : false }) } else{ From 060a8eb1e639211610dc6192042eb36416fe6185 Mon Sep 17 00:00:00 2001 From: neeramrutia Date: Wed, 17 Jul 2024 12:44:32 +0530 Subject: [PATCH 6/9] added coordinator --- app/api/auth/[...nextauth]/options.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/api/auth/[...nextauth]/options.ts b/app/api/auth/[...nextauth]/options.ts index eb75df7..470d404 100644 --- a/app/api/auth/[...nextauth]/options.ts +++ b/app/api/auth/[...nextauth]/options.ts @@ -119,7 +119,7 @@ export const options: NextAuthOptions = { email : profile?.email, name : profile?.name, password : makeid(10), - role : "Coordinator", + role : "coordinator", isCoordinator : true, isAdmin : false }) From 1848e80fb8cf131f7d4aaac9d8e78f303f2b5d99 Mon Sep 17 00:00:00 2001 From: neeramrutia Date: Wed, 17 Jul 2024 23:21:38 +0530 Subject: [PATCH 7/9] updated footer and nav links --- components/footer/FeaturesGrid.tsx | 2 +- components/footer/footer.tsx | 6 +++--- components/footer/headerforHome.tsx | 1 - public/FooterLinks.module.css | 10 +++++----- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/components/footer/FeaturesGrid.tsx b/components/footer/FeaturesGrid.tsx index 35bc56e..85769af 100644 --- a/components/footer/FeaturesGrid.tsx +++ b/components/footer/FeaturesGrid.tsx @@ -269,7 +269,7 @@ export function FeaturesGrid() { spacing={{ base: 'xl', md: 50 }} verticalSpacing={{ base: 'xl', md: 50 }} > - {features} + {/* {features} */} ); diff --git a/components/footer/footer.tsx b/components/footer/footer.tsx index 6651c22..0fbd031 100644 --- a/components/footer/footer.tsx +++ b/components/footer/footer.tsx @@ -57,7 +57,7 @@ export function FooterLinks() { return (