@@ -52,7 +52,12 @@ interface CardFrontProps {
5252 onAssignDesign : ( ) => void ;
5353 isEnvironmentAllowed : boolean ;
5454 isTeamAllowed : boolean ;
55- isDesignAndViewAllowed : boolean ;
55+ isDesignAllowed : boolean ;
56+ isViewAllowed : boolean ;
57+ isViewsVisible : boolean ;
58+ isDesignsVisible : boolean ;
59+ isTeamsVisible : boolean ;
60+ isEnvironmentsVisible : boolean ;
5661}
5762
5863interface CardBackProps {
@@ -90,9 +95,14 @@ interface WorkspaceCardProps {
9095 designAndViewOfWorkspaceCount : number ;
9196 isEnvironmentAllowed : boolean ;
9297 isTeamAllowed : boolean ;
93- isDesignAndViewAllowed : boolean ;
98+ isDesignAllowed : boolean ;
99+ isViewAllowed : boolean ;
94100 isDeleteWorkspaceAllowed : boolean ;
95101 isEditWorkspaceAllowed : boolean ;
102+ isViewsVisible : boolean ;
103+ isDesignsVisible : boolean ;
104+ isTeamsVisible : boolean ;
105+ isEnvironmentsVisible : boolean ;
96106}
97107
98108/**
@@ -142,9 +152,14 @@ const WorkspaceCard = ({
142152 designAndViewOfWorkspaceCount,
143153 isEnvironmentAllowed,
144154 isTeamAllowed,
145- isDesignAndViewAllowed,
155+ isDesignAllowed,
156+ isViewAllowed,
146157 isDeleteWorkspaceAllowed,
147- isEditWorkspaceAllowed
158+ isEditWorkspaceAllowed,
159+ isViewsVisible,
160+ isDesignsVisible,
161+ isEnvironmentsVisible,
162+ isTeamsVisible
148163} : WorkspaceCardProps ) => {
149164 const deleted = workspaceDetails . deleted_at . Valid ;
150165 return (
@@ -164,7 +179,12 @@ const WorkspaceCard = ({
164179 onAssignDesign = { onAssignDesign }
165180 isEnvironmentAllowed = { isEnvironmentAllowed }
166181 isTeamAllowed = { isTeamAllowed }
167- isDesignAndViewAllowed = { isDesignAndViewAllowed }
182+ isDesignAllowed = { isDesignAllowed }
183+ isViewAllowed = { isViewAllowed }
184+ isViewsVisible = { isViewsVisible }
185+ isDesignsVisible = { isDesignsVisible }
186+ isEnvironmentsVisible = { isEnvironmentsVisible }
187+ isTeamsVisible = { isTeamsVisible }
168188 />
169189
170190 < CardBack
@@ -201,7 +221,12 @@ const CardFront = ({
201221 onAssignDesign,
202222 isEnvironmentAllowed,
203223 isTeamAllowed,
204- isDesignAndViewAllowed
224+ isDesignAllowed,
225+ isViewAllowed,
226+ isViewsVisible,
227+ isDesignsVisible,
228+ isEnvironmentsVisible,
229+ isTeamsVisible
205230} : CardFrontProps ) => {
206231 return (
207232 < CardFrontWrapper elevation = { 2 } onClick = { onFlip } >
@@ -227,52 +252,77 @@ const CardFront = ({
227252 gap : 1
228253 } }
229254 >
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+ ) }
245272
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+ ) }
276326 </ Grid >
277327 </ CardFrontWrapper >
278328 ) ;
0 commit comments