fix(channels): the Length column shows the sum alone
The "+N without length" line did not fit the 4.5 rem column (88 px of text in a 56 px cell) and spilled into Tags. The owner wants no such line there: the cell shows the summed hours, and the channel list no longer sends a count nothing reads. A playlist's total keeps it.
This commit is contained in:
@@ -76,9 +76,8 @@ export interface ManagedChannel {
|
||||
/** When the follow reached this list: the subscription import that first saw it, or a
|
||||
* subscribe made here. */
|
||||
added_at: string;
|
||||
/** The lengths it knows; a video with none (a live one, a 24/7 archive) is left out. */
|
||||
total_duration_seconds: number;
|
||||
/** Live videos the total cannot hold (no length): the "+N without length" beside it. */
|
||||
live_without_length: number;
|
||||
priority: number;
|
||||
hidden: boolean;
|
||||
deep_requested: boolean;
|
||||
|
||||
@@ -28,7 +28,6 @@ const ch = (over: Partial<ManagedChannel>): ManagedChannel => ({
|
||||
last_video_at: null,
|
||||
added_at: "2026-06-10T08:00:00+00:00",
|
||||
total_duration_seconds: 0,
|
||||
live_without_length: 0,
|
||||
priority: 0,
|
||||
hidden: false,
|
||||
deep_requested: false,
|
||||
@@ -186,6 +185,19 @@ describe("buildChannelColumns — Added", () => {
|
||||
render(<>{added!.render(ch({ added_at: "2026-10-12T08:00:00+00:00" }))}</>);
|
||||
expect(screen.getByText(formatDate("2026-10-12T08:00:00+00:00", "en"))).toBeTruthy();
|
||||
});
|
||||
|
||||
// The column is sized for the sum: a count of videos without a length beside it spilled into
|
||||
// Tags, so the table shows the sum alone — even from a server that still sends the count.
|
||||
it("Length shows the sum alone", () => {
|
||||
const length = cols.find((c) => c.key === "length");
|
||||
const row = {
|
||||
...ch({ total_duration_seconds: 7200 }),
|
||||
live_without_length: 2,
|
||||
} as ManagedChannel;
|
||||
const { container } = render(<>{length!.render(row)}</>);
|
||||
expect(container.textContent).not.toContain("card.liveWithoutLength");
|
||||
expect(container.querySelectorAll("span")).toHaveLength(1);
|
||||
});
|
||||
});
|
||||
|
||||
describe("tagFilterChips", () => {
|
||||
|
||||
@@ -11,7 +11,6 @@ import { ChannelTagsControl, type SuggestedTag } from "../../features/channel/Ch
|
||||
import { StoredCell } from "./channelCells";
|
||||
import { isFullySynced } from "./channelSync";
|
||||
import { RelativeTime } from "../../components/ui/RelativeTime";
|
||||
import { withLiveCount } from "../../features/video/liveWithoutLength";
|
||||
import type { FilterChip } from "./TagFilterChips";
|
||||
|
||||
/** The shared "subscribers" DataTable column (right-aligned, sortable, em-dash for null) — identical
|
||||
@@ -236,11 +235,9 @@ export function buildChannelColumns(deps: ChannelColumnDeps): Column<ManagedChan
|
||||
sortValue: (c) => c.total_duration_seconds,
|
||||
render: (c) => (
|
||||
<span className="text-muted tabular-nums">
|
||||
{/* The sum alone: the column is sized for it, and a count of the videos it left out
|
||||
(no length) did not fit beside it. */}
|
||||
{formatTotalHours(c.total_duration_seconds, lang)}
|
||||
{/* Its own line: the column is sized for the sum alone. */}
|
||||
{c.live_without_length > 0 && (
|
||||
<span className="block text-2xs">{withLiveCount("", c.live_without_length, t)}</span>
|
||||
)}
|
||||
</span>
|
||||
),
|
||||
},
|
||||
|
||||
@@ -61,7 +61,6 @@ const ch = (over: Partial<ManagedChannel> = {}): ManagedChannel => ({
|
||||
last_video_at: null,
|
||||
added_at: "2026-06-10T08:00:00+00:00",
|
||||
total_duration_seconds: 0,
|
||||
live_without_length: 0,
|
||||
priority: 0,
|
||||
hidden: false,
|
||||
deep_requested: false,
|
||||
|
||||
Reference in New Issue
Block a user