diff --git a/ui/v2.5/src/components/ErrorBoundary.tsx b/ui/v2.5/src/components/ErrorBoundary.tsx index 9c90c0562..1beb1bfa9 100644 --- a/ui/v2.5/src/components/ErrorBoundary.tsx +++ b/ui/v2.5/src/components/ErrorBoundary.tsx @@ -1,19 +1,22 @@ import React from "react"; interface IErrorBoundaryProps { - children?: React.ReactNode, + children?: React.ReactNode; } type ErrorInfo = { - componentStack: string, + componentStack: string; }; interface IErrorBoundaryState { - error?: Error; + error?: Error; errorInfo?: ErrorInfo; } -export class ErrorBoundary extends React.Component { +export class ErrorBoundary extends React.Component< + IErrorBoundaryProps, + IErrorBoundaryState +> { constructor(props: IErrorBoundaryProps) { super(props); this.state = {}; diff --git a/ui/v2.5/src/components/List/AddFilter.tsx b/ui/v2.5/src/components/List/AddFilter.tsx index 8eb3c2c07..017c833e5 100644 --- a/ui/v2.5/src/components/List/AddFilter.tsx +++ b/ui/v2.5/src/components/List/AddFilter.tsx @@ -26,9 +26,7 @@ export const AddFilter: React.FC = ( const defaultValue = useRef(); const [isOpen, setIsOpen] = useState(false); - const [criterion, setCriterion] = useState( - new NoneCriterion() - ); + const [criterion, setCriterion] = useState(new NoneCriterion()); const valueStage = useRef(criterion.value); @@ -140,10 +138,11 @@ export const AddFilter: React.FC = ( } if (Array.isArray(criterion.value)) { - if( + if ( criterion.type !== "performers" && criterion.type !== "studios" && - criterion.type !== "tags") + criterion.type !== "tags" + ) return; return ( diff --git a/ui/v2.5/src/components/List/ListFilter.tsx b/ui/v2.5/src/components/List/ListFilter.tsx index 8cd64a844..709eedfee 100644 --- a/ui/v2.5/src/components/List/ListFilter.tsx +++ b/ui/v2.5/src/components/List/ListFilter.tsx @@ -72,8 +72,8 @@ export const ListFilter: React.FC = ( } } - function onChangeSortBy(event:React.MouseEvent) { - const target = event.currentTarget as unknown as HTMLAnchorElement; + function onChangeSortBy(event: React.MouseEvent) { + const target = (event.currentTarget as unknown) as HTMLAnchorElement; props.onChangeSortBy(target.text); } diff --git a/ui/v2.5/src/components/SceneFilenameParser/ParserInput.tsx b/ui/v2.5/src/components/SceneFilenameParser/ParserInput.tsx index f2e10e995..5ec69b839 100644 --- a/ui/v2.5/src/components/SceneFilenameParser/ParserInput.tsx +++ b/ui/v2.5/src/components/SceneFilenameParser/ParserInput.tsx @@ -132,7 +132,9 @@ export const ParserInput: React.FC = ( ) => setPattern(e.currentTarget.value)} + onChange={(e: React.FormEvent) => + setPattern(e.currentTarget.value) + } value={pattern} /> @@ -158,7 +160,9 @@ export const ParserInput: React.FC = ( Ignored words ) => setIgnoreWords(e.currentTarget.value)} + onChange={(e: React.FormEvent) => + setIgnoreWords(e.currentTarget.value) + } value={ignoreWords} /> diff --git a/ui/v2.5/src/components/SceneFilenameParser/SceneFilenameParser.tsx b/ui/v2.5/src/components/SceneFilenameParser/SceneFilenameParser.tsx index 5898a5ad0..8e1167ad2 100644 --- a/ui/v2.5/src/components/SceneFilenameParser/SceneFilenameParser.tsx +++ b/ui/v2.5/src/components/SceneFilenameParser/SceneFilenameParser.tsx @@ -10,7 +10,7 @@ import { useToast } from "src/hooks"; import { Pagination } from "src/components/List/Pagination"; import { IParserInput, ParserInput } from "./ParserInput"; import { ParserField } from "./ParserField"; -import { SceneParserResult, SceneParserRow } from './SceneParserRow'; +import { SceneParserResult, SceneParserRow } from "./SceneParserRow"; const initialParserInput = { pattern: "{title}.{ext}", diff --git a/ui/v2.5/src/components/SceneFilenameParser/SceneParserRow.tsx b/ui/v2.5/src/components/SceneFilenameParser/SceneParserRow.tsx index 0dd79f8d3..ba7fe7c58 100644 --- a/ui/v2.5/src/components/SceneFilenameParser/SceneParserRow.tsx +++ b/ui/v2.5/src/components/SceneFilenameParser/SceneParserRow.tsx @@ -1,9 +1,9 @@ import React from "react"; import _ from "lodash"; -import { Form } from 'react-bootstrap'; +import { Form } from "react-bootstrap"; import { ParseSceneFilenamesQuery, - SlimSceneDataFragment, + SlimSceneDataFragment } from "src/core/generated-graphql"; import { PerformerSelect, @@ -77,15 +77,9 @@ export class SceneParserResult { url: this.scene.url, rating: this.scene.rating, gallery_id: this.scene.gallery?.id, - title: this.title.isSet - ? this.title.value - : this.scene.title, - date: this.date.isSet - ? this.date.value - : this.scene.date, - studio_id: this.studio.isSet - ? this.studio.value - : this.scene.studio?.id, + title: this.title.isSet ? this.title.value : this.scene.title, + date: this.date.isSet ? this.date.value : this.scene.date, + studio_id: this.studio.isSet ? this.studio.value : this.scene.studio?.id, performer_ids: this.performers.isSet ? this.performers.value : this.scene.performers.map(performer => performer.id), @@ -135,7 +129,9 @@ function SceneParserStringField(props: ISceneParserFieldProps) { disabled={!props.parserResult.isSet} className={props.className} value={props.parserResult.value || ""} - onChange={(event: React.FormEvent) => maybeValueChanged(event.currentTarget.value)} + onChange={(event: React.FormEvent) => + maybeValueChanged(event.currentTarget.value) + } /> @@ -150,7 +146,8 @@ function SceneParserPerformerField(props: ISceneParserFieldProps) { } } - const originalPerformers = (props.originalParserResult?.originalValue ?? []) as string[]; + const originalPerformers = (props.originalParserResult?.originalValue ?? + []) as string[]; const newPerformers = props.parserResult.value ?? []; return ( @@ -165,11 +162,7 @@ function SceneParserPerformerField(props: ISceneParserFieldProps) { - + { @@ -205,11 +198,7 @@ function SceneParserTagField(props: ISceneParserFieldProps) { - + { @@ -230,7 +219,9 @@ function SceneParserStudioField(props: ISceneParserFieldProps) { } } - const originalStudio = props.originalParserResult?.originalValue ? [props.originalParserResult?.originalValue] : []; + const originalStudio = props.originalParserResult?.originalValue + ? [props.originalParserResult?.originalValue] + : []; const newStudio = props.parserResult.value ? [props.parserResult.value] : []; return ( @@ -245,10 +236,7 @@ function SceneParserStudioField(props: ISceneParserFieldProps) { - + { maybeValueChanged(items[0].id); @@ -295,7 +283,7 @@ export const SceneParserRow = (props: ISceneParserRowProps) => { function onTagIdsChanged(set: boolean, value: string[]) { const newResult = _.clone(props.scene); - newResult.tags= changeParser(newResult.tags, set, value); + newResult.tags = changeParser(newResult.tags, set, value); props.onChange(newResult); } @@ -310,31 +298,33 @@ export const SceneParserRow = (props: ISceneParserRowProps) => { {props.scene.filename} - { props.showFields.get("Title") && ( + {props.showFields.get("Title") && ( - onTitleChanged(isSet, props.scene.title.value ?? '') + onTitleChanged(isSet, props.scene.title.value ?? "") + } + onValueChanged={value => + onTitleChanged(props.scene.title.isSet, value) } - onValueChanged={value => onTitleChanged(props.scene.title.isSet, value)} /> )} - { props.showFields.get("Date") && ( + {props.showFields.get("Date") && ( - onDateChanged(isSet, props.scene.date.value ?? '') + onDateChanged(isSet, props.scene.date.value ?? "") } onValueChanged={value => onDateChanged(props.scene.date.isSet, value)} /> )} - { props.showFields.get("Performers") && ( + {props.showFields.get("Performers") && ( { parserResult={props.scene.performers} originalParserResult={props.scene.performers} onSetChanged={set => - onPerformerIdsChanged( - set, - props.scene.performers.value ?? [] - ) + onPerformerIdsChanged(set, props.scene.performers.value ?? []) } onValueChanged={value => onPerformerIdsChanged(props.scene.performers.isSet, value) } /> )} - { props.showFields.get("Tags") && ( + {props.showFields.get("Tags") && ( { } /> )} - { props.showFields.get("Studio") && ( + {props.showFields.get("Studio") && ( { parserResult={props.scene.studio} originalParserResult={props.scene.studio} onSetChanged={set => - onStudioIdChanged(set, props.scene.studio.value ?? '') + onStudioIdChanged(set, props.scene.studio.value ?? "") + } + onValueChanged={value => + onStudioIdChanged(props.scene.studio.isSet, value) } - onValueChanged={value => onStudioIdChanged(props.scene.studio.isSet, value)} /> )} ); -} +}; diff --git a/ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx b/ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx index 4ed3fffe1..cfd4da852 100644 --- a/ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx +++ b/ui/v2.5/src/components/ScenePlayer/ScenePlayer.tsx @@ -68,10 +68,11 @@ export class ScenePlayerImpl extends React.Component< } public UNSAFE_componentWillReceiveProps(props: IScenePlayerProps) { - if(props.scene !== this.props.scene) { - this.setState( state => ( - { ...state, config: this.makeJWPlayerConfig(this.props.scene) } - )); + if (props.scene !== this.props.scene) { + this.setState(state => ({ + ...state, + config: this.makeJWPlayerConfig(this.props.scene) + })); } } @@ -147,7 +148,9 @@ export class ScenePlayerImpl extends React.Component< let seekHook: | ((seekToPosition: number, _videoTag: HTMLVideoElement) => void) | undefined; - let getCurrentTimeHook: ((_videoTag: HTMLVideoElement) => number) | undefined; + let getCurrentTimeHook: + | ((_videoTag: HTMLVideoElement) => number) + | undefined; if (!this.props.scene.is_streamable) { getDurationHook = () => { @@ -163,7 +166,7 @@ export class ScenePlayerImpl extends React.Component< }; getCurrentTimeHook = (_videoTag: HTMLVideoElement) => { - const start = Number.parseInt(_videoTag.dataset?.start ?? '0', 10); + const start = Number.parseInt(_videoTag.dataset?.start ?? "0", 10); return _videoTag.currentTime + start; }; } diff --git a/ui/v2.5/src/components/ScenePlayer/ScenePlayerScrubber.tsx b/ui/v2.5/src/components/ScenePlayer/ScenePlayerScrubber.tsx index 9a24cca0d..4d7ee55cd 100644 --- a/ui/v2.5/src/components/ScenePlayer/ScenePlayerScrubber.tsx +++ b/ui/v2.5/src/components/ScenePlayer/ScenePlayerScrubber.tsx @@ -78,8 +78,8 @@ export const ScenePlayerScrubber: React.FC = ( const positionIndicatorEl = useRef(null); const scrubberSliderEl = useRef(null); const mouseDown = useRef(false); - const lastMouseEvent = useRef(null); - const startMouseEvent = useRef(null); + const lastMouseEvent = useRef(null); + const startMouseEvent = useRef(null); const velocity = useRef(0); const _position = useRef(0); @@ -279,7 +279,7 @@ export const ScenePlayerScrubber: React.FC = ( return {}; } - let tag: Element|null; + let tag: Element | null; for (let index = 0; index < tags.length; index++) { tag = tags.item(index); const id = tag?.getAttribute("data-marker-id") ?? null; @@ -293,7 +293,8 @@ export const ScenePlayerScrubber: React.FC = ( const percentage = marker.seconds / duration; const left = - scrubberSliderEl.current.scrollWidth * percentage - tag!.clientWidth / 2; + scrubberSliderEl.current.scrollWidth * percentage - + tag!.clientWidth / 2; return { left: `${left}px`, height: 20 diff --git a/ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx b/ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx index de4408f5b..ccde9e117 100644 --- a/ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx +++ b/ui/v2.5/src/components/Scenes/SceneDetails/SceneEditPanel.tsx @@ -305,7 +305,9 @@ export const SceneEditPanel: React.FC = (props: IProps) => { URL ) => setUrl(newValue.currentTarget.value)} + onChange={(newValue: React.FormEvent) => + setUrl(newValue.currentTarget.value) + } value={url} placeholder="URL" /> @@ -376,7 +378,9 @@ export const SceneEditPanel: React.FC = (props: IProps) => { ) => setDetails(newValue.currentTarget.value)} + onChange={(newValue: React.FormEvent) => + setDetails(newValue.currentTarget.value) + } value={details} /> diff --git a/ui/v2.5/src/components/Scenes/SceneSelectedOptions.tsx b/ui/v2.5/src/components/Scenes/SceneSelectedOptions.tsx index 4a3315767..b39d401b6 100644 --- a/ui/v2.5/src/components/Scenes/SceneSelectedOptions.tsx +++ b/ui/v2.5/src/components/Scenes/SceneSelectedOptions.tsx @@ -265,7 +265,9 @@ export const SceneSelectedOptions: React.FC = ( ) => setRating(event.currentTarget.value)} + onChange={(event: React.FormEvent) => + setRating(event.currentTarget.value) + } > {["", "1", "2", "3", "4", "5"].map(opt => (