├── .eslintrc.json ├── .gitignore ├── .vscode └── settings.json ├── CODE_OF_CONDUCT.md ├── Contributing.md ├── README.md ├── __pycache__ └── fetching_data.cpython-311.pyc ├── cron_jobs ├── __pycache__ │ └── fetching_data.cpython-311.pyc ├── fetching_data.py └── testing_supabase.py ├── jsconfig.json ├── next.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public └── assets │ └── images │ ├── 1.png │ ├── ASPDC_dp.jpeg │ ├── BWCool.jpg │ ├── Coding-B&W.jpg │ ├── Coding-low-brightness.jpg │ ├── Coding.jpg │ ├── Main Coding.jpg │ ├── low-bright.jpg │ ├── next.svg │ └── vercel.svg ├── src ├── app │ ├── api │ │ ├── codechefData │ │ │ └── route.js │ │ ├── codeforcesData │ │ │ └── route.js │ │ ├── cron_jobs │ │ │ └── route.js │ │ ├── leetcodeData │ │ │ └── route.js │ │ └── postData │ │ │ └── route.js │ ├── components │ │ ├── Footer.jsx │ │ ├── Home │ │ │ ├── about │ │ │ │ └── About.jsx │ │ │ ├── hero │ │ │ │ ├── DownArrow.jsx │ │ │ │ ├── Hero.jsx │ │ │ │ └── SingleArrow.jsx │ │ │ └── team │ │ │ │ ├── MemberCard.jsx │ │ │ │ └── Team.jsx │ │ ├── LoadingPage.jsx │ │ ├── Navbar.jsx │ │ ├── ProfilePage.jsx │ │ ├── leaderboard │ │ │ ├── codechef.jsx │ │ │ ├── codeforces.jsx │ │ │ └── leetcode.jsx │ │ └── sorting.jsx │ ├── favicon.ico │ ├── globals.css │ ├── layout.jsx │ ├── page.jsx │ ├── pages │ │ ├── events │ │ │ └── page.jsx │ │ ├── gallery │ │ │ └── page.jsx │ │ ├── home │ │ │ └── page.jsx │ │ ├── leaderboard │ │ │ ├── loading.jsx │ │ │ └── page.jsx │ │ ├── profile │ │ │ └── page.jsx │ │ ├── projects │ │ │ └── page.jsx │ │ └── resources │ │ │ └── page.jsx │ ├── sign-in │ │ └── [[...sign-in]] │ │ │ └── page.jsx │ └── sign-up │ │ └── [[...sign-up]] │ │ └── page.jsx ├── middleware.js └── utils │ └── get-item.js ├── supabase.js ├── tailwind.config.js └── vercel.json /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "next/core-web-vitals" 3 | } 4 | -------------------------------------------------------------------------------- /.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 | # next.js 12 | /.next/ 13 | /out/ 14 | 15 | # production 16 | /build 17 | 18 | # misc 19 | .DS_Store 20 | *.pem 21 | 22 | # debug 23 | npm-debug.log* 24 | yarn-debug.log* 25 | yarn-error.log* 26 | 27 | # local env files 28 | .env*.local 29 | .env 30 | 31 | # vercel 32 | .vercel 33 | 34 | # typescript 35 | *.tsbuildinfo 36 | next-env.d.ts 37 | -------------------------------------------------------------------------------- /.vscode/settings.json: -------------------------------------------------------------------------------- 1 | { 2 | "workbench.colorCustomizations": { 3 | "activityBar.activeBackground": "#242424", 4 | "activityBar.background": "#242424", 5 | "activityBar.foreground": "#e7e7e7", 6 | "activityBar.inactiveForeground": "#e7e7e799", 7 | "activityBarBadge.background": "#606020", 8 | "activityBarBadge.foreground": "#e7e7e7", 9 | "commandCenter.border": "#e7e7e799", 10 | "sash.hoverBorder": "#242424", 11 | "statusBar.background": "#0b0b0b", 12 | "statusBar.foreground": "#e7e7e7", 13 | "statusBarItem.hoverBackground": "#242424", 14 | "statusBarItem.remoteBackground": "#0b0b0b", 15 | "statusBarItem.remoteForeground": "#e7e7e7", 16 | "titleBar.activeBackground": "#0b0b0b", 17 | "titleBar.activeForeground": "#e7e7e7", 18 | "titleBar.inactiveBackground": "#0b0b0b99", 19 | "titleBar.inactiveForeground": "#e7e7e799" 20 | }, 21 | "peacock.color": "#0b0b0b" 22 | } -------------------------------------------------------------------------------- /CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | # ASPDC Code of Conduct 2 | 3 | The ASPDC (Adani Student Programming and Development Club) community is dedicated to providing a safe and welcoming environment for all members and contributors, regardless of their background, identity, or level of experience. As a member or contributor of ASPDC, we ask that you follow our Code of Conduct to ensure a positive and inclusive community experience. 4 | 5 | ## Our Values 6 | 7 | - **Inclusivity**: We welcome individuals from all backgrounds and skill levels. Discrimination or exclusion based on factors such as race, gender, sexual orientation, disability, age, or any other characteristic will not be tolerated. 8 | 9 | - **Respect**: Treat all community members and contributors with respect and kindness. We encourage constructive criticism and open discussions. 10 | 11 | - **Collaboration**: Promote cooperation and collaboration. We believe that working together leads to better results. 12 | 13 | - **Learning**: ASPDC is a place of learning and growth. We encourage sharing knowledge and supporting each other's learning journey. 14 | 15 | - **Positive Environment**: Help create a positive and supportive environment. Be mindful of your words and actions, and consider their impact on others. 16 | 17 | ## Unacceptable Behavior 18 | 19 | The following behaviors are considered unacceptable within the ASPDC community: 20 | 21 | - Harassment, bullying, or intimidation of any form. 22 | - Offensive or discriminatory language, comments, or imagery. 23 | - Personal attacks or insults. 24 | - Trolling, spamming, or disruptive behavior. 25 | - Unsolicited or inappropriate messages, whether in public or private channels. 26 | 27 | ## Reporting and Enforcement 28 | 29 | If you witness or experience any behavior that violates this Code of Conduct, please report it to the ASPDC administrators through [contact@aspdc.org]. We will investigate and take appropriate actions, which may include warning, suspension, or expulsion from the community. 30 | 31 | ## Acknowledgment 32 | 33 | ASPDC is committed to upholding this Code of Conduct, and we ask that all members and contributors adhere to these guidelines. By participating in the ASPDC community, you agree to abide by this Code of Conduct. 34 | 35 | ## Questions or Concerns 36 | 37 | If you have questions, concerns, or need assistance related to the Code of Conduct or community guidelines, please reach out to the ASPDC administrators through [contact@aspdc.org]. We are here to help and provide support. 38 | 39 | Thank you for being part of the ASPDC community and helping us create a welcoming and inclusive environment for all. 40 | 41 | --- 42 | *This Code of Conduct is adapted and inspired by the [Contributor Covenant](https://www.contributor-covenant.org/version/2/0/code_of_conduct/).* 43 | 44 | -------------------------------------------------------------------------------- /Contributing.md: -------------------------------------------------------------------------------- 1 | # Contributing to ASPDC 2 | 3 | 👋 Welcome to the ASPDC GitHub repository! We're thrilled that you're interested in contributing to our project. By participating in our open-source efforts, you'll be helping us build a fully functional website for the ASPDC community. Here's how you can get started: 4 | 5 | ## Table of Contents 6 | 7 | - [Getting Started](#getting-started) 8 | - [How to Contribute](#how-to-contribute) 9 | - [Code of Conduct](#code-of-conduct) 10 | - [License](#license) 11 | 12 | ## Getting Started 13 | 14 | 1. **Fork the Repository**: Click the "Fork" button in the top right of this repository to create your copy. 15 | 16 | 2. **Clone the Repository**: Clone your forked repository to your local machine. You can do this using Git and running: 17 | 18 | ```shell 19 | git clone https://github.com/your-username/aspdc 20 | ``` 21 | 22 | 3. **Navigate to the ASPDC Website Repository**: To work on the ASPDC website, navigate to our website repository by running: 23 | 24 | ```shell 25 | cd aspdc-website 26 | ``` 27 | 28 | 4. **Create a New Branch**: Create a new branch for your feature or bug fix: 29 | 30 | ```shell 31 | git checkout -b feature-name 32 | ``` 33 | 34 | ## How to Contribute 35 | 36 | 1. **Issue Tracker**: Check the [issue tracker](https://github.com/aspdc/aspdc-website/issues) for tasks that need attention. If you don't find an issue that suits your skillset, feel free to create one. 37 | 38 | 2. **Work on Your Contribution**: Code, test, and ensure that your contribution meets the project's coding standards. 39 | 40 | 3. **Commit Changes**: Commit your changes with a descriptive message: 41 | 42 | ```shell 43 | git commit -m "Add feature XYZ" 44 | ``` 45 | 46 | 4. **Push Changes**: Push your changes to your fork: 47 | 48 | ```shell 49 | git push origin feature-name 50 | ``` 51 | 52 | 5. **Submit a Pull Request (PR)**: Submit a PR to the `main` branch of the ASPDC repository. Be sure to describe the changes you've made and reference any related issues. 53 | 54 | 6. **Review and Discuss**: Our team will review your PR, and discussions or additional changes may be requested. 55 | 56 | 7. **Approval and Merge**: Once your PR is approved, it will be merged into the `main` branch. 57 | 58 | ## Code of Conduct 59 | 60 | Please review our [Code of Conduct](CODE_OF_CONDUCT.md) to ensure that all interactions and contributions are respectful and considerate. 61 | 62 | ## License 63 | 64 | By contributing to the ASPDC project, you agree that your contributions will be licensed under the [MIT License](LICENSE.md). 65 | 66 | Thank you for contributing to ASPDC! Your help is invaluable in building a thriving and inclusive community. 🚀 67 | 68 | If you have any questions or need further assistance, please feel free to reach out to us. 69 | 70 | Happy coding! 71 | ASPDC Admin Team 72 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # ASPDC (Adani Student Programming and Development Club) 2 | 3 | ASPDC, the Adani Student Programming and Development Club, is a dynamic and student-driven community dedicated to fostering a passion for coding. Whether you're interested in data structures and algorithms, web development, or any other coding genre, ASPDC is the place for you. We organize a variety of online and offline events to promote learning and collaboration. 4 | 5 | ## About Us 6 | 7 | - 📚 **Learning**: We provide resources and support for various coding disciplines. 8 | - 🏆 **Challenges**: Daily Problem of the Day (POTD) solutions and weekly contests like Showdown. 9 | - 🚀 **Projects**: Collaborate on exciting projects with fellow students. 10 | - 💬 **Community**: Engage with a vibrant community of like-minded coders. 11 | 12 | ## Join Our Club 13 | 14 | Join our club and be part of a vibrant coding community. Connect with us on the following platforms: 15 | 16 | - 🗣️ **Discord**: [Join us on Discord](https://discord.com/invite/XGRrb9JZrR) 17 | - 📷 **Instagram**: [Follow us on Instagram](https://www.instagram.com/aspd.club/) 18 | - 🎥 **YouTube**: [Subscribe to our YouTube channel](https://www.youtube.com/@clubaspd) 19 | 20 | ## Getting Started 21 | 22 | To get started with contributing to ASPDC, please refer to our [Contributing Guidelines](https://github.com/aspdc/aspdc-website/blob/main/Contributing.md). This document provides detailed information on how you can contribute to our project. 23 | 24 | ## Code of Conduct 25 | 26 | ASPDC is committed to providing an inclusive and respectful environment for all members and contributors. Please review our [Code of Conduct](CODE_OF_CONDUCT.md) to understand the standards of behavior and interaction expected within our community. 27 | 28 | ## License 29 | 30 | By contributing to the ASPDC project, you agree that your contributions will be licensed under the [MIT License](LICENSE.md). 31 | 32 | Thank you for your interest in ASPDC! Your contributions are integral to building a thriving and supportive community for students passionate about programming. If you have any questions or need further assistance, please feel free to reach out to us. 33 | 34 | Happy coding! 35 | ASPDC Admin Team 36 | -------------------------------------------------------------------------------- /__pycache__/fetching_data.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/__pycache__/fetching_data.cpython-311.pyc -------------------------------------------------------------------------------- /cron_jobs/__pycache__/fetching_data.cpython-311.pyc: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/cron_jobs/__pycache__/fetching_data.cpython-311.pyc -------------------------------------------------------------------------------- /cron_jobs/fetching_data.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | def fetch_codeforces_data(username,enrollment_no): 4 | # Define the API URL you want to fetch data from 5 | api_url = "https://codeforces.com/api/user.info?handles="+username 6 | # Make a GET request to the API 7 | response = requests.get(api_url) 8 | 9 | # Check if the request was successful (status code 200) 10 | if response.status_code == 200: 11 | # Parse the JSON data from the response (assuming the API returns JSON) 12 | data = response.json() 13 | supabase={ 14 | "enrollment_no":enrollment_no , 15 | "username":username, 16 | "rating":data['result'][0]['rating'], 17 | "maxRating":data['result'][0]['maxRating'], 18 | "rank":data['result'][0]['rank'], 19 | "maxRank":data['result'][0]['maxRank'], 20 | } 21 | # Now you can work with the data 22 | return supabase 23 | else: 24 | return ("Failed to fetch data from the API. Status code:", response.status_code) 25 | 26 | def fetch_leetcode_data(username,enrollment): 27 | api_url = "https://leetcode-api-faisalshohag.vercel.app/"+username 28 | 29 | response = requests.get(api_url) 30 | 31 | 32 | if response.status_code == 200: 33 | data = response.json() 34 | supabase={ 35 | "enrollment_no":enrollment , 36 | "username":username, 37 | "rank":data['ranking'], 38 | "easySolved":data['easySolved'], 39 | "mediumSolved":data['mediumSolved'], 40 | "hardSolved":data['hardSolved'], 41 | "totalSolved":data['totalSolved'], 42 | } 43 | 44 | return supabase 45 | else: 46 | return ("Failed to fetch data from the API. Status code:", response.status_code) 47 | 48 | def fetch_codechef_data(username,enrollment): 49 | api_url = "https://codechef-api.vercel.app/"+username 50 | 51 | response = requests.get(api_url) 52 | 53 | if response.status_code == 200: 54 | data = response.json() 55 | supabase={ 56 | "enrollment_no":enrollment , 57 | "username":username, 58 | "currentRating":data['currentRating'], 59 | "highestRating":data['highestRating'], 60 | "globalRank":data['globalRank'], 61 | "countryRank":data['countryRank'], 62 | "stars":data['stars'], 63 | } 64 | 65 | return supabase 66 | else: 67 | return ("Failed to fetch data from the API. Status code:", response.status_code) 68 | 69 | 70 | -------------------------------------------------------------------------------- /cron_jobs/testing_supabase.py: -------------------------------------------------------------------------------- 1 | import os 2 | from supabase import create_client, Client 3 | from fetching_data import * 4 | 5 | # url=process.env.SUPABASE_URL 6 | # key=process.env.SUPABASE_KEY 7 | url:str = os.environ.get("SUPABASE_URL") 8 | key:str = os.environ.get("SUPABASE_KEY") 9 | 10 | 11 | supabase: Client = create_client(url, key) 12 | response = supabase.table('userData').select("*").execute() 13 | 14 | def write_codeforces_data(row): 15 | data, count = supabase.table('codeforces').upsert([row]).execute() 16 | return 17 | 18 | def write_leetcode_data(row): 19 | data, count = supabase.table('leetcode').upsert([row]).execute() 20 | return 21 | 22 | def write_codechef_data(row): 23 | data, count = supabase.table('codechef').upsert([row]).execute() 24 | return 25 | 26 | 27 | 28 | # # print(response.data[0]) 29 | 30 | def updateData(response): 31 | for i in range(len(response.data)): 32 | print(response.data[i]) 33 | try: 34 | cfData=fetch_codeforces_data(response.data[i]['codeforces_handle'],response.data[i]['enrollment_no']) 35 | write_codeforces_data(cfData) 36 | except: 37 | pass 38 | # print("Error in codeforces") 39 | try: 40 | ccData=fetch_codechef_data(response.data[i]['codechef_handle'],response.data[i]['enrollment_no']) 41 | write_codechef_data(ccData) 42 | except: 43 | # print("Error in codechef") 44 | pass 45 | try: 46 | lcData=fetch_leetcode_data(response.data[i]['leetcode_handle'],response.data[i]['enrollment_no']) 47 | write_leetcode_data(lcData) 48 | except: 49 | pass 50 | # print("Error in leetcode") 51 | return response.data 52 | 53 | updateData(response) 54 | 55 | -------------------------------------------------------------------------------- /jsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "paths": { 4 | "@/*": ["./src/*"] 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /next.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('next').NextConfig} */ 2 | const nextConfig = { 3 | reactStrictMode: false, 4 | async rewrites() { 5 | return [ 6 | { 7 | source: '/api/:path*', 8 | destination: 'https://api.example.com/:path*', 9 | }, 10 | ] 11 | }, 12 | 13 | } 14 | 15 | module.exports = nextConfig 16 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "aspdc", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "build": "next build", 7 | "dev": "next dev ", 8 | "start": "next start ", 9 | "lint": "next lint" 10 | }, 11 | "dependencies": { 12 | "@clerk/nextjs": "^4.26.1", 13 | "@emotion/react": "^11.11.1", 14 | "@emotion/styled": "^11.11.0", 15 | "@hookform/resolvers": "^3.3.2", 16 | "@mui/material": "^5.14.15", 17 | "@mui/styled-engine-sc": "^6.0.0-alpha.3", 18 | "@mui/x-data-grid": "^6.16.3", 19 | "@supabase/supabase-js": "^2.38.2", 20 | "axios": "^1.6.0", 21 | "cors": "^2.8.5", 22 | "express": "^4.18.2", 23 | "jsdom": "^22.1.0", 24 | "net": "^1.0.2", 25 | "next": "13.5.4", 26 | "nextjs-toploader": "^1.6.4", 27 | "react": "^18", 28 | "react-dom": "^18", 29 | "react-hook-form": "^7.47.0", 30 | "react-icons": "^4.11.0", 31 | "react-intersection-observer": "^9.5.2", 32 | "react-router-dom": "^6.17.0", 33 | "styled-components": "^6.1.0", 34 | "typewriter-effect": "^2.21.0", 35 | "yup": "^1.3.2" 36 | }, 37 | "devDependencies": { 38 | "autoprefixer": "^10", 39 | "eslint": "^8", 40 | "eslint-config-next": "13.5.4", 41 | "postcss": "^8", 42 | "tailwindcss": "^3" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /public/assets/images/1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/public/assets/images/1.png -------------------------------------------------------------------------------- /public/assets/images/ASPDC_dp.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/public/assets/images/ASPDC_dp.jpeg -------------------------------------------------------------------------------- /public/assets/images/BWCool.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/public/assets/images/BWCool.jpg -------------------------------------------------------------------------------- /public/assets/images/Coding-B&W.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/public/assets/images/Coding-B&W.jpg -------------------------------------------------------------------------------- /public/assets/images/Coding-low-brightness.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/public/assets/images/Coding-low-brightness.jpg -------------------------------------------------------------------------------- /public/assets/images/Coding.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/public/assets/images/Coding.jpg -------------------------------------------------------------------------------- /public/assets/images/Main Coding.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/public/assets/images/Main Coding.jpg -------------------------------------------------------------------------------- /public/assets/images/low-bright.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/aspdc/aspdc-website/77573d5e33695863b6e49f5caffd0eb20ac4f745/public/assets/images/low-bright.jpg -------------------------------------------------------------------------------- /public/assets/images/next.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /public/assets/images/vercel.svg: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /src/app/api/codechefData/route.js: -------------------------------------------------------------------------------- 1 | import supabase from '../../../../supabase'; 2 | import { NextResponse } from 'next/server'; 3 | 4 | export async function GET() { 5 | try{ 6 | const codechef=await supabase 7 | .from('codechef') 8 | .select('*') 9 | return NextResponse.json(codechef.data) 10 | } 11 | catch(err){ 12 | console.log(err,"err") 13 | return NextResponse.json({error:"codechef"}) 14 | } 15 | } -------------------------------------------------------------------------------- /src/app/api/codeforcesData/route.js: -------------------------------------------------------------------------------- 1 | import supabase from '../../../../supabase'; 2 | import { NextResponse } from 'next/server'; 3 | 4 | export async function GET() { 5 | try{ 6 | const codeforcesData=await supabase 7 | .from('codeforces') 8 | .select('*') 9 | return NextResponse.json(codeforcesData.data) 10 | } 11 | catch(err){ 12 | console.log(err,"err") 13 | return NextResponse.json({error:"codeforces"}) 14 | } 15 | } -------------------------------------------------------------------------------- /src/app/api/cron_jobs/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from "next/server" 2 | import { exec } from "child_process" 3 | 4 | export async function GET(req, res) { 5 | 6 | await exec("python cron_jobs/testing_supabase.py",(err,stdout,stderr)=>{ 7 | if(err){ 8 | console.log(err) 9 | return NextResponse.json(err) 10 | } 11 | console.log(stdout,"code run") 12 | return NextResponse.json(stdout) 13 | }) 14 | return NextResponse.json({message:"cron job did not start"}) 15 | } -------------------------------------------------------------------------------- /src/app/api/leetcodeData/route.js: -------------------------------------------------------------------------------- 1 | import supabase from '../../../../supabase'; 2 | import { NextResponse } from 'next/server'; 3 | 4 | export async function GET() { 5 | try{ 6 | const leetcodeData=await supabase 7 | .from('leetcode') 8 | .select('*') 9 | const final=leetcodeData.data 10 | return NextResponse.json(final) 11 | } 12 | catch(err){ 13 | console.log(err,"err") 14 | return NextResponse.json({error:"leetcodeApi"}) 15 | } 16 | } -------------------------------------------------------------------------------- /src/app/api/postData/route.js: -------------------------------------------------------------------------------- 1 | import { NextResponse } from "next/server" 2 | import supabase from "../../../../supabase" 3 | const codeforcesPost=async (username,enrollment_no)=>{ 4 | // console.log(username,"username----------------------------------------------------------------------") 5 | const fetchData=await fetch("https://codeforces.com/api/user.info?handles="+username) 6 | const check2=await fetchData.json() 7 | if(check2.status === 'OK'){ 8 | const check3=check2.result[0] 9 | // console.log(check3,"check3") 10 | const { data, error } = await supabase 11 | .from('codeforces') 12 | .insert([ 13 | { enrollment_no: enrollment_no,username:username,rating:check3.rating,maxRating:check3.maxRating,rank:check3.rank,maxRank:check3.maxRank}, 14 | ]) 15 | if(error){ 16 | console.log(error,"error") 17 | return {error:"codeforcesSupabase"} 18 | } 19 | // console.log(check3,"codeforces final --------------------------------------------------------------------------------------------") 20 | return {error:null} 21 | } 22 | else{ 23 | return {error:"codeforcesApi"} 24 | } 25 | } 26 | 27 | const leetcodePost=async (username,enrollment_no)=>{ 28 | const fetchingLeetcodeData = await fetch('https://leetcode-api-faisalshohag.vercel.app/'+username); 29 | const check2=await fetchingLeetcodeData.json() 30 | 31 | if(check2.errors === undefined){ 32 | const { data, error } = await supabase 33 | .from('leetcode') 34 | .insert([ 35 | { enrollment_no: enrollment_no,username:username,rank:check2.ranking,easySolved:check2.easySolved,mediumSolved:check2.mediumSolved,hardSolved:check2.hardSolved,totalSolved:check2.totalSolved}, 36 | ]) 37 | if(error){ 38 | console.log(error,"error") 39 | return {error:"leetcodeSupabase"} 40 | } 41 | // console.log(check2,"leetcode recieves final --------------------------------------------------------------------------------------------") 42 | return {error:null} 43 | } 44 | else{ 45 | return {error:"leetcodeApi"} 46 | } 47 | 48 | } 49 | 50 | const codechefPost=async (username,enrollment_no)=>{ 51 | const fetchingCodechefData=await fetch("https://codechef-api.vercel.app/"+username) 52 | const check2=await fetchingCodechefData.json() 53 | console.log(check2,"codechef check xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx") 54 | if(check2.success !== false){ 55 | console.log("success") 56 | const {data,error}=await supabase 57 | .from('codechef') 58 | .insert([ 59 | { enrollment_no: enrollment_no,username:username,currentRating:check2.currentRating,highestRating:check2.highestRating,globalRank:check2.globalRank,countryRank:check2.countryRank,stars:check2.stars}, 60 | ]) 61 | if(error){ 62 | console.log(error,"error") 63 | return {error:"codechefSupabase"} 64 | } 65 | return {error:null} 66 | } 67 | else{ 68 | return {error:"codechefApi"} 69 | } 70 | } 71 | 72 | const databasePost=async(userData)=>{ 73 | 74 | const {data,error}=await supabase 75 | .from('userData') 76 | .insert([ 77 | { enrollment_no: userData.enrollment_no,Name:userData.name,codeforces_handle:userData.codeforces,leetcode_handle:userData.leetcode,codechef_handle:userData.codechef,github_handle:userData.github} 78 | ]) 79 | if(error){ 80 | console.log(error,"error") 81 | return {error:"userDataSupabase"} 82 | } 83 | return {error:null} 84 | } 85 | 86 | 87 | export async function POST(request) { 88 | const element=await request.json() 89 | 90 | const leetcode = await leetcodePost(element.leetcode,element.enrollment_no) 91 | const codeforces = await codeforcesPost(element.codeforces,element.enrollment_no) 92 | const codechef = await codechefPost(element.codechef,element.enrollment_no) 93 | const db = await databasePost(element) 94 | 95 | 96 | 97 | return NextResponse.json(element) 98 | } -------------------------------------------------------------------------------- /src/app/components/Footer.jsx: -------------------------------------------------------------------------------- 1 | 2 | export default function Footer(){ 3 | return( 4 |
{props.position}
43 |