Skip to content
Merged
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
110 changes: 55 additions & 55 deletions app/sem4/os/[chapter]/page.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Link from "next/link";
import { Ch0Content } from "../content/chapter0";
// import { Ch1Content } from "../content/chapter1";
// import { Ch2Content } from "../content/chapter2";
// import { Ch3Content } from "../content/chapter3";
// import { Ch4Content } from "../content/chapter4";
// import { Ch5Content } from "../content/chapter5";
// import { Ch6Content } from "../content/chapter6";
// import { Ch7Content } from "../content/chapter7";
// import { Ch8Content } from "../content/chapter8";
import { Ch1Content } from "../content/chapter1";
import { Ch2Content } from "../content/chapter2";
import { Ch3Content } from "../content/chapter3";
import { Ch4Content } from "../content/chapter4";
import { Ch5Content } from "../content/chapter5";
import { Ch6Content } from "../content/chapter6";
import { Ch7Content } from "../content/chapter7";
import { Ch8Content } from "../content/chapter8";

import { ArrowBigLeft, ArrowBigRight } from "lucide-react";
import { Righteous } from "next/font/google";
Expand All @@ -22,53 +22,53 @@ const righteous = Righteous({
const chapters = [
{ id: "ch0", title: "Course Outline", component: Ch0Content },

// {
// id: "ch1",
// title: "Introduction to Operating Systems",
// component: Ch1Content,
// },

// {
// id: "ch2",
// title: "Process Management",
// component: Ch2Content,
// },

// {
// id: "ch3",
// title: "CPU Scheduling",
// component: Ch3Content,
// },

// {
// id: "ch4",
// title: "Process Synchronization",
// component: Ch4Content,
// },

// {
// id: "ch5",
// title: "Deadlocks",
// component: Ch5Content,
// },

// {
// id: "ch6",
// title: "Memory Management",
// component: Ch6Content,
// },

// {
// id: "ch7",
// title: "Paging and Segmentation",
// component: Ch7Content,
// },

// {
// id: "ch8",
// title: "File Systems and I/O Management",
// component: Ch8Content,
// },
{
id: "ch1",
title: "Introduction to Operating Systems",
component: Ch1Content,
},

{
id: "ch2",
title: "Process Management",
component: Ch2Content,
},

{
id: "ch3",
title: "CPU Scheduling",
component: Ch3Content,
},

{
id: "ch4",
title: "Process Synchronization",
component: Ch4Content,
},

{
id: "ch5",
title: "Deadlocks",
component: Ch5Content,
},

{
id: "ch6",
title: "Memory Management",
component: Ch6Content,
},

{
id: "ch7",
title: "Paging and Segmentation",
component: Ch7Content,
},

{
id: "ch8",
title: "File Systems and I/O Management",
component: Ch8Content,
},
];

type ChapterProps = {
Expand Down
258 changes: 129 additions & 129 deletions app/sem4/os/components/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -1,129 +1,129 @@
"use client";
import { Righteous } from "next/font/google";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useState, useEffect } from "react";
const righteous = Righteous({
subsets: ["latin"],
weight: "400",
variable: "--font-righteous",
});
export default function Sidebar() {
const pathname = usePathname();
const [open, setOpen] = useState(false);
useEffect(() => {
if (window.innerWidth >= 768) {
setOpen(true);
}
}, []);
const chapters = [
{ id: "ch0", title: "Course Outline" },
// { id: "ch1", title: "Introduction to Operating Systems" },
// { id: "ch2", title: "Process Management" },
// { id: "ch3", title: "CPU Scheduling" },
// { id: "ch4", title: "Process Synchronization" },
// { id: "ch5", title: "Deadlocks" },
// { id: "ch6", title: "Memory Management" },
// { id: "ch7", title: "Paging and Segmentation" },
// { id: "ch8", title: "File Systems and I/O Management" },
];
const quizSlugMap: Record<string, string> = {
os: "os",
};
const subjectKey = pathname.split("/")[2] ?? "";
const quizSlug = quizSlugMap[subjectKey];
const quizHref = quizSlug ? `/quiz/${quizSlug}` : "/quiz";
const quizActive = pathname.startsWith("/quiz");
return (
<>
{/* Backdrop overlay - only on mobile when open */}
<div
className={`fixed inset-0 md:hidden bg-black/50 z-30 transition-opacity duration-300 ${open ? "opacity-100" : "opacity-0 pointer-events-none"}`}
onClick={() => setOpen(false)}
/>
<div className="flex sticky top-14 z-40 h-[calc(100vh-3.5rem)] w-[50px] md:w-auto pointer-events-none md:pointer-events-auto">
{/* Sidebar */}
<aside
className={`h-full shrink-0 bg-[#fae8d7] text-[#1B0D00] p-0 flex flex-col transition-all duration-300 pointer-events-auto border-r-0 ${
open ? "w-64 border-r-2 md:border-r-0" : "w-0 overflow-hidden"
}`}
>
<h2
className="flex items-center text-2xl font-normal pt-3 pl-3 mb-2 bg-[#cebb9c] text-[#1B0D00] pb-2 border-b-4 border-[#1B0D00]"
style={{ fontFamily: "Rockwell, Serif, serif" }}
>
Chapters
</h2>
<ul className="flex-1 overflow-y-auto space-y-0">
{chapters.map((ch) => {
const active = pathname === `/sem4/os/${ch.id}`;
return (
<li key={ch.id}>
<Link
href={`/sem4/os/${ch.id}`}
className={`block px-3 py-2 text-xl transition ${
active ? "bg-[#fccc7e]" : "hover:bg-[#ffdda7af]"
} ${righteous.className}`}
>
{ch.title}
</Link>
</li>
);
})}
</ul>
<div className="border-t-4 border-[#1B0D00]">
<h2
className="flex items-center text-2xl font-normal pt-3 pl-3 mb-2 bg-[#cebb9c] text-[#1B0D00] pb-2"
style={{ fontFamily: "Rockwell, Serif, serif" }}
>
Quiz
</h2>
<Link
href={quizHref}
className={`flex items-center gap-2 px-3 py-2 text-xl transition ${
quizActive ? "bg-[#fccc7e]" : "hover:bg-[#ffdda7af]"
} ${righteous.className}`}
>
<svg
xmlns="http://www.w3.org/2000/svg"
className="w-5 h-5 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M12 20h9" />
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z" />
</svg>
Take the Quiz
</Link>
</div>
</aside>
<button
onClick={() => setOpen(!open)}
className="toggle-sidebar shrink-0 pointer-events-auto bg-[#ffdda7] h-full w-[50px] text-[#1B0D00] text-center font-semibold text-2xl border-l-4 rounded-r-2xl border-[#1B0D00] flex items-center justify-center transition-all duration-300 md:shadow-none"
style={{
fontFamily: "Rockwell, Serif, serif",
boxShadow: open ? "4px 0 15px rgba(0,0,0,0.1)" : "none"
}}
>
<p className="leading-5">
C<br />H<br />A<br />P<br />T<br />E<br />R<br />S
</p>
</button>
</div>
</>
);
}
"use client";
import { Righteous } from "next/font/google";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useState, useEffect } from "react";

const righteous = Righteous({
subsets: ["latin"],
weight: "400",
variable: "--font-righteous",
});

export default function Sidebar() {
const pathname = usePathname();
const [open, setOpen] = useState(false);

useEffect(() => {
if (window.innerWidth >= 768) {
setOpen(true);
}
}, []);

const chapters = [
{ id: "ch0", title: "Course Outline" },
{ id: "ch1", title: "Introduction to Operating Systems" },
{ id: "ch2", title: "Process Management" },
{ id: "ch3", title: "CPU Scheduling" },
{ id: "ch4", title: "Process Synchronization" },
{ id: "ch5", title: "Deadlocks" },
{ id: "ch6", title: "Memory Management" },
{ id: "ch7", title: "Paging and Segmentation" },
{ id: "ch8", title: "File Systems and I/O Management" },
];

const quizSlugMap: Record<string, string> = {
os: "os",
};

const subjectKey = pathname.split("/")[2] ?? "";
const quizSlug = quizSlugMap[subjectKey];
const quizHref = quizSlug ? `/quiz/${quizSlug}` : "/quiz";
const quizActive = pathname.startsWith("/quiz");

return (
<>
{/* Backdrop overlay - only on mobile when open */}
<div
className={`fixed inset-0 md:hidden bg-black/50 z-30 transition-opacity duration-300 ${open ? "opacity-100" : "opacity-0 pointer-events-none"}`}
onClick={() => setOpen(false)}
/>

<div className="flex sticky top-14 z-40 h-[calc(100vh-3.5rem)] w-[50px] md:w-auto pointer-events-none md:pointer-events-auto">
{/* Sidebar */}
<aside
className={`h-full shrink-0 bg-[#fae8d7] text-[#1B0D00] p-0 flex flex-col transition-all duration-300 pointer-events-auto border-r-0 ${
open ? "w-64 border-r-2 md:border-r-0" : "w-0 overflow-hidden"
}`}
>
<h2
className="flex items-center text-2xl font-normal pt-3 pl-3 mb-2 bg-[#cebb9c] text-[#1B0D00] pb-2 border-b-4 border-[#1B0D00]"
style={{ fontFamily: "Rockwell, Serif, serif" }}
>
Chapters
</h2>
<ul className="flex-1 overflow-y-auto space-y-0">
{chapters.map((ch) => {
const active = pathname === `/sem4/os/${ch.id}`;
return (
<li key={ch.id}>
<Link
href={`/sem4/os/${ch.id}`}
className={`block px-3 py-2 text-xl transition ${
active ? "bg-[#fccc7e]" : "hover:bg-[#ffdda7af]"
} ${righteous.className}`}
>
{ch.title}
</Link>
</li>
);
})}
</ul>

{/* <div className="border-t-4 border-[#1B0D00]">
<h2
className="flex items-center text-2xl font-normal pt-3 pl-3 mb-2 bg-[#cebb9c] text-[#1B0D00] pb-2"
style={{ fontFamily: "Rockwell, Serif, serif" }}
>
Quiz
</h2>
<Link
href={quizHref}
className={`flex items-center gap-2 px-3 py-2 text-xl transition ${
quizActive ? "bg-[#fccc7e]" : "hover:bg-[#ffdda7af]"
} ${righteous.className}`}
>
<svg
xmlns="http://www.w3.org/2000/svg"
className="w-5 h-5 shrink-0"
viewBox="0 0 24 24"
fill="none"
stroke="currentColor"
strokeWidth={2}
strokeLinecap="round"
strokeLinejoin="round"
>
<path d="M12 20h9" />
<path d="M16.5 3.5a2.121 2.121 0 0 1 3 3L7 19l-4 1 1-4Z" />
</svg>
Take the Quiz
</Link>
</div> */}
</aside>

<button
onClick={() => setOpen(!open)}
className="toggle-sidebar shrink-0 pointer-events-auto bg-[#ffdda7] h-full w-[50px] text-[#1B0D00] text-center font-semibold text-2xl border-l-4 rounded-r-2xl border-[#1B0D00] flex items-center justify-center transition-all duration-300 md:shadow-none"
style={{
fontFamily: "Rockwell, Serif, serif",
boxShadow: open ? "4px 0 15px rgba(0,0,0,0.1)" : "none"
}}
>
<p className="leading-5">
C<br />H<br />A<br />P<br />T<br />E<br />R<br />S
</p>
</button>
</div>
</>
);
}
Loading