diff --git a/go.mod b/go.mod index ecbeb8fba..9162b9040 100644 --- a/go.mod +++ b/go.mod @@ -12,7 +12,6 @@ require ( github.com/golang-migrate/migrate/v4 v4.3.1 github.com/gorilla/websocket v1.4.0 github.com/h2non/filetype v1.0.8 - github.com/inconshreveable/mousetrap v1.0.0 // indirect github.com/jmoiron/sqlx v1.2.0 github.com/mattn/go-sqlite3 v1.10.0 github.com/rs/cors v1.6.0 @@ -28,3 +27,5 @@ require ( ) replace git.apache.org/thrift.git => github.com/apache/thrift v0.0.0-20180902110319-2566ecd5d999 + +go 1.11 diff --git a/go.sum b/go.sum index 12943ceed..bf4e10dbe 100644 --- a/go.sum +++ b/go.sum @@ -258,6 +258,7 @@ github.com/gobuffalo/packr v1.15.0/go.mod h1:t5gXzEhIviQwVlNx/+3SfS07GS+cZ2hn76W github.com/gobuffalo/packr v1.15.1/go.mod h1:IeqicJ7jm8182yrVmNbM6PR4g79SjN9tZLH8KduZZwE= github.com/gobuffalo/packr v1.19.0/go.mod h1:MstrNkfCQhd5o+Ct4IJ0skWlxN8emOq8DsoT1G98VIU= github.com/gobuffalo/packr v1.20.0/go.mod h1:JDytk1t2gP+my1ig7iI4NcVaXr886+N0ecUga6884zw= +github.com/gobuffalo/packr v1.21.0 h1:p2ujcDJQp2QTiYWcI0ByHbr/gMoCouok6M0vXs/yTYQ= github.com/gobuffalo/packr v1.21.0/go.mod h1:H00jGfj1qFKxscFJSw8wcL4hpQtPe1PfU2wa6sg/SR0= github.com/gobuffalo/packr/v2 v2.0.0-rc.8/go.mod h1:y60QCdzwuMwO2R49fdQhsjCPv7tLQFR0ayzxxla9zes= github.com/gobuffalo/packr/v2 v2.0.0-rc.9/go.mod h1:fQqADRfZpEsgkc7c/K7aMew3n4aF1Kji7+lIZeR98Fc= diff --git a/ui/v2/src/components/Galleries/Gallery.tsx b/ui/v2/src/components/Galleries/Gallery.tsx index f5ea014e3..d1e8fe597 100644 --- a/ui/v2/src/components/Galleries/Gallery.tsx +++ b/ui/v2/src/components/Galleries/Gallery.tsx @@ -1,7 +1,6 @@ import { Spinner, } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent, useEffect, useState } from "react"; import * as GQL from "../../core/generated-graphql"; import { StashService } from "../../core/StashService"; @@ -20,7 +19,7 @@ export const Gallery: FunctionComponent = (props: IProps) => { setIsLoading(loading); if (!data || !data.findGallery || !!error) { return; } setGallery(data.findGallery); - }, [data]); + }, [data, loading, error]); if (!data || !data.findGallery || isLoading) { return ; } if (!!error) { return <>{error.message}; } diff --git a/ui/v2/src/components/Galleries/GalleryList.tsx b/ui/v2/src/components/Galleries/GalleryList.tsx index 6ba0f0fae..754382b55 100644 --- a/ui/v2/src/components/Galleries/GalleryList.tsx +++ b/ui/v2/src/components/Galleries/GalleryList.tsx @@ -1,5 +1,4 @@ import { HTMLTable } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent } from "react"; import { QueryHookResult } from "react-apollo-hooks"; import { Link } from "react-router-dom"; @@ -36,7 +35,7 @@ export const GalleryList: FunctionComponent = (props: IProps) => { - {gallery.files.length > 0 ? : undefined} + {gallery.files.length > 0 ? {gallery.title} : undefined} {gallery.path} diff --git a/ui/v2/src/components/Galleries/GalleryViewer.tsx b/ui/v2/src/components/Galleries/GalleryViewer.tsx index 5a1e7a3ef..55bc2e99d 100644 --- a/ui/v2/src/components/Galleries/GalleryViewer.tsx +++ b/ui/v2/src/components/Galleries/GalleryViewer.tsx @@ -1,4 +1,3 @@ -import _ from "lodash"; import React, { FunctionComponent, useState } from "react"; import Lightbox from "react-images"; import Gallery from "react-photo-gallery"; diff --git a/ui/v2/src/components/Settings/Settings.tsx b/ui/v2/src/components/Settings/Settings.tsx index 61f8294c9..453902aae 100644 --- a/ui/v2/src/components/Settings/Settings.tsx +++ b/ui/v2/src/components/Settings/Settings.tsx @@ -23,7 +23,7 @@ export const Settings: FunctionComponent = (props: IProps) => { const location = Object.assign({}, props.history.location); location.search = queryString.stringify({tab: tabId}, {encode: false}); props.history.replace(location); - }, [tabId]); + }, [tabId, props.history]); function getTabId(): TabId { const queryParams = queryString.parse(props.location.search); diff --git a/ui/v2/src/components/Settings/SettingsAboutPanel.tsx b/ui/v2/src/components/Settings/SettingsAboutPanel.tsx index e428ee62a..2020b8beb 100644 --- a/ui/v2/src/components/Settings/SettingsAboutPanel.tsx +++ b/ui/v2/src/components/Settings/SettingsAboutPanel.tsx @@ -1,15 +1,10 @@ import { Button, - H1, H4, - H6, HTMLTable, Spinner, - Tag, } from "@blueprintjs/core"; import React, { FunctionComponent } from "react"; -import * as GQL from "../../core/generated-graphql"; -import { TextUtils } from "../../utils/text"; import { StashService } from "../../core/StashService"; interface IProps { } @@ -93,7 +88,7 @@ export const SettingsAboutPanel: FunctionComponent = (props: IProps) => {!!error ? {error.message} : undefined} {!!errorLatest ? {errorLatest.message} : undefined} {renderVersion()} - {!dataLatest || loadingLatest || networkStatus == 4 ? : <>{renderLatestVersion()}} + {!dataLatest || loadingLatest || networkStatus === 4 ? : <>{renderLatestVersion()}} ); diff --git a/ui/v2/src/components/Settings/SettingsConfigurationPanel.tsx b/ui/v2/src/components/Settings/SettingsConfigurationPanel.tsx index bf52604b3..ce3de1c17 100644 --- a/ui/v2/src/components/Settings/SettingsConfigurationPanel.tsx +++ b/ui/v2/src/components/Settings/SettingsConfigurationPanel.tsx @@ -3,12 +3,9 @@ import { Button, Divider, FormGroup, - H1, H4, - H6, InputGroup, Spinner, - Tag, Checkbox, HTMLSelect, } from "@blueprintjs/core"; @@ -71,7 +68,7 @@ export const SettingsConfigurationPanel: FunctionComponent = (props: IPr setLogAccess(conf.general.logAccess); setExcludes(conf.general.excludes); } - }, [data]); + }, [data, error]); function onStashesChanged(directories: string[]) { setStashes(directories); diff --git a/ui/v2/src/components/Settings/SettingsInterfacePanel.tsx b/ui/v2/src/components/Settings/SettingsInterfacePanel.tsx index 3fef846ca..44656ef2e 100644 --- a/ui/v2/src/components/Settings/SettingsInterfacePanel.tsx +++ b/ui/v2/src/components/Settings/SettingsInterfacePanel.tsx @@ -8,7 +8,6 @@ import { TextArea, NumericInput } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent, useEffect, useState } from "react"; import { StashService } from "../../core/StashService"; import { ErrorUtils } from "../../utils/errors"; @@ -48,7 +47,7 @@ export const SettingsInterfacePanel: FunctionComponent = () => { setCSS(config.data.configuration.interface.css || ""); setCSSEnabled(config.data.configuration.interface.cssEnabled || false); } - }, [config.data]); + }, [config.data, config.error]); async function onSave() { try { diff --git a/ui/v2/src/components/Settings/SettingsLogsPanel.tsx b/ui/v2/src/components/Settings/SettingsLogsPanel.tsx index 0f3a72337..946485f5b 100644 --- a/ui/v2/src/components/Settings/SettingsLogsPanel.tsx +++ b/ui/v2/src/components/Settings/SettingsLogsPanel.tsx @@ -155,7 +155,7 @@ export const SettingsLogsPanel: FunctionComponent = (props: IProps) => { const logLevels = ["Debug", "Info", "Warning", "Error"]; function filterByLogLevel(logEntry : LogEntry) { - if (logLevel == "Debug") { + if (logLevel === "Debug") { return true; } diff --git a/ui/v2/src/components/Settings/SettingsTasksPanel/SettingsTasksPanel.tsx b/ui/v2/src/components/Settings/SettingsTasksPanel/SettingsTasksPanel.tsx index cdebb5a71..16e3dab89 100644 --- a/ui/v2/src/components/Settings/SettingsTasksPanel/SettingsTasksPanel.tsx +++ b/ui/v2/src/components/Settings/SettingsTasksPanel/SettingsTasksPanel.tsx @@ -5,7 +5,6 @@ import { Divider, FormGroup, H4, - AnchorButton, ProgressBar, H5, } from "@blueprintjs/core"; diff --git a/ui/v2/src/components/Shared/DetailsEditNavbar.tsx b/ui/v2/src/components/Shared/DetailsEditNavbar.tsx index 8ba1f1628..6a58c197c 100644 --- a/ui/v2/src/components/Shared/DetailsEditNavbar.tsx +++ b/ui/v2/src/components/Shared/DetailsEditNavbar.tsx @@ -8,7 +8,6 @@ import { NavbarDivider, Popover, } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent, useState } from "react"; import { Link } from "react-router-dom"; import * as GQL from "../../core/generated-graphql"; diff --git a/ui/v2/src/components/Shared/DurationInput.tsx b/ui/v2/src/components/Shared/DurationInput.tsx index cdd32f9db..2778bc53f 100644 --- a/ui/v2/src/components/Shared/DurationInput.tsx +++ b/ui/v2/src/components/Shared/DurationInput.tsx @@ -1,5 +1,5 @@ import React, { FunctionComponent, useState, useEffect } from "react"; -import { InputGroup, ButtonGroup, Button, IInputGroupProps, HTMLInputProps, ControlGroup } from "@blueprintjs/core"; +import { InputGroup, ButtonGroup, Button, HTMLInputProps, ControlGroup } from "@blueprintjs/core"; import { DurationUtils } from "../../utils/duration"; import { FIXED, NUMERIC_INPUT } from "@blueprintjs/core/lib/esm/common/classes"; diff --git a/ui/v2/src/components/Shared/FolderSelect/FolderSelect.tsx b/ui/v2/src/components/Shared/FolderSelect/FolderSelect.tsx index 67b8bd6b7..cc4dd7711 100644 --- a/ui/v2/src/components/Shared/FolderSelect/FolderSelect.tsx +++ b/ui/v2/src/components/Shared/FolderSelect/FolderSelect.tsx @@ -6,7 +6,6 @@ import { Spinner, FormGroup, } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent, useEffect, useState } from "react"; import { StashService } from "../../../core/StashService"; @@ -29,7 +28,7 @@ export const FolderSelect: FunctionComponent = (props: IProps) => { useEffect(() => { if (!data || !data.directories || !!error) { return; } setSelectableDirectories(StashService.nullToUndefined(data.directories)); - }, [data]); + }, [data, error]); function onSelectDirectory() { selectedDirectories.push(currentDirectory); @@ -79,7 +78,7 @@ export const FolderSelect: FunctionComponent = (props: IProps) => { {renderDialog()} {selectedDirectories.map((path) => { - return ; + return
{path}
; })}
diff --git a/ui/v2/src/components/Shared/TagLink.tsx b/ui/v2/src/components/Shared/TagLink.tsx index f6a1531d6..946aa11a0 100644 --- a/ui/v2/src/components/Shared/TagLink.tsx +++ b/ui/v2/src/components/Shared/TagLink.tsx @@ -2,7 +2,6 @@ import { ITagProps, Tag, } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent } from "react"; import { Link } from "react-router-dom"; import { PerformerDataFragment, SceneMarkerDataFragment, TagDataFragment } from "../../core/generated-graphql"; diff --git a/ui/v2/src/components/Sidebar.tsx b/ui/v2/src/components/Sidebar.tsx index 63ba8c500..f95b2b92a 100644 --- a/ui/v2/src/components/Sidebar.tsx +++ b/ui/v2/src/components/Sidebar.tsx @@ -1,7 +1,6 @@ import { MenuItem, Menu, - IconName, } from "@blueprintjs/core"; import React, { FunctionComponent } from "react"; import { IMenuItem } from "../App"; diff --git a/ui/v2/src/components/Stats.tsx b/ui/v2/src/components/Stats.tsx index bca208438..1ee0aa4bb 100644 --- a/ui/v2/src/components/Stats.tsx +++ b/ui/v2/src/components/Stats.tsx @@ -1,4 +1,4 @@ -import { H1, Spinner } from "@blueprintjs/core"; +import { Spinner } from "@blueprintjs/core"; import React, { FunctionComponent } from "react"; import { StashService } from "../core/StashService"; diff --git a/ui/v2/src/components/Studios/StudioDetails/Studio.tsx b/ui/v2/src/components/Studios/StudioDetails/Studio.tsx index 2673b2705..2f0edd4fb 100644 --- a/ui/v2/src/components/Studios/StudioDetails/Studio.tsx +++ b/ui/v2/src/components/Studios/StudioDetails/Studio.tsx @@ -1,13 +1,8 @@ import { - Button, - Classes, - Dialog, EditableText, - HTMLSelect, HTMLTable, Spinner, } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent, useEffect, useState } from "react"; import * as GQL from "../../../core/generated-graphql"; import { StashService } from "../../../core/StashService"; @@ -52,7 +47,7 @@ export const Studio: FunctionComponent = (props: IProps) => { setIsLoading(loading); if (!data || !data.findStudio || !!error) { return; } setStudio(data.findStudio); - }, [data]); + }, [data, loading, error]); useEffect(() => { setImagePreview(studio.image_path); @@ -61,7 +56,7 @@ export const Studio: FunctionComponent = (props: IProps) => { if (!isNew) { setIsEditing(false); } - }, [studio]); + }, [studio, isNew]); function onImageLoad(this: FileReader) { setImagePreview(this.result as string); @@ -120,7 +115,7 @@ export const Studio: FunctionComponent = (props: IProps) => { async function onDelete() { setIsLoading(true); try { - const result = await deleteStudio(); + await deleteStudio(); } catch (e) { ErrorUtils.handle(e); } @@ -139,7 +134,7 @@ export const Studio: FunctionComponent = (props: IProps) => { <>
- + {name}
= (props: IProps) => { setIsLoading(loading); if (!data || !data.allTags || !!error) { return; } setTags(data.allTags); - }, [data]); + }, [data, loading, error]); useEffect(() => { if (!!editingTag) { diff --git a/ui/v2/src/components/Wall/WallItem.tsx b/ui/v2/src/components/Wall/WallItem.tsx index b7c3c7a64..7fe3cc730 100644 --- a/ui/v2/src/components/Wall/WallItem.tsx +++ b/ui/v2/src/components/Wall/WallItem.tsx @@ -116,7 +116,7 @@ export const WallItem: FunctionComponent = (props: IWallItemProp loop={true} ref={videoHoverHook.videoEl} /> - previewNotFound()} /> + {title} previewNotFound()} /> {showTextContainer ?
diff --git a/ui/v2/src/components/Wall/WallPanel.tsx b/ui/v2/src/components/Wall/WallPanel.tsx index df466f727..7705535bc 100644 --- a/ui/v2/src/components/Wall/WallPanel.tsx +++ b/ui/v2/src/components/Wall/WallPanel.tsx @@ -1,4 +1,3 @@ -import _ from "lodash"; import React, { FunctionComponent, useState } from "react"; import * as GQL from "../../core/generated-graphql"; import "./Wall.scss"; diff --git a/ui/v2/src/components/list/ListFilter.tsx b/ui/v2/src/components/list/ListFilter.tsx index 9524ea896..47a9394c6 100644 --- a/ui/v2/src/components/list/ListFilter.tsx +++ b/ui/v2/src/components/list/ListFilter.tsx @@ -11,7 +11,7 @@ import { Slider, } from "@blueprintjs/core"; import { debounce } from "lodash"; -import React, { FunctionComponent, SyntheticEvent, useEffect, useState } from "react"; +import React, { FunctionComponent, SyntheticEvent, useState } from "react"; import { Criterion } from "../../models/list-filter/criteria/criterion"; import { ListFilterModel } from "../../models/list-filter/filter"; import { DisplayMode } from "../../models/list-filter/types"; @@ -41,22 +41,18 @@ interface IListFilterProps { const PAGE_SIZE_OPTIONS = ["20", "40", "60", "120"]; export const ListFilter: FunctionComponent = (props: IListFilterProps) => { - let searchCallback: any; - const [editingCriterion, setEditingCriterion] = useState(undefined); - useEffect(() => { - searchCallback = debounce((event: any) => { - props.onChangeQuery(event.target.value); - }, 500); - }); - function onChangePageSize(event: SyntheticEvent) { const val = event!.currentTarget!.value; props.onChangePageSize(parseInt(val, 10)); } function onChangeQuery(event: SyntheticEvent) { + let searchCallback = debounce((event: any) => { + props.onChangeQuery(event.target.value); + }, 500); + event.persist(); searchCallback(event); } diff --git a/ui/v2/src/components/performers/PerformerDetails/Performer.tsx b/ui/v2/src/components/performers/PerformerDetails/Performer.tsx index 41d777add..8dc38c275 100644 --- a/ui/v2/src/components/performers/PerformerDetails/Performer.tsx +++ b/ui/v2/src/components/performers/PerformerDetails/Performer.tsx @@ -6,7 +6,6 @@ import { AnchorButton, IconName, } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent, useEffect, useState } from "react"; import * as GQL from "../../../core/generated-graphql"; import { StashService } from "../../../core/StashService"; @@ -40,7 +39,7 @@ export const Performer: FunctionComponent = (props: IPerformerP setIsLoading(loading); if (!data || !data.findPerformer || !!error) { return; } setPerformer(data.findPerformer); - }, [data]); + }, [data, error, loading]); useEffect(() => { setImagePreview(performer.image_path); @@ -191,7 +190,7 @@ export const Performer: FunctionComponent = (props: IPerformerP return (
- + {!imagePreview ? undefined : Performer}
{renderTabs()} @@ -218,7 +217,7 @@ export const Performer: FunctionComponent = (props: IPerformerP <>
- + {performer.name}

diff --git a/ui/v2/src/components/performers/PerformerDetails/PerformerDetailsPanel.tsx b/ui/v2/src/components/performers/PerformerDetails/PerformerDetailsPanel.tsx index 721b13fe5..ef7835446 100644 --- a/ui/v2/src/components/performers/PerformerDetails/PerformerDetailsPanel.tsx +++ b/ui/v2/src/components/performers/PerformerDetails/PerformerDetailsPanel.tsx @@ -2,10 +2,8 @@ import { Button, Classes, Dialog, - EditableText, HTMLTable, Spinner, - FormGroup, Menu, MenuItem, Popover, @@ -19,7 +17,6 @@ import { StashService } from "../../../core/StashService"; import { ErrorUtils } from "../../../utils/errors"; import { TableUtils } from "../../../utils/table"; import { ScrapePerformerSuggest } from "../../select/ScrapePerformerSuggest"; -import { ToastUtils } from "../../../utils/toasts"; import { EditableTextUtils } from "../../../utils/editabletext"; import { ImageUtils } from "../../../utils/image"; diff --git a/ui/v2/src/components/performers/PerformerDetails/PerformerOperationsPanel.tsx b/ui/v2/src/components/performers/PerformerDetails/PerformerOperationsPanel.tsx index 84733ac84..858d73791 100644 --- a/ui/v2/src/components/performers/PerformerDetails/PerformerOperationsPanel.tsx +++ b/ui/v2/src/components/performers/PerformerDetails/PerformerOperationsPanel.tsx @@ -1,7 +1,6 @@ import { Button, } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent } from "react"; import * as GQL from "../../../core/generated-graphql"; import { StashService } from "../../../core/StashService"; diff --git a/ui/v2/src/components/performers/PerformerDetails/PerformerScenesPanel.tsx b/ui/v2/src/components/performers/PerformerDetails/PerformerScenesPanel.tsx index b58b95c12..621e87996 100644 --- a/ui/v2/src/components/performers/PerformerDetails/PerformerScenesPanel.tsx +++ b/ui/v2/src/components/performers/PerformerDetails/PerformerScenesPanel.tsx @@ -1,4 +1,3 @@ -import _ from "lodash"; import React, { FunctionComponent } from "react"; import * as GQL from "../../../core/generated-graphql"; import { IBaseProps } from "../../../models"; diff --git a/ui/v2/src/components/scenes/SceneCard.tsx b/ui/v2/src/components/scenes/SceneCard.tsx index 9ff938324..f259a3b61 100644 --- a/ui/v2/src/components/scenes/SceneCard.tsx +++ b/ui/v2/src/components/scenes/SceneCard.tsx @@ -7,16 +7,14 @@ import { Elevation, H4, Popover, - Tag, } from "@blueprintjs/core"; -import React, { FunctionComponent, RefObject, useEffect, useRef, useState } from "react"; +import React, { FunctionComponent, useState } from "react"; import { Link } from "react-router-dom"; import * as GQL from "../../core/generated-graphql"; import { VideoHoverHook } from "../../hooks/VideoHover"; import { ColorUtils } from "../../utils/color"; import { TextUtils } from "../../utils/text"; import { TagLink } from "../Shared/TagLink"; -import { SceneHelpers } from "./helpers"; import { ZoomUtils } from "../../utils/zoom"; import { StashService } from "../../core/StashService"; diff --git a/ui/v2/src/components/scenes/SceneDetails/Scene.tsx b/ui/v2/src/components/scenes/SceneDetails/Scene.tsx index 38a9b5f55..a298fb787 100644 --- a/ui/v2/src/components/scenes/SceneDetails/Scene.tsx +++ b/ui/v2/src/components/scenes/SceneDetails/Scene.tsx @@ -30,7 +30,7 @@ export const Scene: FunctionComponent = (props: ISceneProps) => { setIsLoading(loading); if (!data || !data.findScene || !!error) { return; } setScene(StashService.nullToUndefined(data.findScene)); - }, [data]); + }, [data, loading, error]); useEffect(() => { const queryParams = queryString.parse(props.location.search); @@ -41,7 +41,7 @@ export const Scene: FunctionComponent = (props: ISceneProps) => { if (queryParams.autoplay && typeof queryParams.autoplay === "string") { setAutoplay(queryParams.autoplay === "true"); } - }); + }, [props.location.search, timestamp]); function onClickMarker(marker: GQL.SceneMarkerDataFragment) { setTimestamp(marker.seconds); diff --git a/ui/v2/src/components/scenes/SceneDetails/SceneDetailPanel.tsx b/ui/v2/src/components/scenes/SceneDetails/SceneDetailPanel.tsx index 0fe32a6b2..b9f17eca8 100644 --- a/ui/v2/src/components/scenes/SceneDetails/SceneDetailPanel.tsx +++ b/ui/v2/src/components/scenes/SceneDetails/SceneDetailPanel.tsx @@ -2,12 +2,9 @@ import { H1, H4, H6, - Tag, } from "@blueprintjs/core"; import React, { FunctionComponent } from "react"; -import { Link } from "react-router-dom"; import * as GQL from "../../../core/generated-graphql"; -import { NavigationUtils } from "../../../utils/navigation"; import { TextUtils } from "../../../utils/text"; import { TagLink } from "../../Shared/TagLink"; import { SceneHelpers } from "../helpers"; diff --git a/ui/v2/src/components/scenes/SceneDetails/SceneEditPanel.tsx b/ui/v2/src/components/scenes/SceneDetails/SceneEditPanel.tsx index 0f904f8bc..814d70d96 100644 --- a/ui/v2/src/components/scenes/SceneDetails/SceneEditPanel.tsx +++ b/ui/v2/src/components/scenes/SceneDetails/SceneEditPanel.tsx @@ -15,7 +15,6 @@ import { Popover, MenuItem, } from "@blueprintjs/core"; -import _ from "lodash"; import React, { FunctionComponent, useEffect, useState } from "react"; import * as GQL from "../../../core/generated-graphql"; import { StashService } from "../../../core/StashService"; @@ -229,7 +228,7 @@ export const SceneEditPanel: FunctionComponent = (props: IProps) => { } function renderScraperMenu() { - if (!queryableScrapers || queryableScrapers.length == 0) { + if (!queryableScrapers || queryableScrapers.length === 0) { return; } @@ -272,7 +271,7 @@ export const SceneEditPanel: FunctionComponent = (props: IProps) => { setStudioId(scene.studio.id); } - if ((!performerIds || performerIds.length == 0) && scene.performers && scene.performers.length > 0) { + if ((!performerIds || performerIds.length === 0) && scene.performers && scene.performers.length > 0) { let idPerfs = scene.performers.filter((p) => { return p.id !== undefined && p.id !== null; }); @@ -283,7 +282,7 @@ export const SceneEditPanel: FunctionComponent = (props: IProps) => { } } - if ((!tagIds || tagIds.length == 0) && scene.tags && scene.tags.length > 0) { + if ((!tagIds || tagIds.length === 0) && scene.tags && scene.tags.length > 0) { let idTags = scene.tags.filter((p) => { return p.id !== undefined && p.id !== null; }); @@ -395,7 +394,7 @@ export const SceneEditPanel: FunctionComponent = (props: IProps) => { Cover Image - + Scene cover

diff --git a/ui/v2/src/components/scenes/SceneDetails/SceneMarkersPanel.tsx b/ui/v2/src/components/scenes/SceneDetails/SceneMarkersPanel.tsx index 217282cd0..87de6fbb6 100644 --- a/ui/v2/src/components/scenes/SceneDetails/SceneMarkersPanel.tsx +++ b/ui/v2/src/components/scenes/SceneDetails/SceneMarkersPanel.tsx @@ -5,7 +5,6 @@ import { Divider, FormGroup, H3, - NumericInput, Tag, } from "@blueprintjs/core"; import { Field, FieldProps, Form, Formik, FormikActions, FormikProps } from "formik"; @@ -63,8 +62,8 @@ export const SceneMarkersPanel: FunctionComponent = (pr
- onClickMarker(marker)}>{marker.title} - {!isEditorOpen ? onOpenEditor(marker)}>Edit : undefined} + + {!isEditorOpen ? : undefined}
{TextUtils.secondsToTimestamp(marker.seconds)} diff --git a/ui/v2/src/components/scenes/SceneFilenameParser.tsx b/ui/v2/src/components/scenes/SceneFilenameParser.tsx index 343bd477b..d87fb4efa 100644 --- a/ui/v2/src/components/scenes/SceneFilenameParser.tsx +++ b/ui/v2/src/components/scenes/SceneFilenameParser.tsx @@ -14,7 +14,7 @@ import { Tree, ITreeNode, } from "@blueprintjs/core"; -import React, { FunctionComponent, useEffect, useState, useRef } from "react"; +import React, { FunctionComponent, useEffect, useState } from "react"; import { IBaseProps } from "../../models"; import { StashService } from "../../core/StashService"; import * as GQL from "../../core/generated-graphql"; @@ -449,19 +449,19 @@ export const SceneFilenameParser: FunctionComponent = (props: IProps) => return !r.studioId.set; }); - if (newAllTitleSet != allTitleSet) { + if (newAllTitleSet !== allTitleSet) { setAllTitleSet(newAllTitleSet); } - if (newAllDateSet != allDateSet) { + if (newAllDateSet !== allDateSet) { setAllDateSet(newAllDateSet); } - if (newAllPerformerSet != allPerformerSet) { + if (newAllPerformerSet !== allPerformerSet) { setAllTagSet(newAllPerformerSet); } - if (newAllTagSet != allTagSet) { + if (newAllTagSet !== allTagSet) { setAllTagSet(newAllTagSet); } - if (newAllStudioSet != allStudioSet) { + if (newAllStudioSet !== allStudioSet) { setAllStudioSet(newAllStudioSet); } }, [parserResult]); @@ -1071,7 +1071,7 @@ export const SceneFilenameParser: FunctionComponent = (props: IProps) => } function renderTable() { - if (parserResult.length == 0) { return undefined; } + if (parserResult.length === 0) { return undefined; } return ( <> diff --git a/ui/v2/src/components/scenes/SceneListPage.tsx b/ui/v2/src/components/scenes/SceneListPage.tsx index 6f181ae9a..e23c1d066 100644 --- a/ui/v2/src/components/scenes/SceneListPage.tsx +++ b/ui/v2/src/components/scenes/SceneListPage.tsx @@ -1,4 +1,3 @@ -import _ from "lodash"; import React, { FunctionComponent } from "react"; import { IBaseProps } from "../../models/base-props"; import { SceneList } from "./SceneList"; diff --git a/ui/v2/src/components/scenes/ScenePlayer/ScenePlayer.tsx b/ui/v2/src/components/scenes/ScenePlayer/ScenePlayer.tsx index 8ec696a87..5a5f9c248 100644 --- a/ui/v2/src/components/scenes/ScenePlayer/ScenePlayer.tsx +++ b/ui/v2/src/components/scenes/ScenePlayer/ScenePlayer.tsx @@ -1,5 +1,5 @@ import { Hotkey, Hotkeys, HotkeysTarget } from "@blueprintjs/core"; -import React, { Component, FunctionComponent } from "react"; +import React, { FunctionComponent } from "react"; import ReactJWPlayer from "react-jw-player"; import * as GQL from "../../../core/generated-graphql"; import { SceneHelpers } from "../helpers"; diff --git a/ui/v2/src/components/scenes/ScenePlayer/ScenePlayerScrubber.tsx b/ui/v2/src/components/scenes/ScenePlayer/ScenePlayerScrubber.tsx index e524b6194..aef0a5c93 100644 --- a/ui/v2/src/components/scenes/ScenePlayer/ScenePlayerScrubber.tsx +++ b/ui/v2/src/components/scenes/ScenePlayer/ScenePlayerScrubber.tsx @@ -1,5 +1,5 @@ import axios from "axios"; -import React, { CSSProperties, FunctionComponent, RefObject, useEffect, useRef, useState } from "react"; +import React, { CSSProperties, FunctionComponent, useEffect, useRef, useState } from "react"; import * as GQL from "../../../core/generated-graphql"; import { TextUtils } from "../../../utils/text"; import "./ScenePlayerScrubber.scss"; @@ -55,7 +55,6 @@ export const ScenePlayerScrubber: FunctionComponent = } const [spriteItems, setSpriteItems] = useState([]); - const [delayedRender, setDelayedRender] = useState(false); useEffect(() => { if (!scrubberSliderEl.current) { return; } @@ -63,6 +62,47 @@ export const ScenePlayerScrubber: FunctionComponent = }, [scrubberSliderEl]); useEffect(() => { + async function fetchSpriteInfo() { + if (!props.scene || !props.scene.paths.vtt) { return; } + + const response = await axios.get(props.scene.paths.vtt, {responseType: "text"}); + if (response.status !== 200) { + console.log(response.statusText); + } + + // TODO: This is gnarly + const lines = response.data.split("\n"); + if (lines.shift() !== "WEBVTT") { return; } + if (lines.shift() !== "") { return; } + let item: ISceneSpriteItem = {start: 0, end: 0, x: 0, y: 0, w: 0, h: 0}; + const newSpriteItems: ISceneSpriteItem[] = []; + while (lines.length) { + const line = lines.shift(); + if (line === undefined) { continue; } + + if (line.includes("#") && line.includes("=") && line.includes(",")) { + const size = line.split("#")[1].split("=")[1].split(","); + item.x = Number(size[0]); + item.y = Number(size[1]); + item.w = Number(size[2]); + item.h = Number(size[3]); + + newSpriteItems.push(item); + item = {start: 0, end: 0, x: 0, y: 0, w: 0, h: 0}; + } else if (line.includes(" --> ")) { + const times = line.split(" --> "); + + const start = times[0].split(":"); + item.start = (+start[0]) * 60 * 60 + (+start[1]) * 60 + (+start[2]); + + const end = times[1].split(":"); + item.end = (+end[0]) * 60 * 60 + (+end[1]) * 60 + (+end[2]); + } + } + + setSpriteItems(newSpriteItems); + } + fetchSpriteInfo(); }, [props.scene]); @@ -77,30 +117,20 @@ export const ScenePlayerScrubber: FunctionComponent = }, [props.position]); useEffect(() => { + let element = contentEl.current; + if (!element) { return; } + element.addEventListener("mousedown", onMouseDown, false); + element.addEventListener("mousemove", onMouseMove, false); window.addEventListener("mouseup", onMouseUp, false); + return () => { + if (!element) { return; } + element.removeEventListener("mousedown", onMouseDown); + element.removeEventListener("mousemove", onMouseMove); window.removeEventListener("mouseup", onMouseUp); }; }); - useEffect(() => { - if (!contentEl.current) { return; } - contentEl.current.addEventListener("mousedown", onMouseDown, false); - return () => { - if (!contentEl.current) { return; } - contentEl.current.removeEventListener("mousedown", onMouseDown); - }; - }); - - useEffect(() => { - if (!contentEl.current) { return; } - contentEl.current.addEventListener("mousemove", onMouseMove, false); - return () => { - if (!contentEl.current) { return; } - contentEl.current.removeEventListener("mousemove", onMouseMove); - }; - }); - function onMouseUp(this: Window, event: MouseEvent) { if (!startMouseEvent.current || !scrubberSliderEl.current) { return; } mouseDown.current = false; @@ -170,51 +200,6 @@ export const ScenePlayerScrubber: FunctionComponent = setPosition(newPosition); } - async function fetchSpriteInfo() { - if (!props.scene || !props.scene.paths.vtt) { return; } - - const response = await axios.get(props.scene.paths.vtt, {responseType: "text"}); - if (response.status !== 200) { - console.log(response.statusText); - } - - // TODO: This is gnarly - const lines = response.data.split("\n"); - if (lines.shift() !== "WEBVTT") { return; } - if (lines.shift() !== "") { return; } - let item: ISceneSpriteItem = {start: 0, end: 0, x: 0, y: 0, w: 0, h: 0}; - const newSpriteItems: ISceneSpriteItem[] = []; - while (lines.length) { - const line = lines.shift(); - if (line === undefined) { continue; } - - if (line.includes("#") && line.includes("=") && line.includes(",")) { - const size = line.split("#")[1].split("=")[1].split(","); - item.x = Number(size[0]); - item.y = Number(size[1]); - item.w = Number(size[2]); - item.h = Number(size[3]); - - newSpriteItems.push(item); - item = {start: 0, end: 0, x: 0, y: 0, w: 0, h: 0}; - } else if (line.includes(" --> ")) { - const times = line.split(" --> "); - - const start = times[0].split(":"); - item.start = (+start[0]) * 60 * 60 + (+start[1]) * 60 + (+start[2]); - - const end = times[1].split(":"); - item.end = (+end[0]) * 60 * 60 + (+end[1]) * 60 + (+end[2]); - } - } - - setSpriteItems(newSpriteItems); - // TODO: Very hacky. Need to wait for the scroll width to update from the image loading. - setTimeout(() => { - setDelayedRender(true); - }, 100); - } - function renderTags() { function getTagStyle(i: number): CSSProperties { if (!scrubberSliderEl.current || @@ -296,7 +281,7 @@ export const ScenePlayerScrubber: FunctionComponent = return (
- goBack()}>< +
@@ -310,7 +295,7 @@ export const ScenePlayerScrubber: FunctionComponent =
- goForward()}>> +
); }; diff --git a/ui/v2/src/components/scenes/SceneSelectedOptions.tsx b/ui/v2/src/components/scenes/SceneSelectedOptions.tsx index 037bb78d4..35a28d2eb 100644 --- a/ui/v2/src/components/scenes/SceneSelectedOptions.tsx +++ b/ui/v2/src/components/scenes/SceneSelectedOptions.tsx @@ -1,19 +1,12 @@ import _ from "lodash"; import { - AnchorButton, Button, ButtonGroup, - ControlGroup, FormGroup, HTMLSelect, - InputGroup, - Menu, - MenuItem, - Popover, Spinner, - Tag, } from "@blueprintjs/core"; -import React, { FunctionComponent, SyntheticEvent, useEffect, useRef, useState } from "react"; +import React, { FunctionComponent, useEffect, useState } from "react"; import { FilterSelect } from "../select/FilterSelect"; import { FilterMultiSelect } from "../select/FilterMultiSelect"; import { StashService } from "../../core/StashService"; @@ -106,7 +99,7 @@ export const SceneSelectedOptions: FunctionComponent = (pro async function onSave() { setIsLoading(true); try { - const result = await updateScenes(); + await updateScenes(); ToastUtils.success("Updated scenes"); } catch (e) { ErrorUtils.handle(e); @@ -143,7 +136,7 @@ export const SceneSelectedOptions: FunctionComponent = (pro first = false; } else { var studioId = scene.studio ? scene.studio.id : undefined; - if (ret != studioId) { + if (ret !== studioId) { ret = undefined; } } @@ -221,7 +214,7 @@ export const SceneSelectedOptions: FunctionComponent = (pro if (rating !== thisRating) { rating = ""; } - if (studioId != thisStudio) { + if (studioId !== thisStudio) { studioId = undefined; } const perfIds = !!scene.performers ? scene.performers.map(toId).sort() : []; diff --git a/ui/v2/src/components/select/FilterMultiSelect.tsx b/ui/v2/src/components/select/FilterMultiSelect.tsx index a5c8d7462..3145e19fa 100644 --- a/ui/v2/src/components/select/FilterMultiSelect.tsx +++ b/ui/v2/src/components/select/FilterMultiSelect.tsx @@ -120,7 +120,7 @@ export const FilterMultiSelect: React.FunctionComponent = (props: IProps break; } default: { - throw "Unhandled case in FilterMultiSelect"; + throw new Error("Unhandled case in FilterMultiSelect"); } } diff --git a/ui/v2/src/components/select/FilterSelect.tsx b/ui/v2/src/components/select/FilterSelect.tsx index b906667db..bb3e6d3dd 100644 --- a/ui/v2/src/components/select/FilterSelect.tsx +++ b/ui/v2/src/components/select/FilterSelect.tsx @@ -91,7 +91,7 @@ export const FilterSelect: React.FunctionComponent = (props: IProps) => }; function onItemSelect(item: ValidTypes | undefined) { - if (item && item.id == "0") { + if (item && item.id === "0") { item = undefined; } diff --git a/ui/v2/src/components/select/ScrapePerformerSuggest.tsx b/ui/v2/src/components/select/ScrapePerformerSuggest.tsx index c9fa3fc92..183d8f456 100644 --- a/ui/v2/src/components/select/ScrapePerformerSuggest.tsx +++ b/ui/v2/src/components/select/ScrapePerformerSuggest.tsx @@ -1,7 +1,7 @@ import * as React from "react"; import { MenuItem } from "@blueprintjs/core"; -import { ItemPredicate, ItemRenderer, Suggest } from "@blueprintjs/select"; +import { ItemRenderer, Suggest } from "@blueprintjs/select"; import * as GQL from "../../core/generated-graphql"; import { StashService } from "../../core/StashService"; import { HTMLInputProps } from "../../models"; diff --git a/ui/v2/src/components/select/ValidGalleriesSelect.tsx b/ui/v2/src/components/select/ValidGalleriesSelect.tsx index 1c3c140df..b00dd9bee 100644 --- a/ui/v2/src/components/select/ValidGalleriesSelect.tsx +++ b/ui/v2/src/components/select/ValidGalleriesSelect.tsx @@ -50,7 +50,7 @@ export const ValidGalleriesSelect: React.FunctionComponent = (props: IPr }; function onItemSelect(item: GQL.ValidGalleriesForSceneValidGalleriesForScene | undefined) { - if (item && item.id == "0") { + if (item && item.id === "0") { item = undefined; } diff --git a/ui/v2/src/index.scss b/ui/v2/src/index.scss index d24ae87b8..ae75d3808 100755 --- a/ui/v2/src/index.scss +++ b/ui/v2/src/index.scss @@ -280,6 +280,28 @@ video.preview.portrait { } } +.button-link { + background-color: transparent; + color: #48aff0; + border-width: 0; + cursor: pointer; + display: inline; + padding: 0; +} + +.button-link:hover { + text-decoration: underline; +} + +.scrubber-button { + background-color: transparent; + color: #48aff0; +} + +.scrubber-button:hover { + text-decoration: underline; +} + #jwplayer-container { margin: 10px auto; width: 75%; diff --git a/ui/v2/src/utils/duration.ts b/ui/v2/src/utils/duration.ts index 975a4667e..a79ec33f0 100644 --- a/ui/v2/src/utils/duration.ts +++ b/ui/v2/src/utils/duration.ts @@ -30,7 +30,7 @@ export class DurationUtils { let factor = 1; while(splits.length > 0) { let thisSplit = splits.pop(); - if (thisSplit == undefined) { + if (thisSplit === undefined) { return 0; } diff --git a/ui/v2/src/utils/image.tsx b/ui/v2/src/utils/image.tsx index bb6352e39..7b04b3321 100644 --- a/ui/v2/src/utils/image.tsx +++ b/ui/v2/src/utils/image.tsx @@ -15,7 +15,7 @@ export class ImageUtils { } public static pasteImage(e : any, onLoadEnd: (this: FileReader) => any) { - if (e.clipboardData.files.length == 0) { + if (e.clipboardData.files.length === 0) { return; } diff --git a/ui/v2/src/utils/table.tsx b/ui/v2/src/utils/table.tsx index 402561837..9238754ec 100644 --- a/ui/v2/src/utils/table.tsx +++ b/ui/v2/src/utils/table.tsx @@ -1,4 +1,4 @@ -import { EditableText, HTMLSelect, InputGroup, IOptionProps, TextArea } from "@blueprintjs/core"; +import { EditableText, IOptionProps } from "@blueprintjs/core"; import React from "react"; import { EditableTextUtils } from "./editabletext"; import { FilterMultiSelect } from "../components/select/FilterMultiSelect"; diff --git a/ui/v2/src/utils/text.ts b/ui/v2/src/utils/text.ts index 0f468c198..7accec252 100644 --- a/ui/v2/src/utils/text.ts +++ b/ui/v2/src/utils/text.ts @@ -33,7 +33,7 @@ export class TextUtils { public static fileNameFromPath(path: string): string { if (!!path === false) { return "No File Name"; } - return path.replace(/^.*[\\\/]/, ""); + return path.replace(/^.*[\\/]/, ""); } public static age(dateString?: string, fromDateString?: string): number {