1
1
import { useTheme } from '@mui/material' ;
2
- import { Backdrop , CircularProgress , Grid , Typography } from '../../base' ;
2
+ import { Backdrop , CircularProgress , Grid } from '../../base' ;
3
3
import { FlipCard } from '../FlipCard' ;
4
4
import { RecordRow , RedirectButton , TransferButton } from './WorkspaceTransferButton' ;
5
5
import { formattoLongDate } from './helper' ;
6
6
import {
7
+ AllocationColumnGrid ,
7
8
AllocationWorkspace ,
8
9
BulkSelectCheckbox ,
10
+ CardBackActionsGrid ,
11
+ CardBackTitleGrid ,
12
+ CardBackTopGrid ,
13
+ CardBackWrapper ,
14
+ CardFrontWrapper ,
9
15
CardTitle ,
10
- CardWrapper ,
16
+ DateColumnGrid ,
17
+ DateGrid ,
11
18
DateLabel ,
12
19
DescriptionLabel ,
13
20
EmptyDescription ,
14
21
L5DeleteIcon ,
15
- L5EditIcon
22
+ L5EditIcon ,
23
+ RecentActivityGrid ,
24
+ RecentActivityTitle ,
25
+ WorkspaceCardGrid
16
26
} from './styles' ;
17
27
18
28
interface WorkspaceDetails {
@@ -138,7 +148,10 @@ const WorkspaceCard = ({
138
148
} : WorkspaceCardProps ) => {
139
149
const deleted = workspaceDetails . deleted_at . Valid ;
140
150
return (
141
- < FlipCard disableFlip = { selectedWorkspaces . includes ( workspaceDetails . id ) ? true : false } >
151
+ < FlipCard
152
+ disableFlip = { selectedWorkspaces . includes ( workspaceDetails . id ) ? true : false }
153
+ padding = { '0' }
154
+ >
142
155
< CardFront
143
156
onFlip = { onFlip }
144
157
name = { workspaceDetails ?. name }
@@ -190,22 +203,14 @@ const CardFront = ({
190
203
isTeamAllowed,
191
204
isDesignAndViewAllowed
192
205
} : CardFrontProps ) => {
193
- const theme = useTheme ( ) ;
194
206
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 >
204
209
< CardTitle variant = "body2" onClick = { ( e ) => e . stopPropagation ( ) } >
205
210
{ name }
206
211
</ CardTitle >
207
- </ Grid >
208
- < Grid sx = { { display : 'flex' , alignItems : 'center' , mt : 1 } } >
212
+ </ WorkspaceCardGrid >
213
+ < Grid >
209
214
{ description ? (
210
215
< DescriptionLabel onClick = { ( e ) => e . stopPropagation ( ) } sx = { { maxHeight : '105px' } } >
211
216
{ description }
@@ -222,7 +227,7 @@ const CardFront = ({
222
227
gap : 1
223
228
} }
224
229
>
225
- < Grid xs = { 12 } sm = { 4 } >
230
+ < AllocationColumnGrid xs = { 12 } sm = { 4 } >
226
231
< AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
227
232
{ isEnvironmentAllowed ? (
228
233
< TransferButton
@@ -236,8 +241,9 @@ const CardFront = ({
236
241
) }
237
242
< RedirectButton title = "Connections" count = { 0 } />
238
243
</ AllocationWorkspace >
239
- </ Grid >
240
- < Grid xs = { 12 } sm = { 4 } sx = { { display : 'flex' , justifyContent : 'center' } } >
244
+ </ AllocationColumnGrid >
245
+
246
+ < AllocationColumnGrid xs = { 12 } sm = { 4 } >
241
247
< AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
242
248
{ isTeamAllowed ? (
243
249
< TransferButton
@@ -251,8 +257,8 @@ const CardFront = ({
251
257
) }
252
258
< RedirectButton title = "Users" count = { 0 } />
253
259
</ AllocationWorkspace >
254
- </ Grid >
255
- < Grid xs = { 12 } sm = { 4 } sx = { { display : 'flex' , justifyContent : 'flex-end' } } >
260
+ </ AllocationColumnGrid >
261
+ < AllocationColumnGrid xs = { 12 } sm = { 4 } >
256
262
< AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
257
263
{ isDesignAndViewAllowed ? (
258
264
< TransferButton
@@ -266,9 +272,9 @@ const CardFront = ({
266
272
) }
267
273
< RedirectButton title = "Deploys" count = { 0 } />
268
274
</ AllocationWorkspace >
269
- </ Grid >
275
+ </ AllocationColumnGrid >
270
276
</ Grid >
271
- </ CardWrapper >
277
+ </ CardFrontWrapper >
272
278
) ;
273
279
} ;
274
280
@@ -294,74 +300,41 @@ const CardBack = ({
294
300
295
301
const theme = useTheme ( ) ;
296
302
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 ( ) }
328
315
>
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 >
344
334
< 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 >
356
336
</ Grid >
357
- < Grid
358
- sx = { {
359
- display : 'flex' ,
360
- flexDirection : 'column' ,
361
- maxHeight : '14.5rem' ,
362
- overflowY : 'scroll'
363
- } }
364
- >
337
+ < RecentActivityGrid >
365
338
{ loadingEvents ? (
366
339
< Backdrop sx = { { zIndex : '2010' } } open = { loadingEvents } >
367
340
< CircularProgress
@@ -381,28 +354,19 @@ const CardBack = ({
381
354
) ;
382
355
} )
383
356
) }
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 } >
396
360
< DateLabel onClick = { ( e ) => e . stopPropagation ( ) } >
397
361
Updated At: { formattoLongDate ( updatedDate ) }
398
362
</ DateLabel >
399
- </ Grid >
400
- < Grid xs = { 6 } sx = { { textAlign : 'left' } } >
363
+ </ DateColumnGrid >
364
+ < DateColumnGrid xs = { 6 } >
401
365
< DateLabel onClick = { ( e ) => e . stopPropagation ( ) } >
402
366
Created At: { formattoLongDate ( createdDate ) }
403
367
</ DateLabel >
404
- </ Grid >
405
- </ Grid >
406
- </ CardWrapper >
368
+ </ DateColumnGrid >
369
+ </ DateGrid >
370
+ </ CardBackWrapper >
407
371
) ;
408
372
} ;
0 commit comments