fix(web): drop redundant status chip beside counts (#266)
This commit is contained in:
@@ -57,6 +57,23 @@ export function seriesNeedsAttention(series: LibrarySeries): boolean {
|
||||
return series.status === "airing" || series.status === "incomplete";
|
||||
}
|
||||
|
||||
/**
|
||||
* §4.2: `incomplete` and `complete` say nothing a counts chip beside them
|
||||
* hasn't already said — amber-partial or green-full. `airing`, `waiting`
|
||||
* and `ended` share a count with another status (a finished season reads
|
||||
* `complete` either way) so the word is what tells them apart, and stays.
|
||||
* With no counts chip to lean on (`wanted_episodes === 0`) the word is the
|
||||
* only thing on the row saying it, so it stays too.
|
||||
*/
|
||||
export function seriesStatusChipRedundant(series: {
|
||||
status: SeriesStatus;
|
||||
wanted_episodes: number;
|
||||
}): boolean {
|
||||
return (
|
||||
series.wanted_episodes > 0 && (series.status === "incomplete" || series.status === "complete")
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* The movie analogue of §4.2's default set: wanted and not yet on disk.
|
||||
* Available and unwanted titles are satisfied and collapse with the rest.
|
||||
|
||||
+22
-15
@@ -18,6 +18,7 @@ import {
|
||||
type LibrarySeries,
|
||||
movieNeedsAttention,
|
||||
seriesNeedsAttention,
|
||||
seriesStatusChipRedundant,
|
||||
waiverLabel,
|
||||
} from "./library";
|
||||
import {
|
||||
@@ -3828,11 +3829,13 @@ function seriesRow(
|
||||
if (series.blocked) {
|
||||
chips.append(chip(NO_TARGETED_SEARCH));
|
||||
}
|
||||
chips.append(
|
||||
chip(series.status, (span) => {
|
||||
span.dataset.status = series.status;
|
||||
}),
|
||||
);
|
||||
if (!seriesStatusChipRedundant(series)) {
|
||||
chips.append(
|
||||
chip(series.status, (span) => {
|
||||
span.dataset.status = series.status;
|
||||
}),
|
||||
);
|
||||
}
|
||||
const affordance = document.createElement("span");
|
||||
affordance.className = "row-add control readout";
|
||||
affordance.textContent = "episodes";
|
||||
@@ -3941,11 +3944,13 @@ function seriesCard(
|
||||
if (series.blocked) {
|
||||
chips.push(chip(NO_TARGETED_SEARCH));
|
||||
}
|
||||
chips.push(
|
||||
chip(series.status, (span) => {
|
||||
span.dataset.status = series.status;
|
||||
}),
|
||||
);
|
||||
if (!seriesStatusChipRedundant(series)) {
|
||||
chips.push(
|
||||
chip(series.status, (span) => {
|
||||
span.dataset.status = series.status;
|
||||
}),
|
||||
);
|
||||
}
|
||||
const rating = ratingChip(series.vote_average);
|
||||
if (rating !== null) {
|
||||
chips.push(rating);
|
||||
@@ -4522,11 +4527,13 @@ function seriesMain(tvDeck: TvReleasesView, views: HideableView[]): SeriesView {
|
||||
`${current.available_episodes} of ${current.wanted_episodes} wanted episodes on disk`,
|
||||
),
|
||||
);
|
||||
chipsEl.append(
|
||||
chip(current.status, (span) => {
|
||||
span.dataset.status = current.status;
|
||||
}),
|
||||
);
|
||||
if (!seriesStatusChipRedundant(current)) {
|
||||
chipsEl.append(
|
||||
chip(current.status, (span) => {
|
||||
span.dataset.status = current.status;
|
||||
}),
|
||||
);
|
||||
}
|
||||
if (current.blocked) {
|
||||
chipsEl.append(chip(NO_TARGETED_SEARCH));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user