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