@@ -52,7 +52,13 @@ interface CardFrontProps {
52
52
onAssignDesign : ( ) => void ;
53
53
isEnvironmentAllowed : boolean ;
54
54
isTeamAllowed : boolean ;
55
- isDesignAndViewAllowed : boolean ;
55
+ isDesignAllowed : boolean ;
56
+ isViewAllowed : boolean ;
57
+ isEditWorkspaceAllowed : boolean ;
58
+ isViewsVisible : boolean ;
59
+ isDesignsVisible : boolean ;
60
+ isTeamsVisible : boolean ;
61
+ isEnvironmentsVisible : boolean ;
56
62
}
57
63
58
64
interface CardBackProps {
@@ -90,9 +96,14 @@ interface WorkspaceCardProps {
90
96
designAndViewOfWorkspaceCount : number ;
91
97
isEnvironmentAllowed : boolean ;
92
98
isTeamAllowed : boolean ;
93
- isDesignAndViewAllowed : boolean ;
99
+ isDesignAllowed : boolean ;
100
+ isViewAllowed : boolean ;
94
101
isDeleteWorkspaceAllowed : boolean ;
95
102
isEditWorkspaceAllowed : boolean ;
103
+ isViewsVisible : boolean ;
104
+ isDesignsVisible : boolean ;
105
+ isTeamsVisible : boolean ;
106
+ isEnvironmentsVisible : boolean ;
96
107
}
97
108
98
109
/**
@@ -142,9 +153,14 @@ const WorkspaceCard = ({
142
153
designAndViewOfWorkspaceCount,
143
154
isEnvironmentAllowed,
144
155
isTeamAllowed,
145
- isDesignAndViewAllowed,
156
+ isDesignAllowed,
157
+ isViewAllowed,
146
158
isDeleteWorkspaceAllowed,
147
- isEditWorkspaceAllowed
159
+ isEditWorkspaceAllowed,
160
+ isViewsVisible,
161
+ isDesignsVisible,
162
+ isEnvironmentsVisible,
163
+ isTeamsVisible
148
164
} : WorkspaceCardProps ) => {
149
165
const deleted = workspaceDetails . deleted_at . Valid ;
150
166
return (
@@ -164,7 +180,13 @@ const WorkspaceCard = ({
164
180
onAssignDesign = { onAssignDesign }
165
181
isEnvironmentAllowed = { isEnvironmentAllowed }
166
182
isTeamAllowed = { isTeamAllowed }
167
- isDesignAndViewAllowed = { isDesignAndViewAllowed }
183
+ isDesignAllowed = { isDesignAllowed }
184
+ isViewAllowed = { isViewAllowed }
185
+ isViewsVisible = { isViewsVisible }
186
+ isDesignsVisible = { isDesignsVisible }
187
+ isEnvironmentsVisible = { isEnvironmentsVisible }
188
+ isTeamsVisible = { isTeamsVisible }
189
+ isEditWorkspaceAllowed = { isEditWorkspaceAllowed }
168
190
/>
169
191
170
192
< CardBack
@@ -201,7 +223,12 @@ const CardFront = ({
201
223
onAssignDesign,
202
224
isEnvironmentAllowed,
203
225
isTeamAllowed,
204
- isDesignAndViewAllowed
226
+ isDesignAllowed,
227
+ isViewAllowed,
228
+ isViewsVisible,
229
+ isDesignsVisible,
230
+ isEnvironmentsVisible,
231
+ isTeamsVisible
205
232
} : CardFrontProps ) => {
206
233
return (
207
234
< CardFrontWrapper elevation = { 2 } onClick = { onFlip } >
@@ -227,52 +254,77 @@ const CardFront = ({
227
254
gap : 1
228
255
} }
229
256
>
230
- < AllocationColumnGrid xs = { 12 } sm = { 4 } >
231
- < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
232
- { isEnvironmentAllowed ? (
233
- < TransferButton
234
- title = "Environments"
235
- count = { environmentsCount }
236
- onAssign = { onAssignEnvironment }
237
- disabled = { ! isEnvironmentAllowed }
238
- />
239
- ) : (
240
- < RedirectButton title = "Environment" count = { environmentsCount } />
241
- ) }
242
- < RedirectButton title = "Connections" count = { 0 } />
243
- </ AllocationWorkspace >
244
- </ AllocationColumnGrid >
257
+ { isEnvironmentsVisible && (
258
+ < AllocationColumnGrid >
259
+ < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
260
+ { isEnvironmentAllowed ? (
261
+ < TransferButton
262
+ title = "Environments"
263
+ count = { environmentsCount }
264
+ onAssign = { onAssignEnvironment }
265
+ disabled = { ! isEnvironmentAllowed }
266
+ />
267
+ ) : (
268
+ < RedirectButton title = "Environment" count = { environmentsCount } />
269
+ ) }
270
+ < RedirectButton title = "Connections" count = { 0 } />
271
+ </ AllocationWorkspace >
272
+ </ AllocationColumnGrid >
273
+ ) }
245
274
246
- < AllocationColumnGrid xs = { 12 } sm = { 4 } >
247
- < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
248
- { isTeamAllowed ? (
249
- < TransferButton
250
- title = "Teams"
251
- count = { teamsCount }
252
- onAssign = { onAssignTeam }
253
- disabled = { ! isTeamAllowed }
254
- />
255
- ) : (
256
- < RedirectButton title = "Teams" count = { teamsCount } />
257
- ) }
258
- < RedirectButton title = "Users" count = { 0 } />
259
- </ AllocationWorkspace >
260
- </ AllocationColumnGrid >
261
- < AllocationColumnGrid xs = { 12 } sm = { 4 } >
262
- < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
263
- { isDesignAndViewAllowed ? (
264
- < TransferButton
265
- title = "Designs/Views"
266
- count = { designAndViewOfWorkspaceCount }
267
- onAssign = { onAssignDesign }
268
- disabled = { ! isDesignAndViewAllowed }
269
- />
270
- ) : (
271
- < RedirectButton title = "Designs/Views" count = { designAndViewOfWorkspaceCount } />
272
- ) }
273
- < RedirectButton title = "Deploys" count = { 0 } />
274
- </ AllocationWorkspace >
275
- </ AllocationColumnGrid >
275
+ { isTeamsVisible && (
276
+ < AllocationColumnGrid >
277
+ < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
278
+ { isTeamAllowed ? (
279
+ < TransferButton
280
+ title = "Teams"
281
+ count = { teamsCount }
282
+ onAssign = { onAssignTeam }
283
+ disabled = { ! isTeamAllowed }
284
+ />
285
+ ) : (
286
+ < RedirectButton title = "Teams" count = { teamsCount } />
287
+ ) }
288
+ < RedirectButton title = "Users" count = { 0 } />
289
+ </ AllocationWorkspace >
290
+ </ AllocationColumnGrid >
291
+ ) }
292
+
293
+ { isDesignsVisible && ! isViewsVisible && (
294
+ < AllocationColumnGrid >
295
+ < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
296
+ { isDesignAllowed ? (
297
+ < TransferButton
298
+ title = "Designs"
299
+ count = { designAndViewOfWorkspaceCount }
300
+ onAssign = { onAssignDesign }
301
+ disabled = { ! isDesignAllowed }
302
+ />
303
+ ) : (
304
+ < RedirectButton title = "Designs/Views" count = { designAndViewOfWorkspaceCount } />
305
+ ) }
306
+ < RedirectButton title = "Deploys" count = { 0 } />
307
+ </ AllocationWorkspace >
308
+ </ AllocationColumnGrid >
309
+ ) }
310
+
311
+ { isDesignsVisible && isViewsVisible && (
312
+ < AllocationColumnGrid >
313
+ < AllocationWorkspace onClick = { ( e ) => e . stopPropagation ( ) } >
314
+ { isDesignAllowed && isViewAllowed ? (
315
+ < TransferButton
316
+ title = "Designs/Views"
317
+ count = { designAndViewOfWorkspaceCount }
318
+ onAssign = { onAssignDesign }
319
+ disabled = { ! ( isDesignAllowed && isViewAllowed ) }
320
+ />
321
+ ) : (
322
+ < RedirectButton title = "Designs/Views" count = { designAndViewOfWorkspaceCount } />
323
+ ) }
324
+ < RedirectButton title = "Deploys" count = { 0 } />
325
+ </ AllocationWorkspace >
326
+ </ AllocationColumnGrid >
327
+ ) }
276
328
</ Grid >
277
329
</ CardFrontWrapper >
278
330
) ;
0 commit comments