mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Add filesize on scene cards, invisibly (#2335)
* Add filesize on scene cards, in secret * Add find extra copies button, also hidden
This commit is contained in:
committed by
GitHub
parent
299d59b51e
commit
4e9a635ed8
@@ -10,12 +10,13 @@ import {
|
|||||||
SweatDrops,
|
SweatDrops,
|
||||||
TruncatedText,
|
TruncatedText,
|
||||||
} from "src/components/Shared";
|
} from "src/components/Shared";
|
||||||
import { TextUtils } from "src/utils";
|
import { NavUtils, TextUtils } from "src/utils";
|
||||||
import { SceneQueue } from "src/models/sceneQueue";
|
import { SceneQueue } from "src/models/sceneQueue";
|
||||||
import { ConfigurationContext } from "src/hooks/Config";
|
import { ConfigurationContext } from "src/hooks/Config";
|
||||||
import { PerformerPopoverButton } from "../Shared/PerformerPopoverButton";
|
import { PerformerPopoverButton } from "../Shared/PerformerPopoverButton";
|
||||||
import { GridCard } from "../Shared/GridCard";
|
import { GridCard } from "../Shared/GridCard";
|
||||||
import { RatingBanner } from "../Shared/RatingBanner";
|
import { RatingBanner } from "../Shared/RatingBanner";
|
||||||
|
import { FormattedNumber } from "react-intl";
|
||||||
|
|
||||||
interface IScenePreviewProps {
|
interface IScenePreviewProps {
|
||||||
isPortrait: boolean;
|
isPortrait: boolean;
|
||||||
@@ -91,8 +92,25 @@ export const SceneCard: React.FC<ISceneCardProps> = (
|
|||||||
missingStudioImage || (configuration?.interface.showStudioAsText ?? false);
|
missingStudioImage || (configuration?.interface.showStudioAsText ?? false);
|
||||||
|
|
||||||
function maybeRenderSceneSpecsOverlay() {
|
function maybeRenderSceneSpecsOverlay() {
|
||||||
|
let sizeObj = null;
|
||||||
|
if (props.scene.file.size) {
|
||||||
|
sizeObj = TextUtils.fileSize(parseInt(props.scene.file.size));
|
||||||
|
}
|
||||||
return (
|
return (
|
||||||
<div className="scene-specs-overlay">
|
<div className="scene-specs-overlay">
|
||||||
|
{sizeObj != null ? (
|
||||||
|
<span className="overlay-filesize extra-scene-info">
|
||||||
|
<FormattedNumber
|
||||||
|
value={sizeObj.size}
|
||||||
|
maximumFractionDigits={TextUtils.fileSizeFractionalDigits(
|
||||||
|
sizeObj.unit
|
||||||
|
)}
|
||||||
|
/>
|
||||||
|
{TextUtils.formatFileSizeUnit(sizeObj.unit)}
|
||||||
|
</span>
|
||||||
|
) : (
|
||||||
|
""
|
||||||
|
)}
|
||||||
{props.scene.file.width && props.scene.file.height ? (
|
{props.scene.file.width && props.scene.file.height ? (
|
||||||
<span className="overlay-resolution">
|
<span className="overlay-resolution">
|
||||||
{" "}
|
{" "}
|
||||||
@@ -273,6 +291,21 @@ export const SceneCard: React.FC<ISceneCardProps> = (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function maybeRenderDupeCopies() {
|
||||||
|
if (props.scene.phash) {
|
||||||
|
return (
|
||||||
|
<div className="other-copies extra-scene-info">
|
||||||
|
<Button
|
||||||
|
href={NavUtils.makeScenesPHashMatchUrl(props.scene.phash)}
|
||||||
|
className="minimal"
|
||||||
|
>
|
||||||
|
<Icon icon="copy" />
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
function maybeRenderPopoverButtonGroup() {
|
function maybeRenderPopoverButtonGroup() {
|
||||||
if (
|
if (
|
||||||
!props.compact &&
|
!props.compact &&
|
||||||
@@ -295,6 +328,7 @@ export const SceneCard: React.FC<ISceneCardProps> = (
|
|||||||
{maybeRenderOCounter()}
|
{maybeRenderOCounter()}
|
||||||
{maybeRenderGallery()}
|
{maybeRenderGallery()}
|
||||||
{maybeRenderOrganized()}
|
{maybeRenderOrganized()}
|
||||||
|
{maybeRenderDupeCopies()}
|
||||||
</ButtonGroup>
|
</ButtonGroup>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -160,6 +160,10 @@ textarea.scene-description {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.extra-scene-info {
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
.overlay-resolution {
|
.overlay-resolution {
|
||||||
font-weight: 900;
|
font-weight: 900;
|
||||||
margin-right: 0.3rem;
|
margin-right: 0.3rem;
|
||||||
|
|||||||
Reference in New Issue
Block a user