1
- import { Question , StatusBody , Difficulty } from "@/api/structs" ;
1
+ 'use client' ;
2
+ import { Question , Difficulty } from "@/api/structs" ;
2
3
import Chip from "@/components/shared/Chip" ;
4
+ import PeerprepButton from "@/components/shared/PeerprepButton" ;
3
5
import styles from '@/style/question.module.css' ;
4
6
5
7
interface Props {
6
8
question : Question ;
7
9
}
8
10
9
- const difficultyColor = ( diff : Difficulty ) => {
11
+ interface DifficultyChipProps {
12
+ diff : Difficulty
13
+ }
14
+
15
+ function DifficultyChip ( { diff } : DifficultyChipProps ) {
10
16
return (
11
17
diff === Difficulty . Easy
12
18
? < Chip className = { styles . easy } > Easy</ Chip >
@@ -30,10 +36,23 @@ function QuestionBlock({ question }: Props) {
30
36
< >
31
37
< div className = { styles . qn_container } >
32
38
< div className = { styles . title_wrapper } >
33
- < h1 className = { styles . title } > Q{ question . id } : { question . title } </ h1 >
34
- { difficultyColor ( question . difficulty ) }
39
+ < div className = { styles . label_wrapper } >
40
+ < h1 className = { styles . title } > Q{ question . id } : { question . title } </ h1 >
41
+ < DifficultyChip diff = { question . difficulty } />
42
+ </ div >
43
+ < PeerprepButton className = { ` ${ styles . button } ` }
44
+ onClick = { /* TODO: Replace this function with gateway.delete*/ ( ) => console . log ( "Delete Me!" ) } >
45
+ Delete
46
+ </ PeerprepButton >
47
+ </ div >
48
+ < div className = { styles . label_wrapper } >
49
+ < p > Categories: </ p >
50
+ { question . categories . length == 0
51
+ ? ( < p > No categories listed.</ p > )
52
+ : question . categories . map ( ( elem , idx ) => (
53
+ < p key = { idx } > { elem } </ p >
54
+ ) ) }
35
55
</ div >
36
- < br />
37
56
< p > { question . description } </ p >
38
57
< br />
39
58
{ question . test_cases && (
0 commit comments