From acff7ea631f2a3ecd55633e355131c6047c78e0f Mon Sep 17 00:00:00 2001 From: Thomas Nordquist Date: Sun, 16 Jun 2019 22:30:56 +0200 Subject: [PATCH] Refactor --- app/src/components/ChartPanel/index.tsx | 18 ------------------ .../components/Sidebar/CodeDiff/Gutters.tsx | 17 +++++++++-------- 2 files changed, 9 insertions(+), 26 deletions(-) diff --git a/app/src/components/ChartPanel/index.tsx b/app/src/components/ChartPanel/index.tsx index 826fc42..8253fdc 100644 --- a/app/src/components/ChartPanel/index.tsx +++ b/app/src/components/ChartPanel/index.tsx @@ -28,24 +28,6 @@ function spacingForChartCount(count: number): 4 | 6 | 12 { } } -// function FadingChart(props: { chartParameters: ChartParameters; chartsInView: number; key: any }) { -// const { chartsInView, chartParameters } = props -// const [spacing, setSpacing] = React.useState(spacingForChartCount(chartsInView)) - -// // Update spacing after animations have completed -// React.useEffect(() => { -// const newSpacing = spacingForChartCount(chartsInView) -// if (spacing !== newSpacing) { -// setSpacing(newSpacing) -// // setTimeout(() => , 500) -// } -// }) - -// return ( - -// ) -// } - function ChartPanel(props: Props) { const chartsInView = props.charts.count() diff --git a/app/src/components/Sidebar/CodeDiff/Gutters.tsx b/app/src/components/Sidebar/CodeDiff/Gutters.tsx index 129b10b..3b93247 100644 --- a/app/src/components/Sidebar/CodeDiff/Gutters.tsx +++ b/app/src/components/Sidebar/CodeDiff/Gutters.tsx @@ -4,10 +4,9 @@ import * as React from 'react' import Add from '@material-ui/icons/Add' import ChartPreview from './ChartPreview' import Remove from '@material-ui/icons/Remove' -import ShowChart from '@material-ui/icons/ShowChart' -import { Theme, Tooltip } from '@material-ui/core' import { JsonPropertyLocation } from '../../../../../backend/src/JsonAstParser' import { lineChangeStyle, trimNewlineRight } from './util' +import { Theme } from '@material-ui/core' import { withStyles } from '@material-ui/styles' interface Props { @@ -53,12 +52,14 @@ function tokensForLine(change: diff.Change, line: number, props: Props) { const { classes, literalPositions } = props const literal = literalPositions[line] - let chartPreview = null - if (literal) { - chartPreview = ( - - ) - } + const chartPreview = Boolean(literal) ? ( + + ) : null if (change.added) { return [chartPreview, ]