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' ;
12import Markdown from 'react-markdown' ;
23import rehypeKatex from 'rehype-katex' ;
34import remarkGfm from 'remark-gfm' ;
45import remarkMath from 'remark-math' ;
56
67import { 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' ;
810import { ScrollArea } from '@/components/ui/scroll-area' ;
911import { Separator } from '@/components/ui/separator' ;
12+ import { useAuthedRoute } from '@/stores/auth-store' ;
1013import type { IGetQuestionDetailsResponse } from '@/types/question-types' ;
1114
1215export const QuestionDetails = ( {
1316 questionDetails,
1417} : {
1518 questionDetails : IGetQuestionDetailsResponse [ 'question' ] ;
1619} ) => {
20+ const { isAdmin } = useAuthedRoute ( ) ;
1721 return (
1822 < ScrollArea className = 'h-full' >
1923 < CardHeader >
@@ -22,6 +26,12 @@ export const QuestionDetails = ({
2226 < CardTitle className = 'text-2xl' >
2327 { questionDetails . id } . { questionDetails . title }
2428 </ CardTitle >
29+ { isAdmin && (
30+ < Button className = 'flex gap-1 uppercase' >
31+ < Pencil1Icon />
32+ < span > Edit</ span >
33+ </ Button >
34+ ) }
2535 </ div >
2636 < div className = 'flex flex-wrap items-center gap-1' >
2737 < Badge
Original file line number Diff line number Diff line change @@ -34,31 +34,31 @@ export default defineConfig(({ mode }) => {
3434 } ,
3535 '/question-service' : {
3636 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 / , '' ) ,
3838 changeOrigin : true ,
3939 cookiePathRewrite : {
4040 '*' : '/' ,
4141 } ,
4242 } ,
4343 '/collaboration-service' : {
4444 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 / , '' ) ,
4646 changeOrigin : true ,
4747 cookiePathRewrite : {
4848 '*' : '/' ,
4949 } ,
5050 } ,
5151 '/matching-service' : {
5252 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 / , '' ) ,
5454 changeOrigin : true ,
5555 cookiePathRewrite : {
5656 '*' : '/' ,
5757 } ,
5858 } ,
5959 '/collab-ws' : {
6060 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 / , '' ) ,
6262 ws : true ,
6363 } ,
6464 '/matching-socket/' : {
You can’t perform that action at this time.
0 commit comments