Skip to content

Commit

Permalink
Delete unused code in Plots (#3367)
Browse files Browse the repository at this point in the history
  • Loading branch information
julieg18 authored Feb 28, 2023
1 parent 51e210a commit 990796c
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 29 deletions.
6 changes: 1 addition & 5 deletions webview/src/plots/components/PlotsContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,7 @@ import {
import { isSelecting } from '../../util/strings'
import { isTooltip } from '../../util/helpers'

export interface CommonPlotsContainerProps {
onResize: (size: number) => void
}

export interface PlotsContainerProps extends CommonPlotsContainerProps {
export interface PlotsContainerProps {
sectionCollapsed: boolean
sectionKey: Section
title: string
Expand Down
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
import { Section } from 'dvc/src/plots/webview/contract'
import { MessageFromWebviewType } from 'dvc/src/webview/contract'
import React, { useEffect, useState } from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { useSelector } from 'react-redux'
import { CheckpointPlots } from './CheckpointPlots'
import { changeSize } from './checkpointPlotsSlice'
import { PlotsContainer } from '../PlotsContainer'
import { sendMessage } from '../../../shared/vscode'
import { PlotsState } from '../../store'

export const CheckpointPlotsWrapper: React.FC = () => {
const dispatch = useDispatch()
const { plotsIds, size, selectedMetrics, isCollapsed, colors } = useSelector(
(state: PlotsState) => state.checkpoint
)
Expand All @@ -29,10 +27,6 @@ export const CheckpointPlotsWrapper: React.FC = () => {
})
}

const handleResize = (size: number) => {
dispatch(changeSize(size))
}

const menu =
plotsIds.length > 0
? {
Expand All @@ -49,7 +43,6 @@ export const CheckpointPlotsWrapper: React.FC = () => {
menu={menu}
currentSize={size}
sectionCollapsed={isCollapsed}
onResize={handleResize}
>
<CheckpointPlots plotsIds={selectedPlots} colors={colors} />
</PlotsContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,27 +1,21 @@
import { Section } from 'dvc/src/plots/webview/contract'
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { useSelector } from 'react-redux'
import { ComparisonTable } from './ComparisonTable'
import { changeSize } from './comparisonTableSlice'
import { PlotsContainer } from '../PlotsContainer'
import { PlotsState } from '../../store'

export const ComparisonTableWrapper: React.FC = () => {
const dispatch = useDispatch()
const { size, isCollapsed } = useSelector(
(state: PlotsState) => state.comparison
)
const handleResize = (size: number) => {
dispatch(changeSize(size))
}

return (
<PlotsContainer
title="Images"
sectionKey={Section.COMPARISON_TABLE}
currentSize={size}
sectionCollapsed={isCollapsed}
onResize={handleResize}
>
<ComparisonTable />
</PlotsContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,28 +1,20 @@
import { Section } from 'dvc/src/plots/webview/contract'
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { useSelector } from 'react-redux'
import { TemplatePlots } from './TemplatePlots'
import { changeSize } from './templatePlotsSlice'
import { PlotsContainer } from '../PlotsContainer'
import { PlotsState } from '../../store'

export const TemplatePlotsWrapper: React.FC = () => {
const dispatch = useDispatch()
const { size, isCollapsed } = useSelector(
(state: PlotsState) => state.template
)

const handleResize = (size: number) => {
dispatch(changeSize(size))
}

return (
<PlotsContainer
title="Data Series"
sectionKey={Section.TEMPLATE_PLOTS}
currentSize={size}
sectionCollapsed={isCollapsed}
onResize={handleResize}
>
<TemplatePlots />
</PlotsContainer>
Expand Down

0 comments on commit 990796c

Please sign in to comment.