Skip to content

Commit d399bbe

Browse files
committed
Merge branch 'prod' of https://github.com/Advik-Gupta/papers-codechef into prod
2 parents 3f84491 + 5d3808c commit d399bbe

10 files changed

Lines changed: 40 additions & 39 deletions

File tree

src/app/api/upload/route.ts

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,6 @@ export async function POST(req: Request) {
5959

6060
let final_url: string | undefined = "";
6161
let public_id_cloudinary: string | undefined = "";
62-
let thumbnail_url: string | undefined = "";
6362

6463
if (!files || files.length === 0) {
6564
return NextResponse.json(
@@ -93,19 +92,13 @@ export async function POST(req: Request) {
9392
);
9493
}
9594

96-
const thumbnailResponse = cloudinary.v2.image(final_url!, {
97-
format: "jpg",
98-
});
99-
thumbnail_url = thumbnailResponse
100-
.replace("pdf", "jpg")
101-
.replace("upload", "upload/w_400,h_400,c_fill")
102-
.replace(/<img src='|'\s*\/>/g, "");
10395

10496
const paper = new PaperAdmin({
10597
cloudinary_index: configIndex,
98+
10699
public_id_cloudinary,
107100
final_url,
108-
thumbnail_url,
101+
thumbnail_url: null,
109102
subject: null,
110103
slot: null,
111104
year: null,

src/app/paper/[id]/page.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function generateMetadata({
2121
metadataBase: new URL("https://papers.codechefvit.com/"),
2222
title: `Papers | ${paper.subject} | ${paper.exam} | ${paper.slot}`,
2323
description: `Discover ${paper.subject}'s question paper created by CodeChef-VIT at Vellore Institute of Technology. Made with ♡ to help students excel.`,
24-
icons: [{ rel: "icon", url: "/codechef_logo.svg" }],
24+
icons: [{ rel: "icon", url: "/favicon.svg" }],
2525
openGraph: {
2626
title: `Papers | ${paper.subject} | ${paper.exam} | ${paper.slot}`,
2727
images: [{ url: "/papers.png" }],

src/app/upload/page.tsx

Lines changed: 14 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,7 @@ const Page = () => {
174174
const isCurrentlyDragging = isDragging || isGlobalDragging;
175175

176176
return (
177-
<div className="flex h-[calc(100vh-85px)] flex-col justify-center px-6 font-play">
177+
<div className="flex h-[calc(100vh-185px)] flex-col justify-center px-3 font-play">
178178
<div className="2xl:my-15 flex flex-col items-center">
179179
<fieldset className="mb-4 w-full max-w-md rounded-lg border-2 border-gray-300 p-4 pr-8">
180180
<div className="flex w-full flex-col 2xl:gap-y-4">
@@ -211,11 +211,18 @@ const Page = () => {
211211
<Upload className="mt-2 h-10 w-10 animate-bounce text-[#6D28D9]" />
212212
</div>
213213
) : (
214-
<p>
215-
Drag &apos;n&apos; drop some files here, or{" "}
216-
<span className="text-[#6D28D9]">click</span> to select
217-
files
218-
</p>
214+
<div>
215+
<p className="font-semibold text-lg">
216+
Drag &apos;n&apos; drop some files here, or{" "}
217+
<span className="text-[#6D28D9]">click</span> to select
218+
files
219+
</p>
220+
<div className="mx-auto my-6 w-full max-w-xl rounded-md text-sm text-black dark:text-white opacity-70">
221+
<p className="text-center">
222+
<strong>Note:</strong> Uploaded papers are first reviewed by our team before appearing on the website. If your paper doesn&apos;t show up immediately, please be patient,it&apos;s likely still under review.
223+
</p>
224+
</div>
225+
</div>
219226
)}
220227
<div
221228
className={`mt-2 text-xs ${
@@ -225,7 +232,7 @@ const Page = () => {
225232
{files?.length || 0} files selected
226233
</div>
227234
</section>
228-
)}
235+
)}
229236
</Dropzone>
230237
<label className="mx-2 -mr-2 block text-center text-xs font-medium text-gray-700">
231238
Only Images and PDF are allowed

src/components/FloatingNavbar.tsx

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -41,14 +41,14 @@ export default function FloatingNavbar({ onNavigate }: Props) {
4141
</DropdownMenuTrigger>
4242

4343
<DropdownMenuContent
44-
className="xl:hidden mt-2 w-72 space-y-1 rounded-3xl border border-white/10 bg-[#110F18] px-4 py-4 text-white shadow-xl backdrop-blur-sm pointer-events-auto"
44+
className="xl:hidden mt-2 py-2 w-72 space-y-1 rounded-3xl bg-[#4B22D1] text-white border border-[rgba(255,255,255,0.1)] shadow-2xl backdrop-blur-sm pointer-events-auto"
4545
align="end"
4646
>
4747
<DropdownMenuItem asChild>
4848
<Link
4949
href={pathname === "/upload" ? "/" : "/upload"}
5050
onClick={() => onNavigate()}
51-
className="flex w-full items-center gap-3 rounded-lg px-3 py-3 hover:bg-[#1A1823] transition"
51+
className="flex w-full items-center gap-3 rounded-lg px-3 py-1 hover:bg-[#1A1823] transition"
5252
>
5353
<UploadIcon className="h-4 w-4" />
5454
<span className="text-sm font-medium">
@@ -61,7 +61,7 @@ export default function FloatingNavbar({ onNavigate }: Props) {
6161
<Link
6262
href="/pinned"
6363
onClick={() => onNavigate()}
64-
className="flex w-full items-center gap-3 rounded-lg px-3 py-3 hover:bg-[#1A1823] transition"
64+
className="flex w-full items-center gap-3 rounded-lg px-3 py-1 hover:bg-[#1A1823] transition"
6565
>
6666
<Pin className="h-4 w-4" />
6767
<span className="text-sm font-medium">Pinned Subjects</span>
@@ -72,18 +72,15 @@ export default function FloatingNavbar({ onNavigate }: Props) {
7272
<Link
7373
href="/request"
7474
onClick={() => onNavigate()}
75-
className="flex w-full items-center gap-3 rounded-lg px-3 py-3 hover:bg-[#1A1823] transition"
75+
className="flex w-full items-center gap-3 rounded-lg px-3 py-1 hover:bg-[#1A1823] transition"
7676
>
7777
<ArrowUpRight className="h-4 w-4" />
7878
<span className="text-sm font-medium">Paper Request</span>
7979
</Link>
8080
</DropdownMenuItem>
81-
82-
<div className="pt-2 border-t border-[#3A3745] mt-2">
83-
<div className="flex justify-center pt-2">
84-
<div className="rounded-full border border-[#3A3745] p-1">
85-
<ModeToggle />
86-
</div>
81+
<div className="flex w-full items-center gap-3 rounded-lg px-3 py-1">
82+
<div className="border rounded-full">
83+
<ModeToggle />
8784
</div>
8885
</div>
8986
</DropdownMenuContent>

src/components/PinButton.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ export default function PinButton({
1313
}) {
1414
return (
1515
<button
16+
type="submit"
1617
onClick={onToggle}
1718
className={`ml-2 flex items-center gap-2 rounded-full border border-[#3A3745] px-4 py-2 text-sm font-medium transition ${
1819
isPinned

src/components/Searchbar/pinned-searchbar.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ function PinnedSearchBar({
6767
setPinned(currentPinnedSubjects.includes(suggestion));
6868
}
6969

70+
setTimeout(() => {
71+
searchRef.current?.focus();
72+
}, 0);
73+
7074
setShowControls(true);
7175
setSuggestions([]);
7276
filtersNotPulled?.();
@@ -102,7 +106,7 @@ function PinnedSearchBar({
102106
const current = !pinned;
103107
setPinned(current);
104108

105-
if (searchText.trim() === "") {
109+
if (searchText.trim() === "" || !initialSubjects.includes(searchText.trim())) {
106110
return;
107111
}
108112

@@ -174,6 +178,9 @@ function PinnedSearchBar({
174178
<form
175179
onSubmit={(e) => {
176180
e.preventDefault();
181+
handlePinToggle();
182+
if(searchText.trim()!=="")
183+
setOpen(false);
177184
}}
178185
>
179186
<div className="flex items-center gap-2">
@@ -188,13 +195,9 @@ function PinnedSearchBar({
188195
suggestions.length > 0 ? "rounded-b-none" : ""
189196
}`}
190197
/>
191-
<button
192-
type="submit"
193-
className="absolute inset-y-0 right-3 flex items-center"
194-
title="Search"
195-
>
198+
<div className="absolute inset-y-0 right-3 flex items-center">
196199
<Search className="h-5 w-5 text-black dark:text-white" />
197-
</button>
200+
</div>
198201

199202
{suggestions.length > 0 && (
200203
<ul

src/components/bannerDismiss.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ export default function Banner({
5252

5353
<button
5454
onClick={closeBanner}
55-
className="absolute right-4 top-4 transition hover:opacity-75 sm:static sm:self-start"
55+
className="absolute right-4 top-6 transition hover:opacity-75 sm:static sm:self-start"
5656
aria-label="Dismiss banner"
5757
style={{ color: accentColor }}
5858
>
59-
<X className="h-5 w-5" />
59+
<X className="text-sm"/>
6060
</button>
6161
</div>
6262
</div>

src/components/screens/Faq.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ function Faq() {
8282
className={`flex h-6 w-8 shrink-0 items-center justify-center rounded-full text-base font-bold transition-all duration-200 sm:h-7 sm:w-9 sm:text-lg ${
8383
faqActive === index
8484
? "bg-[#A47DE5] text-white"
85-
: "bg-white text-[#99979F]"
85+
: "bg-black text-white"
8686
}`}
8787
>
8888
{faqActive === index ? "−" : "+"}

src/components/ui/switch.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ const Switch = React.forwardRef<
2727
{props.checked ? (
2828
<Moon className="h-4 w-4 text-black" />
2929
) : (
30-
<Sun className="black h-4 w-4" />
30+
<Sun className="black h-4 w-4 text-black" />
3131
)}
3232
</SwitchPrimitives.Thumb>
3333
</SwitchPrimitives.Root>

src/db/papers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const adminSchema = new Schema<IAdminPaper>({
55
public_id_cloudinary: { type: String, required: true },
66
cloudinary_index: { type: Number, required: true },
77
final_url: { type: String, required: true },
8-
thumbnail_url: { type: String, required: true },
8+
thumbnail_url: { type: String, required: false },
99
subject: { type: String || null, index: true },
1010
slot: { type: String || null },
1111
year: { type: String || null },

0 commit comments

Comments
 (0)