You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
7 years ago
|
import React from 'react';
|
||
|
import ProgressBar from 'Components/ProgressBar';
|
||
4 years ago
|
import { sizes } from 'Helpers/Props';
|
||
|
import getProgressBarKind from 'Utilities/Artist/getProgressBarKind';
|
||
3 years ago
|
import translate from 'Utilities/String/translate';
|
||
7 years ago
|
import styles from './ArtistIndexProgressBar.css';
|
||
7 years ago
|
|
||
2 years ago
|
interface ArtistIndexProgressBarProps {
|
||
|
monitored: boolean;
|
||
|
status: string;
|
||
|
trackCount: number;
|
||
|
trackFileCount: number;
|
||
|
totalTrackCount: number;
|
||
|
posterWidth: number;
|
||
|
detailedProgressBar: boolean;
|
||
|
}
|
||
|
|
||
|
function ArtistIndexProgressBar(props: ArtistIndexProgressBarProps) {
|
||
7 years ago
|
const {
|
||
|
monitored,
|
||
|
status,
|
||
|
trackCount,
|
||
|
trackFileCount,
|
||
7 years ago
|
totalTrackCount,
|
||
7 years ago
|
posterWidth,
|
||
2 years ago
|
detailedProgressBar,
|
||
7 years ago
|
} = props;
|
||
|
|
||
2 years ago
|
const progress = trackCount ? (trackFileCount / trackCount) * 100 : 100;
|
||
7 years ago
|
const text = `${trackFileCount} / ${trackCount}`;
|
||
|
|
||
|
return (
|
||
|
<ProgressBar
|
||
|
className={styles.progressBar}
|
||
|
containerClassName={styles.progress}
|
||
|
progress={progress}
|
||
|
kind={getProgressBarKind(status, monitored, progress)}
|
||
|
size={detailedProgressBar ? sizes.MEDIUM : sizes.SMALL}
|
||
|
showText={detailedProgressBar}
|
||
|
text={text}
|
||
2 years ago
|
title={translate('ArtistProgressBarText', {
|
||
|
trackFileCount,
|
||
|
trackCount,
|
||
|
totalTrackCount,
|
||
|
})}
|
||
7 years ago
|
width={posterWidth}
|
||
|
/>
|
||
|
);
|
||
|
}
|
||
|
|
||
7 years ago
|
export default ArtistIndexProgressBar;
|