Skip to content

Commit c38c0b6

Browse files
committed
fixed merge issues
1 parent 361a6c7 commit c38c0b6

File tree

7 files changed

+75
-96
lines changed

7 files changed

+75
-96
lines changed

src/app/api/user-papers/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ export async function POST(req: Request) {
3939
[],
4040
);
4141

42-
return NextResponse.json(uniquePapers, {
42+
return NextResponse.json(transformedPapers, {
4343
status: 200,
4444
});
4545
} catch (error) {

src/components/PapersCarousel.tsx

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ import Autoplay from "embla-carousel-autoplay";
1515
import { chunkArray } from "@/util/utils";
1616
import { Skeleton } from "@/components/ui/skeleton";
1717

18-
function PapersCarousel() {
1918
function PapersCarousel() {
2019
const [displayPapers, setDisplayPapers] = useState<IUpcomingPaper[]>([]);
2120
const [isLoading, setIsLoading] = useState(true);
@@ -76,9 +75,7 @@ function PapersCarousel() {
7675
{isLoading ? (
7776
<CarouselItem
7877
className={`grid ${
79-
chunkSize === 4
80-
? "grid-cols-2 grid-rows-2"
81-
: "grid-cols-4"
78+
chunkSize === 4 ? "grid-cols-2 grid-rows-2" : "grid-cols-4"
8279
} gap-4 lg:auto-rows-fr`}
8380
>
8481
{Array.from({ length: chunkSize }).map((_, idx) => (
@@ -104,9 +101,7 @@ function PapersCarousel() {
104101
<CarouselItem
105102
key={`carousel-item-${index}`}
106103
className={`grid ${
107-
chunkSize === 4
108-
? "grid-cols-2 grid-rows-2"
109-
: "grid-cols-4"
104+
chunkSize === 4 ? "grid-cols-2 grid-rows-2" : "grid-cols-4"
110105
} gap-4 lg:auto-rows-fr`}
111106
>
112107
{paperGroup.map((paper, subIndex) => (
@@ -120,7 +115,7 @@ function PapersCarousel() {
120115
</CarouselItem>
121116
))
122117
)}
123-
</CarouselContent>
118+
</CarouselContent>
124119
</Carousel>
125120
</div>
126121
);

src/components/Searchbar/searchbar.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,7 @@ import PinnedSearchBar from "./pinned-searchbar";
77

88
export async function fetchSubjects() {
99
try {
10-
const response = await axios.get<ICourses[]>(
11-
`${process.env.SERVER_URL}/api/course-list`,
12-
);
10+
const response = await axios.get<ICourses[]>(`/api/course-list`);
1311
console.log("Fetched subjects:", response.data);
1412
return response.data.map((course) => course.name);
1513
} catch (err) {

src/components/screens/Info.tsx

Lines changed: 59 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -13,69 +13,68 @@ import Link from "next/link";
1313
import { Button } from "@/components/ui/button";
1414
import PWAInstallButton from "../ui/PWAInstallButton";
1515

16-
1716
function Info() {
1817
return (
19-
<section
20-
id="features"
21-
className="flex scroll-mt-24 flex-col items-center justify-between px-6 py-12 md:scroll-mt-32 lg:flex-row"
22-
>
23-
<div className="w-full text-center lg:w-[50%] lg:text-left">
24-
<div className="mb-8 hidden font-vipnabd text-3xl font-extrabold text-black dark:text-white lg:block lg:text-5xl">
25-
<span>Prepare to excel in </span>
26-
<span>your CATs and FATs </span>
27-
<span>with CodeChef-</span>
28-
<span>VIT’s dedicated </span>
29-
<span>repository of past </span>
30-
<span>exam papers</span>
31-
</div>
32-
<div className="w-full">
18+
<>
19+
<section
20+
id="features"
21+
className="flex scroll-mt-24 flex-col items-center justify-between px-6 py-12 md:scroll-mt-32 lg:flex-row"
22+
>
23+
<div className="w-full text-center lg:w-[50%] lg:text-left">
24+
<div className="mb-8 hidden font-vipnabd text-3xl font-extrabold text-black dark:text-white lg:block lg:text-5xl">
25+
<span>Prepare to excel in </span>
26+
<span>your CATs and FATs </span>
27+
<span>with CodeChef-</span>
28+
<span>VIT’s dedicated </span>
29+
<span>repository of past </span>
30+
<span>exam papers</span>
31+
</div>
3332
<div className="w-full">
34-
<div className="origin-top-left">
35-
<div className="grid grid-cols-3 gap-2 overflow-hidden font-play text-xs text-black dark:text-white sm:text-sm lg:gap-4 lg:text-lg xl:text-base">
36-
<FeatureCard
37-
icon={<User size={24} />}
38-
text="No Sign-up required"
39-
/>
40-
<FeatureCard
41-
isHighlight
42-
highlightText="1200+"
43-
subText="Past Year Papers"
44-
/>
45-
<FeatureCard
46-
icon={<Download size={24} />}
47-
text="Flexible Downloads"
48-
/>
49-
<FeatureCard
50-
icon={<Check size={24} />}
51-
text="Answer Key Available"
52-
/>
53-
<FeatureCard
54-
icon={<Filter size={24} />}
55-
text="Filtered Search"
56-
/>
33+
<div className="w-full">
34+
<div className="origin-top-left">
35+
<div className="grid grid-cols-3 gap-2 overflow-hidden font-play text-xs text-black dark:text-white sm:text-sm lg:gap-4 lg:text-lg xl:text-base">
36+
<FeatureCard
37+
icon={<User size={24} />}
38+
text="No Sign-up required"
39+
/>
40+
<FeatureCard
41+
isHighlight
42+
highlightText="1200+"
43+
subText="Past Year Papers"
44+
/>
45+
<FeatureCard
46+
icon={<Download size={24} />}
47+
text="Flexible Downloads"
48+
/>
49+
<FeatureCard
50+
icon={<Check size={24} />}
51+
text="Answer Key Available"
52+
/>
53+
<FeatureCard
54+
icon={<Filter size={24} />}
55+
text="Filtered Search"
56+
/>
57+
</div>
5758
</div>
5859
</div>
5960
</div>
6061
</div>
61-
</div>
62-
<div className="mb-10 hidden h-[450px] w-[450px] justify-center p-5 lg:flex lg:h-[600px] lg:w-[500px]">
63-
<Image
64-
src={man1 as string}
65-
height={600}
66-
width={500}
67-
alt="man-light"
68-
className="block dark:hidden"
69-
/>
70-
<Image
71-
src={man as string}
72-
height={600}
73-
width={500}
74-
alt="man-dark"
75-
className="hidden dark:block"
76-
/>
77-
</div>
78-
</section>
62+
<div className="mb-10 hidden h-[450px] w-[450px] justify-center p-5 lg:flex lg:h-[600px] lg:w-[500px]">
63+
<Image
64+
src={man1 as string}
65+
height={600}
66+
width={500}
67+
alt="man-light"
68+
className="block dark:hidden"
69+
/>
70+
<Image
71+
src={man as string}
72+
height={600}
73+
width={500}
74+
alt="man-dark"
75+
className="hidden dark:block"
76+
/>
77+
</div>
7978
</section>
8079

8180
{/* Create Request Section */}
@@ -89,13 +88,13 @@ function Info() {
8988
className="group border-[1.5px] border-[#4A55FF] bg-transparent px-6 py-3 text-sm font-medium text-[#4A55FF] transition-all duration-200 hover:bg-[#4A55FF] hover:text-white dark:border-[#9EA8FF] dark:text-[#9EA8FF] dark:hover:bg-[#9EA8FF] dark:hover:text-black"
9089
>
9190
Create Request
92-
<ArrowUpRight className="ml-2 h-4 w-4 transition-transform group-hover:translate-x-0.5 group-hover:-translate-y-0.5" />
91+
<ArrowUpRight className="ml-2 h-4 w-4 transition-transform group-hover:-translate-y-0.5 group-hover:translate-x-0.5" />
9392
</Button>
9493
</Link>
9594
</section>
96-
<div className="flex justify-center py-4 z-50">
97-
<PWAInstallButton />
98-
</div>
95+
<div className="z-50 flex justify-center py-4">
96+
<PWAInstallButton />
97+
</div>
9998
</>
10099
);
101100
}

src/components/screens/PapersPage.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ export default function PapersPage() {
3535
useEffect(() => {
3636
async function fetchSubjects() {
3737
try {
38-
const response = await axios.get<Course[]>(
39-
`${process.env.NEXT_PUBLIC_SERVER_URL}/api/course-list`,
40-
);
38+
const response = await axios.get<Course[]>(`/api/course-list`);
4139
const courses: Course[] = response.data;
4240
const names = courses
4341
.map((course) => course.name ?? course.courseName ?? course.title)
@@ -177,7 +175,7 @@ export default function PapersPage() {
177175
<Select
178176
onValueChange={setSelectedExam}
179177
disabled={!selectedSubject}
180-
value={selectedExam || undefined}
178+
value={selectedExam ?? undefined}
181179
>
182180
<SelectTrigger className="w-32">
183181
<SelectValue placeholder="Exam" />
@@ -193,7 +191,7 @@ export default function PapersPage() {
193191
<Select
194192
onValueChange={setSelectedSlot}
195193
disabled={!selectedSubject}
196-
value={selectedSlot || undefined}
194+
value={selectedSlot ?? undefined}
197195
>
198196
<SelectTrigger className="w-32">
199197
<SelectValue placeholder="Slot" />
@@ -209,7 +207,7 @@ export default function PapersPage() {
209207
<Select
210208
onValueChange={setSelectedYear}
211209
disabled={!selectedSubject}
212-
value={selectedYear || undefined}
210+
value={selectedYear ?? undefined}
213211
>
214212
<SelectTrigger className="w-32">
215213
<SelectValue placeholder="Year" />

src/interface.ts

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -171,13 +171,8 @@ export interface IPaper {
171171
| "Andhra Pradesh"
172172
| "Bhopal"
173173
| "Bangalore"
174-
| "Mauritius";
175-
| "Vellore"
176-
| "Chennai"
177-
| "Andhra Pradesh"
178-
| "Bhopal"
179-
| "Bangalore"
180-
| "Mauritius";
174+
| "Mauritius"
175+
| null;
181176
slot: string;
182177
subject: string;
183178
year: string;
@@ -189,12 +184,6 @@ export type ExamDetail = {
189184
slot: string;
190185
"course-code": string;
191186
exam: string;
192-
semester:
193-
| "Fall Semester"
194-
| "Winter Semester"
195-
| "Summer Semester"
196-
| "Weekend Semester";
197-
exam: string;
198187
semester:
199188
| "Fall Semester"
200189
| "Winter Semester"
@@ -212,3 +201,7 @@ export interface Filters {
212201
unique_campuses: string[];
213202
unique_semesters: string[];
214203
}
204+
205+
export interface StoredSubjects {
206+
subjects: string[];
207+
}

src/middleware.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,14 @@
11
import { type NextRequest, NextResponse } from "next/server";
22
import { Ratelimit } from "@upstash/ratelimit";
33
import { kv } from "@vercel/kv";
4-
import { type NextRequest, NextResponse } from "next/server";
5-
import { Ratelimit } from "@upstash/ratelimit";
6-
import { kv } from "@vercel/kv";
74

85
const ratelimit = new Ratelimit({
96
redis: kv,
107
limiter: Ratelimit.slidingWindow(100, "900 s"),
11-
limiter: Ratelimit.slidingWindow(100, "900 s"),
128
});
139

1410
export const config = {
15-
matcher: "/api/upload",
11+
matcher: "/api/ai-upload",
1612
};
1713

1814
export default async function middleware(request: NextRequest) {

0 commit comments

Comments
 (0)