Skip to content

Commit 8b5e33b

Browse files
committed
redirect login button to correct page implement log out button and it function then also add auth check of add project if not loggin in redirect login page temperoily removed the footer page for now builded the entire project added the github secreat as well
1 parent b0833e9 commit 8b5e33b

5 files changed

Lines changed: 107 additions & 159 deletions

File tree

app/page.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import Navbar from '@/components/Navbar';
55
import ProjectGrid from '@/components/repeto/ProjectGrid';
66
import FilterSection from '@/components/repeto/FilterSection';
77
import TabSection from '@/components/repeto/TabSection';
8-
import Footer from '@/components/Footer';
8+
// import Footer from '@/components/Footer';
99
import AddProjectFAB from '@/components/repeto/AddProjectFAB';
1010
import LoadingScreen from "@/components/loadingScrenn";
1111

@@ -43,7 +43,7 @@ export default function Home() {
4343
</div>
4444
<AddProjectFAB />
4545
</div>
46-
<Footer />
46+
{/* <Footer /> */}
4747
</main>
4848
);
4949
}

app/repeto/page.tsx

Lines changed: 0 additions & 35 deletions
This file was deleted.

components/Footer.tsx

Lines changed: 52 additions & 102 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,59 @@
11
import { memo } from "react";
22
import Link from "next/link";
3-
import Image from "next/image";
3+
// import Image from "next/image";
44

