@@ -4,7 +4,9 @@ import { useSuspenseTanQuery } from '../hooks/reactQueryAlias';
44import { useCurrentProjectValue } from '../hooks/useCurrentProject' ;
55import BAICard , { BAICardProps } from './BAICard' ;
66import BAIPanelItem from './BAIPanelItem' ;
7+ import FolderInvitationResponseModal from './FolderInvitationResponseModal' ;
78import { StorageStatusPanelCardQuery } from './__generated__/StorageStatusPanelCardQuery.graphql' ;
9+ import { useToggle } from 'ahooks' ;
810import { Badge , Col , Row , theme , Tooltip , Typography } from 'antd' ;
911import { createStyles } from 'antd-style' ;
1012import graphql from 'babel-plugin-relay/macro' ;
@@ -41,6 +43,10 @@ const StorageStatusPanelCard: React.FC<StorageStatusPanelProps> = ({
4143 const currentProject = useCurrentProjectValue ( ) ;
4244 const deferredFetchKey = useDeferredValue ( fetchKey ) ;
4345 const [ { count } ] = useVFolderInvitations ( ) ;
46+ const [
47+ isInvitationResponseModalOpen ,
48+ { toggle : toggleInvitationResponseModal } ,
49+ ] = useToggle ( false ) ;
4450
4551 const isExcludedCount = ( status : string ) => {
4652 return _ . includes (
@@ -92,90 +98,100 @@ const StorageStatusPanelCard: React.FC<StorageStatusPanelProps> = ({
9298 ) ;
9399
94100 return (
95- < BAICard { ...cardProps } title = { t ( 'data.StorageStatus' ) } >
96- < Row gutter = { [ 24 , 16 ] } >
97- < Col
98- span = { 8 }
99- style = { {
100- borderRight : `1px solid ${ token . colorBorderSecondary } ` ,
101- justifyItems : 'center' ,
102- } }
103- >
104- < BAIPanelItem
105- title = { t ( 'data.MyFolders' ) }
106- value = { createdCount }
107- unit = {
108- user_resource_policy ?. max_vfolder_count
109- ? `/ ${ user_resource_policy ?. max_vfolder_count } `
110- : undefined
111- }
112- />
113- </ Col >
114- < Col
115- span = { 8 }
116- style = { {
117- borderRight : `1px solid ${ token . colorBorderSecondary } ` ,
118- justifyItems : 'center' ,
119- } }
120- >
121- < BAIPanelItem
122- title = { t ( 'data.ProjectFolders' ) }
123- value = { projectCount }
124- unit = {
125- project_resource_policy ?. max_vfolder_count
126- ? `/ ${ project_resource_policy ?. max_vfolder_count } `
127- : undefined
128- }
129- />
130- </ Col >
131- < Col
132- span = { 8 }
133- style = { {
134- justifyItems : 'center' ,
135- } }
136- >
137- < BAIPanelItem
138- title = {
139- // Add a tag to the Tooltip to make it clickable
140- // eslint-disable-next-line
141- < a >
142- < Tooltip
143- title = {
144- count > 0
145- ? t ( 'data.InvitedFoldersTooltip' , {
146- count : count ,
147- } )
148- : null
149- }
150- rootClassName = { styles . invitationTooltip }
151- placement = "topRight"
101+ < >
102+ < BAICard { ...cardProps } title = { t ( 'data.StorageStatus' ) } >
103+ < Row gutter = { [ 24 , 16 ] } >
104+ < Col
105+ span = { 8 }
106+ style = { {
107+ borderRight : `1px solid ${ token . colorBorderSecondary } ` ,
108+ justifyItems : 'center' ,
109+ } }
110+ >
111+ < BAIPanelItem
112+ title = { t ( 'data.MyFolders' ) }
113+ value = { createdCount }
114+ unit = {
115+ user_resource_policy ?. max_vfolder_count
116+ ? `/ ${ user_resource_policy ?. max_vfolder_count } `
117+ : undefined
118+ }
119+ />
120+ </ Col >
121+ < Col
122+ span = { 8 }
123+ style = { {
124+ borderRight : `1px solid ${ token . colorBorderSecondary } ` ,
125+ justifyItems : 'center' ,
126+ } }
127+ >
128+ < BAIPanelItem
129+ title = { t ( 'data.ProjectFolders' ) }
130+ value = { projectCount }
131+ unit = {
132+ project_resource_policy ?. max_vfolder_count
133+ ? `/ ${ project_resource_policy ?. max_vfolder_count } `
134+ : undefined
135+ }
136+ />
137+ </ Col >
138+ < Col
139+ span = { 8 }
140+ style = { {
141+ justifyItems : 'center' ,
142+ } }
143+ >
144+ < BAIPanelItem
145+ title = {
146+ // Add a tag to the Tooltip to make it clickable
147+ // eslint-disable-next-line
148+ < a
149+ onClick = { ( ) => {
150+ toggleInvitationResponseModal ( ) ;
151+ } }
152152 >
153- < Badge
154- count = { count > 0 ? `+${ count } ` : null }
155- offset = { [ 0 , - `${ token . sizeXS } ` ] }
153+ < Tooltip
154+ title = {
155+ count > 0
156+ ? t ( 'data.InvitedFoldersTooltip' , {
157+ count : count ,
158+ } )
159+ : null
160+ }
161+ rootClassName = { styles . invitationTooltip }
162+ placement = "topRight"
156163 >
157- < Typography . Title level = { 5 } style = { { margin : 0 } } >
158- { t ( 'data.InvitedFolders' ) }
159- </ Typography . Title >
160- </ Badge >
161- </ Tooltip >
162- </ a >
163- }
164- value = {
165- < Typography . Text
166- strong
167- style = { {
168- fontSize : token . fontSizeHeading1 ,
169- color : token . Layout ?. headerBg ,
170- } }
171- >
172- { invitedCount }
173- </ Typography . Text >
174- }
175- />
176- </ Col >
177- </ Row >
178- </ BAICard >
164+ < Badge
165+ count = { count > 0 ? `+${ count } ` : null }
166+ offset = { [ 0 , - `${ token . sizeXS } ` ] }
167+ >
168+ < Typography . Title level = { 5 } style = { { margin : 0 } } >
169+ { t ( 'data.InvitedFolders' ) }
170+ </ Typography . Title >
171+ </ Badge >
172+ </ Tooltip >
173+ </ a >
174+ }
175+ value = {
176+ < Typography . Text
177+ strong
178+ style = { {
179+ fontSize : token . fontSizeHeading1 ,
180+ color : token . Layout ?. headerBg ,
181+ } }
182+ >
183+ { invitedCount }
184+ </ Typography . Text >
185+ }
186+ />
187+ </ Col >
188+ </ Row >
189+ </ BAICard >
190+ < FolderInvitationResponseModal
191+ open = { isInvitationResponseModalOpen }
192+ onRequestClose = { toggleInvitationResponseModal }
193+ />
194+ </ >
179195 ) ;
180196} ;
181197
0 commit comments