File tree Expand file tree Collapse file tree 2 files changed +26
-23
lines changed
Expand file tree Collapse file tree 2 files changed +26
-23
lines changed Original file line number Diff line number Diff line change @@ -32,20 +32,23 @@ export const PostList = ({
3232} : PostListProps ) => {
3333 const { classes } = useStyles ( ) ;
3434 const [ createPostState , createPost ] = useDialog ( ) ;
35+ const canCreate = rest . data ?. canCreate ;
3536
3637 return (
3738 < div >
3839 < Grid container spacing = { 2 } alignItems = "center" >
3940 < Grid item >
4041 < Typography variant = "h3" > Posts</ Typography >
4142 </ Grid >
42- < Grid item >
43- < Tooltip title = "Add Post" >
44- < Fab color = "error" onClick = { createPost } >
45- < Add />
46- </ Fab >
47- </ Tooltip >
48- </ Grid >
43+ { canCreate && (
44+ < Grid item >
45+ < Tooltip title = "Add Post" >
46+ < Fab color = "error" onClick = { createPost } >
47+ < Add />
48+ </ Fab >
49+ </ Tooltip >
50+ </ Grid >
51+ ) }
4952 </ Grid >
5053 < List
5154 { ...rest }
Original file line number Diff line number Diff line change @@ -236,22 +236,22 @@ export const LanguageDetail = () => {
236236 < Grid item >
237237 < Typography variant = "h3" > Locations</ Typography >
238238 </ Grid >
239- < Grid item >
240- < Tooltip title = "Add location" >
241- < Fab
242- color = "error"
243- aria-label = "add location "
244- className = {
245- locations ?. canCreate === true
246- ? undefined
247- : classes . hidden
248- }
249- onClick = { addLocation }
250- >
251- < Add / >
252- </ Fab >
253- </ Tooltip >
254- </ Grid >
239+ { locations ?. canCreate && (
240+ < Grid item >
241+ < Tooltip title = "Add location" >
242+ < Fab
243+ color = "error "
244+ aria-label = "add location"
245+ className = {
246+ locations . canCreate ? undefined : classes . hidden
247+ }
248+ onClick = { addLocation }
249+ >
250+ < Add / >
251+ </ Fab >
252+ </ Tooltip >
253+ </ Grid >
254+ ) }
255255 </ Grid >
256256 { listOrPlaceholders ( locations ?. items , 3 ) . map (
257257 ( location , index ) => (
You can’t perform that action at this time.
0 commit comments