@@ -7,6 +7,8 @@ import { innkeeperWriteAtom, isQueuingAtom } from "@/libs/room-jotai";
7
7
import { fetchAllQuestionsDoneByUser } from "@/app/api" ;
8
8
import { useQuery } from "@tanstack/react-query" ;
9
9
import { Skeleton , Table , notification } from "antd" ;
10
+ import { EyeOutlined } from "@ant-design/icons" ;
11
+ import ReactMarkdown from "react-markdown" ;
10
12
11
13
const sendMatchRequestAtom = atom (
12
14
null ,
@@ -19,6 +21,8 @@ const sendMatchRequestAtom = atom(
19
21
) ;
20
22
21
23
const MatchingPage = ( ) => {
24
+ const [ currQn , setCurrQn ] = useState < QuestionType | null > ( null ) ;
25
+
22
26
const sendMatchRequest : (
23
27
questionDifficulty : "EASY" | "MEDIUM" | "HARD" ,
24
28
) => void = useAtom ( sendMatchRequestAtom ) [ 1 ] ;
@@ -96,12 +100,37 @@ const MatchingPage = () => {
96
100
} ,
97
101
{
98
102
title : "Submitted Date" ,
99
- dataIndex : "date " ,
103
+ dataIndex : "submitted " ,
100
104
sortDirections : [ "descend" ] ,
101
- render : ( date : string ) => < > { date } </ > ,
105
+ render : ( date : string ) => {
106
+ return new Date ( date ) . toLocaleDateString ( ) ;
107
+ } ,
108
+ } ,
109
+ {
110
+ title : "Actions" ,
111
+ dataIndex : "actions" ,
112
+ align : "center" ,
113
+ width : 10 ,
114
+ render : ( text : string , record : QuestionType , index : number ) => (
115
+ < div className = "flex justify-center gap-2" >
116
+ < EyeOutlined
117
+ className = "p-2 text-xl hover:cursor-pointer hover:rounded-full hover:bg-primary-focus"
118
+ onClick = { ( ) => {
119
+ onClickModal ( "my_modal_2" ) ;
120
+ setCurrQn ( record ) ;
121
+ } }
122
+ />
123
+ </ div >
124
+ ) ,
102
125
} ,
103
126
] ;
104
127
128
+ const onClickModal = ( modalId : string ) => {
129
+ if ( document ) {
130
+ ( document . getElementById ( modalId ) as HTMLFormElement ) . showModal ( ) ;
131
+ }
132
+ } ;
133
+
105
134
const {
106
135
data : allQuestions ,
107
136
isLoading : allQuestionsLoading ,
@@ -115,6 +144,18 @@ const MatchingPage = () => {
115
144
return (
116
145
< >
117
146
< main className = "flex h-full flex-col items-center justify-center" >
147
+ < dialog id = "my_modal_2" className = "modal" >
148
+ < div className = "modal-box max-w-4xl p-6" >
149
+ < form method = "dialog" className = "pb" >
150
+ < button className = "btn btn-circle btn-ghost btn-sm absolute right-2 top-2" >
151
+ ✕
152
+ </ button >
153
+ </ form >
154
+ < ReactMarkdown className = "prose min-w-[40svh] max-w-none rounded-b-md bg-secondary p-6" >
155
+ { currQn ?. description || "" }
156
+ </ ReactMarkdown >
157
+ </ div >
158
+ </ dialog >
118
159
< section className = "flex items-center gap-4" >
119
160
< label >
120
161
< span > Difficulty Setting:</ span >
0 commit comments