File tree Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Expand file tree Collapse file tree 4 files changed +14
-8
lines changed Original file line number Diff line number Diff line change @@ -6,13 +6,13 @@ import Footer from "@/components/Footer";
6
6
7
7
const HomePage = ( ) => {
8
8
return (
9
- < div >
9
+ < div className = "flex min-h-screen flex-col" >
10
10
< div >
11
11
< Navbar />
12
12
</ div >
13
- < div className = "mt-2 flex flex-col items-center justify-center gap-y-6" >
13
+ < div className = "mt-2 flex flex-col items-center justify-center gap-y-6 flex-grow " >
14
14
< div className = "w-full max-w-2xl space-y-6 text-center" >
15
- < h1 className = "phonk text-2xl md:text-3xl font-bold tracking-wider" >
15
+ < h1 className = "phonk text-2xl font-bold tracking-wider md:text-3xl " >
16
16
Built by students for students
17
17
</ h1 >
18
18
< p className = "text-base font-semibold" >
Original file line number Diff line number Diff line change @@ -27,6 +27,12 @@ const Card = ({
27
27
setChecked ( isSelected ) ;
28
28
} , [ isSelected ] ) ;
29
29
30
+ const handleDownload = async ( paper : Paper ) => {
31
+ const extension = paper . finalUrl . split ( "." ) . pop ( ) ;
32
+ const fileName = `${ extractBracketContent ( paper . subject ) } -${ paper . exam } -${ paper . slot } -${ paper . year } .${ extension } ` ;
33
+ await downloadFile ( paper . finalUrl , fileName ) ;
34
+ } ;
35
+
30
36
function handleCheckboxChange ( ) {
31
37
setChecked ( ! checked ) ;
32
38
onSelect ( paper , ! checked ) ;
@@ -92,9 +98,9 @@ const Card = ({
92
98
< p className = "text-sm" > Select</ p >
93
99
</ div >
94
100
< div className = "flex gap-2" onClick = { handleOpen } >
95
- < Eye size = { 20 } />
101
+ < Eye size = { 20 } className = "cursor-pointer" />
96
102
< button
97
- onClick = { ( ) => downloadFile ( paper . finalUrl , ` ${ paper . subject } .jpg` ) }
103
+ onClick = { ( ) => handleDownload ( paper ) }
98
104
>
99
105
< Download size = { 20 } />
100
106
</ button >
Original file line number Diff line number Diff line change @@ -57,8 +57,8 @@ const CatalogueContent = () => {
57
57
58
58
async function downloadFile ( url : string , filename : string ) {
59
59
try {
60
- const response = await fetch ( url , { method : "GET " } ) ;
61
- const blob = await response . blob ( ) ;
60
+ const response = await axios . get ( url , { responseType : "blob " } ) ;
61
+ const blob = new Blob ( [ response . data ] ) ;
62
62
const link = document . createElement ( "a" ) ;
63
63
link . href = window . URL . createObjectURL ( blob ) ;
64
64
link . download = filename ;
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import x_twitter_icon_dark from "../assets/x_twitter_icon_dark.svg";
9
9
10
10
export default function Footer ( ) {
11
11
return (
12
- < div className = "flex md:flex-row flex-col gap-y-12 max-w-7xl mx-auto items-center justify-between pt-12" >
12
+ < div className = "flex md:flex-row flex-col gap-y-12 md:w-full md:px-12 mx-auto items-center justify-between pt-12" >
13
13
< div className = "flex items-center" >
14
14
< h1 className = "jost bg-gradient-to-r from-[#562EE7] to-[#FFC6E8] bg-clip-text text-center text-3xl md:text-5xl font-bold text-transparent" >
15
15
Papers
You can’t perform that action at this time.
0 commit comments