import { Button, ButtonGroup, Card, Checkbox, Divider, Elevation, H4, Popover, } from "@blueprintjs/core"; 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 { ZoomUtils } from "../../utils/zoom"; import { StashService } from "../../core/StashService"; import { Icons } from "../../utils/icons"; interface ISceneCardProps { scene: GQL.SlimSceneDataFragment; selected: boolean | undefined; zoomIndex: number; onSelectedChanged: (selected : boolean, shiftKey : boolean) => void; } export const SceneCard: FunctionComponent = (props: ISceneCardProps) => { const [previewPath, setPreviewPath] = useState(undefined); const videoHoverHook = VideoHoverHook.useVideoHover({resetOnMouseLeave: false}); const config = StashService.useConfiguration(); const showStudioAsText = !!config.data && !!config.data.configuration ? config.data.configuration.interface.showStudioAsText : false; function maybeRenderRatingBanner() { if (!props.scene.rating) { return; } return (
RATING: {props.scene.rating}
); } function maybeRenderSceneSpecsOverlay() { return (
{!!props.scene.file.height ? {TextUtils.resolution(props.scene.file.height)} : undefined} {props.scene.file.duration !== undefined && props.scene.file.duration >= 1 ? TextUtils.secondsToTimestamp(props.scene.file.duration) : ""}
); } function maybeRenderSceneStudioOverlay() { if (!props.scene.studio) { return; } let style: React.CSSProperties = { backgroundImage: `url('${props.scene.studio.image_path}')`, }; let text = ""; if (showStudioAsText) { style = {}; text = props.scene.studio.name; } return (
{text}
); } function maybeRenderTagPopoverButton() { if (props.scene.tags.length <= 0) { return; } const tags = props.scene.tags.map((tag) => ( )); return (