@@ -3,12 +3,6 @@ import AddIcon from "@mui/icons-material/AddOutlined";
3
3
import AddOutlined from "@mui/icons-material/AddOutlined" ;
4
4
import Button from "@mui/material/Button" ;
5
5
import Skeleton from "@mui/material/Skeleton" ;
6
- import Table from "@mui/material/Table" ;
7
- import TableBody from "@mui/material/TableBody" ;
8
- import TableCell from "@mui/material/TableCell" ;
9
- import TableContainer from "@mui/material/TableContainer" ;
10
- import TableHead from "@mui/material/TableHead" ;
11
- import TableRow from "@mui/material/TableRow" ;
12
6
import type { AssignableRoles , Role } from "api/typesGenerated" ;
13
7
import { ChooseOne , Cond } from "components/Conditionals/ChooseOne" ;
14
8
import { EmptyState } from "components/EmptyState/EmptyState" ;
@@ -21,6 +15,14 @@ import {
21
15
} from "components/MoreMenu/MoreMenu" ;
22
16
import { Paywall } from "components/Paywall/Paywall" ;
23
17
import { Stack } from "components/Stack/Stack" ;
18
+ import {
19
+ Table ,
20
+ TableBody ,
21
+ TableCell ,
22
+ TableHead ,
23
+ TableHeader ,
24
+ TableRow ,
25
+ } from "components/Table/Table" ;
24
26
import {
25
27
TableLoaderSkeleton ,
26
28
TableRowSkeleton ,
@@ -123,68 +125,66 @@ const RoleTable: FC<RoleTableProps> = ({
123
125
const isLoading = roles === undefined ;
124
126
const isEmpty = Boolean ( roles && roles . length === 0 ) ;
125
127
return (
126
- < TableContainer >
127
- < Table >
128
- < TableHead >
129
- < TableRow >
130
- < TableCell width = "40%" > Name</ TableCell >
131
- < TableCell width = "59%" > Permissions</ TableCell >
132
- < TableCell width = "1%" />
133
- </ TableRow >
134
- </ TableHead >
135
- < TableBody >
136
- < ChooseOne >
137
- < Cond condition = { isLoading } >
138
- < TableLoader />
139
- </ Cond >
128
+ < Table >
129
+ < TableHeader >
130
+ < TableRow >
131
+ < TableHead className = "w-2/5" > Name</ TableHead >
132
+ < TableHead className = "w-3/5" > Permissions</ TableHead >
133
+ < TableHead className = "w-auto" />
134
+ </ TableRow >
135
+ </ TableHeader >
136
+ < TableBody >
137
+ < ChooseOne >
138
+ < Cond condition = { isLoading } >
139
+ < TableLoader />
140
+ </ Cond >
140
141
141
- < Cond condition = { isEmpty } >
142
- < TableRow >
143
- < TableCell colSpan = { 999 } >
144
- < EmptyState
145
- message = "No custom roles yet"
146
- description = {
147
- canCreateOrgRole && isCustomRolesEnabled
148
- ? "Create your first custom role"
149
- : ! isCustomRolesEnabled
150
- ? "Upgrade to a premium license to create a custom role"
151
- : "You don't have permission to create a custom role"
152
- }
153
- cta = {
154
- canCreateOrgRole &&
155
- isCustomRolesEnabled && (
156
- < Button
157
- component = { RouterLink }
158
- to = "create"
159
- startIcon = { < AddOutlined /> }
160
- variant = "contained"
161
- >
162
- Create custom role
163
- </ Button >
164
- )
165
- }
166
- />
167
- </ TableCell >
168
- </ TableRow >
169
- </ Cond >
142
+ < Cond condition = { isEmpty } >
143
+ < TableRow >
144
+ < TableCell colSpan = { 999 } >
145
+ < EmptyState
146
+ message = "No custom roles yet"
147
+ description = {
148
+ canCreateOrgRole && isCustomRolesEnabled
149
+ ? "Create your first custom role"
150
+ : ! isCustomRolesEnabled
151
+ ? "Upgrade to a premium license to create a custom role"
152
+ : "You don't have permission to create a custom role"
153
+ }
154
+ cta = {
155
+ canCreateOrgRole &&
156
+ isCustomRolesEnabled && (
157
+ < Button
158
+ component = { RouterLink }
159
+ to = "create"
160
+ startIcon = { < AddOutlined /> }
161
+ variant = "contained"
162
+ >
163
+ Create custom role
164
+ </ Button >
165
+ )
166
+ }
167
+ />
168
+ </ TableCell >
169
+ </ TableRow >
170
+ </ Cond >
170
171
171
- < Cond >
172
- { roles
173
- ?. sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
174
- . map ( ( role ) => (
175
- < RoleRow
176
- key = { role . name }
177
- role = { role }
178
- canUpdateOrgRole = { canUpdateOrgRole }
179
- canDeleteOrgRole = { canDeleteOrgRole }
180
- onDelete = { ( ) => onDeleteRole ( role ) }
181
- />
182
- ) ) }
183
- </ Cond >
184
- </ ChooseOne >
185
- </ TableBody >
186
- </ Table >
187
- </ TableContainer >
172
+ < Cond >
173
+ { roles
174
+ ?. sort ( ( a , b ) => a . name . localeCompare ( b . name ) )
175
+ . map ( ( role ) => (
176
+ < RoleRow
177
+ key = { role . name }
178
+ role = { role }
179
+ canUpdateOrgRole = { canUpdateOrgRole }
180
+ canDeleteOrgRole = { canDeleteOrgRole }
181
+ onDelete = { ( ) => onDeleteRole ( role ) }
182
+ />
183
+ ) ) }
184
+ </ Cond >
185
+ </ ChooseOne >
186
+ </ TableBody >
187
+ </ Table >
188
188
) ;
189
189
} ;
190
190
0 commit comments