import React from "react"; import { Table } from 'react-bootstrap'; import * as GQL from "src/core/generated-graphql"; import { TextUtils } from "src/utils"; interface ISceneFileInfoPanelProps { scene: GQL.SceneDataFragment; } export const SceneFileInfoPanel: React.FC = (props: ISceneFileInfoPanelProps) => { function renderChecksum() { return ( Checksum {props.scene.checksum} ); } function renderPath() { return ( Path {"file://"+props.scene.path} ); } function renderStream() { return ( Stream {props.scene.paths.stream} ); } function renderFileSize() { if (props.scene.file.size === undefined) { return; } return ( File Size {TextUtils.fileSize(parseInt(props.scene.file.size, 10))} ); } function renderDuration() { if (props.scene.file.duration === undefined) { return; } return ( Duration {TextUtils.secondsToTimestamp(props.scene.file.duration)} ); } function renderDimensions() { if (props.scene.file.duration === undefined) { return; } return ( Dimensions {props.scene.file.width} x {props.scene.file.height} ); } function renderFrameRate() { if (props.scene.file.framerate === undefined) { return; } return ( Frame Rate {props.scene.file.framerate} frames per second ); } function renderBitRate() { if (props.scene.file.bitrate === undefined) { return; } return ( Bit Rate {TextUtils.bitRate(props.scene.file.bitrate)} ); } function renderVideoCodec() { if (props.scene.file.video_codec === undefined) { return; } return ( Video Codec {props.scene.file.video_codec} ); } function renderAudioCodec() { if (props.scene.file.audio_codec === undefined) { return; } return ( Audio Codec {props.scene.file.audio_codec} ); } function renderUrl() { if (!props.scene.url || props.scene.url === "") { return; } return ( Downloaded From {props.scene.url} ); } return ( <> {renderChecksum()} {renderPath()} {renderStream()} {renderFileSize()} {renderDuration()} {renderDimensions()} {renderFrameRate()} {renderBitRate()} {renderVideoCodec()} {renderAudioCodec()} {renderUrl()}
); };