55
const Footer = memo(() => {
6-
return (
7-
<footer className="bg-[#27272A] text-gray-200">
8-
<div className="w-full flex flex-col md:flex-row md:justify-around items-center py-6 border-t border-gray-600 gap-6">
9-
<div>
10-
<Image
11-
src="/path-to-your-logo.png"
12-
className="w-32 h-32 object-contain"
13-
alt="Logo"
14-
width={128}
15-
height={128}
16-
/>
17-
</div>
18-
<nav className="flex gap-6 text-sm md:text-base">
19-
<Link href="/" className="hover:text-blue-600 transition-colors">
20-
Home
21-
</Link>
22-
<Link href="/" className="hover:text-blue-600 transition-colors">
23-
Contact Us
24-
</Link>
25-
<Link href="/" className="hover:text-blue-600 transition-colors">
26-
Repeto
27-
</Link>
28-
</nav>
29-
<div className="flex flex-row gap-6 lg:gap-10 md:gap-6 items-center justify-start sm:justify-start">
30-
<div className="bg-white p-1 rounded-full">
31-
<Link href="/">
32-
<svg
33-
className="w-8 h-8 text-[#27272A] hover:text-[#2761b8]"
34-
aria-hidden="true"
35-
xmlns="http://www.w3.org/2000/svg"
36-
width="24"
37-
height="24"
38-
fill="currentColor"
39-
viewBox="0 0 24 24"
40-
>
41-
<path
42-
fillRule="evenodd"
43-
d="M13.135 6H15V3h-1.865a4.147 4.147 0 0 0-4.142 4.142V9H7v3h2v9.938h3V12h2.021l.592-3H12V6.591A.6.6 0 0 1 12.592 6h.543Z"
44-
clipRule="evenodd"
6+
return (
7+
<footer className="w-full bg-white flex flex-col md:flex-row items-center justify-between py-6 px-6 box-border text-base text-gray-600 font-h3 border-t border-gray-200">
8+
{/* <div className="flex items-center mb-4 md:mb-0">
9+
<Image
10+
src={darsanaLogo}
11+
alt="Darsana Logo"
12+
width={100}
13+
height={40}
14+
objectFit="contain"
4515
/>
46-
</svg>
47-
</Link>
48-
</div>
49-
<div className="bg-white p-1 rounded-full">
50-
<Link href="/">
51-
<svg
52-
className="w-8 h-8 text-[#27272A] hover:text-[#cd2f8b]"
53-
aria-hidden="true"
54-
xmlns="http://www.w3.org/2000/svg"
55-
width="24"
56-
height="24"
57-
fill="none"
58-
viewBox="0 0 24 24"
59-
>
60-
<path
61-
fill="currentColor"
62-
fillRule="evenodd"
63-
d="M3 8a5 5 0 0 1 5-5h8a5 5 0 0 1 5 5v8a5 5 0 0 1-5 5H8a5 5 0 0 1-5-5V8Zm5-3a3 3 0 0 0-3 3v8a3 3 0 0 0 3 3h8a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3H8Zm7.597 2.214a1 1 0 0 1 1-1h.01a1 1 0 1 1 0 2h-.01a1 1 0 0 1-1-1ZM12 9a3 3 0 1 0 0 6 3 3 0 0 0 0-6Zm-5 3a5 5 0 1 1 10 0 5 5 0 0 1-10 0Z"
64-
clipRule="evenodd"
65-
/>
66-
</svg>
67-
</Link>
68-
</div>
69-
<div className="bg-white p-1 rounded-full">
70-
<Link href="/">
71-
<svg
72-
className="w-8 h-8 text-[#27272A] hover:text-[#2b6be3]"
73-
aria-hidden="true"
74-
xmlns="http://www.w3.org/2000/svg"
75-
width="24"
76-
height="24"
77-
fill="currentColor"
78-
viewBox="0 0 24 24"
79-
>
80-
<path
81-
fillRule="evenodd"
82-
d="M22 5.892a8.178 8.178 0 0 1-2.355.635 4.074 4.074 0 0 0 1.8-2.235 8.343 8.343 0 0 1-2.605.981A4.13 4.13 0 0 0 15.85 4a4.068 4.068 0 0 0-4.1 4.038c0 .31.035.618.105.919A11.705 11.705 0 0 1 3.4 4.734a4.006 4.006 0 0 0 1.268 5.392 4.165 4.165 0 0 1-1.859-.5v.05A4.057 4.057 0 0 0 6.1 13.635a4.192 4.192 0 0 1-1.856.07 4.108 4.108 0 0 0 3.831 2.807A8.36 8.36 0 0 1 2 18.184 11.732 11.732 0 0 0 8.291 20 11.502 11.502 0 0 0 19.964 8.5c0-.177 0-.349-.012-.523A8.143 8.143 0 0 0 22 5.892Z"
83-
clipRule="evenodd"
84-
/>
85-
</svg>
86-
</Link>
87-
</div>
88-
</div>
89-
</div>
90-
<div className="w-full flex flex-col md:flex-row justify-between px-4 items-center py-6 text-sm md:text-base">
91-
<div className="flex flex-wrap gap-4 md:gap-10">
92-
<Link href="/" className="underline">
93-
Privacy Policy
94-
</Link>
95-
<Link href="/" className="underline">
96-
Terms of Service
97-
</Link>
98-
<Link href="/" className="underline">
99-
Cookies Settings
100-
</Link>
101-
</div>
102-
<div>@2024 Code Compass. All rights reserved</div>
103-
</div>
104-
</footer>
105-
);
16+
</div> */}
17+
<nav className="flex items-center space-x-6 mb-4 md:mb-0">
18+
<Link href="/contactUs" className="hover:text-blue-600 transition-colors">
19+
20+
</Link>
21+
<Link href="/aboutus" className="hover:text-blue-600 transition-colors">
22+
About Us
23+
</Link>
24+
<Link href="/chapters" className="hover:text-blue-600 transition-colors">
25+
Chapters
26+
</Link>
27+
<Link href="/eye-magazine" className="hover:text-blue-600 transition-colors">
28+
Made by codecompass coding community
29+
</Link>
30+
</nav>
31+
<div className="flex items-center space-x-4">
32+
<Link href="https://www.facebook.com" aria-label="Facebook" className="text-gray-400 hover:text-blue-600 transition-colors">
33+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
34+
<path d="M9 8h-3v4h3v12h5v-12h3.642l.358-4h-4v-1.667c0-.955.192-1.333 1.115-1.333h2.885v-5h-3.808c-3.596 0-5.192 1.583-5.192 4.615v3.385z" />
35+
</svg>
36+
</Link>
37+
<Link href="https://www.instagram.com" aria-label="Instagram" className="text-gray-400 hover:text-pink-600 transition-colors">
38+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
39+
<path d="M12 2.163c3.204 0 3.584.012 4.85.07 3.252.148 4.771 1.691 4.919 4.919.058 1.265.069 1.645.069 4.849 0 3.205-.012 3.584-.069 4.849-.149 3.225-1.664 4.771-4.919 4.919-1.266.058-1.644.07-4.85.07-3.204 0-3.584-.012-4.849-.07-3.26-.149-4.771-1.699-4.919-4.92-.058-1.265-.07-1.644-.07-4.849 0-3.204.013-3.583.07-4.849.149-3.227 1.664-4.771 4.919-4.919 1.266-.057 1.645-.069 4.849-.069zm0-2.163c-3.259 0-3.667.014-4.947.072-4.358.2-6.78 2.618-6.98 6.98-.059 1.281-.073 1.689-.073 4.948 0 3.259.014 3.668.072 4.948.2 4.358 2.618 6.78 6.98 6.98 1.281.058 1.689.072 4.948.072 3.259 0 3.668-.014 4.948-.072 4.354-.2 6.782-2.618 6.979-6.98.059-1.28.073-1.689.073-4.948 0-3.259-.014-3.667-.072-4.947-.196-4.354-2.617-6.78-6.979-6.98-1.281-.059-1.69-.073-4.949-.073zm0 5.838c-3.403 0-6.162 2.759-6.162 6.162s2.759 6.163 6.162 6.163 6.162-2.759 6.162-6.163c0-3.403-2.759-6.162-6.162-6.162zm0 10.162c-2.209 0-4-1.79-4-4 0-2.209 1.791-4 4-4s4 1.791 4 4c0 2.21-1.791 4-4 4zm6.406-11.845c-.796 0-1.441.645-1.441 1.44s.645 1.44 1.441 1.44c.795 0 1.439-.645 1.439-1.44s-.644-1.44-1.439-1.44z" />
40+
</svg>
41+
</Link>
42+
<Link href="https://www.youtube.com" aria-label="YouTube" className="text-gray-400 hover:text-red-600 transition-colors">
43+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
44+
<path d="M19.615 3.184c-3.604-.246-11.631-.245-15.23 0-3.897.266-4.356 2.62-4.385 8.816.029 6.185.484 8.549 4.385 8.816 3.6.245 11.626.246 15.23 0 3.897-.266 4.356-2.62 4.385-8.816-.029-6.185-.484-8.549-4.385-8.816zm-10.615 12.816v-8l8 3.993-8 4.007z" />
45+
</svg>
46+
</Link>
47+
<Link href="https://www.linkedin.com" aria-label="LinkedIn" className="text-gray-400 hover:text-blue-700 transition-colors">
48+
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="currentColor">
49+
<path d="M4.98 3.5c0 1.381-1.11 2.5-2.48 2.5s-2.48-1.119-2.48-2.5c0-1.38 1.11-2.5 2.48-2.5s2.48 1.12 2.48 2.5zm.02 4.5h-5v16h5v-16zm7.982 0h-4.968v16h4.969v-8.399c0-4.67 6.029-5.052 6.029 0v8.399h4.988v-10.131c0-7.88-8.922-7.593-11.018-3.714v-2.155z" />
50+
</svg>
51+
</Link>
52+
</div>
53+
</footer>
54+
);
10655
});
107-
Footer.displayName = "Footer";
10856

109-
export default Footer;
57+
Footer.displayName = "Footer";
58+
59+
export default Footer;

components/Navbar.tsx

Lines changed: 37 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,32 @@
11
"use client";
2-
// import { useState } from "react";
2+
3+
import { useEffect, useState } from "react";
34
import Link from "next/link";
5+
import { onAuthStateChanged } from "@/lib/firebase/auth";
6+
import { signOut, getAuth, User } from "firebase/auth"; // Adjust the import path based on your Firebase setup
7+
import { useRouter } from "next/navigation";
48

59
const Navbar = () => {
6-
// const [dropdownOpen, setDropdownOpen] = useState(false);
7-
// const [menuOpen, setMenuOpen] = useState(false);
8-
9-
// const toggleDropdown = () => {
10-
// setDropdownOpen((prevState) => !prevState);
11-
// };
12-
13-
// const toggleMenu = () => {
14-
// setMenuOpen((prevState) => !prevState);
15-
// };
10+
const [user, setUser] = useState<User | null>(null);
11+
const router = useRouter();
12+
13+
useEffect(() => {
14+
const unsubscribe = onAuthStateChanged((currentUser) => {
15+
setUser(currentUser);
16+
});
17+
return () => unsubscribe();
18+
}, []);
19+
20+
const handleLogout = async () => {
21+
try {
22+
const auth = getAuth(); // Get the Auth instance
23+
await signOut(auth);
24+
setUser(null); // Clear user state
25+
router.push("/"); // Redirect to home after logout
26+
} catch (error) {
27+
console.error("Logout failed:", error);
28+
}
29+
};
1630

1731
return (
1832
<nav className="bg-white relative z-50 border-b-2 border-black px-4">
@@ -22,17 +36,21 @@ const Navbar = () => {
2236
GecianArchive
2337
</div>
2438

25-
26-
27-
28-
{/* Repeto Button */}
29-
<button>
30-
<Link href="/repeto">
31-
<div className="w-[117px] h-[45px] bg-[#000000] rounded-3xl text-white font-davidLibre flex justify-center items-center text-[15.5px] hover:bg-white drop-shadow-lg hover:text-black">
39+
{/* Authentication Button */}
40+
{user ? (
41+
<button
42+
onClick={handleLogout}
43+
className="w-[117px] h-[45px] bg-red-600 rounded-3xl text-white font-davidLibre flex justify-center items-center text-[15.5px] hover:bg-red-700 drop-shadow-lg transition"
44+
>
45+
Logout
46+
</button>
47+
) : (
48+
<Link href="/login">
49+
<div className="w-[117px] h-[45px] bg-[#000000] rounded-3xl text-white font-davidLibre flex justify-center items-center text-[15.5px] hover:bg-white drop-shadow-lg hover:text-black transition">
3250
Login
3351
</div>
3452
</Link>
35-
</button>
53+
)}
3654
</div>
3755
</nav>
3856
);

components/repeto/AddProjectFAB.tsx

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,28 @@
11
"use client";
22

3+
import { useEffect, useState } from "react";
4+
import { User } from "firebase/auth"; // Adjust the import path based on your Firebase setup
35
import { useRouter } from "next/navigation";
46
import { Plus } from "lucide-react";
7+
import { onAuthStateChanged } from "@/lib/firebase/auth";
58

69
const AddProjectFAB = () => {
710
const router = useRouter();
11+
const [user, setUser] = useState<User | null>(null);
12+
13+
useEffect(() => {
14+
const unsubscribe = onAuthStateChanged((currentUser) => {
15+
setUser(currentUser);
16+
});
17+
return () => unsubscribe();
18+
}, []);
819

920
const handleClick = () => {
10-
router.push("/add-project");
21+
if (user) {
22+
router.push("/add-project");
23+
} else {
24+
router.push("/login"); // Redirect to login if not authenticated
25+
}
1126
};
1227

1328
return (

0 commit comments

Comments
 (0)