11import { useTheme } from '@mui/material' ;
2- import { Backdrop , CircularProgress , Grid , Typography } from '../../base' ;
2+ import { Backdrop , CircularProgress , Grid } from '../../base' ;
33import { FlipCard } from '../FlipCard' ;
44import { RecordRow , RedirectButton , TransferButton } from './WorkspaceTransferButton' ;
55import { formattoLongDate } from './helper' ;
66import {
7+ AllocationColumnGrid ,
78 AllocationWorkspace ,
89 BulkSelectCheckbox ,
10+ CardBackActionsGrid ,
11+ CardBackTitleGrid ,
12+ CardBackTopGrid ,
13+ CardBackWrapper ,
14+ CardFrontWrapper ,
915 CardTitle ,
10- CardWrapper ,
16+ DateColumnGrid ,
17+ DateGrid ,
1118 DateLabel ,
1219 DescriptionLabel ,
1320 EmptyDescription ,
1421 L5DeleteIcon ,
15- L5EditIcon
22+ L5EditIcon ,
23+ RecentActivityGrid ,
24+ RecentActivityTitle ,
25+ WorkspaceCardGrid
1626} from './styles' ;
1727
1828interface WorkspaceDetails {
@@ -138,7 +148,10 @@ const WorkspaceCard = ({
138148} : WorkspaceCardProps ) => {
139149 const deleted = workspaceDetails . deleted_at . Valid ;
140150 return (
141- < FlipCard disableFlip = { selectedWorkspaces . includes ( workspaceDetails . id ) ? true : false } >
151+ < FlipCard
152+ disableFlip = { selectedWorkspaces . includes ( workspaceDetails . id ) ? true : false }
153+ padding = { '0' }
154+ >
142155 < CardFront
143156 onFlip = { onFlip }
144157 name = { workspaceDetails ?. name }
@@ -190,22 +203,14 @@ const CardFront = ({
190203 isTeamAllowed,
191204 isDesignAndViewAllowed
192205} : CardFrontProps ) => {
193- const theme = useTheme ( ) ;
194206 return (
195- < CardWrapper
196- elevation = { 2 }
197- sx = { {
198- minHeight : { xs : '520px' , sm : '400px' } ,
199- background : theme . palette . background . card
200- } }
201- onClick = { onFlip }
202- >
203- < Grid sx = { { display : 'flex' , flexDirection : 'row' } } >
207+ < CardFrontWrapper elevation = { 2 } onClick = { onFlip } >
208+ < WorkspaceCardGrid >
204209 < CardTitle variant = "body2" onClick = { ( e ) => e . stopPropagation ( ) } >
205210 { name }
206211 </ CardTitle >
207- </ Grid >
208- < Grid sx = { { display : 'flex' , alignItems : 'center' , mt : 1 } } >
212+ </ WorkspaceCardGrid >
213+ < Grid >
209214 { description ? (
210215 < DescriptionLabel onClick = { ( e ) => e . stopPropagation ( ) } sx = { { maxHeight : '105px' } } >
211216 { description }
@@ -222,7 +227,7 @@ const CardFront = ({
222227 gap : 1
223228 } }
224229 >
225- < Grid xs = { 12 } sm = { 4 } >
230+ < AllocationColumnGrid xs = { 12 } sm = { 4 } >
226231 < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
227232 { isEnvironmentAllowed ? (
228233 < TransferButton
@@ -236,8 +241,9 @@ const CardFront = ({
236241 ) }
237242 < RedirectButton title = "Connections" count = { 0 } />
238243 </ AllocationWorkspace >
239- </ Grid >
240- < Grid xs = { 12 } sm = { 4 } sx = { { display : 'flex' , justifyContent : 'center' } } >
244+ </ AllocationColumnGrid >
245+
246+ < AllocationColumnGrid xs = { 12 } sm = { 4 } >
241247 < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
242248 { isTeamAllowed ? (
243249 < TransferButton
@@ -251,8 +257,8 @@ const CardFront = ({
251257 ) }
252258 < RedirectButton title = "Users" count = { 0 } />
253259 </ AllocationWorkspace >
254- </ Grid >
255- < Grid xs = { 12 } sm = { 4 } sx = { { display : 'flex' , justifyContent : 'flex-end' } } >
260+ </ AllocationColumnGrid >
261+ < AllocationColumnGrid xs = { 12 } sm = { 4 } >
256262 < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
257263 { isDesignAndViewAllowed ? (
258264 < TransferButton
@@ -266,9 +272,9 @@ const CardFront = ({
266272 ) }
267273 < RedirectButton title = "Deploys" count = { 0 } />
268274 </ AllocationWorkspace >
269- </ Grid >
275+ </ AllocationColumnGrid >
270276 </ Grid >
271- </ CardWrapper >
277+ </ CardFrontWrapper >
272278 ) ;
273279} ;
274280
@@ -294,74 +300,41 @@ const CardBack = ({
294300
295301 const theme = useTheme ( ) ;
296302 return (
297- < CardWrapper
298- elevation = { 2 }
299- sx = { {
300- minHeight : { xs : '520px' , sm : '400px' } ,
301- background : 'linear-gradient(180deg, #007366 0%, #000 100%)'
302- } }
303- onClick = { onFlipBack }
304- >
305- < Grid xs = { 12 } >
306- < Grid xs = { 12 } sx = { { display : 'flex' , flexDirection : 'row' } } >
307- < Grid xs = { 6 } sx = { { display : 'flex' , alignItems : 'flex-start' } } >
308- < BulkSelectCheckbox
309- onClick = { ( e ) => e . stopPropagation ( ) }
310- onChange = { onSelect }
311- disabled = { deleted ? true : ! isDeleteWorkspaceAllowed }
312- />
313- < CardTitle
314- sx = { { color : theme . palette . background . constant ?. white } }
315- variant = "body2"
316- onClick = { ( e ) => e . stopPropagation ( ) }
317- >
318- { name }
319- </ CardTitle >
320- </ Grid >
321- < Grid
322- xs = { 6 }
323- sx = { {
324- display : 'flex' ,
325- alignItems : 'center' ,
326- justifyContent : 'flex-end'
327- } }
303+ < CardBackWrapper elevation = { 2 } onClick = { onFlipBack } >
304+ < CardBackTopGrid xs = { 12 } >
305+ < CardBackTitleGrid xs = { 6 } >
306+ < BulkSelectCheckbox
307+ onClick = { ( e ) => e . stopPropagation ( ) }
308+ onChange = { onSelect }
309+ disabled = { deleted ? true : ! isDeleteWorkspaceAllowed }
310+ />
311+ < CardTitle
312+ sx = { { color : theme . palette . background . constant ?. white } }
313+ variant = "body2"
314+ onClick = { ( e ) => e . stopPropagation ( ) }
328315 >
329- < L5EditIcon
330- onClick = { onEdit }
331- disabled = { isEditButtonDisabled }
332- style = { { fill : theme . palette . background . constant ?. white } }
333- bulk = { true }
334- />
335- < L5DeleteIcon
336- onClick = { onDelete }
337- style = { { fill : theme . palette . background . constant ?. white } }
338- disabled = { isDeleteButtonDisabled }
339- bulk = { true }
340- />
341- </ Grid >
342- </ Grid >
343- </ Grid >
316+ { name }
317+ </ CardTitle >
318+ </ CardBackTitleGrid >
319+ < CardBackActionsGrid xs = { 6 } >
320+ < L5EditIcon
321+ onClick = { onEdit }
322+ disabled = { isEditButtonDisabled }
323+ style = { { fill : theme . palette . background . constant ?. white } }
324+ bulk = { true }
325+ />
326+ < L5DeleteIcon
327+ onClick = { onDelete }
328+ style = { { fill : theme . palette . background . constant ?. white } }
329+ disabled = { isDeleteButtonDisabled }
330+ bulk = { true }
331+ />
332+ </ CardBackActionsGrid >
333+ </ CardBackTopGrid >
344334 < Grid sx = { { display : 'flex' , alignItems : 'center' , flexDirection : 'row' } } >
345- < Typography
346- sx = { {
347- fontSize : '1.25rem' ,
348- fontWeight : 600 ,
349- padding : '0.5rem 0' ,
350- color : theme . palette . background . constant ?. white
351- } }
352- variant = "body2"
353- >
354- Recent Activity
355- </ Typography >
335+ < RecentActivityTitle variant = "body2" > Recent Activity</ RecentActivityTitle >
356336 </ Grid >
357- < Grid
358- sx = { {
359- display : 'flex' ,
360- flexDirection : 'column' ,
361- maxHeight : '14.5rem' ,
362- overflowY : 'scroll'
363- } }
364- >
337+ < RecentActivityGrid >
365338 { loadingEvents ? (
366339 < Backdrop sx = { { zIndex : '2010' } } open = { loadingEvents } >
367340 < CircularProgress
@@ -381,28 +354,19 @@ const CardBack = ({
381354 ) ;
382355 } )
383356 ) }
384- </ Grid >
385- < Grid
386- sx = { {
387- display : 'flex' ,
388- flexDirection : 'row' ,
389- position : 'absolute' ,
390- bottom : '20px' ,
391- width : '100%' ,
392- color : `${ theme . palette . background . constant ?. white } 99`
393- } }
394- >
395- < Grid xs = { 6 } sx = { { textAlign : 'left' } } >
357+ </ RecentActivityGrid >
358+ < DateGrid xs = { 12 } >
359+ < DateColumnGrid xs = { 6 } >
396360 < DateLabel onClick = { ( e ) => e . stopPropagation ( ) } >
397361 Updated At: { formattoLongDate ( updatedDate ) }
398362 </ DateLabel >
399- </ Grid >
400- < Grid xs = { 6 } sx = { { textAlign : 'left' } } >
363+ </ DateColumnGrid >
364+ < DateColumnGrid xs = { 6 } >
401365 < DateLabel onClick = { ( e ) => e . stopPropagation ( ) } >
402366 Created At: { formattoLongDate ( createdDate ) }
403367 </ DateLabel >
404- </ Grid >
405- </ Grid >
406- </ CardWrapper >
368+ </ DateColumnGrid >
369+ </ DateGrid >
370+ </ CardBackWrapper >
407371 ) ;
408372} ;
0 commit comments