File tree Expand file tree Collapse file tree 1 file changed +22
-16
lines changed
Expand file tree Collapse file tree 1 file changed +22
-16
lines changed Original file line number Diff line number Diff line change 66 HStack ,
77 Box ,
88 Center ,
9- useDisclosure
9+ useDisclosure ,
10+ Tooltip
1011} from '@chakra-ui/react' ;
1112import {
1213 ArrowIcon ,
@@ -30,6 +31,18 @@ const SelectProject_: FunctionComponent<ComponentProps<typeof Box>> = props => {
3031 if ( ! projectsStore . selectedProject ) {
3132 return null ;
3233 }
34+ const isLimitReached = projectsStore . projects$ . value . length >= 10 ;
35+
36+ const createProjectMenuItem = ( { isDisabled } : { isDisabled : boolean } ) => (
37+ < MenuItem isDisabled = { isDisabled } onClick = { ( ) => ! isDisabled && onOpen ( ) } >
38+ < Center w = "7" minW = "7" h = "7" mr = "2" borderRadius = "sm" bgColor = "background.contentTint" >
39+ < PlusIcon16 />
40+ </ Center >
41+ < Text textStyle = "label2" color = "text.primary" noOfLines = { 1 } >
42+ Create Project
43+ </ Text >
44+ </ MenuItem >
45+ ) ;
3346
3447 return (
3548 < Box { ...props } >
@@ -66,21 +79,14 @@ const SelectProject_: FunctionComponent<ComponentProps<typeof Box>> = props => {
6679 { projectsStore . projects$ . value . map ( project => (
6780 < SelectProjectItem project = { project } key = { project . id } />
6881 ) ) }
69- < MenuItem onClick = { onOpen } >
70- < Center
71- w = "7"
72- minW = "7"
73- h = "7"
74- mr = "2"
75- borderRadius = "sm"
76- bgColor = "background.contentTint"
77- >
78- < PlusIcon16 />
79- </ Center >
80- < Text textStyle = "label2" color = "text.primary" noOfLines = { 1 } >
81- Create Project
82- </ Text >
83- </ MenuItem >
82+
83+ { isLimitReached ? (
84+ < Tooltip hasArrow label = "Project limit reached (10 max)" >
85+ { createProjectMenuItem ( { isDisabled : true } ) }
86+ </ Tooltip >
87+ ) : (
88+ createProjectMenuItem ( { isDisabled : false } )
89+ ) }
8490 </ MenuList >
8591 </ Menu >
8692 < CreateProjectModal isOpen = { isOpen } onClose = { onClose } />
You can’t perform that action at this time.
0 commit comments