Skip to content

Commit 4769878

Browse files
authored
Merge pull request #30 from Ishita06-ai/UI
UI
2 parents 8370149 + 63c4def commit 4769878

30 files changed

Lines changed: 902 additions & 779 deletions

client/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { useNavigate, useLocation } from "react-router-dom";
2+
3+
const TABS = [
4+
{ id: "chat", label: "Chat", icon: "💬" },
5+
{ id: "quiz", label: "Quiz Generator", icon: "📝" },
6+
{ id: "summarize", label: "Summarize", icon: "📋" },
7+
{ id: "feedback", label: "Feedback", icon: "✅" },
8+
{ id: "study-plan", label: "Study Plan", icon: "📅" },
9+
{ id: "explain", label: "Explain", icon: "💡" },
10+
{ id: "performance", label: "Performance", icon: "📊" },
11+
{ id: "course-outline", label: "Course Outline", icon: "🎓" },
12+
{ id: "agent", label: "Agent", icon: "🤖" },
13+
];
14+
15+
export default function AiPlaygroundNav() {
16+
const navigate = useNavigate();
17+
const { pathname } = useLocation();
18+
const current = pathname.split("/").pop() || "chat";
19+
20+
return (
21+
<div className="mb-6 flex flex-wrap gap-2">
22+
{TABS.map((tab) => {
23+
const active = tab.id === current;
24+
return (
25+
<button
26+
key={tab.id}
27+
type="button"
28+
onClick={() => navigate(`/ai-playground/${tab.id}`)}
29+
className={`flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-semibold transition-all ${
30+
active
31+
? "bg-[var(--accent)] text-white shadow-lg"
32+
: "glass border border-[var(--border)]/40 text-[var(--muted)] hover:text-[var(--text)]"
33+
}`}
34+
>
35+
<span>{tab.icon}</span>
36+
<span>{tab.label}</span>
37+
</button>
38+
);
39+
})}
40+
</div>
41+
);
42+
}

