quintodrome/ui/src/common/QualityInfo.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
698 B
JavaScript
Raw Normal View History

import React from 'react'
import PropTypes from 'prop-types'
import Chip from '@material-ui/core/Chip'
2021-04-06 18:18:48 -08:00
import config from '../config'
2021-04-06 18:18:48 -08:00
const llFormats = new Set(config.losslessFormats.split(','))
const placeholder = 'N/A'
export const QualityInfo = ({ record, ...rest }) => {
let { suffix, bitRate } = record
let info = placeholder
if (suffix) {
suffix = suffix.toUpperCase()
info = suffix
if (!llFormats.has(suffix)) {
info += ' ' + bitRate
}
}
2021-04-06 18:18:48 -08:00
return <Chip {...rest} variant="outlined" label={info} />
}
QualityInfo.propTypes = {
record: PropTypes.object.isRequired,
size: PropTypes.string,
}
QualityInfo.defaultProps = {
size: 'small',
record: {},
}