Skip to content
Open
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
2 changes: 1 addition & 1 deletion app/components/subjects.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const subjectCodes: Record<string, string> = {
};

// Available subjects
const available = ["ep", "c", "em1", "em2", "oops", "dsc", "coa", "os", "ml", "dops", "cd", "cle","ec"];
const available = ["ep", "c", "em1", "em2", "oops", "dsc", "coa", "os", "ml", "dops", "cd", "cle", "ec", "vlsi"];

export default function SubjectsSection() {
return (
Expand Down
144 changes: 144 additions & 0 deletions app/sem7/vlsi/[chapter]/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,144 @@
import Link from "next/link";
import { Metadata } from "next";
import { Righteous } from "next/font/google";
import { ArrowBigLeft, ArrowBigRight } from "lucide-react";
import BookmarkButton from "../../../components/BookmarkButton";
import { chapters } from "../constants";
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 { Ch9Content } from "../content/chapter9";

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

const chapterComponents: Record<string, React.ComponentType> = {
ch0: Ch0Content,
ch1: Ch1Content,
ch2: Ch2Content,
ch3: Ch3Content,
ch4: Ch4Content,
ch5: Ch5Content,
ch6: Ch6Content,
ch7: Ch7Content,
ch8: Ch8Content,
ch9: Ch9Content,
};

type ChapterProps = {
params: Promise<{ chapter: string }>;
};

export async function generateMetadata({ params }: ChapterProps): Promise<Metadata> {
const { chapter: chapterId } = await params;
const chapterData = chapters.find((chapter) => chapter.id === chapterId);

return {
title: chapterData
? `${chapterData.title} | VLSI and Embedded Systems | openCSE`
: "VLSI and Embedded Systems | openCSE",
};
}

export default async function ChapterPage({ params }: ChapterProps) {
const { chapter: chapterId } = await params;
const chapterData = chapters.find((chapter) => chapter.id === chapterId);

if (!chapterData) {
return (
<div className="flex flex-col items-center justify-center min-h-[50vh] text-[#e2d1c1]">
<h1 className="text-2xl font-bold mb-4">Chapter not found</h1>
<Link
href="/sem7/vlsi/ch0"
className="px-4 py-2 bg-[#e2d1c1] text-[#1b0d00] rounded hover:bg-[#ac9e91] transition font-bold"
>
Return to Course Outline
</Link>
</div>
);
}

const ChapterComponent = chapterComponents[chapterData.id];
const currentIndex = chapters.findIndex((chapter) => chapter.id === chapterId);
const prevChapter = currentIndex > 0 ? chapters[currentIndex - 1] : null;
const nextChapter = currentIndex < chapters.length - 1 ? chapters[currentIndex + 1] : null;

return (
<div className="flex flex-col bg-[#1B0D00] min-h-full p-2 pt-6 text-[#e2d1c1]">
<div className="flex-1">
<h1 className={`text-4xl font-bold ${righteous.className} mb-2`}>
VLSI and Embedded Systems
</h1>

<div className="flex items-center justify-between gap-4">
<p className={`text-2xl mt-[-8px] ${righteous.className}`}>{chapterData.title}</p>
<BookmarkButton title={`VLSI: ${chapterData.title}`} />
</div>

<div className="flex justify-between mt-3">
{prevChapter ? (
<Link
href={`/sem7/vlsi/${prevChapter.id}`}
className="px-4 py-1 text-2xl flex items-center justify-center bg-[#e2d1c1] text-[#1b0d00] rounded hover:bg-[#ac9e91] transition"
style={{ fontFamily: "Rockwell, Serif, serif" }}
>
<ArrowBigLeft className="inline-block mr-1" /> Previous
</Link>
) : (
<div />
)}

{nextChapter ? (
<Link
href={`/sem7/vlsi/${nextChapter.id}`}
className="px-4 py-1 text-2xl flex items-center justify-center bg-[#e2d1c1] text-[#1b0d00] rounded hover:bg-[#ac9e91] transition"
style={{ fontFamily: "Rockwell, Serif, serif" }}
>
Next <ArrowBigRight className="inline-block ml-1" />
</Link>
) : (
<div />
)}
</div>

<hr className="my-6 border-t-3" />
<ChapterComponent />
</div>

<div className="flex justify-between my-8">
{prevChapter ? (
<Link
href={`/sem7/vlsi/${prevChapter.id}`}
className="px-4 py-2 bg-[#e2d1c1] text-xl flex items-center justify-center text-[#1b0d00] rounded hover:bg-[#ac9e91] transition"
style={{ fontFamily: "Rockwell, Serif, serif" }}
>
<ArrowBigLeft className="inline-block mr-1" /> {prevChapter.title}
</Link>
) : (
<div />
)}

{nextChapter ? (
<Link
href={`/sem7/vlsi/${nextChapter.id}`}
className="px-4 py-2 bg-[#e2d1c1] text-xl flex items-center justify-center text-[#1b0d00] rounded hover:bg-[#ac9e91] transition"
style={{ fontFamily: "Rockwell, Serif, serif" }}
>
{nextChapter.title} <ArrowBigRight className="inline-block ml-1" />
</Link>
) : (
<div />
)}
</div>
</div>
);
}
95 changes: 95 additions & 0 deletions app/sem7/vlsi/components/sidebar.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"use client";

import { Righteous } from "next/font/google";
import Link from "next/link";
import { usePathname } from "next/navigation";
import { useEffect, useState } from "react";
import { chapters } from "../constants";

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);
}
}, []);

return (
<>
<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">
<aside
className={`h-full shrink-0 bg-[#fae8d7] text-[#1B0D00] p-0 flex flex-col transition-all duration-300 pointer-events-auto ${
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 no-scrollbar space-y-0">
{chapters.map((chapter) => {
const active = pathname === `/sem7/vlsi/${chapter.id}`;
return (
<li key={chapter.id}>
<Link
href={`/sem7/vlsi/${chapter.id}`}
className={`block px-3 py-2 text-xl transition ${
active ? "bg-[#fccc7e]" : "hover:bg-[#ffdda7af]"
} ${righteous.className}`}
>
{chapter.title}
</Link>
</li>
);
})}
</ul>
</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>
</>
);
}
17 changes: 17 additions & 0 deletions app/sem7/vlsi/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
export type Chapter = {
id: string;
title: string;
};

export const chapters: Chapter[] = [
{ id: "ch0", title: "Course Outline" },
{ id: "ch1", title: "Introduction to VLSI" },
{ id: "ch2", title: "CMOS Technology" },
{ id: "ch3", title: "Digital IC Design" },
{ id: "ch4", title: "FPGA Basics" },
{ id: "ch5", title: "Embedded Systems Fundamentals" },
{ id: "ch6", title: "Microcontrollers and Processors" },
{ id: "ch7", title: "Arduino and Raspberry Pi Basics" },
{ id: "ch8", title: "Real-time Systems" },
{ id: "ch9", title: "Mini Projects and Resource Hub" },
];
Loading