File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
frontend/src/app/dashboard/_components/QuestionTable Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ import { Table } from "@tanstack/react-table";
8
8
import { CreateQuestionModal } from "../Forms/CreateQuestionModal" ;
9
9
import { QuestionTableContext } from "@/contexts/QuestionTableContext" ;
10
10
import { useContext } from "react" ;
11
+ import { useUser } from "@/contexts/UserContext" ;
11
12
12
13
interface DataTableToolbarProps < TData > {
13
14
table : Table < TData > ;
@@ -17,6 +18,7 @@ interface DataTableToolbarProps<TData> {
17
18
export default function DataTableToolbar < TData > ( {
18
19
table,
19
20
} : DataTableToolbarProps < TData > ) {
21
+ const user = useUser ( ) ;
20
22
const { categories } = useContext ( QuestionTableContext ) ;
21
23
22
24
return (
@@ -62,10 +64,12 @@ export default function DataTableToolbar<TData>({
62
64
/>
63
65
</ div >
64
66
< CreateQuestionModal >
65
- < Button variant = "soft" >
66
- < LucidePlus className = "mr-2" />
67
- Create question
68
- </ Button >
67
+ { user ?. roles . includes ( "admin" ) && (
68
+ < Button variant = "soft" >
69
+ < LucidePlus className = "mr-2" />
70
+ Create question
71
+ </ Button >
72
+ ) }
69
73
</ CreateQuestionModal >
70
74
</ div >
71
75
</ div >
You can’t perform that action at this time.
0 commit comments