Skip to content

Commit 7a0314a

Browse files
committed
ui and bug fix
1 parent d5c97bb commit 7a0314a

File tree

12 files changed

+1255
-278
lines changed

12 files changed

+1255
-278
lines changed

frontend/package-lock.json

Lines changed: 1133 additions & 236 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frontend/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
"react": "19.1.0",
1818
"react-dom": "19.1.0",
1919
"react-hot-toast": "^2.6.0",
20+
"vite": "^7.1.9",
2021
"zod": "^4.1.11"
2122
},
2223
"devDependencies": {
@@ -29,6 +30,6 @@
2930
"eslint": "^9",
3031
"eslint-config-next": "15.5.3",
3132
"tailwindcss": "^4",
32-
"typescript": "^5"
33+
"typescript": "^5.9.3"
3334
}
3435
}

frontend/src/app/admin/page.tsx

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,7 @@ export default function AdminPage() {
369369
</div>
370370

371371

372-
{loading && <p>Loading...</p>}
372+
{loading && <p style={{ color: 'white' }}>Loading...</p>}
373373
{error && (
374374
<div style={{ color: 'crimson', marginBottom: 12 }}>
375375
{error}
@@ -532,12 +532,6 @@ export default function AdminPage() {
532532
</td>
533533
<td style={{ padding: 12, borderTop: '1px solid #333' }}>
534534
<div style={{ display: 'flex', gap: 8 }}>
535-
<button
536-
onClick={() => openEdit(r)}
537-
style={{ padding: '6px 10px', borderRadius: 6, background: '#f0f0f0', color: '#000', border: '1px solid #ccc' }}
538-
>
539-
View
540-
</button>
541535
<button
542536
onClick={() => openEdit(r)}
543537
style={{ padding: '6px 10px', borderRadius: 6, background: '#ddffdd', color: '#050', border: '1px solid #aaffaa', opacity: !token ? 0.6 : 1 }}

frontend/src/app/api/registration/route.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { NextResponse } from 'next/server';
22
import dbConnect from '../../../lib/dbConnect';
33
import Registration from '../../../models/Registration';
4-
import { handleError } from '../../../lib/errorUtils.js';
4+
import { handleError } from '../../../lib/errorUtils';
55
import { z } from 'zod';
66
import nodemailer from 'nodemailer';
77

@@ -79,7 +79,7 @@ export async function POST(request: Request) {
7979
.trim()
8080
.min(1, 'Project description is required')
8181
.max(500, 'Project description must be at most 500 characters'),
82-
teamLeadId: z.number().nullable(),
82+
teamLeadId: z.number().nullable().default(0),
8383
members: z.array(teamMemberSchema).min(2).max(4),
8484
})
8585
.refine(({ members }) => {
@@ -90,7 +90,7 @@ export async function POST(request: Request) {
9090
path: ['members'],
9191
})
9292
.refine(({ teamLeadId, members }) => {
93-
if (teamLeadId === null) return false;
93+
if (teamLeadId === null || teamLeadId === 0) return true;
9494
return members.some((m) => m.id === teamLeadId);
9595
}, {
9696
message: 'teamLeadId must refer to one of the members',

frontend/src/app/api/team/lead/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ export async function GET(request: Request) {
3030
if (team) {
3131
return NextResponse.json(team, { status: 200 });
3232
}
33-
return NextResponse.json({ message: 'Invalid credentials. Please check your team lead email and phone number.' }, { status: 404 });
33+
return NextResponse.json(0, { status: 200 });
3434
} catch (error: unknown) {
3535
return handleError(error);
3636
}

frontend/src/app/globals.css

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,23 @@ h2 {
6565
margin-bottom: 50px;
6666
letter-spacing: 2px;
6767
}
68+
69+
/* Toast notification limit to 2 */
70+
[data-toast-container] {
71+
max-height: calc(100vh - 100px);
72+
}
73+
74+
[data-toast-container] > div {
75+
display: flex;
76+
flex-direction: column;
77+
max-height: inherit;
78+
overflow: hidden;
79+
}
80+
81+
[data-toast-container] > div > * {
82+
flex-shrink: 0;
83+
}
84+
85+
[data-toast-container] > div > *:nth-child(n+3) {
86+
display: none !important;
87+
}

frontend/src/app/layout.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,12 +44,17 @@ export default function RootLayout({
4444
<Toaster
4545
position="top-center"
4646
reverseOrder={false}
47+
containerStyle={{
48+
top: 80,
49+
}}
50+
gutter={8}
4751
toastOptions={{
4852
duration: 4000,
4953
style: {
5054
background: '#1a1a1a',
5155
color: '#fff',
5256
border: '1px solid #333',
57+
maxWidth: '500px',
5358
},
5459
success: {
5560
style: {

frontend/src/components/Contact.tsx

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,7 @@ export default function Contact() {
160160
</div>
161161

162162
<footer ref={addToElementsRef} className="relative w-full h-[150px] md:h-[500px] z-20 flex flex-col justify-center items-center text-center" style={{ backgroundColor: 'rgba(0,0,0,0.1)', backgroundImage: "url('/grass.png')", backgroundSize: 'cover', backgroundPosition: 'bottom center', backgroundRepeat: 'no-repeat' }}>
163-
<Image src="/genesis-2k25-logo.png" alt="Genesis 2025 Logo" width={150} height={150} className="mb-4 md:mb-6 mt-8 md:mt-50 w-[100px] md:w-[150px] h-auto filter brightness-75" />
164-
<nav className={`${poppins.className} flex flex-wrap justify-center space-x-4 md:space-x-8 text-gray-300 text-xs md:text-sm`}>
165-
<a href="#hero" className="hover:text-red-500 transition-colors duration-220">Home</a>
166-
<a href="#events" className="hover:text-red-500 transition-colors duration-220">Events</a>
167-
<a href="#sponsors" className="hover:text-red-500 transition-colors duration-220">Sponsors</a>
168-
<a href="#leads" className="hover:text-red-500 transition-colors duration-220">Leads</a>
169-
<a href="#gallery" className="hover:text-red-500 transition-colors duration-220">Gallery</a>
170-
<a href="#members" className="hover:text-red-500 transition-colors duration-220">Members</a>
171-
</nav>
163+
<Image src="/genesis-2k25-logo.png" alt="Genesis 2025 Logo" width={188} height={188} className="mb-4 md:mb-6 mt-8 md:mt-50 w-[125px] md:w-[188px] h-auto filter brightness-75" />
172164
<p className="w-full text-center text-xs text-[#555555] py-2 md:mt-5">
173165
Made With <span className="text-red-500">❤️</span> By Genesis. All Rights Reserved.
174166
</p>

frontend/src/components/Navigation.tsx

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22
import { Poppins, Jolly_Lodger } from "next/font/google";
3-
import { useState } from "react";
3+
import { useState, useEffect } from "react";
44

55
const jolly = Jolly_Lodger({ weight: "400", subsets: ["latin"] });
66
const poppins = Poppins({
@@ -31,6 +31,16 @@ export function OrangeStrip() {
3131

3232
export default function Navigation() {
3333
const [isMenuOpen, setIsMenuOpen] = useState(false);
34+
const [isScrolled, setIsScrolled] = useState(false);
35+
36+
useEffect(() => {
37+
const handleScroll = () => {
38+
setIsScrolled(window.scrollY > 0);
39+
};
40+
41+
window.addEventListener('scroll', handleScroll);
42+
return () => window.removeEventListener('scroll', handleScroll);
43+
}, []);
3444

3545
const toggleMenu = () => {
3646
setIsMenuOpen(!isMenuOpen);
@@ -64,7 +74,7 @@ export default function Navigation() {
6474
</div>
6575

6676
<button
67-
className={`fixed top-16 left-6 z-60 flex flex-col items-center justify-center w-10 h-10 bg-black/30 rounded-lg backdrop-blur-sm md:hidden ${poppins.className}`}
77+
className={`fixed top-[6.5vh] left-6 z-60 flex flex-col items-center justify-center w-10 h-10 bg-black/30 rounded-lg backdrop-blur-sm md:hidden ${poppins.className}`}
6878
onClick={toggleMenu}
6979
aria-label="Toggle menu"
7080
style={{
@@ -141,7 +151,7 @@ export default function Navigation() {
141151
</div>
142152

143153
<nav
144-
className={`fixed left-4 right-4 top-12 bg-black/20 text-white ${poppins.className} px-6 py-3 md:px-16 md:py-2 flex flex-col md:flex-row items-center justify-between z-40 animate-fade-in-up gap-4 md:gap-0 rounded-2xl shadow-lg`}
154+
className={`fixed left-4 right-4 top-[6.5vh] md:top-[6.5vh] ${isScrolled ? 'bg-black/85 shadow-lg' : 'bg-transparent'} text-white ${poppins.className} px-6 py-3 md:px-16 md:py-2 flex flex-col md:flex-row items-center justify-between z-40 animate-fade-in-up gap-4 md:gap-0 rounded-2xl transition-all duration-300`}
145155
style={{
146156
animation: "fadeInUp 0.8s ease-out 0.2s forwards",
147157
opacity: 0,
Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,22 @@ import mongoose from 'mongoose';
22

33
const MONGODB_URI = process.env.MONGODB_URI || 'mongodb://127.0.0.1:27017/hackman-v8';
44

5-
let cached = global.mongoose;
5+
interface MongooseCache {
6+
conn: typeof mongoose | null;
7+
promise: Promise<typeof mongoose> | null;
8+
}
9+
10+
declare global {
11+
var mongoose: MongooseCache | undefined;
12+
}
13+
14+
const cached: MongooseCache = global.mongoose || { conn: null, promise: null };
615

7-
if (!cached) {
8-
cached = global.mongoose = { conn: null, promise: null };
16+
if (!global.mongoose) {
17+
global.mongoose = cached;
918
}
1019

11-
async function dbConnect() {
20+
async function dbConnect(): Promise<typeof mongoose> {
1221
if (cached.conn) {
1322
return cached.conn;
1423
}
@@ -34,4 +43,4 @@ async function dbConnect() {
3443
return cached.conn;
3544
}
3645

37-
export default dbConnect;
46+
export default dbConnect;

0 commit comments

Comments
 (0)