@@ -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,98 @@ 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+ < a
147+ onClick = { ( ) => {
148+ toggleInvitationResponseModal ( ) ;
149+ } }
152150 >
153- < Badge
154- count = { count > 0 ? `+${ count } ` : null }
155- offset = { [ 0 , - `${ token . sizeXS } ` ] }
151+ < Tooltip
152+ title = {
153+ count > 0
154+ ? t ( 'data.InvitedFoldersTooltip' , {
155+ count : count ,
156+ } )
157+ : null
158+ }
159+ rootClassName = { styles . invitationTooltip }
160+ placement = "topRight"
156161 >
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 >
162+ < Badge
163+ count = { count > 0 ? `+${ count } ` : null }
164+ offset = { [ 0 , - `${ token . sizeXS } ` ] }
165+ >
166+ < Typography . Title level = { 5 } style = { { margin : 0 } } >
167+ { t ( 'data.InvitedFolders' ) }
168+ </ Typography . Title >
169+ </ Badge >
170+ </ Tooltip >
171+ </ a >
172+ }
173+ value = {
174+ < Typography . Text
175+ strong
176+ style = { {
177+ fontSize : token . fontSizeHeading1 ,
178+ color : token . Layout ?. headerBg ,
179+ } }
180+ >
181+ { invitedCount }
182+ </ Typography . Text >
183+ }
184+ />
185+ </ Col >
186+ </ Row >
187+ </ BAICard >
188+ < FolderInvitationResponseModal
189+ open = { isInvitationResponseModalOpen }
190+ onRequestClose = { toggleInvitationResponseModal }
191+ />
192+ </ >
179193 ) ;
180194} ;
181195
0 commit comments