@@ -8,15 +8,14 @@ import React, {
88import { AnyAction } from '@reduxjs/toolkit'
99import { useDispatch , useSelector } from 'react-redux'
1010import { PlotHeight , PlotsSection } from 'dvc/src/plots/webview/contract'
11- import { MessageFromWebviewType } from 'dvc/src/webview/contract'
1211import { PlotsPicker , PlotsPickerProps } from './PlotsPicker'
1312import styles from './styles.module.scss'
1413import { IconMenuItemProps } from '../../shared/components/iconMenu/IconMenuItem'
15- import { sendMessage } from '../../shared/vscode'
1614import { ListFilter , Add , Trash } from '../../shared/components/icons'
1715import { Slider } from '../../shared/components/slider/Slider'
1816import { PlotsState } from '../store'
1917import { SectionContainer } from '../../shared/components/sectionContainer/SectionContainer'
18+ import { resizePlots , togglePlotsSection } from '../util/messages'
2019
2120interface PlotsContainerProps {
2221 sectionCollapsed : boolean
@@ -96,25 +95,12 @@ export const PlotsContainer: React.FC<PlotsContainerProps> = ({
9695 nbItemsPerRowOrWidth : positiveNbItems
9796 } )
9897 )
99- sendMessage ( {
100- payload : {
101- height : newHeight ,
102- nbItemsPerRow : positiveNbItems ,
103- section : sectionKey
104- } ,
105- type : MessageFromWebviewType . RESIZE_PLOTS
106- } )
98+ resizePlots ( newHeight , positiveNbItems , sectionKey )
10799 } ,
108100 [ dispatch , changeSize , sectionKey ]
109101 )
110102
111- const toggleSection = ( ) =>
112- sendMessage ( {
113- payload : {
114- [ sectionKey ] : ! sectionCollapsed
115- } ,
116- type : MessageFromWebviewType . TOGGLE_PLOTS_SECTION
117- } )
103+ const toggleSection = ( ) => togglePlotsSection ( sectionKey , sectionCollapsed )
118104
119105 const plotHeights = Object . values ( PlotHeight ) . filter (
120106 value => typeof value !== 'string'
0 commit comments