From 301b10ba693dc76ebcd42d3fa4020410f2092bee Mon Sep 17 00:00:00 2001 From: bobzel Date: Thu, 6 Aug 2020 23:13:50 -0400 Subject: fixed lint warnings --- .../collectionFreeForm/CollectionFreeFormView.tsx | 48 +++++++------- src/client/views/nodes/AudioBox.tsx | 75 ++++++++++++---------- src/client/views/nodes/PresBox.tsx | 4 +- .../views/nodes/formattedText/FormattedTextBox.tsx | 3 +- 4 files changed, 67 insertions(+), 63 deletions(-) (limited to 'src') diff --git a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx index 5b1f3c01c..ef4b7b9d2 100644 --- a/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx +++ b/src/client/views/collections/collectionFreeForm/CollectionFreeFormView.tsx @@ -1504,32 +1504,30 @@ class CollectionFreeFormViewPannableContents extends React.Component - {!this.props.presPaths ? (null) : <>
{PresBox.Instance.order}
- - - - - - - - - - - - - - - - ; + return !(PresBox.Instance) ? (null) : (<> + {!this.props.presPaths ? (null) : <>
{PresBox.Instance.order}
+ + + + + + + + + + + + + + + + ; {PresBox.Instance.paths} - } - - ); + } + ); } render() { diff --git a/src/client/views/nodes/AudioBox.tsx b/src/client/views/nodes/AudioBox.tsx index 11fecc0c2..eba1046b2 100644 --- a/src/client/views/nodes/AudioBox.tsx +++ b/src/client/views/nodes/AudioBox.tsx @@ -23,8 +23,8 @@ import { Networking } from "../../Network"; import { LinkAnchorBox } from "./LinkAnchorBox"; import { List } from "../../../fields/List"; import { Scripting } from "../../util/Scripting"; -import Waveform from "react-audio-waveform" -import axios from "axios" +import Waveform from "react-audio-waveform"; +import axios from "axios"; const _global = (window /* browser */ || global /* node */) as any; declare class MediaRecorder { @@ -375,7 +375,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent { - for (let i = 0; i < this.dataDoc[this.annotationKey].length; i++) { - if (this.isSame(this.dataDoc[this.annotationKey][i], m)) { - this._left ? this.dataDoc[this.annotationKey][i].audioStart = time : this.dataDoc[this.annotationKey][i].audioEnd = time; + DocListCast(this.dataDoc[this.annotationKey]).forEach((marker: Doc) => { + if (this.isSame(marker, m)) { + this._left ? marker.audioStart = time : marker.audioEnd = time; } - } + }); } // checks if the two markers are the same with start and end time @@ -457,7 +457,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent= m.audioStart && this._count[i][0] <= m.audioEnd) { @@ -490,7 +490,7 @@ export class AudioBox extends ViewBoxAnnotatableComponent { - let audioCtx = new (window.AudioContext)(); + const audioCtx = new (window.AudioContext)(); axios({ url: this.path, responseType: "arraybuffer" }) .then(response => { - let audioData = response.data; + const audioData = response.data; audioCtx.decodeAudioData(audioData, action(buffer => { - let decodedAudioData = buffer.getChannelData(0); + const decodedAudioData = buffer.getChannelData(0); const NUMBER_OF_BUCKETS = 100; - let bucketDataSize = Math.floor(decodedAudioData.length / NUMBER_OF_BUCKETS); + const bucketDataSize = Math.floor(decodedAudioData.length / NUMBER_OF_BUCKETS); for (let i = 0; i < NUMBER_OF_BUCKETS; i++) { - let startingPoint = i * bucketDataSize; - let endingPoint = i * bucketDataSize + bucketDataSize; + const startingPoint = i * bucketDataSize; + const endingPoint = i * bucketDataSize + bucketDataSize; let max = 0; for (let j = startingPoint; j < endingPoint; j++) { if (decodedAudioData[j] > max) { max = decodedAudioData[j]; } } - let size = Math.abs(max); + const size = Math.abs(max); this._buckets.push(size / 2); } @@ -560,36 +560,36 @@ export class AudioBox extends ViewBoxAnnotatableComponent { if (height) { this._height = 0.8 * NumCast(this.layoutDoc._height); - let canvas2 = document.getElementsByTagName("canvas")[0]; + const canvas2 = document.getElementsByTagName("canvas")[0]; if (canvas2) { - let oldWidth = canvas2.width; - let oldHeight = canvas2.height; + const oldWidth = canvas2.width; + const oldHeight = canvas2.height; canvas2.style.height = `${this._height}`; canvas2.style.width = `${width}`; - let ratio1 = oldWidth / window.innerWidth; - let ratio2 = oldHeight / window.innerHeight; - let context = canvas2.getContext('2d'); + const ratio1 = oldWidth / window.innerWidth; + const ratio2 = oldHeight / window.innerHeight; + const context = canvas2.getContext('2d'); if (context) { - context.scale(ratio1, ratio2) + context.scale(ratio1, ratio2); } } - let canvas1 = document.getElementsByTagName("canvas")[1]; + const canvas1 = document.getElementsByTagName("canvas")[1]; if (canvas1) { - let oldWidth = canvas1.width; - let oldHeight = canvas1.height; + const oldWidth = canvas1.width; + const oldHeight = canvas1.height; canvas1.style.height = `${this._height}`; canvas1.style.width = `${width}`; - let ratio1 = oldWidth / window.innerWidth; - let ratio2 = oldHeight / window.innerHeight; - let context = canvas1.getContext('2d'); + const ratio1 = oldWidth / window.innerWidth; + const ratio2 = oldHeight / window.innerHeight; + const context = canvas1.getContext('2d'); if (context) { - context.scale(ratio1, ratio2) + context.scale(ratio1, ratio2); } - let parent = canvas1.parentElement; + const parent = canvas1.parentElement; if (parent) { parent.style.width = `${width}`; parent.style.height = `${this._height}`; @@ -665,7 +665,14 @@ export class AudioBox extends ViewBoxAnnotatableComponent { this.playFrom(NumCast(m.audioStart), NumCast(m.audioEnd)); e.stopPropagation() }} > +
{ this.playFrom(NumCast(m.audioStart), NumCast(m.audioEnd)); e.stopPropagation(); }} >
this.onPointerDown(e, m, true)}>
this.gotoDocument(nextSelected, this.itemIndex); const targetNext = Cast(activeNext.presentationTargetDoc, Doc, null); if (activeNext && targetNext.type === DocumentType.AUDIO && activeNext.playAuto) { - } else { this._moveOnFromAudio = false }; + } else this._moveOnFromAudio = false; } } @@ -1646,7 +1646,7 @@ export class PresBox extends ViewBoxBaseComponent
0 ? 1 : 0.3 }}> -
{ if (this.childDocs.length > 0) this.layoutDoc.presStatus = "manual" }}> +
(this.childDocs.length > 0) && (this.layoutDoc.presStatus = "manual")}>
200 ? "inline-flex" : "none" }}>  Present
diff --git a/src/client/views/nodes/formattedText/FormattedTextBox.tsx b/src/client/views/nodes/formattedText/FormattedTextBox.tsx index 4b06f2800..b0bf54be6 100644 --- a/src/client/views/nodes/formattedText/FormattedTextBox.tsx +++ b/src/client/views/nodes/formattedText/FormattedTextBox.tsx @@ -305,7 +305,6 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp // for inserting timestamps insertTime = () => { - let linkTime; if (this._first) { this._first = false; DocListCast(this.dataDoc.links).map((l, i) => { @@ -318,7 +317,7 @@ export class FormattedTextBox extends ViewBoxAnnotatableComponent<(FieldViewProp this._linkTime = NumCast(l.anchor1_timecode); } - }) + }); } this._currentTime = Date.now(); let time; -- cgit v1.2.3-70-g09d2