@@ -52,7 +52,13 @@ interface CardFrontProps {
5252 onAssignDesign : ( ) => void ;
5353 isEnvironmentAllowed : boolean ;
5454 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 ;
5662}
5763
5864interface CardBackProps {
@@ -90,9 +96,14 @@ interface WorkspaceCardProps {
9096 designAndViewOfWorkspaceCount : number ;
9197 isEnvironmentAllowed : boolean ;
9298 isTeamAllowed : boolean ;
93- isDesignAndViewAllowed : boolean ;
99+ isDesignAllowed : boolean ;
100+ isViewAllowed : boolean ;
94101 isDeleteWorkspaceAllowed : boolean ;
95102 isEditWorkspaceAllowed : boolean ;
103+ isViewsVisible : boolean ;
104+ isDesignsVisible : boolean ;
105+ isTeamsVisible : boolean ;
106+ isEnvironmentsVisible : boolean ;
96107}
97108
98109/**
@@ -142,9 +153,14 @@ const WorkspaceCard = ({
142153 designAndViewOfWorkspaceCount,
143154 isEnvironmentAllowed,
144155 isTeamAllowed,
145- isDesignAndViewAllowed,
156+ isDesignAllowed,
157+ isViewAllowed,
146158 isDeleteWorkspaceAllowed,
147- isEditWorkspaceAllowed
159+ isEditWorkspaceAllowed,
160+ isViewsVisible,
161+ isDesignsVisible,
162+ isEnvironmentsVisible,
163+ isTeamsVisible
148164} : WorkspaceCardProps ) => {
149165 const deleted = workspaceDetails . deleted_at . Valid ;
150166 return (
@@ -164,7 +180,13 @@ const WorkspaceCard = ({
164180 onAssignDesign = { onAssignDesign }
165181 isEnvironmentAllowed = { isEnvironmentAllowed }
166182 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 }
168190 />
169191
170192 < CardBack
@@ -201,7 +223,12 @@ const CardFront = ({
201223 onAssignDesign,
202224 isEnvironmentAllowed,
203225 isTeamAllowed,
204- isDesignAndViewAllowed
226+ isDesignAllowed,
227+ isViewAllowed,
228+ isViewsVisible,
229+ isDesignsVisible,
230+ isEnvironmentsVisible,
231+ isTeamsVisible
205232} : CardFrontProps ) => {
206233 return (
207234 < CardFrontWrapper elevation = { 2 } onClick = { onFlip } >
@@ -227,52 +254,77 @@ const CardFront = ({
227254 gap : 1
228255 } }
229256 >
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+ ) }
245274
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+ ) }
276328 </ Grid >
277329 </ CardFrontWrapper >
278330 ) ;
0 commit comments