mirror of
https://github.com/Readarr/Readarr.git
synced 2026-04-18 21:34:28 -04:00
54 lines
1.4 KiB
JavaScript
54 lines
1.4 KiB
JavaScript
import PropTypes from 'prop-types';
|
|
import React from 'react';
|
|
import { getAuthorStatusDetails } from 'Author/AuthorStatus';
|
|
import Icon from 'Components/Icon';
|
|
import VirtualTableRowCell from 'Components/Table/Cells/TableRowCell';
|
|
import { icons } from 'Helpers/Props';
|
|
import translate from 'Utilities/String/translate';
|
|
import styles from './AuthorStatusCell.css';
|
|
|
|
function AuthorStatusCell(props) {
|
|
const {
|
|
className,
|
|
monitored,
|
|
status,
|
|
component: Component,
|
|
...otherProps
|
|
} = props;
|
|
|
|
const statusDetails = getAuthorStatusDetails(status);
|
|
|
|
return (
|
|
<Component
|
|
className={className}
|
|
{...otherProps}
|
|
>
|
|
<Icon
|
|
className={styles.statusIcon}
|
|
name={monitored ? icons.MONITORED : icons.UNMONITORED}
|
|
title={monitored ? translate('MonitoredAuthorIsMonitored') : translate('MonitoredAuthorIsUnmonitored')}
|
|
/>
|
|
|
|
<Icon
|
|
className={styles.statusIcon}
|
|
name={statusDetails.icon}
|
|
title={`${statusDetails.title}: ${statusDetails.message}`}
|
|
/>
|
|
</Component>
|
|
);
|
|
}
|
|
|
|
AuthorStatusCell.propTypes = {
|
|
className: PropTypes.string.isRequired,
|
|
monitored: PropTypes.bool.isRequired,
|
|
status: PropTypes.string.isRequired,
|
|
component: PropTypes.elementType
|
|
};
|
|
|
|
AuthorStatusCell.defaultProps = {
|
|
className: styles.status,
|
|
component: VirtualTableRowCell
|
|
};
|
|
|
|
export default AuthorStatusCell;
|