File tree Expand file tree Collapse file tree 5 files changed +24
-9
lines changed
app/(auth)/leetcode-dashboard Expand file tree Collapse file tree 5 files changed +24
-9
lines changed Original file line number Diff line number Diff line change @@ -3,11 +3,9 @@ import {
3
3
QuestionFull ,
4
4
NewQuestionData ,
5
5
} from "@/types/find-match" ;
6
- import * as dotenv from "dotenv" ;
7
-
8
- dotenv . config ( ) ;
9
6
10
7
const QUESTION_SERVICE =
8
+ process . env . NEXT_PUBLIC_QUESTION_SERVICE ??
11
9
"https://question-service-598285527681.us-central1.run.app/api" ;
12
10
13
11
export const createSingleLeetcodeQuestion = async (
Original file line number Diff line number Diff line change @@ -22,7 +22,11 @@ import MoonLoader from "react-spinners/MoonLoader";
22
22
import { createSingleLeetcodeQuestion } from "@/api/leetcode-dashboard" ;
23
23
import { topicsList } from "@/utils/constants" ;
24
24
25
- const AddQuestionDialog = ( ) => {
25
+ interface AddQuestionDialogProps {
26
+ handleClose : ( ) => void ;
27
+ }
28
+
29
+ const AddQuestionDialog = ( { handleClose } : AddQuestionDialogProps ) => {
26
30
const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
27
31
28
32
const formSchema = z . object ( {
@@ -75,6 +79,7 @@ const AddQuestionDialog = () => {
75
79
} )
76
80
. finally ( ( ) => {
77
81
setIsSubmitting ( false ) ;
82
+ handleClose ( ) ;
78
83
} ) ;
79
84
}
80
85
Original file line number Diff line number Diff line change @@ -27,6 +27,7 @@ import { capitalizeWords } from "@/utils/string_utils";
27
27
import { topicsList } from "@/utils/constants" ;
28
28
29
29
interface EditQuestionDialogProp {
30
+ handleClose : ( ) => void ;
30
31
questionId : string ;
31
32
}
32
33
@@ -44,7 +45,10 @@ const initialValues: EditQuestionValues = {
44
45
questionDescription : "" ,
45
46
} ;
46
47
47
- const EditQuestionDialog = ( { questionId } : EditQuestionDialogProp ) => {
48
+ const EditQuestionDialog = ( {
49
+ questionId,
50
+ handleClose,
51
+ } : EditQuestionDialogProp ) => {
48
52
const [ isSubmitting , setIsSubmitting ] = useState ( false ) ;
49
53
const [ leetcodeData , setLeetcodeData ] =
50
54
useState < EditQuestionValues > ( initialValues ) ;
@@ -107,6 +111,7 @@ const EditQuestionDialog = ({ questionId }: EditQuestionDialogProp) => {
107
111
} ) ;
108
112
} )
109
113
. finally ( ( ) => {
114
+ handleClose ( ) ;
110
115
setIsSubmitting ( false ) ;
111
116
} ) ;
112
117
}
Original file line number Diff line number Diff line change @@ -72,7 +72,7 @@ const LeetcodeDashboard = () => {
72
72
variants = { modalAnimation }
73
73
transition = { { duration : 0.3 } }
74
74
>
75
- < AddQuestionDialog />
75
+ < AddQuestionDialog handleClose = { closeModal } />
76
76
</ motion . div >
77
77
</ Modal >
78
78
</ div >
Original file line number Diff line number Diff line change @@ -117,7 +117,11 @@ export function LeetcodeDashboardTable() {
117
117
accessorKey : "category" ,
118
118
header : ( ) => < Cell > Topics</ Cell > ,
119
119
cell : ( { row } ) => {
120
- return < Cell > { row . getValue ( "category" ) } </ Cell > ;
120
+ const categoryValue = row . getValue ( "category" ) ;
121
+ const result : string = Array . isArray ( categoryValue )
122
+ ? categoryValue . join ( ", " )
123
+ : String ( categoryValue ) ;
124
+ return < Cell > { result } </ Cell > ;
121
125
} ,
122
126
} ,
123
127
{
@@ -148,7 +152,10 @@ export function LeetcodeDashboardTable() {
148
152
variants = { modalAnimation }
149
153
transition = { { duration : 0.3 } }
150
154
>
151
- < EditQuestionDialog questionId = { questionId } />
155
+ < EditQuestionDialog
156
+ questionId = { questionId }
157
+ handleClose = { closeModal }
158
+ />
152
159
</ motion . div >
153
160
</ Modal >
154
161
< Button variant = { "ghost" } onClick = { ( ) => handleDelete ( questionId ) } >
@@ -161,7 +168,7 @@ export function LeetcodeDashboardTable() {
161
168
] ;
162
169
163
170
useEffect ( ( ) => {
164
- getLeetcodeDashboardData ( ) . then ( ( data ) => setData ( data ) ) ;
171
+ getLeetcodeDashboardData ( ) . then ( ( data ) => setData ( data . reverse ( ) ) ) ;
165
172
} , [ refreshKey ] ) ;
166
173
167
174
const table = useReactTable ( {
You can’t perform that action at this time.
0 commit comments