File tree Expand file tree Collapse file tree 4 files changed +20
-32
lines changed
webview/src/experiments/components/table Expand file tree Collapse file tree 4 files changed +20
-32
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,9 @@ const RowExpansionButton: React.FC<RowProp> = ({ row }) =>
3131 < span className = { styles . rowArrowContainer } />
3232 )
3333
34- export const FirstCell : React . FC < CellProp & CellRowActionsProps > = ( {
35- cell,
36- ...rowActionsProps
37- } ) => {
34+ export const FirstCell : React . FC <
35+ CellProp & CellRowActionsProps & { changesIfWorkspace : boolean }
36+ > = ( { cell, changesIfWorkspace, ...rowActionsProps } ) => {
3837 const { row, isPlaceholder } = cell
3938 const {
4039 original : { error, status, label, displayNameOrParent = '' }
@@ -53,10 +52,10 @@ export const FirstCell: React.FC<CellProp & CellRowActionsProps> = ({
5352 { isPlaceholder ? null : (
5453 < ErrorTooltip error = { error } >
5554 < div
56- className = { cx (
57- styles . experimentCellContentsContainer ,
58- error && styles . error
59- ) }
55+ className = { cx ( styles . experimentCellContentsContainer , {
56+ [ styles . workspaceChange ] : changesIfWorkspace ,
57+ [ styles . error ] : error
58+ } ) }
6059 { ...clickAndEnterProps ( toggleExperiment , [
6160 label ,
6261 displayNameOrParent
Original file line number Diff line number Diff line change @@ -39,8 +39,7 @@ const getRowClassNames = (
3939 isRowFocused : boolean ,
4040 isRowSelected : boolean ,
4141 isWorkspace : boolean ,
42- className ?: string ,
43- changes ?: string [ ]
42+ className ?: string
4443) => {
4544 return cx (
4645 className ,
@@ -55,7 +54,6 @@ const getRowClassNames = (
5554 isWorkspace ? styles . workspaceRow : styles . normalRow ,
5655 styles . row ,
5756 isRowSelected && styles . rowSelected ,
58- isWorkspace && changes ?. length && styles . workspaceWithChanges ,
5957 isRowFocused && styles . rowFocused
6058 )
6159}
@@ -165,8 +163,7 @@ export const RowContent: React.FC<
165163 menuActive ,
166164 isRowSelected ,
167165 isWorkspace ,
168- className ,
169- changes
166+ className
170167 )
171168 } ) }
172169 tabIndex = { 0 }
@@ -176,6 +173,7 @@ export const RowContent: React.FC<
176173 >
177174 < FirstCell
178175 cell = { firstCell }
176+ changesIfWorkspace = { ! ! changesIfWorkspace ?. length }
179177 bulletColor = { displayColor }
180178 starred = { starred }
181179 isRowSelected = { isRowSelected }
Original file line number Diff line number Diff line change @@ -279,20 +279,24 @@ describe('Table', () => {
279279 } )
280280
281281 describe ( 'Changes' , ( ) => {
282- it ( ' should not have the workspaceWithChanges class on a row if there are no workspace changes' , async ( ) => {
282+ it ( " should not have the workspaceChange class on the workspace's first cell (text) workspace changes" , async ( ) => {
283283 renderTable ( )
284284
285- const row = await screen . findByTestId ( 'workspace-row' )
285+ const workspaceCell = await screen . findByText ( EXPERIMENT_WORKSPACE_ID )
286286
287- expect ( row ?. className . includes ( styles . workspaceWithChanges ) ) . toBe ( false )
287+ expect ( workspaceCell ?. className . includes ( styles . workspaceChange ) ) . toBe (
288+ false
289+ )
288290 } )
289291
290- it ( ' should have the workspaceWithChanges class on a row if there are workspace changes' , async ( ) => {
292+ it ( " should have the workspaceChange class on the workspace's first cell (text) if there are workspace changes" , async ( ) => {
291293 renderTable ( { changes : [ 'something_changed' ] } )
292294
293- const row = await screen . findByTestId ( 'workspace-row' )
295+ const workspaceCell = await screen . findByText ( EXPERIMENT_WORKSPACE_ID )
294296
295- expect ( row ?. className . includes ( styles . workspaceWithChanges ) ) . toBe ( true )
297+ expect ( workspaceCell ?. className . includes ( styles . workspaceChange ) ) . toBe (
298+ true
299+ )
296300 } )
297301
298302 it ( 'should not have the workspaceChange class on a cell if there are no changes' , async ( ) => {
Original file line number Diff line number Diff line change @@ -131,10 +131,6 @@ $bullet-size: calc(var(--design-unit) * 4px);
131131 border-radius : 100% ;
132132 }
133133
134- .workspaceWithChanges.normalExperiment & {
135- background-color : $changed-color ;
136- }
137-
138134 .unselectedExperiment & {
139135 width : 4px ;
140136 height : 4px ;
@@ -143,10 +139,6 @@ $bullet-size: calc(var(--design-unit) * 4px);
143139 background-color : $checkbox-background ;
144140 }
145141
146- .workspaceWithChanges.unselectedExperiment & {
147- border : 1px solid $changed-color ;
148- }
149-
150142 .runningExperiment & {
151143 width : 4px ;
152144 height : 4px ;
@@ -158,11 +150,6 @@ $bullet-size: calc(var(--design-unit) * 4px);
158150 animation : spin 1s cubic-bezier (0.53 , 0.21 , 0.29 , 0.67 ) infinite ;
159151 background-color : $checkbox-background ;
160152 }
161-
162- .workspaceWithChanges.runningExperiment & {
163- border-right-color : $changed-color ;
164- border-top-color : $changed-color ;
165- }
166153 }
167154}
168155
You can’t perform that action at this time.
0 commit comments