Skip to content

Commit

Permalink
Remove + button in custom plots section
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 committed Sep 20, 2023
1 parent 6233c89 commit ec3c5ed
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 31 deletions.
19 changes: 0 additions & 19 deletions webview/src/plots/components/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -766,25 +766,6 @@ describe('App', () => {
})
})

it('should hide the custom plots add button if there are no more plots to create', () => {
renderAppWithOptionalData({
comparison: comparisonTableFixture,
custom: customPlotsFixture
})

const customSection = screen.getAllByTestId('section-container')[2]

expect(within(customSection).getByLabelText('Add Plot')).toBeInTheDocument()

sendSetDataMessage({
custom: { ...customPlotsFixture, enablePlotCreation: false }
})

expect(
within(customSection).queryByLabelText('Add Plot')
).not.toBeInTheDocument()
})

it('should display a slider to pick the number of items per row if there are items and the action is available', () => {
const store = renderAppWithOptionalData({
custom: customPlotsFixture
Expand Down
15 changes: 3 additions & 12 deletions webview/src/plots/components/customPlots/CustomPlotsWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,11 @@ import { CustomPlots } from './CustomPlots'
import { changeSize } from './customPlotsSlice'
import { PlotsContainer } from '../PlotsContainer'
import { PlotsState } from '../../store'
import { addCustomPlot, removeCustomPlots } from '../../util/messages'
import { removeCustomPlots } from '../../util/messages'

export const CustomPlotsWrapper: React.FC = () => {
const {
plotsIds,
nbItemsPerRow,
isCollapsed,
height,
enablePlotCreation,
hasAddedPlots
} = useSelector((state: PlotsState) => state.custom)
const { plotsIds, nbItemsPerRow, isCollapsed, height, hasAddedPlots } =
useSelector((state: PlotsState) => state.custom)
const [selectedPlots, setSelectedPlots] = useState<string[]>([])
useEffect(() => {
setSelectedPlots(plotsIds)
Expand All @@ -29,9 +23,6 @@ export const CustomPlotsWrapper: React.FC = () => {
sectionKey={PlotsSection.CUSTOM_PLOTS}
nbItemsPerRowOrWidth={nbItemsPerRow}
sectionCollapsed={isCollapsed}
addPlotsButton={
enablePlotCreation ? { onClick: addCustomPlot } : undefined
}
removePlotsButton={
hasAddedPlots ? { onClick: removeCustomPlots } : undefined
}
Expand Down

0 comments on commit ec3c5ed

Please sign in to comment.