Skip to content

Commit

Permalink
Merge pull request #19 from masterking008:main
Browse files Browse the repository at this point in the history
Solved issue #3 responsiveness, #5 navbar remains open and #10 Dark mode implementation
  • Loading branch information
Pratyaksh2309 authored Nov 23, 2024
2 parents e76d6a0 + f16a0ed commit a93c88d
Show file tree
Hide file tree
Showing 11 changed files with 164 additions and 54 deletions.
47 changes: 45 additions & 2 deletions socbackend/projects/management/commands/upload_projects.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,46 @@
# Write your functions for uploading the projects from csv file..
import csv
import os
from django.core.management.base import BaseCommand, CommandError
from projects.models import Project
from django.conf import settings

class Command(BaseCommand):
help = 'Upload project data from a CSV file'

def add_arguments(self, parser):
parser.add_argument('csv_file', type=str, help='The path to the CSV file to be processed')

def handle(self, *args, **options):
csv_file_path = options['csv_file']

if not os.path.exists(csv_file_path):
raise CommandError(f"File '{csv_file_path}' does not exist.")

with open(csv_file_path, newline='') as csvfile:
reader = csv.DictReader(csvfile)
for row in reader:
try:
project, created = Project.objects.update_or_create(
project_id=row['project_id'],
defaults={
'primary_mentor': row['primary_mentor'],
'project_title': row['project_title'],
'co_mentor_details': row['co_mentor_details'],
'project_category_specific': row['project_category_specific'],
'project_description': row['project_description'],
'maximum_mentees': row['maximum_mentees'],
'prereuisites': row['prereuisites'],
'banner_image_path': row['banner_image_path'],
'banner_image_url': row['banner_image_url'],
'project_timeline': row['project_timeline'],
'project_checkpoints': row['project_checkpoints'],
'project_category_general': row['project_category_general'],
}
)
if created:
self.stdout.write(self.style.SUCCESS(f"Successfully created project {project.project_title}"))
else:
self.stdout.write(self.style.SUCCESS(f"Updated project {project.project_title}"))
except Exception as e:
self.stdout.write(self.style.ERROR(f"Error processing row {row}: {e}"))

# Use projects.csv
1 change: 1 addition & 0 deletions socfrontend/public/dark.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions socfrontend/public/light.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
58 changes: 47 additions & 11 deletions socfrontend/src/components/Navbar.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React, { useState } from "react";
import { Link } from "react-router-dom";
import React, { useEffect, useState } from "react";
import { Link, useLocation } from "react-router-dom";
import wncc_logo from '../assets/wncc-logo.png';
import PropTypes from "prop-types";

