@@ -20,15 +20,16 @@ interface Paper {
20
20
_id : string ;
21
21
exam : string ;
22
22
finalUrl : string ;
23
+ thumbnailUrl : string ;
23
24
slot : string ;
24
25
subject : string ;
25
26
year : string ;
26
27
}
27
- interface Filters {
28
+ interface Filters {
28
29
paper : Paper ;
29
- uniqueExams : string [ ] ;
30
- uniqueSlots : string [ ] ;
31
- uniqueYears : string [ ]
30
+ uniqueExams : string [ ] ;
31
+ uniqueSlots : string [ ] ;
32
+ uniqueYears : string [ ] ;
32
33
}
33
34
const cryptr = new Cryptr (
34
35
process . env . NEXT_PUBLIC_CRYPTO_SECRET ?? "default_crypto_secret" ,
@@ -41,7 +42,7 @@ const CatalogueContent = () => {
41
42
const [ papers , setPapers ] = useState < Paper [ ] > ( [ ] ) ;
42
43
const [ error , setError ] = useState < string | null > ( null ) ;
43
44
const [ loading , setLoading ] = useState < boolean > ( false ) ;
44
- const [ filterOptions , setFilterOptions ] = useState < Filters [ ] > ( [ ] ) ;
45
+ const [ filterOptions , setFilterOptions ] = useState < Filters [ ] > ( [ ] ) ;
45
46
useEffect ( ( ) => {
46
47
if ( subject ) {
47
48
const fetchPapers = async ( ) => {
@@ -83,29 +84,27 @@ const CatalogueContent = () => {
83
84
84
85
return (
85
86
< div className = "min-h-screen bg-gray-50 p-8" >
86
-
87
87
< button
88
88
onClick = { ( ) => router . push ( "/" ) }
89
89
className = "mb-4 rounded-md bg-blue-500 px-4 py-2 text-white"
90
- >
90
+ >
91
91
Back to Search
92
92
</ button >
93
- < Dialog >
94
- < DialogTrigger className = " rounded-lg bg-[#7480FF] px-8 py-3 text-white" > Filter </ DialogTrigger >
95
- < DialogContent >
96
- < DialogHeader >
97
- < DialogTitle > Choose your filters </ DialogTitle >
98
- < DialogDescription >
99
- { }
100
- </ DialogDescription >
101
- </ DialogHeader >
102
- </ DialogContent >
103
- </ Dialog >
93
+ < Dialog >
94
+ < DialogTrigger className = " rounded-lg bg-[#7480FF] px-8 py-3 text-white" >
95
+ Filter
96
+ </ DialogTrigger >
97
+ < DialogContent >
98
+ < DialogHeader >
99
+ < DialogTitle > Choose your filters </ DialogTitle >
100
+ < DialogDescription > { } </ DialogDescription >
101
+ </ DialogHeader >
102
+ </ DialogContent >
103
+ </ Dialog >
104
104
105
105
{ /* <h1 className="mb-4 text-2xl font-bold">Papers for {subject}</h1> */ }
106
106
{ error && < p className = "text-red-500" > { error } </ p > }
107
107
108
-
109
108
{ loading ? (
110
109
< p > Loading papers...</ p >
111
110
) : papers . length > 0 ? (
@@ -142,7 +141,7 @@ function Card({ paper }: { paper: Paper }) {
142
141
className = { `space-y-1 rounded-md border border-black border-opacity-50 ${ checked ? "bg-[#EEF2FF]" : "bg-white" } p-4 ` }
143
142
>
144
143
< Image
145
- src = { paper . finalUrl }
144
+ src = { paper . thumbnailUrl }
146
145
alt = { paper . subject }
147
146
// layout="responsive"
148
147
width = { 320 } // Adjust width to maintain aspect ratio if needed
@@ -171,13 +170,15 @@ function Card({ paper }: { paper: Paper }) {
171
170
< p className = "text-sm" > Select</ p >
172
171
</ div >
173
172
< div className = "flex gap-2" >
174
- < Eye />
175
173
< a
176
174
href = { paper . finalUrl }
177
175
target = "_blank"
178
176
rel = "noopener noreferrer"
179
177
// className="text-blue-500 hover:underline"
180
178
>
179
+ < Eye />
180
+ </ a >
181
+ < a href = { paper . finalUrl } download >
181
182
< Download />
182
183
</ a >
183
184
</ div >
0 commit comments