client/src/components/CourseView/CourseHeader.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ function CourseHeader({
1212
icon: "📄",
1313
val: materials.length,
1414
label: "Materials",
15-
gradient: "from-blue-500 to-indigo-600",
16-
bgGlow: "bg-blue-500/10",
15+
gradient: "from-emerald-500 to-teal-500",
16+
bgGlow: "bg-emerald-500/10",
1717
},
1818
{
1919
icon: "📋",

client/src/components/CourseView/LiveClassCard.jsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,11 @@ function LiveClassCard({
3535
}
3636
: {
3737
label: "Scheduled",
38-
dot: "bg-blue-400",
39-
bg: "bg-blue-500/10",
40-
text: "text-blue-400",
41-
border: "border-blue-500/20",
42-
bar: "from-blue-500 to-indigo-600",
38+
dot: "bg-emerald-400 shadow-[0_0_8px_rgba(16,185,129,0.5)]",
39+
bg: "bg-emerald-500/10",
40+
text: "text-emerald-300",
41+
border: "border-emerald-500/20",
42+
bar: "from-emerald-500 to-teal-600",
4343
icon: "📅",
4444
cardBorder:
4545
"border-[var(--border)]/12 hover:border-[var(--accent)]/18",

client/src/components/CourseView/LiveClassesTab.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ function LiveClassesTab({
2929
{/* Section header */}
3030
<div className="flex items-center justify-between mb-6">
3131
<div className="flex items-center gap-3">
32-
<div className="w-10 h-10 rounded-2xl bg-gradient-to-br from-red-500/20 to-red-600/10 border border-red-500/15 flex items-center justify-center text-lg">
32+
<div className="w-10 h-10 rounded-2xl bg-gradient-to-br from-emerald-500/20 to-teal-500/10 border border-emerald-500/15 flex items-center justify-center text-lg">
3333
📹
3434
</div>
3535
<div>
@@ -40,7 +40,7 @@ function LiveClassesTab({
4040
{liveClasses.length}{" "}
4141
{liveClasses.length === 1 ? "session" : "sessions"} total
4242
{liveNow.length > 0 && (
43-
<span className="text-red-400 font-bold ml-1">
43+
<span className="text-emerald-300 font-bold ml-1">
4444
· {liveNow.length} live now
4545
</span>
4646
)}
@@ -67,8 +67,8 @@ function LiveClassesTab({
6767
shadow-[0_4px_24px_-8px_rgba(0,0,0,0.06)]"
6868
>
6969
<div
70-
className="w-16 h-16 rounded-3xl bg-red-500/10 border border-red-500/15 flex items-center justify-center text-3xl mx-auto mb-5
71-
shadow-[0_8px_24px_-8px_rgba(239,68,68,0.15)]"
70+
className="w-16 h-16 rounded-3xl bg-emerald-500/10 border border-emerald-500/15 flex items-center justify-center text-3xl mx-auto mb-5
71+
shadow-[0_8px_24px_-8px_rgba(16,185,129,0.15)]"
7272
>
7373
📹
7474
</div>
@@ -94,7 +94,7 @@ function LiveClassesTab({
9494
{liveNow.length > 0 && (
9595
<section>
9696
<SectionLabel
97-
dot="bg-red-500 animate-pulse shadow-[0_0_8px_rgba(239,68,68,0.5)]"
97+
dot="bg-emerald-400 animate-pulse shadow-[0_0_8px_rgba(16,185,129,0.5)]"
9898
label="Live Now"
9999
count={liveNow.length}
100100
/>
@@ -121,7 +121,7 @@ function LiveClassesTab({
121121
{upcoming.length > 0 && (
122122
<section>
123123
<SectionLabel
124-
dot="bg-blue-400"
124+
dot="bg-emerald-400"
125125
label="Upcoming"
126126
count={upcoming.length}
127127
/>

client/src/components/CourseView/MaterialCard.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ const TYPE_META = {
2020
link: {
2121
icon: "🔗",
2222
label: "Link",
23-
bg: "from-blue-500/20 to-blue-600/8",
24-
text: "text-blue-400",
25-
border: "border-blue-500/20",
26-
iconBg: "bg-blue-500/12",
23+
bg: "from-emerald-500/20 to-teal-600/8",
24+
text: "text-emerald-400",
25+
border: "border-emerald-500/20",
26+
iconBg: "bg-emerald-500/12",
2727
},
2828
image: {
2929
icon: "🖼️",

client/src/components/CourseView/MaterialsTab.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ function MaterialsTab({
1818
{/* Section header + Add button */}
1919
<div className="flex items-center justify-between mb-6">
2020
<div className="flex items-center gap-3">
21-
<div className="w-10 h-10 rounded-2xl bg-gradient-to-br from-blue-500/20 to-indigo-600/10 border border-blue-500/15 flex items-center justify-center text-lg">
21+
<div className="w-10 h-10 rounded-2xl bg-gradient-to-br from-emerald-500/20 to-teal-600/10 border border-emerald-500/15 flex items-center justify-center text-lg">
2222
📄
2323
</div>
2424
<div>
@@ -81,8 +81,8 @@ function MaterialsTab({
8181
shadow-[0_4px_24px_-8px_rgba(0,0,0,0.06)]"
8282
>
8383
<div
84-
className="w-16 h-16 rounded-3xl bg-blue-500/10 border border-blue-500/15 flex items-center justify-center text-3xl mx-auto mb-5
85-
shadow-[0_8px_24px_-8px_rgba(59,130,246,0.15)]"
84+
className="w-16 h-16 rounded-3xl bg-emerald-500/10 border border-emerald-500/15 flex items-center justify-center text-3xl mx-auto mb-5
85+
shadow-[0_8px_24px_-8px_rgba(16,185,129,0.15)]"
8686
>
8787
📄
8888
</div>

client/src/components/CourseView/QuizzesTab.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ function QuizzesTab({ quizzes, isTeacher, onDelete, onAddClick }) {
113113
{q.totalPoints} pts
114114
</span>
115115
{q.timeLimit > 0 && (
116-
<span className="flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-bold bg-blue-500/8 text-blue-400 border border-blue-500/12">
116+
<span className="flex items-center gap-1.5 px-3 py-1.5 rounded-xl text-[11px] font-bold bg-emerald-500/8 text-emerald-300 border border-emerald-500/12">
117117
{q.timeLimit} min
118118
</span>
119119
)}

client/src/components/CourseView/StudentsTab.jsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
const AVATAR_COLORS = [
2-
"from-violet-500/35 to-purple-500/15 text-violet-300 border-violet-500/18",
3-
"from-blue-500/35 to-indigo-500/15 text-blue-300 border-blue-500/18",
42
"from-emerald-500/35 to-teal-500/15 text-emerald-300 border-emerald-500/18",
3+
"from-violet-500/35 to-purple-500/15 text-violet-300 border-violet-500/18",
4+
"from-teal-500/35 to-cyan-500/15 text-teal-300 border-teal-500/18",
55
"from-pink-500/35 to-rose-500/15 text-pink-300 border-pink-500/18",
66
"from-amber-500/35 to-orange-500/15 text-amber-300 border-amber-500/18",
7-
"from-cyan-500/35 to-sky-500/15 text-cyan-300 border-cyan-500/18",
7+
"from-emerald-500/35 to-lime-500/15 text-emerald-300 border-emerald-500/18",
88
];
99

1010
function StudentsTab({ students }) {

client/src/components/Navbar.jsx

Lines changed: 62 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -56,9 +56,16 @@ const NAV_LINKS = [
5656
path: `/ai-playground/${t.id}`,
5757
})),
5858
},
59-
{ label: "Live Classes", icon: "📹", path: "/live-classes" },
59+
{
60+
label: "Live Classes",
61+
icon: "📹",
62+
isLiveClass: true // ✅ IMPORTANT FLAG
63+
}
6064
];
6165

66+
67+
68+
6269
function Navbar({ showBack }) {
6370
const navigate = useNavigate();
6471
const location = useLocation();
@@ -172,21 +179,41 @@ function Navbar({ showBack }) {
172179
setThemeName(next);
173180
};
174181

175-
const handleLogout = () => {
176-
logout();
177-
navigate("/signin");
178-
};
182+
const goToLiveClass = async () => {
183+
try {
184+
const res = await fetch("/api/live-classes/active");
185+
const data = await res.json();
186+
187+
if (data?.id) {
188+
navigate(`/live-class/${data.id}`);
189+
} else {
190+
alert("No live class available");
191+
}
192+
} catch (err) {
193+
console.error(err);
194+
alert("Error fetching live class");
195+
}
196+
};
197+
198+
const handleLogout = () => {
199+
logout();
200+
navigate("/signin");
201+
};
179202

180203
return (
181204
<nav
182205
data-theme={themeName}
183206
className={`sticky top-0 z-50 h-auto sm:h-16 px-4 sm:px-6 py-3 sm:py-0 flex items-center justify-between
184207
text-[var(--text)] transition-all duration-500 ease-out
185-
${
186-
scrolled
187-
? "glass-heavy border-b border-[var(--border)]/60 shadow-[0_4px_30px_-8px_rgba(0,0,0,0.25)]"
188-
: "bg-transparent border-b border-transparent"
189-
}`}
208+
${
209+
themeName === themeMap.dark
210+
? scrolled
211+
? "bg-[#0b0f1a]/80 backdrop-blur-xl border-b border-white/10 shadow-[0_8px_40px_rgba(0,0,0,0.6)]"
212+
: "bg-transparent"
213+
: scrolled
214+
? "glass-heavy border-b border-[var(--border)]/60 shadow-[0_4px_30px_-8px_rgba(0,0,0,0.25)]"
215+
: "bg-transparent border-b border-transparent"
216+
}`}
190217
>
191218
{/* Left Section - Logo & Brand */}
192219
<div className="flex items-center gap-2 sm:gap-5 min-w-0 flex-1">
@@ -260,13 +287,16 @@ function Navbar({ showBack }) {
260287
<button
261288
type="button"
262289
onClick={() => {
263-
if (link.dropdown) {
264-
setNavDropdown(isOpen ? null : link.label);
265-
} else {
266-
navigate(link.path);
267-
setNavDropdown(null);
268-
}
269-
}}
290+
if (link.isLiveClass) {
291+
goToLiveClass();
292+
setNavDropdown(null);
293+
} else if (link.dropdown) {
294+
setNavDropdown(isOpen ? null : link.label);
295+
} else {
296+
navigate(link.path);
297+
setNavDropdown(null);
298+
}
299+
}}
270300
className={`flex items-center gap-1.5 px-3 py-2 rounded-xl text-sm font-semibold transition-all duration-300 active:scale-95 border-none cursor-pointer
271301
${
272302
active
@@ -415,10 +445,13 @@ function Navbar({ showBack }) {
415445
{/* Notifications Dropdown */}
416446
{open && (
417447
<div
418-
className="absolute right-0 top-12 w-[360px] sm:w-96 rounded-2xl border border-[var(--border)]/60
419-
glass-heavy shadow-[0_20px_60px_-12px_rgba(0,0,0,0.3)] overflow-hidden z-[200]
420-
animate-[scale-in_0.3s_cubic-bezier(0.16,1,0.3,1)_both]
421-
origin-top-right"
448+
className={`absolute right-0 top-12 w-[360px] sm:w-96 rounded-2xl border overflow-hidden z-[200]
449+
animate-[scale-in_0.3s_cubic-bezier(0.16,1,0.3,1)_both] origin-top-right
450+
${
451+
themeName === themeMap.dark
452+
? "bg-[#0f172a]/90 backdrop-blur-xl border-white/10 shadow-[0_20px_60px_rgba(0,0,0,0.6)]"
453+
: "border-[var(--border)]/60 glass-heavy shadow-[0_20px_60px_-12px_rgba(0,0,0,0.3)]"
454+
}`}
422455
>
423456
<div
424457
className="flex items-center justify-between px-5 py-4 border-b border-[var(--border)]/40
@@ -549,9 +582,13 @@ function Navbar({ showBack }) {
549582
key={link.path}
550583
type="button"
551584
onClick={() => {
552-
navigate(link.path);
553-
setMobileMenuOpen(false);
554-
}}
585+
if (link.isLiveClass) {
586+
goToLiveClass();
587+
} else {
588+
navigate(link.path);
589+
}
590+
setMobileMenuOpen(false);
591+
}}
555592
className={`w-full text-left px-4 py-2.5 rounded-xl text-sm font-semibold flex items-center gap-2.5
556593
transition-all duration-300 active:scale-95 border-none cursor-pointer
557594
${
@@ -610,4 +647,4 @@ function Navbar({ showBack }) {
610647
);
611648
}
612649

613-
export default Navbar;
650+
export default Navbar;

0 commit comments

Comments
 (0)