File tree Expand file tree Collapse file tree 2 files changed +15
-5
lines changed
src/components/blocks/questions Expand file tree Collapse file tree 2 files changed +15
-5
lines changed Original file line number Diff line number Diff line change
1
+ import { Pencil1Icon } from '@radix-ui/react-icons' ;
1
2
import Markdown from 'react-markdown' ;
2
3
import rehypeKatex from 'rehype-katex' ;
3
4
import remarkGfm from 'remark-gfm' ;
4
5
import remarkMath from 'remark-math' ;
5
6
6
7
import { Badge } from '@/components/ui/badge' ;
7
- import { CardContent , CardHeader , CardTitle } from '@/components/ui/card' ;
8
+ import { Button } from '@/components/ui/button' ;
9
+ import { CardContent , CardHeader , CardTitle } from '@/components/ui/card' ;
8
10
import { ScrollArea } from '@/components/ui/scroll-area' ;
9
11
import { Separator } from '@/components/ui/separator' ;
12
+ import { useAuthedRoute } from '@/stores/auth-store' ;
10
13
import type { IGetQuestionDetailsResponse } from '@/types/question-types' ;
11
14
12
15
export const QuestionDetails = ( {
13
16
questionDetails,
14
17
} : {
15
18
questionDetails : IGetQuestionDetailsResponse [ 'question' ] ;
16
19
} ) => {
20
+ const { isAdmin } = useAuthedRoute ( ) ;
17
21
return (
18
22
< ScrollArea className = 'h-full' >
19
23
< CardHeader >
@@ -22,6 +26,12 @@ export const QuestionDetails = ({
22
26
< CardTitle className = 'text-2xl' >
23
27
{ questionDetails . id } . { questionDetails . title }
24
28
</ CardTitle >
29
+ { isAdmin && (
30
+ < Button className = 'flex gap-1 uppercase' >
31
+ < Pencil1Icon />
32
+ < span > Edit</ span >
33
+ </ Button >
34
+ ) }
25
35
</ div >
26
36
< div className = 'flex flex-wrap items-center gap-1' >
27
37
< Badge
Original file line number Diff line number Diff line change @@ -34,31 +34,31 @@ export default defineConfig(({ mode }) => {
34
34
} ,
35
35
'/question-service' : {
36
36
target : env . VITE_QUESTION_SERVICE ,
37
- rewrite : ( path : string ) => path . replace ( / ^ \/ q u e s t i o n - s e r v i c e / , '' ) ,
37
+ rewrite : ( path : string ) => path ? .replace ( / ^ \/ q u e s t i o n - s e r v i c e / , '' ) ,
38
38
changeOrigin : true ,
39
39
cookiePathRewrite : {
40
40
'*' : '/' ,
41
41
} ,
42
42
} ,
43
43
'/collaboration-service' : {
44
44
target : env . VITE_COLLAB_SERVICE ,
45
- rewrite : ( path : string ) => path . replace ( / ^ \/ c o l l a b o r a t i o n - s e r v i c e / , '' ) ,
45
+ rewrite : ( path : string ) => path ? .replace ( / ^ \/ c o l l a b o r a t i o n - s e r v i c e / , '' ) ,
46
46
changeOrigin : true ,
47
47
cookiePathRewrite : {
48
48
'*' : '/' ,
49
49
} ,
50
50
} ,
51
51
'/matching-service' : {
52
52
target : env . VITE_MATCHING_SERVICE ,
53
- rewrite : ( path : string ) => path . replace ( / ^ \/ m a t c h i n g - s e r v i c e / , '' ) ,
53
+ rewrite : ( path : string ) => path ? .replace ( / ^ \/ m a t c h i n g - s e r v i c e / , '' ) ,
54
54
changeOrigin : true ,
55
55
cookiePathRewrite : {
56
56
'*' : '/' ,
57
57
} ,
58
58
} ,
59
59
'/collab-ws' : {
60
60
target : `${ env . VITE_COLLAB_SERVICE . replace ( 'http' , 'ws' ) } ` ,
61
- rewrite : ( path : string ) => path . replace ( / \/ c o l l a b - w s / , '' ) ,
61
+ rewrite : ( path : string ) => path ? .replace ( / \/ c o l l a b - w s / , '' ) ,
62
62
ws : true ,
63
63
} ,
64
64
'/matching-socket/' : {
You can’t perform that action at this time.
0 commit comments