Skip to content
Open

mvp1 #14

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import type { Metadata } from "next";
import { Geist, Geist_Mono } from "next/font/google";
import "./globals.css";

import BottomNavBar from "@/components/bottomNavbar";
const geistSans = Geist({
variable: "--font-geist-sans",
subsets: ["latin"],
Expand All @@ -28,6 +28,7 @@ export default function RootLayout({
className={`${geistSans.variable} ${geistMono.variable} antialiased`}
>
{children}
<BottomNavBar />
</body>
</html>
);
Expand Down
4 changes: 1 addition & 3 deletions app/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -141,9 +141,7 @@ export default function AuthPage() {
<p className="text-center text-blue-500 text-sm mt-6 font-medium">
Secure authentication powered by Google
</p>
<p className="text-center text-orange-500 text-sm mt-6 font-medium">
Sign in with pkd skp mail
</p>

</div>
</div>
);
Expand Down
56 changes: 40 additions & 16 deletions components/Navbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import Link from "next/link";
import { onAuthStateChanged } from "@/lib/firebase/auth";
import { signOut, getAuth, User } from "firebase/auth";
import { useRouter } from "next/navigation";
import { ArrowLeftIcon } from "lucide-react";

const Navbar = () => {
const [user, setUser] = useState<User | null>(null);
Expand All @@ -31,32 +32,55 @@ const Navbar = () => {
return (
<nav className="bg-white border-b border-gray-200 shadow-sm sticky top-0 z-50">
<div className="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8 py-4 flex justify-between items-center">
{/* Logo */}
<Link href="/">
<h1 className="text-2xl font-bold text-gray-900 tracking-tight hover:opacity-90 transition-opacity">
Project Archive
</h1>
</Link>

{/* Right Section */}
{/* Left section */}
<div className="flex items-center gap-4">
<button
className="border text-black border-gray-400 rounded-full p-2"
onClick={() => router.push("https://gecian-hub.netlify.app/")}
>
<ArrowLeftIcon className="w-5 h-5" />
</button>

<Link href="/">
<h1 className="text-2xl font-bold text-gray-900 tracking-tight hover:opacity-90 transition-opacity">
Project Archive
</h1>
</Link>
</div>

{/* Right section */}
<div className="flex items-center space-x-4">
{user ? (
<Link href="/profile" className="flex items-center space-x-2 group">
<div className="w-10 h-10 bg-blue-600 text-white rounded-full flex items-center justify-center text-lg font-bold">
{(user.displayName || user.email || "U")[0].toUpperCase()}
</div>
<span className="hidden sm:inline text-sm font-medium text-gray-700 group-hover:text-blue-600 transition">
{user.displayName || user.email || "User"}
</span>
</Link>
<>
<Link
href="/profile"
className="flex items-center space-x-2 group"
>
<div className="w-10 h-10 bg-blue-600 text-white rounded-full flex items-center justify-center text-lg font-bold">
{(user.displayName || user.email || "U")[0].toUpperCase()}
</div>
<span className="hidden sm:inline text-sm font-medium text-gray-700 group-hover:text-blue-600 transition">
{user.displayName || user.email || "User"}
</span>
</Link>

<button
onClick={handleLogout}
className="px-4 py-2 rounded-full bg-red-600 text-white text-sm font-medium hover:bg-red-700 transition"
>
Logout
</button>
</>
) : (
<Link href="/login">
<button className="px-5 py-2 rounded-full bg-black text-white font-medium text-sm hover:bg-gray-800 transition shadow-md hover:shadow-lg">
<button className="px-5 py-2 rounded-full bg-black text-white font-medium text-sm hover:bg-gray-800 transition shadow-md">
Login
</button>
</Link>
)}
</div>

</div>
</nav>
);
Expand Down
52 changes: 52 additions & 0 deletions components/bottomNavbar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
"use client";

import Link from "next/link";
import { useState } from "react";
import { bottomTabs } from "@/data/nav";

const BottomNavBar = () => {
const [activeTab, setActiveTab] = useState("home");
const [hoveredTab, setHoveredTab] = useState<string | null>(null);

return (
<nav className="fixed left-6 right-6 bottom-8 border-t border-gray-300 bg-[#17c6fa] max-w-[800px] mx-auto text-[#171717] rounded-2xl">
<ul className="flex items-center justify-around py-2">
{bottomTabs.map(({ name, icon: Icon, href, label }) => (
<li key={name} className="flex flex-col items-center">
<button
type="button"
className="focus:outline-none"
onClick={() => setActiveTab(name)}
onMouseEnter={() => setHoveredTab(name)}
onMouseLeave={() => setHoveredTab(null)}
>
<Link href={href}>
<div
className={`${
activeTab === name
? "bg-black w-full flex text-blue-400 text-center items-center gap-2 p-[4px] px-2 font-bold rounded-xl transition-all duration-300"
: "overflow-hidden transition-all duration-300 hover:bg-black hover:text-blue-400 text-center items-center gap-2 p-[4px] px-2 font-bold rounded-xl"
}`}
>
<Icon
color={
activeTab === name || hoveredTab === name
? "#17c6fa"
: "black"
}
size="32"
/>
<span className="hidden md:inline">
{activeTab === name ? label : ""}
</span>
</div>
</Link>
</button>
</li>
))}
</ul>
</nav>
);
};

export default BottomNavBar;
9 changes: 9 additions & 0 deletions data/nav.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
import { Book, Calendar2, Calendar, Home2, Money } from "iconsax-react";

export const bottomTabs = [
{ name: "home", icon: Home2, href: "https://gecian-hub.netlify.app/", label: "Home" },
{ name: "studymaterial", icon: Book, href: "https://www.ktunotes.in/", label: "Study" },
{ name: "attendance", icon: Calendar2, href: "https://gecian-hub.netlify.app/attendance/calendar", label: "Attendance" },
{ name: "finance", icon: Money, href: "https://gecian-hub.netlify.app/expense", label: "Finance" },
{ name: "event", icon: Calendar, href: "https://gecian-hub.netlify.app/events", label: "Event" },
];
9 changes: 1 addition & 8 deletions lib/firebase/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,7 @@ export async function signInWithGoogle(): Promise<{ user:User; isAdmin: boolean
throw new Error('Google sign-in failed');
}

// Restrict login to only emails from "gecskp.ac.in"
// Restrict login to only emails from "gecskp.ac.in", except for a specific admin email
const allowedEmailPattern = /^[a-zA-Z0-9]+@gecskp\.ac\.in$/;
const adminOverrideEmail = "codecompass2024@gmail.com";

if (user.email !== adminOverrideEmail && !allowedEmailPattern.test(user.email)) {
throw new Error('Only GEC SKP emails are allowed');
}




Expand Down
Loading