@@ -2,6 +2,7 @@ import { useInfiniteQuery } from '@tanstack/react-query';
2
2
import React , { useEffect , useMemo } from 'react' ;
3
3
4
4
import { CardContent } from '@/components/ui/card' ;
5
+ import { cn } from '@/lib/utils' ;
5
6
import { getQuestionAttempts } from '@/services/question-service' ;
6
7
import { useAuthedRoute } from '@/stores/auth-store' ;
7
8
import { IPostGetQuestionAttemptsResponse } from '@/types/question-types' ;
@@ -11,9 +12,15 @@ import { QuestionAttemptsTable } from './table';
11
12
12
13
type QuestionAttemptsProps = {
13
14
questionId : number ;
15
+ pageSize ?: number ;
16
+ className ?: string ;
14
17
} ;
15
18
16
- export const QuestionAttemptsPane : React . FC < QuestionAttemptsProps > = ( { questionId } ) => {
19
+ export const QuestionAttemptsPane : React . FC < QuestionAttemptsProps > = ( {
20
+ questionId,
21
+ pageSize,
22
+ className,
23
+ } ) => {
17
24
const { userId } = useAuthedRoute ( ) ;
18
25
const { data, hasNextPage, isFetchingNextPage, fetchNextPage, isError } = useInfiniteQuery ( {
19
26
queryKey : [ 'question' , 'attempts' , questionId , userId ] ,
@@ -33,8 +40,13 @@ export const QuestionAttemptsPane: React.FC<QuestionAttemptsProps> = ({ question
33
40
return data ?. pages . flatMap ( ( v ) => v as IPostGetQuestionAttemptsResponse ) ?? [ ] ;
34
41
} , [ data ] ) ;
35
42
return (
36
- < CardContent className = 'flex size-full p-0' >
37
- < QuestionAttemptsTable columns = { columns } data = { attempts } isError = { isError } />
43
+ < CardContent className = { cn ( 'flex h-full w-full p-0' , className ) } >
44
+ < QuestionAttemptsTable
45
+ columns = { columns }
46
+ data = { attempts }
47
+ isError = { isError }
48
+ pageSize = { pageSize }
49
+ />
38
50
</ CardContent >
39
51
) ;
40
52
} ;
0 commit comments