New: Size column for tracks

pull/4374/head
Bogdan 5 months ago
parent 1da1020a83
commit 51085482bc

@ -23,6 +23,7 @@
} }
.duration, .duration,
.size,
.status { .status {
composes: cell from '~Components/Table/Cells/TableRowCell.css'; composes: cell from '~Components/Table/Cells/TableRowCell.css';

@ -5,6 +5,7 @@ interface CssExports {
'customFormatScore': string; 'customFormatScore': string;
'duration': string; 'duration': string;
'monitored': string; 'monitored': string;
'size': string;
'status': string; 'status': string;
'title': string; 'title': string;
'trackNumber': string; 'trackNumber': string;

@ -9,6 +9,7 @@ import { tooltipPositions } from 'Helpers/Props';
import MediaInfoConnector from 'TrackFile/MediaInfoConnector'; import MediaInfoConnector from 'TrackFile/MediaInfoConnector';
import * as mediaInfoTypes from 'TrackFile/mediaInfoTypes'; import * as mediaInfoTypes from 'TrackFile/mediaInfoTypes';
import formatTimeSpan from 'Utilities/Date/formatTimeSpan'; import formatTimeSpan from 'Utilities/Date/formatTimeSpan';
import formatBytes from 'Utilities/Number/formatBytes';
import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore'; import formatCustomFormatScore from 'Utilities/Number/formatCustomFormatScore';
import TrackActionsCell from './TrackActionsCell'; import TrackActionsCell from './TrackActionsCell';
import styles from './TrackRow.css'; import styles from './TrackRow.css';
@ -28,6 +29,7 @@ class TrackRow extends Component {
title, title,
duration, duration,
trackFilePath, trackFilePath,
trackFileSize,
customFormats, customFormats,
customFormatScore, customFormatScore,
columns, columns,
@ -145,6 +147,17 @@ class TrackRow extends Component {
); );
} }
if (name === 'size') {
return (
<TableRowCell
key={name}
className={styles.size}
>
{!!trackFileSize && formatBytes(trackFileSize)}
</TableRowCell>
);
}
if (name === 'status') { if (name === 'status') {
return ( return (
<TableRowCell <TableRowCell
@ -192,6 +205,7 @@ TrackRow.propTypes = {
duration: PropTypes.number.isRequired, duration: PropTypes.number.isRequired,
isSaving: PropTypes.bool, isSaving: PropTypes.bool,
trackFilePath: PropTypes.string, trackFilePath: PropTypes.string,
trackFileSize: PropTypes.number,
customFormats: PropTypes.arrayOf(PropTypes.object), customFormats: PropTypes.arrayOf(PropTypes.object),
customFormatScore: PropTypes.number.isRequired, customFormatScore: PropTypes.number.isRequired,
mediaInfo: PropTypes.object, mediaInfo: PropTypes.object,

@ -11,6 +11,7 @@ function createMapStateToProps() {
(id, trackFile) => { (id, trackFile) => {
return { return {
trackFilePath: trackFile ? trackFile.path : null, trackFilePath: trackFile ? trackFile.path : null,
trackFileSize: trackFile ? trackFile.size : null,
customFormats: trackFile ? trackFile.customFormats : [], customFormats: trackFile ? trackFile.customFormats : [],
customFormatScore: trackFile ? trackFile.customFormatScore : 0 customFormatScore: trackFile ? trackFile.customFormatScore : 0
}; };

@ -58,6 +58,11 @@ export const defaultState = {
label: () => translate('AudioInfo'), label: () => translate('AudioInfo'),
isVisible: true isVisible: true
}, },
{
name: 'size',
label: () => translate('Size'),
isVisible: false
},
{ {
name: 'customFormats', name: 'customFormats',
label: 'Formats', label: 'Formats',

Loading…
Cancel
Save