Fixed: Progress bar for authors and books

pull/3304/head
Bogdan 4 months ago
parent 0b924005ec
commit d659e86a7d

@ -90,7 +90,7 @@ class AuthorIndexOverview extends Component {
status, status,
titleSlug, titleSlug,
nextAiring, nextAiring,
statistics, statistics = {},
images, images,
posterWidth, posterWidth,
posterHeight, posterHeight,
@ -113,10 +113,11 @@ class AuthorIndexOverview extends Component {
} = this.props; } = this.props;
const { const {
bookCount, bookCount = 0,
sizeOnDisk, availableBookCount = 0,
bookFileCount, bookFileCount = 0,
totalBookCount totalBookCount = 0,
sizeOnDisk = 0
} = statistics; } = statistics;
const { const {
@ -179,6 +180,7 @@ class AuthorIndexOverview extends Component {
monitored={monitored} monitored={monitored}
status={status} status={status}
bookCount={bookCount} bookCount={bookCount}
availableBookCount={availableBookCount}
bookFileCount={bookFileCount} bookFileCount={bookFileCount}
totalBookCount={totalBookCount} totalBookCount={totalBookCount}
posterWidth={posterWidth} posterWidth={posterWidth}

@ -85,7 +85,7 @@ class AuthorIndexPoster extends Component {
titleSlug, titleSlug,
status, status,
nextAiring, nextAiring,
statistics, statistics = {},
images, images,
posterWidth, posterWidth,
posterHeight, posterHeight,
@ -110,10 +110,11 @@ class AuthorIndexPoster extends Component {
} = this.props; } = this.props;
const { const {
bookCount, bookCount = 0,
sizeOnDisk, availableBookCount = 0,
bookFileCount, bookFileCount = 0,
totalBookCount totalBookCount = 0,
sizeOnDisk = 0
} = statistics; } = statistics;
const { const {
@ -213,6 +214,7 @@ class AuthorIndexPoster extends Component {
monitored={monitored} monitored={monitored}
status={status} status={status}
bookCount={bookCount} bookCount={bookCount}
availableBookCount={availableBookCount}
bookFileCount={bookFileCount} bookFileCount={bookFileCount}
totalBookCount={totalBookCount} totalBookCount={totalBookCount}
posterWidth={posterWidth} posterWidth={posterWidth}

@ -11,14 +11,15 @@ function AuthorIndexProgressBar(props) {
monitored, monitored,
status, status,
bookCount, bookCount,
availableBookCount,
bookFileCount, bookFileCount,
totalBookCount, totalBookCount,
posterWidth, posterWidth,
detailedProgressBar detailedProgressBar
} = props; } = props;
const progress = bookCount ? bookCount / totalBookCount * 100 : 100; const progress = bookCount ? (availableBookCount / bookCount) * 100 : 100;
const text = `${bookCount} / ${totalBookCount}`; const text = `${availableBookCount} / ${bookCount}`;
return ( return (
<ProgressBar <ProgressBar
@ -29,7 +30,7 @@ function AuthorIndexProgressBar(props) {
size={detailedProgressBar ? sizes.MEDIUM : sizes.SMALL} size={detailedProgressBar ? sizes.MEDIUM : sizes.SMALL}
showText={detailedProgressBar} showText={detailedProgressBar}
text={text} text={text}
title={translate('BookFileCountBookCountTotalTotalBookCountInterp', [bookFileCount, bookCount, totalBookCount])} title={translate('AuthorProgressBarText', { bookCount, availableBookCount, bookFileCount, totalBookCount })}
width={posterWidth} width={posterWidth}
/> />
); );
@ -39,6 +40,7 @@ AuthorIndexProgressBar.propTypes = {
monitored: PropTypes.bool.isRequired, monitored: PropTypes.bool.isRequired,
status: PropTypes.string.isRequired, status: PropTypes.string.isRequired,
bookCount: PropTypes.number.isRequired, bookCount: PropTypes.number.isRequired,
availableBookCount: PropTypes.number.isRequired,
bookFileCount: PropTypes.number.isRequired, bookFileCount: PropTypes.number.isRequired,
totalBookCount: PropTypes.number.isRequired, totalBookCount: PropTypes.number.isRequired,
posterWidth: PropTypes.number.isRequired, posterWidth: PropTypes.number.isRequired,

@ -90,7 +90,7 @@ class AuthorIndexRow extends Component {
nextBook, nextBook,
lastBook, lastBook,
added, added,
statistics, statistics = {},
genres, genres,
ratings, ratings,
path, path,
@ -110,10 +110,11 @@ class AuthorIndexRow extends Component {
} = this.props; } = this.props;
const { const {
bookCount, bookCount = 0,
bookFileCount, availableBookCount = 0,
totalBookCount, bookFileCount = 0,
sizeOnDisk totalBookCount = 0,
sizeOnDisk = 0
} = statistics; } = statistics;
const { const {
@ -286,7 +287,7 @@ class AuthorIndexRow extends Component {
} }
if (name === 'bookProgress') { if (name === 'bookProgress') {
const progress = bookCount ? bookFileCount / bookCount * 100 : 100; const progress = bookCount ? (availableBookCount / bookCount) * 100 : 100;
return ( return (
<VirtualTableRowCell <VirtualTableRowCell
@ -297,8 +298,8 @@ class AuthorIndexRow extends Component {
progress={progress} progress={progress}
kind={getProgressBarKind(status, monitored, progress)} kind={getProgressBarKind(status, monitored, progress)}
showText={true} showText={true}
text={`${bookCount} / ${totalBookCount}`} text={`${availableBookCount} / ${bookCount}`}
title={translate('BookFileCountBookCountTotalTotalBookCountInterp', [bookFileCount, bookCount, totalBookCount])} title={translate('AuthorProgressBarText', { bookCount, availableBookCount, bookFileCount, totalBookCount })}
width={125} width={125}
/> />
</VirtualTableRowCell> </VirtualTableRowCell>

@ -16,8 +16,8 @@ function BookIndexProgressBar(props) {
detailedProgressBar detailedProgressBar
} = props; } = props;
const progress = bookCount ? bookFileCount / totalBookCount * 100 : 0; const progress = bookFileCount && bookCount ? (totalBookCount / bookCount) * 100 : 0;
const text = `${bookFileCount} / ${bookCount}`; const text = `${bookFileCount ? bookCount : 0} / ${totalBookCount}`;
return ( return (
<ProgressBar <ProgressBar
@ -28,7 +28,11 @@ function BookIndexProgressBar(props) {
size={detailedProgressBar ? sizes.MEDIUM : sizes.SMALL} size={detailedProgressBar ? sizes.MEDIUM : sizes.SMALL}
showText={detailedProgressBar} showText={detailedProgressBar}
text={text} text={text}
title={translate('BookFileCountBookCountTotalTotalBookCountInterp', [bookFileCount, bookCount, totalBookCount])} title={translate('BookProgressBarText', {
bookCount: bookFileCount ? bookCount : 0,
bookFileCount,
totalBookCount
})}
width={posterWidth} width={posterWidth}
/> />
); );

@ -27,14 +27,15 @@ class BookshelfBook extends Component {
title, title,
disambiguation, disambiguation,
monitored, monitored,
statistics, statistics = {},
isSaving isSaving
} = this.props; } = this.props;
const { const {
bookFileCount, bookCount = 0,
totalBookCount, bookFileCount = 0,
percentOfBooks totalBookCount = 0,
percentOfBooks = 0
} = statistics; } = statistics;
return ( return (
@ -59,10 +60,14 @@ class BookshelfBook extends Component {
percentOfBooks < 100 && monitored && styles.missingWanted, percentOfBooks < 100 && monitored && styles.missingWanted,
percentOfBooks === 100 && styles.allBooks percentOfBooks === 100 && styles.allBooks
)} )}
title={translate('BookFileCounttotalBookCountBooksDownloadedInterp', [bookFileCount, totalBookCount])} title={translate('BookProgressBarText', {
bookCount: bookFileCount ? bookCount : 0,
bookFileCount,
totalBookCount
})}
> >
{ {
totalBookCount === 0 ? '0/0' : `${bookFileCount}/${totalBookCount}` totalBookCount === 0 ? '0/0' : `${bookFileCount ? bookCount : 0}/${totalBookCount}`
} }
</div> </div>
</div> </div>

@ -59,6 +59,7 @@
"AuthorFolderFormat": "Author Folder Format", "AuthorFolderFormat": "Author Folder Format",
"AuthorIndex": "Author Index", "AuthorIndex": "Author Index",
"AuthorNameHelpText": "The name of the author/book to exclude (can be anything meaningful)", "AuthorNameHelpText": "The name of the author/book to exclude (can be anything meaningful)",
"AuthorProgressBarText": "{availableBookCount} / {bookCount} (Total: {totalBookCount}, Files: {bookFileCount})",
"Authors": "Authors", "Authors": "Authors",
"AutoAdd": "Auto Add", "AutoAdd": "Auto Add",
"AutoRedownloadFailed": "Redownload Failed", "AutoRedownloadFailed": "Redownload Failed",
@ -92,8 +93,6 @@
"Book": "Book", "Book": "Book",
"BookAvailableButMissing": "Book Available, but Missing", "BookAvailableButMissing": "Book Available, but Missing",
"BookEditor": "Book Editor", "BookEditor": "Book Editor",
"BookFileCountBookCountTotalTotalBookCountInterp": "{0} / {1} (Total: {2})",
"BookFileCounttotalBookCountBooksDownloadedInterp": "{0}/{1} books downloaded",
"BookFilesCountMessage": "No book files", "BookFilesCountMessage": "No book files",
"BookIndex": "Book Index", "BookIndex": "Book Index",
"BookIsDownloading": "Book is downloading", "BookIsDownloading": "Book is downloading",
@ -101,6 +100,7 @@
"BookList": "Book List", "BookList": "Book List",
"BookMonitoring": "Book Monitoring", "BookMonitoring": "Book Monitoring",
"BookNaming": "Book Naming", "BookNaming": "Book Naming",
"BookProgressBarText": "{bookCount} / {totalBookCount} (Files: {bookFileCount})",
"BookStudio": "Book Studio", "BookStudio": "Book Studio",
"BookTitle": "Book Title", "BookTitle": "Book Title",
"Books": "Books", "Books": "Books",

Loading…
Cancel
Save