From 4e9a635ed8a48150ead7a24f1920ff9a781a752d Mon Sep 17 00:00:00 2001 From: kermieisinthehouse Date: Wed, 23 Feb 2022 14:27:46 -0800 Subject: [PATCH] Add filesize on scene cards, invisibly (#2335) * Add filesize on scene cards, in secret * Add find extra copies button, also hidden --- ui/v2.5/src/components/Scenes/SceneCard.tsx | 36 ++++++++++++++++++++- ui/v2.5/src/components/Scenes/styles.scss | 4 +++ 2 files changed, 39 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/components/Scenes/SceneCard.tsx b/ui/v2.5/src/components/Scenes/SceneCard.tsx index 36b99ad8c..00ee3a80a 100644 --- a/ui/v2.5/src/components/Scenes/SceneCard.tsx +++ b/ui/v2.5/src/components/Scenes/SceneCard.tsx @@ -10,12 +10,13 @@ import { SweatDrops, TruncatedText, } from "src/components/Shared"; -import { TextUtils } from "src/utils"; +import { NavUtils, TextUtils } from "src/utils"; import { SceneQueue } from "src/models/sceneQueue"; import { ConfigurationContext } from "src/hooks/Config"; import { PerformerPopoverButton } from "../Shared/PerformerPopoverButton"; import { GridCard } from "../Shared/GridCard"; import { RatingBanner } from "../Shared/RatingBanner"; +import { FormattedNumber } from "react-intl"; interface IScenePreviewProps { isPortrait: boolean; @@ -91,8 +92,25 @@ export const SceneCard: React.FC = ( missingStudioImage || (configuration?.interface.showStudioAsText ?? false); function maybeRenderSceneSpecsOverlay() { + let sizeObj = null; + if (props.scene.file.size) { + sizeObj = TextUtils.fileSize(parseInt(props.scene.file.size)); + } return (
+ {sizeObj != null ? ( + + + {TextUtils.formatFileSizeUnit(sizeObj.unit)} + + ) : ( + "" + )} {props.scene.file.width && props.scene.file.height ? ( {" "} @@ -273,6 +291,21 @@ export const SceneCard: React.FC = ( } } + function maybeRenderDupeCopies() { + if (props.scene.phash) { + return ( +
+ +
+ ); + } + } + function maybeRenderPopoverButtonGroup() { if ( !props.compact && @@ -295,6 +328,7 @@ export const SceneCard: React.FC = ( {maybeRenderOCounter()} {maybeRenderGallery()} {maybeRenderOrganized()} + {maybeRenderDupeCopies()} ); diff --git a/ui/v2.5/src/components/Scenes/styles.scss b/ui/v2.5/src/components/Scenes/styles.scss index 353d57913..e82106878 100644 --- a/ui/v2.5/src/components/Scenes/styles.scss +++ b/ui/v2.5/src/components/Scenes/styles.scss @@ -160,6 +160,10 @@ textarea.scene-description { } } +.extra-scene-info { + display: none; +} + .overlay-resolution { font-weight: 900; margin-right: 0.3rem;