mirror of
https://github.com/stashapp/stash.git
synced 2025-12-06 16:34:02 +01:00
Add show sprite button to scene tagger list (#3536)
* Add show sprite button to scene tagger list --------- Co-authored-by: WithoutPants <53250216+WithoutPants@users.noreply.github.com>
This commit is contained in:
parent
e22c938d74
commit
e2b52a4bf6
4 changed files with 58 additions and 2 deletions
|
|
@ -1,4 +1,4 @@
|
||||||
import React, { useContext, useState } from "react";
|
import React, { useContext, useMemo, useState } from "react";
|
||||||
import * as GQL from "src/core/generated-graphql";
|
import * as GQL from "src/core/generated-graphql";
|
||||||
import { SceneQueue } from "src/models/sceneQueue";
|
import { SceneQueue } from "src/models/sceneQueue";
|
||||||
import { Button, Form } from "react-bootstrap";
|
import { Button, Form } from "react-bootstrap";
|
||||||
|
|
@ -15,6 +15,7 @@ import { SceneSearchResults } from "./StashSearchResult";
|
||||||
import { ConfigurationContext } from "src/hooks/Config";
|
import { ConfigurationContext } from "src/hooks/Config";
|
||||||
import { faCog } from "@fortawesome/free-solid-svg-icons";
|
import { faCog } from "@fortawesome/free-solid-svg-icons";
|
||||||
import { distance } from "src/utils/hamming";
|
import { distance } from "src/utils/hamming";
|
||||||
|
import { useLightbox } from "src/hooks/Lightbox/hooks";
|
||||||
|
|
||||||
interface ITaggerProps {
|
interface ITaggerProps {
|
||||||
scenes: GQL.SlimSceneDataFragment[];
|
scenes: GQL.SlimSceneDataFragment[];
|
||||||
|
|
@ -221,6 +222,19 @@ export const Tagger: React.FC<ITaggerProps> = ({ scenes, queue }) => {
|
||||||
return minDurationDiffSceneA - minDurationDiffSceneB;
|
return minDurationDiffSceneA - minDurationDiffSceneB;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const [spriteImage, setSpriteImage] = useState<string | null>(null);
|
||||||
|
const lightboxImage = useMemo(
|
||||||
|
() => [{ paths: { thumbnail: spriteImage, image: spriteImage } }],
|
||||||
|
[spriteImage]
|
||||||
|
);
|
||||||
|
const showLightbox = useLightbox({
|
||||||
|
images: lightboxImage,
|
||||||
|
});
|
||||||
|
function showLightboxImage(imagePath: string) {
|
||||||
|
setSpriteImage(imagePath);
|
||||||
|
showLightbox();
|
||||||
|
}
|
||||||
|
|
||||||
function renderScenes() {
|
function renderScenes() {
|
||||||
const filteredScenes = !hideUnmatched
|
const filteredScenes = !hideUnmatched
|
||||||
? scenes
|
? scenes
|
||||||
|
|
@ -267,6 +281,7 @@ export const Tagger: React.FC<ITaggerProps> = ({ scenes, queue }) => {
|
||||||
}
|
}
|
||||||
: undefined
|
: undefined
|
||||||
}
|
}
|
||||||
|
showLightboxImage={showLightboxImage}
|
||||||
>
|
>
|
||||||
{searchResult && searchResult.results?.length ? (
|
{searchResult && searchResult.results?.length ? (
|
||||||
<SceneSearchResults scenes={searchResult.results} target={scene} />
|
<SceneSearchResults scenes={searchResult.results} target={scene} />
|
||||||
|
|
|
||||||
|
|
@ -12,7 +12,11 @@ import { TruncatedText } from "src/components/Shared/TruncatedText";
|
||||||
import { parsePath, prepareQueryString } from "src/components/Tagger/utils";
|
import { parsePath, prepareQueryString } from "src/components/Tagger/utils";
|
||||||
import { ScenePreview } from "src/components/Scenes/SceneCard";
|
import { ScenePreview } from "src/components/Scenes/SceneCard";
|
||||||
import { TaggerStateContext } from "../context";
|
import { TaggerStateContext } from "../context";
|
||||||
import { faChevronDown, faChevronUp } from "@fortawesome/free-solid-svg-icons";
|
import {
|
||||||
|
faChevronDown,
|
||||||
|
faChevronUp,
|
||||||
|
faImage,
|
||||||
|
} from "@fortawesome/free-solid-svg-icons";
|
||||||
import { objectPath, objectTitle } from "src/core/files";
|
import { objectPath, objectTitle } from "src/core/files";
|
||||||
|
|
||||||
interface ITaggerSceneDetails {
|
interface ITaggerSceneDetails {
|
||||||
|
|
@ -84,6 +88,7 @@ interface ITaggerScene {
|
||||||
doSceneQuery?: (queryString: string) => void;
|
doSceneQuery?: (queryString: string) => void;
|
||||||
scrapeSceneFragment?: (scene: GQL.SlimSceneDataFragment) => void;
|
scrapeSceneFragment?: (scene: GQL.SlimSceneDataFragment) => void;
|
||||||
loading?: boolean;
|
loading?: boolean;
|
||||||
|
showLightboxImage: (imagePath: string) => void;
|
||||||
}
|
}
|
||||||
|
|
||||||
export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
|
export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
|
||||||
|
|
@ -94,6 +99,7 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
|
||||||
scrapeSceneFragment,
|
scrapeSceneFragment,
|
||||||
errorMessage,
|
errorMessage,
|
||||||
children,
|
children,
|
||||||
|
showLightboxImage,
|
||||||
}) => {
|
}) => {
|
||||||
const { config } = useContext(TaggerStateContext);
|
const { config } = useContext(TaggerStateContext);
|
||||||
const [queryString, setQueryString] = useState<string>("");
|
const [queryString, setQueryString] = useState<string>("");
|
||||||
|
|
@ -186,6 +192,27 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function onSpriteClick(ev: React.MouseEvent<HTMLElement>) {
|
||||||
|
ev.preventDefault();
|
||||||
|
showLightboxImage(scene.paths.sprite ?? "");
|
||||||
|
}
|
||||||
|
|
||||||
|
function maybeRenderSpriteIcon() {
|
||||||
|
// If a scene doesn't have any files, or doesn't have a sprite generated, the
|
||||||
|
// path will be http://localhost:9999/scene/_sprite.jpg
|
||||||
|
if (scene.files.length > 0) {
|
||||||
|
return (
|
||||||
|
<Button
|
||||||
|
className="sprite-button"
|
||||||
|
variant="link"
|
||||||
|
onClick={onSpriteClick}
|
||||||
|
>
|
||||||
|
<Icon icon={faImage} />
|
||||||
|
</Button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div key={scene.id} className="mt-3 search-item">
|
<div key={scene.id} className="mt-3 search-item">
|
||||||
<div className="row">
|
<div className="row">
|
||||||
|
|
@ -198,6 +225,7 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
|
||||||
isPortrait={isPortrait}
|
isPortrait={isPortrait}
|
||||||
soundActive={false}
|
soundActive={false}
|
||||||
/>
|
/>
|
||||||
|
{maybeRenderSpriteIcon()}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
<Link to={url} className="scene-link overflow-hidden">
|
<Link to={url} className="scene-link overflow-hidden">
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,10 @@
|
||||||
padding-bottom: 0;
|
padding-bottom: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.scene-card {
|
||||||
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
.scene-card-preview {
|
.scene-card-preview {
|
||||||
border-radius: 3px;
|
border-radius: 3px;
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
@ -18,6 +22,14 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.sprite-button {
|
||||||
|
bottom: 5px;
|
||||||
|
filter: drop-shadow(1px 1px 1px #222);
|
||||||
|
padding: 0;
|
||||||
|
position: absolute;
|
||||||
|
right: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
.sub-content {
|
.sub-content {
|
||||||
min-height: 1.5rem;
|
min-height: 1.5rem;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
##### 💥 Note: The cache directory is now required if using HLS/DASH streaming. Please set the cache directory in the System Settings page.
|
##### 💥 Note: The cache directory is now required if using HLS/DASH streaming. Please set the cache directory in the System Settings page.
|
||||||
|
|
||||||
### ✨ New Features
|
### ✨ New Features
|
||||||
|
* Added button to tagger scene cards to view scene sprite. ([#3536](https://github.com/stashapp/stash/pull/3536))
|
||||||
* Added hardware acceleration support (for a limited number of encoders) for transcoding. ([#3419](https://github.com/stashapp/stash/pull/3419))
|
* Added hardware acceleration support (for a limited number of encoders) for transcoding. ([#3419](https://github.com/stashapp/stash/pull/3419))
|
||||||
* Added support for DASH streaming. ([#3275](https://github.com/stashapp/stash/pull/3275))
|
* Added support for DASH streaming. ([#3275](https://github.com/stashapp/stash/pull/3275))
|
||||||
* Added configuration option for the maximum number of items in selector drop-downs. ([#3277](https://github.com/stashapp/stash/pull/3277))
|
* Added configuration option for the maximum number of items in selector drop-downs. ([#3277](https://github.com/stashapp/stash/pull/3277))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue