@@ -37,6 +37,7 @@ import { Input } from "@/components/ui/input";
37
37
import { ListFilter , Search } from "lucide-react" ;
38
38
import { MultiSelect } from "@/components/ui/multiselect" ;
39
39
import { capitalizeWords } from "@/utils/string_utils" ;
40
+ import { topicsList } from "@/utils/constants" ;
40
41
41
42
const Cell = ( {
42
43
className,
@@ -111,6 +112,7 @@ export function LeetcodeDashboardTable({
111
112
const [ totalPages , setTotalPage ] = React . useState < number > ( 1 ) ;
112
113
const [ searchTitle , setSearchTitle ] = React . useState < string > ( "" ) ;
113
114
const [ searchDifficulty , setSearchDifficulty ] = React . useState < string [ ] > ( [ ] ) ;
115
+ const [ searchTopic , setSearchTopic ] = React . useState < string [ ] > ( [ ] ) ;
114
116
const [ isFilterOpen , setIsFilterOpen ] = React . useState < boolean > ( false ) ;
115
117
116
118
const questionDifficulty = Object . values ( QuestionDifficulty ) . map ( ( q1 ) => {
@@ -204,7 +206,8 @@ export function LeetcodeDashboardTable({
204
206
pagination . pageIndex + 1 ,
205
207
pagination . pageSize ,
206
208
searchTitle ,
207
- searchDifficulty
209
+ searchDifficulty ,
210
+ searchTopic
208
211
) . then ( ( data ) => {
209
212
setTotalPage ( data . totalPages ) ;
210
213
if ( data . totalPages < pagination . pageIndex + 1 ) {
@@ -216,7 +219,13 @@ export function LeetcodeDashboardTable({
216
219
setData ( data . questions ) ;
217
220
}
218
221
} ) ;
219
- } , [ refreshKey , pagination . pageIndex , searchTitle , searchDifficulty ] ) ;
222
+ } , [
223
+ refreshKey ,
224
+ pagination . pageIndex ,
225
+ searchTitle ,
226
+ searchDifficulty ,
227
+ searchTopic ,
228
+ ] ) ;
220
229
221
230
const table = useReactTable ( {
222
231
data,
@@ -234,7 +243,7 @@ export function LeetcodeDashboardTable({
234
243
return (
235
244
< div className = "w-full test" >
236
245
< div >
237
- < Table className = "font-light" >
246
+ < Table className = "font-light min-h-[50vh] " >
238
247
< TableHeader className = "w-full" >
239
248
< TableRow className = "text-white bg-primary-900 font-medium hover:bg-transparent h-[5rem] text-md" >
240
249
< TableCell colSpan = { 5 } className = "pl-10" >
@@ -258,8 +267,8 @@ export function LeetcodeDashboardTable({
258
267
Filter By
259
268
</ Button >
260
269
{ isFilterOpen && (
261
- < div className = "absolute right-0 mt-2 h-80 w-52 bg-primary-800 text-primary-300 border border-gray-300 rounded shadow-lg z-10" >
262
- < div className = "flex flex-col place-items-center mt-4" >
270
+ < div className = "absolute right-0 mt-2 w-72 min-h-[184px] bg-primary-800 text-primary-300 border border-gray-300 rounded shadow-lg z-10" >
271
+ < div className = "flex flex-col place-items-center mt-4 gap-4 " >
263
272
< div className = "w-[90%]" >
264
273
< div className = "text-xs" > Difficulty</ div >
265
274
< MultiSelect
@@ -270,6 +279,16 @@ export function LeetcodeDashboardTable({
270
279
className = "mt-1"
271
280
/>
272
281
</ div >
282
+ < div className = "w-[90%] mb-4" >
283
+ < div className = "text-xs" > Topics</ div >
284
+ < MultiSelect
285
+ options = { topicsList }
286
+ onValueChange = { setSearchTopic }
287
+ placeholder = "Select options"
288
+ variant = "inverted"
289
+ className = "mt-1"
290
+ />
291
+ </ div >
273
292
</ div >
274
293
</ div >
275
294
) }
0 commit comments