Skip to content

Commit a6546dc

Browse files
authored
fix: remove dummy content from footer (#118)
1 parent 0ae09d4 commit a6546dc

1 file changed

Lines changed: 134 additions & 17 deletions

File tree

Lines changed: 134 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,42 @@
1-
import { Mail, Phone, MapPin } from 'lucide-react';
1+
import { useEffect, useState } from 'react';
2+
import { Mail, Phone, MapPin, ChevronDown } from 'lucide-react';
3+
import { Link, useNavigate } from 'react-router-dom';
4+
5+
type Profile = { department?: string; hostel?: string; building?: string } | null;
6+
7+
function getPostRoute(profile: NonNullable<Profile>): string {
8+
if ('department' in profile) return '/faculty/post';
9+
if ('hostel' in profile) return '/warden/post';
10+
return '/centre-head/post';
11+
}
212

313
export function Footer() {
14+
const [profile, setProfile] = useState<Profile>(null);
15+
const [isAuth, setIsAuth] = useState<boolean | null>(null);
16+
const [lodgeOpen, setLodgeOpen] = useState(false);
17+
const navigate = useNavigate();
18+
19+
useEffect(() => {
20+
fetch('/api/profile', { credentials: 'include' })
21+
.then(res => {
22+
if (!res.ok) { setIsAuth(false); return null; }
23+
return res.json();
24+
})
25+
.then(data => { if (data) { setProfile(data); setIsAuth(true); } })
26+
.catch(() => setIsAuth(false));
27+
}, []);
28+
29+
function handleLodgeComplaintClick() {
30+
if (isAuth && profile) {
31+
navigate(getPostRoute(profile));
32+
} else {
33+
setLodgeOpen(prev => !prev);
34+
}
35+
}
36+
437
return (
5-
<footer className="bg-[#111111] text-white mt-auto">
6-
<div className="container mx-auto px-6 py-12 grid grid-cols-1 md:grid-cols-3 gap-10">
38+
<footer className="bg-[#111111] text-white mt-auto border-t border-[#222222]">
39+
<div className="container mx-auto px-6 py-12 grid grid-cols-1 sm:grid-cols-2 md:grid-cols-4 gap-10">
740
<div>
841
<h3 className="font-bold text-base mb-3">NIT Hamirpur</h3>
942
<p className="text-sm text-[#999999] leading-relaxed">
@@ -14,28 +47,111 @@ export function Footer() {
1447

1548
<div>
1649
<h3 className="font-bold text-base mb-3">Quick Links</h3>
17-
<ul className="text-sm text-[#999999] space-y-2">
18-
<li><a href="#" className="hover:text-white transition-colors">Lodge a Complaint</a></li>
19-
<li><a href="#" className="hover:text-white transition-colors">Track Complaint Status</a></li>
20-
<li><a href="#" className="hover:text-white transition-colors">Filing Guidelines</a></li>
21-
<li><a href="#" className="hover:text-white transition-colors">Staff Portal</a></li>
50+
<ul className="text-sm text-[#999999] space-y-2.5">
51+
<li>
52+
<Link to="/" className="hover:text-white transition-colors">
53+
Home
54+
</Link>
55+
</li>
56+
<li className="relative">
57+
<button
58+
onClick={handleLodgeComplaintClick}
59+
className="hover:text-white transition-colors flex items-center gap-1 cursor-pointer text-left"
60+
>
61+
<span>Lodge a Complaint</span>
62+
{!isAuth && <ChevronDown className={`w-3.5 h-3.5 opacity-60 transition-transform ${lodgeOpen ? 'rotate-180' : ''}`} />}
63+
</button>
64+
{!isAuth && lodgeOpen && (
65+
<div className="mt-2 bg-[#222222] border border-[#333333] rounded-lg p-2 space-y-1 text-xs">
66+
<Link to="/faculty/login" className="block px-3 py-1.5 hover:bg-[#333333] rounded transition-colors text-white">Faculty / Staff Login</Link>
67+
<Link to="/warden/login" className="block px-3 py-1.5 hover:bg-[#333333] rounded transition-colors text-white">Warden Login</Link>
68+
<Link to="/centre-head/login" className="block px-3 py-1.5 hover:bg-[#333333] rounded transition-colors text-white">Centre Head Login</Link>
69+
</div>
70+
)}
71+
</li>
72+
<li>
73+
<Link to={isAuth ? "/profile" : "/faculty/login"} className="hover:text-white transition-colors">
74+
Track Complaint Status
75+
</Link>
76+
</li>
77+
<li>
78+
<Link to="/staff/login" className="hover:text-white transition-colors">
79+
Staff Portal (XEN / AE / JE)
80+
</Link>
81+
</li>
82+
</ul>
83+
</div>
84+
85+
<div>
86+
<h3 className="font-bold text-base mb-3">Developers</h3>
87+
<ul className="text-sm text-[#999999] space-y-2.5">
88+
<li>
89+
<a
90+
href="https://github.com/ayush00git"
91+
target="_blank"
92+
rel="noopener noreferrer"
93+
className="hover:text-white transition-colors flex items-center gap-1.5"
94+
>
95+
<span>Ayush</span>
96+
</a>
97+
</li>
98+
<li>
99+
<a
100+
href="https://github.com/divyansh-v15-06"
101+
target="_blank"
102+
rel="noopener noreferrer"
103+
className="hover:text-white transition-colors flex items-center gap-1.5"
104+
>
105+
<span>Divyansh</span>
106+
</a>
107+
</li>
108+
<li className="pt-1">
109+
<a
110+
href="https://github.com/ayush00git/cms-web"
111+
target="_blank"
112+
rel="noopener noreferrer"
113+
className="hover:text-white transition-colors inline-flex items-center gap-1.5 text-xs text-white/80 bg-white/10 hover:bg-white/20 px-2.5 py-1.5 rounded-md font-medium"
114+
>
115+
<svg className="w-4 h-4 fill-current" viewBox="0 0 24 24">
116+
<path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z" />
117+
</svg>
118+
<span>Source Code</span>
119+
</a>
120+
</li>
22121
</ul>
23122
</div>
24123

25124
<div>
26125
<h3 className="font-bold text-base mb-3">Contact Us</h3>
27126
<ul className="text-sm text-[#999999] space-y-3">
28-
<li className="flex items-start gap-2.5">
29-
<MapPin className="w-4 h-4 shrink-0 mt-0.5 text-[#666666]" />
30-
<span>NIT Hamirpur, Anu, Hamirpur, Himachal Pradesh 177005</span>
127+
<li>
128+
<a
129+
href="https://maps.google.com/?q=NIT+Hamirpur,+Himachal+Pradesh+177005"
130+
target="_blank"
131+
rel="noopener noreferrer"
132+
className="flex items-start gap-2.5 hover:text-white transition-colors"
133+
>
134+
<MapPin className="w-4 h-4 shrink-0 mt-0.5 text-[#666666]" />
135+
<span>NIT Hamirpur, Anu, Hamirpur, Himachal Pradesh 177005</span>
136+
</a>
31137
</li>
32-
<li className="flex items-center gap-2.5">
33-
<Phone className="w-4 h-4 shrink-0 text-[#666666]" />
34-
<span>+91-1972-254011</span>
138+
<li>
139+
<a
140+
href="tel:+911972254011"
141+
className="flex items-center gap-2.5 hover:text-white transition-colors"
142+
>
143+
<Phone className="w-4 h-4 shrink-0 text-[#666666]" />
144+
<span>+91-1972-254011</span>
145+
</a>
35146
</li>
36-
<li className="flex items-center gap-2.5">
37-
<Mail className="w-4 h-4 shrink-0 text-[#666666]" />
38-
<span>registrar@nith.ac.in</span>
147+
<li>
148+
<a
149+
href="mailto:registrar@nith.ac.in"
150+
className="flex items-center gap-2.5 hover:text-white transition-colors"
151+
>
152+
<Mail className="w-4 h-4 shrink-0 text-[#666666]" />
153+
<span>registrar@nith.ac.in</span>
154+
</a>
39155
</li>
40156
</ul>
41157
</div>
@@ -47,3 +163,4 @@ export function Footer() {
47163
</footer>
48164
);
49165
}
166+

0 commit comments

Comments
 (0)