-
+
Built by Students for Students
-
-
- Prepare to excel in your CATs and FATs with CodeChef-VIT's
- dedicated repository of past exam papers. Access key resources to
- review concepts, tackle challenging questions, and familiarize
- yourself with exam patterns. Boost your confidence, sharpen your
- strategy, and get ready to ace your exams!
-
-
-
- {[
- "NO SIGN UP REQUIRED",
- "FILTERED SEARCH",
- "FLEXIBLE DOWNLOAD",
- ].map((text) => (
-
- ))}
-
+
-
-
diff --git a/src/assets/download.svg b/src/assets/download.svg
new file mode 100644
index 0000000..1e11209
--- /dev/null
+++ b/src/assets/download.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/assets/downloadd.svg b/src/assets/downloadd.svg
new file mode 100644
index 0000000..c2b5daf
--- /dev/null
+++ b/src/assets/downloadd.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/assets/filter.svg b/src/assets/filter.svg
new file mode 100644
index 0000000..32bb16b
--- /dev/null
+++ b/src/assets/filter.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/assets/filterd.svg b/src/assets/filterd.svg
new file mode 100644
index 0000000..a0646e5
--- /dev/null
+++ b/src/assets/filterd.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/assets/man.svg b/src/assets/man.svg
new file mode 100644
index 0000000..452d997
--- /dev/null
+++ b/src/assets/man.svg
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/assets/man1.svg b/src/assets/man1.svg
new file mode 100644
index 0000000..47d5745
--- /dev/null
+++ b/src/assets/man1.svg
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/src/assets/sign.svg b/src/assets/sign.svg
new file mode 100644
index 0000000..af2f734
--- /dev/null
+++ b/src/assets/sign.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/assets/signd.svg b/src/assets/signd.svg
new file mode 100644
index 0000000..a956dd1
--- /dev/null
+++ b/src/assets/signd.svg
@@ -0,0 +1,4 @@
+
+
+
+
diff --git a/src/assets/tick.svg b/src/assets/tick.svg
new file mode 100644
index 0000000..3a253a4
--- /dev/null
+++ b/src/assets/tick.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/assets/tickd.svg b/src/assets/tickd.svg
new file mode 100644
index 0000000..fcfefa6
--- /dev/null
+++ b/src/assets/tickd.svg
@@ -0,0 +1,3 @@
+
+
+
diff --git a/src/components/Faq.tsx b/src/components/Faq.tsx
new file mode 100644
index 0000000..a5b5d16
--- /dev/null
+++ b/src/components/Faq.tsx
@@ -0,0 +1,49 @@
+"use client";
+import { useState } from "react";
+
+function Faq() {
+ const faqs = [
+ { question: "What makes papers unique?", answer: "Lorem ipsum" },
+ { question: "What makes papers unique?", answer: "Lorem ipsum" },
+ { question: "What makes papers unique?", answer: "Lorem ipsum" },
+ { question: "What makes papers unique?", answer: "Lorem ipsum" },
+ { question: "What makes papers unique?", answer: "Lorem ipsum" }
+ ];
+ const [faqActive, setFaqActive] = useState
(null);
+
+ const handleClick = (index: number) => {
+ setFaqActive(faqActive === index ? null : index);
+ };
+
+ return (
+
+
+ Frequently Asked Questions
+
+
+ {faqs.map((faq, index) => (
+
+
+
+ {faq.question}
+
+ handleClick(index)}
+ className={`text-md font-bold w-11 h-6 flex items-center justify-center rounded-full transition-all duration-200 ${faqActive === index ? "text-white dark:bg-[#A47DE5] bg-[#6F2DA6]" : "dark:bg-white bg-[#EDEFF0] text-[#99979F]"}`}
+ >
+ {faqActive === index ? "−" : "+"}
+
+
+ {faqActive === index && (
+
{faq.answer}
+ )}
+
+ ))}
+
+
+ );
+}
+
+export default Faq;
diff --git a/src/components/Footer.tsx b/src/components/Footer.tsx
index beda4ce..cb67890 100644
--- a/src/components/Footer.tsx
+++ b/src/components/Footer.tsx
@@ -13,7 +13,7 @@ import { useEffect, useState } from "react";
import { Button } from "./ui/button";
export default function Footer() {
- const { theme, setTheme } = useTheme();
+ const { theme } = useTheme();
const [isDarkMode, setIsDarkMode] = useState(true);
useEffect(() => {
@@ -23,78 +23,81 @@ export default function Footer() {
}, [theme]);
return (
-
-
-
- Papers
-
-
-
-
-
CodeChef-VIT
+
);
}
diff --git a/src/components/Hero.tsx b/src/components/Hero.tsx
new file mode 100644
index 0000000..2598d67
--- /dev/null
+++ b/src/components/Hero.tsx
@@ -0,0 +1,124 @@
+import Image from "next/image";
+import man from "../assets/man.svg" assert { type: "image/svg" };
+import man1 from "../assets/man1.svg" assert { type: "image/svg" };
+import sign from "../assets/sign.svg" assert { type: "image/svg" };
+import signd from "../assets/signd.svg" assert { type: "image/svg" };
+import download from "../assets/download.svg" assert { type: "image/svg" };
+import downloadd from "../assets/downloadd.svg" assert { type: "image/svg" };
+import tick from "../assets/tick.svg" assert { type: "image/svg" };
+import tickd from "../assets/tickd.svg" assert { type: "image/svg" };
+import filter from "../assets/filter.svg" assert { type: "image/svg" };
+import filterd from "../assets/filterd.svg" assert { type: "image/svg" };
+
+function Hero() {
+ return (
+
+
+
+ Prepare to excel in
+ your CATs and FATs
+ with CodeChef-
+ VIT’s dedicated
+ repository of past
+ exam papers
+
+
+
+
+
+
+ No Sign-up required
+
+
+
+
+ Flexible Downloads
+
+
+
+ 900+
+ Past Year Papers
+
+
+
+
+
+ Answer Key Available
+
+
+
+
+ Filtered Search
+
+
+
+
+
+
+
+
+
+ );
+}
+
+export default Hero;
diff --git a/src/components/Navbar.tsx b/src/components/Navbar.tsx
index 4a5b341..9936dea 100644
--- a/src/components/Navbar.tsx
+++ b/src/components/Navbar.tsx
@@ -11,38 +11,35 @@ function Navbar() {
const pathname = usePathname();
return (
-
-
+
+
-
Papers
-
+
-
-
-
- {pathname == "/upload" ? "⇱ SEARCH PAPERS": "⇱ UPLOAD PAPERS"}
-
+
+
+
+ {pathname == "/upload" ? "⇱ SEARCH PAPERS" : "⇱ UPLOAD PAPERS"}
+
-
);
diff --git a/src/components/PreviewCard.tsx b/src/components/PreviewCard.tsx
index 1a58d25..f4f9e1b 100644
--- a/src/components/PreviewCard.tsx
+++ b/src/components/PreviewCard.tsx
@@ -14,7 +14,7 @@ const PreviewCard = ({ paper }: { paper: IPaper }) => {
return (
{
/>
-
+
{extractBracketContent(paper.subject)}
+
-
+
{extractWithoutBracketContent(paper.subject)}
@@ -41,7 +42,6 @@ const PreviewCard = ({ paper }: { paper: IPaper }) => {
{capsule(paper.slot)}
{capsule(paper.year)}
{capsule(paper.semester)}
-
diff --git a/src/components/StoredPapers.tsx b/src/components/StoredPapers.tsx
index 3d9c81f..8ca4627 100644
--- a/src/components/StoredPapers.tsx
+++ b/src/components/StoredPapers.tsx
@@ -5,6 +5,7 @@ import axios from "axios";
import PreviewCard from "@/components/PreviewCard";
import { type IPaper } from "@/interface";
import Loader from "./ui/loader";
+import Link from "next/link";
function StoredPapers() {
const [displayPapers, setDisplayPapers] = useState
([]);
@@ -29,12 +30,14 @@ function StoredPapers() {
return (
<>
- Most Viewed Papers
+ Most Viewed Papers
{displayPapers.map((paper: IPaper) => (
))}
+ Learn More
+ ▼
>
);
}
diff --git a/src/components/searchbar.tsx b/src/components/searchbar.tsx
new file mode 100644
index 0000000..9520d97
--- /dev/null
+++ b/src/components/searchbar.tsx
@@ -0,0 +1,137 @@
+"use client";
+
+import { useState, useCallback, useRef, useEffect } from "react";
+import axios, { AxiosError } from "axios";
+import { Search } from "lucide-react";
+import debounce from "debounce";
+import { useRouter } from "next/navigation";
+import { Input } from "@/components/ui/input";
+
+function SearchBar() {
+ const router = useRouter();
+ const [searchText, setSearchText] = useState("");
+ const [suggestions, setSuggestions] = useState([]);
+ const [error, setError] = useState(null);
+ const [loading, setLoading] = useState(false);
+ const suggestionsRef = useRef(null);
+
+ const debouncedSearch = useCallback(
+ debounce(async (text: string) => {
+ if (text.length > 1) {
+ setLoading(true);
+ try {
+ const searchResponse = await axios.get<{
+ subjects: { subject: string }[];
+ }>("/api/search", {
+ params: { text },
+ });
+
+ const { subjects } = searchResponse.data;
+ const suggestionList = subjects.map(
+ (subjectObj: { subject: string }) => subjectObj.subject,
+ );
+ setSuggestions(suggestionList);
+ setError(null);
+ } catch (error) {
+ const typedError = error as AxiosError<{ message?: string }>;
+ const errorMessage =
+ typedError.response?.data?.message ?? "Error fetching suggestions";
+ setError(errorMessage);
+ } finally {
+ setLoading(false);
+ }
+ } else {
+ setSuggestions([]);
+ }
+ }, 500),
+ [],
+ );
+
+ const handleSearchChange = (e: React.ChangeEvent) => {
+ const text = e.target.value;
+ if (text.length <= 1) {
+ setSuggestions([]);
+ }
+ setSearchText(text);
+ void debouncedSearch(text);
+ };
+
+ const handleSelectSuggestion = async (suggestion: string) => {
+ setSearchText(suggestion);
+ setSuggestions([]);
+ router.push(`/catalogue?subject=${encodeURIComponent(suggestion)}`);
+ };
+
+ const handleClickOutside = (event: MouseEvent) => {
+ if (
+ suggestionsRef.current &&
+ !suggestionsRef.current.contains(event.target as Node)
+ ) {
+ setSuggestions([]);
+ }
+ };
+
+ useEffect(() => {
+ document.addEventListener("mousedown", handleClickOutside);
+ return () => {
+ document.removeEventListener("mousedown", handleClickOutside);
+ };
+ }, []);
+
+ return (
+
+ );
+}
+
+export default SearchBar;
diff --git a/src/components/ui/switch.tsx b/src/components/ui/switch.tsx
index eabc737..ce6e907 100644
--- a/src/components/ui/switch.tsx
+++ b/src/components/ui/switch.tsx
@@ -1,3 +1,4 @@
+
"use client"
import * as React from "react"
diff --git a/src/styles/globals.css b/src/styles/globals.css
index 376e7d4..fa120dd 100644
--- a/src/styles/globals.css
+++ b/src/styles/globals.css
@@ -17,7 +17,6 @@
color: #888888;
}
-
@layer base {
:root {
--background: 0 0% 100%;
@@ -75,7 +74,6 @@
}
}
-
@layer base {
* {
@apply border-border;
@@ -93,12 +91,33 @@
font-family: "jost";
src: url(/jostfont.ttf);
}
-.jost{
+@font-face {
+ font-family: "vipna";
+ src: url(/Vipnagorgialla.otf);
+}
+@font-face {
+ font-family: "vipnabd";
+ src: url(/VipnagorgiallaBd.otf);
+}
+@font-face {
+ font-family: "play";
+ src: url(/play.ttf);
+}
+.jost {
font-family: "jost";
}
-.phonk{
+.phonk {
font-family: "phonk";
}
+.vipna {
+ font-family: "vipna";
+}
+.vipnabd {
+ font-family: "vipnabd";
+}
+.play {
+ font-family: "play";
+}
.dark ::-webkit-scrollbar {
width: 0.4rem;
height: 0.4rem;
@@ -140,4 +159,4 @@
src: url("/fonts/yerk.woff") format("woff");
font-weight: 400;
font-style: normal;
-}
\ No newline at end of file
+}
diff --git a/src/util/utils.tsx b/src/util/utils.tsx
index 794df30..bf15b62 100644
--- a/src/util/utils.tsx
+++ b/src/util/utils.tsx
@@ -25,7 +25,7 @@ export function extractWithoutBracketContent(subject: string): string {
export function capsule(data: string) {
return (
- {data}
+ {data}
);
}
export function capsuleGreen(data: string) {