Fixed: Progress bar for authors and books

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

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

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

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

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

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

@ -27,14 +27,15 @@ class BookshelfBook extends Component {
title,
disambiguation,
monitored,
statistics,
statistics = {},
isSaving
} = this.props;
const {
bookFileCount,
totalBookCount,
percentOfBooks
bookCount = 0,
bookFileCount = 0,
totalBookCount = 0,
percentOfBooks = 0
} = statistics;
return (
@ -59,10 +60,14 @@ class BookshelfBook extends Component {
percentOfBooks < 100 && monitored && styles.missingWanted,
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>

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

Loading…
Cancel
Save