From 83e437e02e7a7bf2f97465efcba3fe49ecbe2ae7 Mon Sep 17 00:00:00 2001 From: Colin Date: Fri, 20 Aug 2021 15:21:25 -0400 Subject: [PATCH] Fix some tsc --- .../src/DotplotView/components/Axes.tsx | 4 - .../DotplotView/components/DotplotView.tsx | 86 ++++++++++--------- plugins/dotplot-view/src/DotplotView/model.ts | 3 +- .../components/ImportForm.tsx | 2 +- .../src/LinearGenomeView/index.test.ts | 2 +- 5 files changed, 48 insertions(+), 49 deletions(-) diff --git a/plugins/dotplot-view/src/DotplotView/components/Axes.tsx b/plugins/dotplot-view/src/DotplotView/components/Axes.tsx index 61c2fbf8db8..5dd47bced92 100644 --- a/plugins/dotplot-view/src/DotplotView/components/Axes.tsx +++ b/plugins/dotplot-view/src/DotplotView/components/Axes.tsx @@ -10,10 +10,6 @@ const useStyles = makeStyles(() => ({ gridRow: '1/2', pointerEvents: 'none', }, - spacer: { - gridColumn: '1/2', - gridRow: '2/2', - }, htext: { gridColumn: '2/2', gridRow: '2/2', diff --git a/plugins/dotplot-view/src/DotplotView/components/DotplotView.tsx b/plugins/dotplot-view/src/DotplotView/components/DotplotView.tsx index 7f6bc9d45e9..fdc31e4291b 100644 --- a/plugins/dotplot-view/src/DotplotView/components/DotplotView.tsx +++ b/plugins/dotplot-view/src/DotplotView/components/DotplotView.tsx @@ -11,51 +11,53 @@ import Controls from './Controls' import { locstr } from './util' import { HorizontalAxis, VerticalAxis } from './Axes' -const useStyles = makeStyles(theme => { - return { - root: { - position: 'relative', - marginBottom: theme.spacing(1), - overflow: 'hidden', - }, - viewContainer: { - marginTop: '3px', - }, - container: { - display: 'grid', - padding: 5, - position: 'relative', - }, - overlay: { - pointerEvents: 'none', - overflow: 'hidden', - display: 'flex', - width: '100%', - gridRow: '1/2', - gridColumn: '2/2', - zIndex: 100, // needs to be below controls - '& path': { - cursor: 'crosshair', - fill: 'none', - }, +const useStyles = makeStyles(theme => ({ + spacer: { + gridColumn: '1/2', + gridRow: '2/2', + }, + root: { + position: 'relative', + marginBottom: theme.spacing(1), + overflow: 'hidden', + }, + viewContainer: { + marginTop: '3px', + }, + container: { + display: 'grid', + padding: 5, + position: 'relative', + }, + overlay: { + pointerEvents: 'none', + overflow: 'hidden', + display: 'flex', + width: '100%', + gridRow: '1/2', + gridColumn: '2/2', + zIndex: 100, // needs to be below controls + '& path': { + cursor: 'crosshair', + fill: 'none', }, + }, - content: { - gridColumn: '2/2', - gridRow: '1/2', - }, + content: { + gridColumn: '2/2', + gridRow: '1/2', + }, - popover: { - background: '#fff', - maxWidth: 400, - wordBreak: 'break-all', - zIndex: 1000, - border: '1px solid black', - pointerEvents: 'none', - position: 'absolute', - }, - } -}) + popover: { + background: '#fff', + maxWidth: 400, + wordBreak: 'break-all', + zIndex: 1000, + border: '1px solid black', + pointerEvents: 'none', + position: 'absolute', + }, +})) type Coord = [number, number] | undefined type Timer = ReturnType diff --git a/plugins/dotplot-view/src/DotplotView/model.ts b/plugins/dotplot-view/src/DotplotView/model.ts index 40da8faa5ac..b3fd0c52d8d 100644 --- a/plugins/dotplot-view/src/DotplotView/model.ts +++ b/plugins/dotplot-view/src/DotplotView/model.ts @@ -350,7 +350,8 @@ export default function stateModelFactory(pluginManager: PluginManager) { .map(track => { const trackConf = track.configuration return trackConf.displays.find( - display => display.type === 'LinearSyntenyDisplay', + (display: { type: string }) => + display.type === 'LinearSyntenyDisplay', ) }) .filter(f => !!f) diff --git a/plugins/linear-genome-view/src/LinearGenomeView/components/ImportForm.tsx b/plugins/linear-genome-view/src/LinearGenomeView/components/ImportForm.tsx index df2e0bab7bf..612e2394f8e 100644 --- a/plugins/linear-genome-view/src/LinearGenomeView/components/ImportForm.tsx +++ b/plugins/linear-genome-view/src/LinearGenomeView/components/ImportForm.tsx @@ -50,7 +50,7 @@ const ImportForm = observer(({ model }: { model: LGV }) => { error: modelError, } = model const [selectedAsm, setSelectedAsm] = useState(assemblyNames[0]) - const [error, setError] = useState(modelError) + const [error, setError] = useState(modelError) const message = !assemblyNames.length ? 'No configured assemblies' : '' const searchScope = model.searchScope(selectedAsm) diff --git a/plugins/linear-genome-view/src/LinearGenomeView/index.test.ts b/plugins/linear-genome-view/src/LinearGenomeView/index.test.ts index d20a7737101..b5355b0ffc1 100644 --- a/plugins/linear-genome-view/src/LinearGenomeView/index.test.ts +++ b/plugins/linear-genome-view/src/LinearGenomeView/index.test.ts @@ -620,7 +620,7 @@ test('can perform bpToPx in a way that makes sense on things that happen outside expect(model.hideHeaderOverview).toEqual(true) model.toggleHeaderOverview() model.setError(Error('pxToBp failed to map to a region')) - expect(model.error?.message).toEqual('pxToBp failed to map to a region') + expect(`${model.error}`).toEqual('pxToBp failed to map to a region') }) // determined objectively by looking at // http://localhost:3000/?config=test_data%2Fconfig_demo.json&session=share-Se2K5q_Jog&password=qT9on