Skip to content

Commit 20e2030

Browse files
committed
chore/ui: try fix build bug
Signed-off-by: SeeuSim <[email protected]>
1 parent 4ad7968 commit 20e2030

File tree

2 files changed

+15
-5
lines changed

2 files changed

+15
-5
lines changed

frontend/src/components/blocks/questions/details.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,23 @@
1+
import { Pencil1Icon } from '@radix-ui/react-icons';
12
import Markdown from 'react-markdown';
23
import rehypeKatex from 'rehype-katex';
34
import remarkGfm from 'remark-gfm';
45
import remarkMath from 'remark-math';
56

67
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';
810
import { ScrollArea } from '@/components/ui/scroll-area';
911
import { Separator } from '@/components/ui/separator';
12+
import { useAuthedRoute } from '@/stores/auth-store';
1013
import type { IGetQuestionDetailsResponse } from '@/types/question-types';
1114

1215
export 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}.&nbsp;{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

frontend/vite.config.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff 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(/^\/question-service/, ''),
37+
rewrite: (path: string) => path?.replace(/^\/question-service/, ''),
3838
changeOrigin: true,
3939
cookiePathRewrite: {
4040
'*': '/',
4141
},
4242
},
4343
'/collaboration-service': {
4444
target: env.VITE_COLLAB_SERVICE,
45-
rewrite: (path: string) => path.replace(/^\/collaboration-service/, ''),
45+
rewrite: (path: string) => path?.replace(/^\/collaboration-service/, ''),
4646
changeOrigin: true,
4747
cookiePathRewrite: {
4848
'*': '/',
4949
},
5050
},
5151
'/matching-service': {
5252
target: env.VITE_MATCHING_SERVICE,
53-
rewrite: (path: string) => path.replace(/^\/matching-service/, ''),
53+
rewrite: (path: string) => path?.replace(/^\/matching-service/, ''),
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(/\/collab-ws/, ''),
61+
rewrite: (path: string) => path?.replace(/\/collab-ws/, ''),
6262
ws: true,
6363
},
6464
'/matching-socket/': {

0 commit comments

Comments
 (0)