Skip to content

Commit

Permalink
Tagger preview scrubber and thumbnail (#5507)
Browse files Browse the repository at this point in the history
  • Loading branch information
dogwithakeyboard authored Nov 27, 2024
1 parent 3c81d3b commit e097f2b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 8 deletions.
2 changes: 2 additions & 0 deletions ui/v2.5/src/components/Tagger/scenes/SceneTagger.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ const Scene: React.FC<{
: undefined
}
showLightboxImage={showLightboxImage}
queue={queue}
index={index}
>
{searchResult && searchResult.results?.length ? (
<SceneSearchResults scenes={searchResult.results} target={scene} />
Expand Down
27 changes: 26 additions & 1 deletion ui/v2.5/src/components/Tagger/scenes/TaggerScene.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React, { useState, useContext, PropsWithChildren, useMemo } from "react";
import * as GQL from "src/core/generated-graphql";
import { Link } from "react-router-dom";
import { Link, useHistory } from "react-router-dom";
import { Button, Collapse, Form, InputGroup } from "react-bootstrap";
import { FormattedMessage } from "react-intl";

Expand All @@ -19,6 +19,8 @@ import {
} from "@fortawesome/free-solid-svg-icons";
import { objectPath, objectTitle } from "src/core/files";
import { ExternalLink } from "src/components/Shared/ExternalLink";
import { ConfigurationContext } from "src/hooks/Config";
import { SceneQueue } from "src/models/sceneQueue";

interface ITaggerSceneDetails {
scene: GQL.SlimSceneDataFragment;
Expand Down Expand Up @@ -91,6 +93,8 @@ interface ITaggerScene {
scrapeSceneFragment?: (scene: GQL.SlimSceneDataFragment) => void;
loading?: boolean;
showLightboxImage: (imagePath: string) => void;
queue?: SceneQueue;
index?: number;
}

export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
Expand All @@ -102,6 +106,8 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
errorMessage,
children,
showLightboxImage,
queue,
index,
}) => {
const { config } = useContext(TaggerStateContext);
const [queryString, setQueryString] = useState<string>("");
Expand All @@ -125,6 +131,11 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
const height = file?.height ? file.height : 0;
const isPortrait = height > width;

const history = useHistory();

const { configuration } = React.useContext(ConfigurationContext);
const cont = configuration?.interface.continuePlaylistDefault ?? false;

async function query() {
if (!doSceneQuery) return;

Expand Down Expand Up @@ -213,6 +224,18 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
}
}

function onScrubberClick(timestamp: number) {
const link = queue
? queue.makeLink(scene.id, {
sceneIndex: index,
continue: cont,
start: timestamp,
})
: `/scenes/${scene.id}?t=${timestamp}`;

history.push(link);
}

return (
<div key={scene.id} className="mt-3 search-item">
<div className="row">
Expand All @@ -224,6 +247,8 @@ export const TaggerScene: React.FC<PropsWithChildren<ITaggerScene>> = ({
video={scene.paths.preview ?? undefined}
isPortrait={isPortrait}
soundActive={false}
vttPath={scene.paths.vtt ?? undefined}
onScrubberClick={onScrubberClick}
/>
{maybeRenderSpriteIcon()}
</Link>
Expand Down
11 changes: 4 additions & 7 deletions ui/v2.5/src/components/Tagger/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,22 +12,19 @@

.scene-card-preview {
border-radius: 3px;
color: $text-color;
height: 100px;
margin-bottom: 0;
max-height: 100px;
overflow: hidden;
width: 150px;

&-video {
background-color: #495b68;
}
width: auto;
}

.sprite-button {
bottom: 5px;
filter: drop-shadow(1px 1px 1px #222);
padding: 0;
position: absolute;
right: 5px;
top: 5px;
}

.sub-content {
Expand Down

0 comments on commit e097f2b

Please sign in to comment.