From c532731f8d4473e321b03913cda3d1d5b1c7df85 Mon Sep 17 00:00:00 2001 From: CJ Date: Sat, 20 Jan 2024 14:48:54 -0600 Subject: [PATCH] support filesize in scene list --- .../src/components/Scenes/SceneListTable.tsx | 29 ++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) diff --git a/ui/v2.5/src/components/Scenes/SceneListTable.tsx b/ui/v2.5/src/components/Scenes/SceneListTable.tsx index 7d8a44202de..bf5ded04333 100644 --- a/ui/v2.5/src/components/Scenes/SceneListTable.tsx +++ b/ui/v2.5/src/components/Scenes/SceneListTable.tsx @@ -3,7 +3,7 @@ import { Link } from "react-router-dom"; import * as GQL from "src/core/generated-graphql"; import NavUtils from "src/utils/navigation"; import TextUtils from "src/utils/text"; -import { FormattedMessage, useIntl } from "react-intl"; +import { FormattedMessage, FormattedNumber, useIntl } from "react-intl"; import { objectTitle } from "src/core/files"; import { galleryTitle } from "src/core/galleries"; import SceneQueue from "src/models/sceneQueue"; @@ -168,6 +168,28 @@ export const SceneListTable: React.FC = ( ); + function renderFileSize(file: { size: number | undefined }) { + const { size, unit } = TextUtils.fileSize(file.size); + + return ( + + ); + } + + const FileSizeCell = (scene: GQL.SlimSceneDataFragment) => ( +
    + {scene.files.map((file) => ( +
  • {renderFileSize(file)}
  • + ))} +
+ ); + const FrameRateCell = (scene: GQL.SlimSceneDataFragment) => (
    {scene.files.map((file) => ( @@ -320,6 +342,11 @@ export const SceneListTable: React.FC = ( label: intl.formatMessage({ id: "resolution" }), render: ResolutionCell, }, + { + value: "filesize", + label: intl.formatMessage({ id: "filesize" }), + render: FileSizeCell, + }, { value: "framerate", label: intl.formatMessage({ id: "framerate" }),