diff --git a/ui/v2.5/.eslintrc.json b/ui/v2.5/.eslintrc.json index 15855b8ec..6a0c9d332 100644 --- a/ui/v2.5/.eslintrc.json +++ b/ui/v2.5/.eslintrc.json @@ -36,6 +36,14 @@ "spaced-comment": ["error", "always", { "markers": ["/"] }], - "max-classes-per-file": "off" + "max-classes-per-file": "off", + "no-plusplus": "off", + "prefer-destructuring": ["error", {"object": true, "array": false}], + "default-case": "off", + "consistent-return": "off", + "@typescript-eslint/no-use-before-define": ["error", { "functions": false, "classes": true }], + "no-underscore-dangle": "off", + "no-nested-ternary": "off", + "jsx-a11y/media-has-caption": "off" } } diff --git a/ui/v2.5/src/App.tsx b/ui/v2.5/src/App.tsx index 4b4b1a6e9..921917665 100755 --- a/ui/v2.5/src/App.tsx +++ b/ui/v2.5/src/App.tsx @@ -1,5 +1,8 @@ import React from "react"; import { Route, Switch } from "react-router-dom"; +import { ToastProvider } from 'src/hooks/Toast'; +import { library } from '@fortawesome/fontawesome-svg-core' +import { fas } from '@fortawesome/free-solid-svg-icons' import { ErrorBoundary } from "./components/ErrorBoundary"; import Galleries from "./components/Galleries/Galleries"; import { MainNavbar } from "./components/MainNavbar"; @@ -11,10 +14,7 @@ import { Stats } from "./components/Stats"; import Studios from "./components/Studios/Studios"; import Tags from "./components/Tags/Tags"; import { SceneFilenameParser } from "./components/scenes/SceneFilenameParser"; -import { ToastProvider } from 'src/hooks/Toast'; -import { library } from '@fortawesome/fontawesome-svg-core' -import { fas } from '@fortawesome/free-solid-svg-icons' import 'bootstrap/dist/css/bootstrap.min.css'; @@ -27,7 +27,7 @@ export const App: React.FC = () => (
- + {/* */} diff --git a/ui/v2.5/src/components/Galleries/Galleries.tsx b/ui/v2.5/src/components/Galleries/Galleries.tsx index 51db624b5..aad72ddd5 100644 --- a/ui/v2.5/src/components/Galleries/Galleries.tsx +++ b/ui/v2.5/src/components/Galleries/Galleries.tsx @@ -5,7 +5,7 @@ import { GalleryList } from "./GalleryList"; const Galleries = () => ( - + ); diff --git a/ui/v2.5/src/components/Galleries/GalleryList.tsx b/ui/v2.5/src/components/Galleries/GalleryList.tsx index bbae430e3..3bd296472 100644 --- a/ui/v2.5/src/components/Galleries/GalleryList.tsx +++ b/ui/v2.5/src/components/Galleries/GalleryList.tsx @@ -16,7 +16,7 @@ export const GalleryList: React.FC = () => { if (!result.data || !result.data.findGalleries) { return; } if (filter.displayMode === DisplayMode.Grid) { return

TODO

; - } else if (filter.displayMode === DisplayMode.List) { + } if (filter.displayMode === DisplayMode.List) { return ( @@ -39,7 +39,7 @@ export const GalleryList: React.FC = () => {
); - } else if (filter.displayMode === DisplayMode.Wall) { + } if (filter.displayMode === DisplayMode.Wall) { return

TODO

; } } diff --git a/ui/v2.5/src/components/MainNavbar.tsx b/ui/v2.5/src/components/MainNavbar.tsx index 22e1f0eb9..556577008 100644 --- a/ui/v2.5/src/components/MainNavbar.tsx +++ b/ui/v2.5/src/components/MainNavbar.tsx @@ -69,7 +69,7 @@ export const MainNavbar: React.FC = () => { {menuItems.map((i) => ( @@ -83,7 +83,7 @@ export const MainNavbar: React.FC = () => {
diff --git a/ui/v2.5/src/components/Shared/HoverPopover.tsx b/ui/v2.5/src/components/Shared/HoverPopover.tsx new file mode 100644 index 000000000..566c64720 --- /dev/null +++ b/ui/v2.5/src/components/Shared/HoverPopover.tsx @@ -0,0 +1,57 @@ +import React, { useState, useCallback, useEffect, useRef } from 'react' +import { Overlay, Popover, OverlayProps } from 'react-bootstrap' + +interface IHoverPopover { + enterDelay?: number; + leaveDelay?: number; + content: JSX.Element[] | JSX.Element | string; + className?: string; + placement?: OverlayProps["placement"]; +} + +export const HoverPopover: React.FC = ({ enterDelay = 0, leaveDelay = 400, content, children, className, placement = 'top' }) => { + const [show, setShow] = useState(false); + const triggerRef = useRef(null); + const enterTimer = useRef(); + const leaveTimer = useRef(); + + const handleMouseEnter = useCallback(() => { + window.clearTimeout(leaveTimer.current); + enterTimer.current = window.setTimeout(() => setShow(true), enterDelay); + }, [enterDelay]); + + const handleMouseLeave = useCallback(() => { + window.clearTimeout(enterTimer.current); + leaveTimer.current = window.setTimeout(() => setShow(false), leaveDelay); + }, [leaveDelay]); + + useEffect(() => ( + () => { + window.clearTimeout(enterTimer.current) + window.clearTimeout(leaveTimer.current) + } + ), []); + + return ( + <> +
+ {children} +
+ { triggerRef.current && + + + {content} + + + } + + ); +} diff --git a/ui/v2.5/src/components/Shared/Modal.tsx b/ui/v2.5/src/components/Shared/Modal.tsx index c1c489f5f..f90939b20 100644 --- a/ui/v2.5/src/components/Shared/Modal.tsx +++ b/ui/v2.5/src/components/Shared/Modal.tsx @@ -35,7 +35,7 @@ const ModalComponent: React.FC = ({ children, show, icon, header, cancel ? : '' } - { } + diff --git a/ui/v2.5/src/components/Shared/Select.tsx b/ui/v2.5/src/components/Shared/Select.tsx index 96b5f1279..9dd474ac7 100644 --- a/ui/v2.5/src/components/Shared/Select.tsx +++ b/ui/v2.5/src/components/Shared/Select.tsx @@ -42,6 +42,12 @@ interface ISceneGallerySelect { sceneId: string; onSelect: (item: GQL.ValidGalleriesForSceneValidGalleriesForScene | undefined) => void; } + +const getSelectedValues = (selectedItems:ValueType