Skip to content

Commit 0c9f0cf

Browse files
authored
Merge pull request #19 from oslabs-beta/brian/feature
Defined new typescript interface and assigned typescript to several variables in BarGraphComparisonActions.tsx
2 parents 5d613c3 + 910ec8f commit 0c9f0cf

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/app/components/FrontendTypes.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,3 +84,15 @@ export interface BarGraphProps extends BarGraphBase{
8484
snapshot: unknown,
8585
setSnapshot: () => void
8686
}
87+
88+
export interface BarGraphComparisonAction{
89+
action: ActionObj,
90+
data: ActionObj[],
91+
width: number,
92+
height: number,
93+
comparison: Series[],
94+
setSeries: (e: boolean | string) => void,
95+
series?: number,
96+
setAction: (e: boolean | string) => void,
97+
}
98+

src/app/components/StateRoute/PerformanceVisx/BarGraphComparisonActions.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import MenuItem from '@material-ui/core/MenuItem';
1414
import FormControl from '@material-ui/core/FormControl';
1515
import { deleteSeries, setCurrentTabInApp } from '../../../actions/actions';
1616
import { useStoreContext } from '../../../store';
17-
import { TooltipData, Margin } from '../../FrontendTypes';
17+
import { TooltipData, Margin, BarGraphComparisonAction, ActionObj, } from '../../FrontendTypes';
1818

1919
/* DEFAULTS */
2020
const margin: Margin = {
@@ -32,7 +32,7 @@ const tooltipStyles = {
3232
fontFamily: 'Roboto',
3333
};
3434

35-
const BarGraphComparisonActions = props => {
35+
const BarGraphComparisonActions = (props: BarGraphComparisonAction) => {
3636
const [dispatch] = useStoreContext();
3737
const {
3838
width, height, data, comparison, setSeries, series, setAction, action
@@ -57,7 +57,7 @@ const BarGraphComparisonActions = props => {
5757
const { containerRef, TooltipInPortal } = useTooltipInPortal();
5858
const keys = Object.keys(data[0]).filter((componentName) => componentName !== 'name' && componentName !== 'seriesName' && componentName !== 'snapshotId');
5959
// data accessor (used to generate scales) and formatter (add units for on hover box)
60-
const getSeriesName = action => action.seriesName;
60+
const getSeriesName = (action: ActionObj):string => action.seriesName;
6161

6262
// create visualization SCALES with cleaned data.
6363
// the domain array/xAxisPoints elements will place the bars along the x-axis

0 commit comments

Comments
 (0)