partially read series: add number of books read from total (#1168)
This commit is contained in:
@@ -69,6 +69,9 @@
|
|||||||
<span class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white"
|
<span class="inline-block px-2 py-0.5 rounded-full text-xs font-bold text-white"
|
||||||
[ngClass]="getStatusSeverityClass(s || 'UNREAD')">
|
[ngClass]="getStatusSeverityClass(s || 'UNREAD')">
|
||||||
{{ getStatusLabel(s) }}
|
{{ getStatusLabel(s) }}
|
||||||
|
@if (s === 'PARTIALLY_READ') {
|
||||||
|
({{ seriesReadProgress$ | async }})
|
||||||
|
}
|
||||||
</span>
|
</span>
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
@@ -120,4 +123,4 @@
|
|||||||
Loading series details...
|
Loading series details...
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -127,6 +127,13 @@ export class SeriesPageComponent {
|
|||||||
const allRead = statuses.every((s) => s === ReadStatus.READ);
|
const allRead = statuses.every((s) => s === ReadStatus.READ);
|
||||||
if (allRead) return ReadStatus.READ;
|
if (allRead) return ReadStatus.READ;
|
||||||
|
|
||||||
|
// If any book is currently being read, surface series status as READING
|
||||||
|
const isAnyReading = statuses.some(
|
||||||
|
(s) => s === ReadStatus.READING || s === ReadStatus.RE_READING || s === ReadStatus.PAUSED
|
||||||
|
);
|
||||||
|
if (isAnyReading) return ReadStatus.READING;
|
||||||
|
|
||||||
|
// If some are read and some are unread, surface as PARTIALLY_READ
|
||||||
const someRead = statuses.some((s) => s === ReadStatus.READ);
|
const someRead = statuses.some((s) => s === ReadStatus.READ);
|
||||||
if (someRead) return ReadStatus.PARTIALLY_READ;
|
if (someRead) return ReadStatus.PARTIALLY_READ;
|
||||||
|
|
||||||
@@ -137,6 +144,15 @@ export class SeriesPageComponent {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Progress like "12/20" (read/total)
|
||||||
|
seriesReadProgress$: Observable<string> = this.filteredBooks$.pipe(
|
||||||
|
map((books) => {
|
||||||
|
const total = books?.length ?? 0;
|
||||||
|
const readCount = (books || []).filter((b) => b.readStatus === ReadStatus.READ).length;
|
||||||
|
return `${readCount}/${total}`;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
get currentCardSize() {
|
get currentCardSize() {
|
||||||
return this.coverScalePreferenceService.currentCardSize;
|
return this.coverScalePreferenceService.currentCardSize;
|
||||||
}
|
}
|
||||||
@@ -193,10 +209,16 @@ export class SeriesPageComponent {
|
|||||||
switch (v) {
|
switch (v) {
|
||||||
case ReadStatus.UNREAD:
|
case ReadStatus.UNREAD:
|
||||||
return 'UNREAD';
|
return 'UNREAD';
|
||||||
|
case ReadStatus.READING:
|
||||||
|
return 'READING';
|
||||||
|
case ReadStatus.RE_READING:
|
||||||
|
return 'RE-READING';
|
||||||
case ReadStatus.READ:
|
case ReadStatus.READ:
|
||||||
return 'READ';
|
return 'READ';
|
||||||
case ReadStatus.PARTIALLY_READ:
|
case ReadStatus.PARTIALLY_READ:
|
||||||
return 'PARTIALLY READ';
|
return 'PARTIALLY READ';
|
||||||
|
case ReadStatus.PAUSED:
|
||||||
|
return 'PAUSED';
|
||||||
case ReadStatus.ABANDONED:
|
case ReadStatus.ABANDONED:
|
||||||
return 'ABANDONED';
|
return 'ABANDONED';
|
||||||
case ReadStatus.WONT_READ:
|
case ReadStatus.WONT_READ:
|
||||||
@@ -211,10 +233,17 @@ export class SeriesPageComponent {
|
|||||||
switch (normalized) {
|
switch (normalized) {
|
||||||
case "UNREAD":
|
case "UNREAD":
|
||||||
return "bg-gray-500";
|
return "bg-gray-500";
|
||||||
|
case "READING":
|
||||||
|
return "bg-blue-600";
|
||||||
case "READ":
|
case "READ":
|
||||||
return "bg-green-600";
|
return "bg-green-600";
|
||||||
case "PARTIALLY_READ":
|
case "PARTIALLY_READ":
|
||||||
return "bg-yellow-600";
|
return "bg-yellow-600";
|
||||||
|
case "PAUSED":
|
||||||
|
return "bg-slate-600";
|
||||||
|
case "RE-READING":
|
||||||
|
case "RE_READING":
|
||||||
|
return "bg-purple-600";
|
||||||
case "ABANDONED":
|
case "ABANDONED":
|
||||||
return "bg-red-600";
|
return "bg-red-600";
|
||||||
case "WONT_READ":
|
case "WONT_READ":
|
||||||
|
|||||||
Reference in New Issue
Block a user