Expand All @@ -8,22 +8,50 @@ export default function Navbar(props) {
const authToken = localStorage.getItem('authToken');
const [isMenuOpen, setIsMenuOpen] = useState(false);

const location = useLocation();

useEffect(() => {
setIsMenuOpen(false);
}, [location]);

const toggleMenu = () => {
setIsMenuOpen(!isMenuOpen);
};

const [darkMode, setDarkMode] = useState(false);

useEffect(() => {
const savedTheme = localStorage.getItem('theme');
if (savedTheme === 'dark') {
document.documentElement.classList.add('dark');
setDarkMode(true);
}
}, []);

const toggleDarkMode = () => {
setDarkMode(!darkMode);
if (darkMode) {
document.documentElement.classList.remove('dark');
localStorage.setItem('theme', 'light');
} else {
document.documentElement.classList.add('dark');
localStorage.setItem('theme', 'dark');
}
};


return (
<nav className="bg-indigo-600 border-gray-200 dark:bg-gray-900 dark:border-gray-700 shadow-xl opacity-90">
<div className="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4">
<Link to="#" className="flex items-center space-x-3 rtl:space-x-reverse">
<Link to="./" className="flex items-center space-x-3 rtl:space-x-reverse">
<img src={wncc_logo} className="h-10" alt="WnCC Logo" />
<span className="self-center text-2xl font-semibold whitespace-nowrap text-white dark:text-white">WnCC</span>
</Link>

<button
id="menubutton"
onClick={toggleMenu}
className="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden hover:bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
className="inline-flex items-center p-2 w-10 h-10 justify-center text-sm text-gray-500 rounded-lg md:hidden bg-gray-100 focus:outline-none focus:ring-2 focus:ring-gray-200 dark:bg-transparent dark:text-gray-400 dark:hover:bg-gray-700 dark:focus:ring-gray-600"
aria-controls="navbar-menu"
aria-expanded={isMenuOpen ? "true" : "false"}
>
Expand All @@ -47,32 +75,40 @@ export default function Navbar(props) {

<div className={`w-full md:flex md:w-auto ${isMenuOpen ? 'block' : 'hidden'}`} id="navbar-menu">
<ul className="flex flex-col md:flex-row font-medium p-4 md:p-0 mt-4 border border-gray-100 rounded-lg md:space-x-8 rtl:space-x-reverse md:mt-0 md:border-0 dark:border-gray-700">

<button onClick={toggleDarkMode}
className=" text-white px-3"
>
{!darkMode ? <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M480-120q-150 0-255-105T120-480q0-150 105-255t255-105q14 0 27.5 1t26.5 3q-41 29-65.5 75.5T444-660q0 90 63 153t153 63q55 0 101-24.5t75-65.5q2 13 3 26.5t1 27.5q0 150-105 255T480-120Zm0-80q88 0 158-48.5T740-375q-20 5-40 8t-40 3q-123 0-209.5-86.5T364-660q0-20 3-40t8-40q-78 32-126.5 102T200-480q0 116 82 198t198 82Zm-10-270Z" /></svg> : <svg xmlns="http://www.w3.org/2000/svg" height="24px" viewBox="0 -960 960 960" width="24px" fill="#e8eaed"><path d="M480-360q50 0 85-35t35-85q0-50-35-85t-85-35q-50 0-85 35t-35 85q0 50 35 85t85 35Zm0 80q-83 0-141.5-58.5T280-480q0-83 58.5-141.5T480-680q83 0 141.5 58.5T680-480q0 83-58.5 141.5T480-280ZM200-440H40v-80h160v80Zm720 0H760v-80h160v80ZM440-760v-160h80v160h-80Zm0 720v-160h80v160h-80ZM256-650l-101-97 57-59 96 100-52 56Zm492 496-97-101 53-55 101 97-57 59Zm-98-550 97-101 59 57-100 96-56-52ZM154-212l101-97 55 53-97 101-59-57Zm326-268Z" /></svg>}

</button>

<li>
<Link to="" className="block py-2 px-3 text-white rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Home</Link>
<Link to="" className="block py-2 px-3 text-white rounded hover:bg-gray-100 hover:text-gray-500 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Home</Link>
</li>

{authToken ? (
<>
<li>
<Link to="current_projects" className="block py-2 px-3 text-white rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Projects</Link>
<Link to="current_projects" className="block py-2 px-3 text-white rounded hover:bg-gray-100 hover:text-gray-500 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Projects</Link>
</li>
<li>
<Link to="wishlist" className="block py-2 px-3 text-white rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Wishlist</Link>
<Link to="wishlist" className="block py-2 px-3 text-white rounded hover:bg-gray-100 hover:text-gray-500 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Wishlist</Link>
</li>
<li>
<Link to="PreferenceForm" className="block py-2 px-3 text-white rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Preference</Link>
<Link to="PreferenceForm" className="block py-2 px-3 text-white rounded hover:bg-gray-100 hover:text-gray-500 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Preference</Link>
</li>
<li>
<Link to="logout" className="block py-2 px-3 text-white rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Logout</Link>
<Link to="logout" className="block py-2 px-3 text-white rounded hover:bg-gray-100 hover:text-gray-500 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Logout</Link>
</li>
</>
) : (
<>
<li>
<Link to="login" className="block py-2 px-3 text-white rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Login</Link>
<Link to="login" className="block py-2 px-3 text-white rounded hover:bg-gray-100 hover:text-gray-500 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Login</Link>
</li>
<li>
<Link to="register" className="block py-2 px-3 text-white rounded hover:bg-gray-100 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Register</Link>
<Link to="register" className="block py-2 px-3 text-white rounded hover:bg-gray-100 hover:text-gray-500 md:hover:bg-transparent md:border-0 md:hover:text-black-700 md:p-0 dark:text-white md:dark:hover:text-blue-500 dark:hover:bg-gray-700 dark:hover:text-white md:dark:hover:bg-transparent">Register</Link>
</li>
</>
)}
Expand Down
19 changes: 8 additions & 11 deletions socfrontend/src/pages/Home.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ function Home() {
return (
<>

<div className="grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-8">
<div className="h-screen">
<div className="grid grid-cols-1 gap-4 lg:grid-cols-2 lg:gap-8 dark:bg-gray-800">
<div>
<svg
xmlns="http://www.w3.org/2000/svg"
x="0"
y="0"
enableBackground="new 0 0 500 500"
viewBox="0 0 500 500"
className="animate-fade-up h-auto m-auto"
className="animate-fade-down m-auto lg:h-[calc(100vh-72px)]"
>
<ellipse
cx="250"
Expand Down Expand Up @@ -478,23 +478,20 @@ function Home() {
</g>
</g>
</svg>
{/* <img src={HomePagePhotu} alt="" className="mt-10"/> */}
</div>
<div className="h-screen rounded-lg font-mono font-left flex flex-col justify-center">
<div className="flex flex-col items-center justify-center">
<div className="p-8 font-mono flex flex-col justify-center">
<div className="flex flex-col items-center text-center">
<h1 className="text-indigo-600 text-5xl animate-fade-up flex flex-row">Web and Coding Club</h1>
<h1 className="text-indigo-600 text-5xl animate-fade-up flex flex-row">Presents</h1>
<h1 className="text-indigo-600 text-4xl animate-fade-up flex flex-row">Seasons of Code</h1>
{/* <h1 className="text-indigo-600 text-6xl animate-fade-up">Of</h1>
<h1 className="text-indigo-600 text-6xl animate-fade-up">Code</h1> */}
</div>
<div className="h-1/2 mt-10">
<h1 className="animate-fade-up">Welcome to Seasons of Code, the flagship event of the Web and Coding Club at IIT Bombay! We invite all aspiring coders and innovators to embark on an exhilarating journey of project development. Embrace the spirit of creativity as you delve into the realms of technology and coding. Whether you're a seasoned programmer or just starting your coding odyssey, Seasons of Code offers a platform for you to showcase your skills and bring your ideas to life. Join us in shaping the future of technology, one line of code at a time. Let's code, innovate, and inspire together!</h1>
<div className="mt-10 flex flex-col items-center dark:text-white ">
<h1 className="animate-fade-up text-justify utilities">Welcome to Seasons of Code, the flagship event of the Web and Coding Club at IIT Bombay! We invite all aspiring coders and innovators to embark on an exhilarating journey of project development. Embrace the spirit of creativity as you delve into the realms of technology and coding. Whether you're a seasoned programmer or just starting your coding odyssey, Seasons of Code offers a platform for you to showcase your skills and bring your ideas to life. Join us in shaping the future of technology, one line of code at a time. Let's code, innovate, and inspire together!</h1>
<Link
className="animate-fade-up inline-flex items-center gap-2 rounded border border-indigo-600 bg-indigo-600 px-8 py-3 text-white hover:bg-transparent hover:text-indigo-600 focus:outline-none focus:ring active:text-indigo-500 mt-10"
to="/current_projects"
>
<span className="text-sm font-medium"> Explore Projects </span>
<span className="text-sm font-medium "> Explore Projects </span>

<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" strokeWidth={1.5} stroke="currentColor" className="w-6 h-6 pl-1">
<path strokeLinecap="round" strokeLinejoin="round" d="M15.59 14.37a6 6 0 0 1-5.84 7.38v-4.8m5.84-2.58a14.98 14.98 0 0 0 6.16-12.12A14.98 14.98 0 0 0 9.631 8.41m5.96 5.96a14.926 14.926 0 0 1-5.841 2.58m-.119-8.54a6 6 0 0 0-7.381 5.84h4.8m2.581-5.84a14.927 14.927 0 0 0-2.58 5.84m2.699 2.7c-.103.021-.207.041-.311.06a15.09 15.09 0 0 1-2.448-2.448 14.9 14.9 0 0 1 .06-.312m-2.24 2.39a4.493 4.493 0 0 0-1.757 4.306 4.493 4.493 0 0 0 4.306-1.758M16.5 9a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z" />
Expand Down
Loading

0 comments on commit a93c88d

Please sign in to comment.