feat(channels): an Added column, and About cards that wait for a resting pointer

The channel manager lists when each follow reached the list (the
subscription import that first saw it, or a subscribe made here) as a
sortable Added date after Last upload. The About cell's card opens after the
pointer rests on it for half a second instead of at once, and a scroll puts
an open one away.
This commit is contained in:
2026-11-01 01:30:30 +01:00
parent e06c0688d9
commit 85fd9b6704
10 changed files with 161 additions and 3 deletions
@@ -13,6 +13,8 @@ import {
} from "./channelColumns";
import { NO_TAG_SENTINEL, type ManagedChannel, type Tag } from "../../lib/api";
import type { TFunction } from "i18next";
import { render, screen } from "@testing-library/react";
import { formatDate } from "../../lib/format";
const ch = (over: Partial<ManagedChannel>): ManagedChannel => ({
id: "c",
@@ -24,6 +26,7 @@ const ch = (over: Partial<ManagedChannel>): ManagedChannel => ({
description: null,
stored_videos: 0,
last_video_at: null,
added_at: "2026-06-10T08:00:00+00:00",
total_duration_seconds: 0,
priority: 0,
hidden: false,
@@ -147,3 +150,39 @@ describe("buildChannelColumns — the row's end", () => {
expect(cols[cols.length - 1]!.render(ch({ id: "UCz" }))).toBe("more:UCz");
});
});
describe("buildChannelColumns — Added", () => {
const noop = () => {};
const cols = buildChannelColumns({
t: ((k: string) => k) as never,
lang: "en",
prioOptions: [],
userTags: [],
bumpPriority: noop,
setPriority: noop,
more: () => null,
onView: noop,
toggleTag: noop,
createAndAttachTag: noop,
onFilterByTag: noop,
suggestionsFor: () => [],
onAcceptSuggestion: noop,
onDismissSuggestion: noop,
});
const added = cols.find((c) => c.key === "added");
it("follows Last upload, and sorts by when the follow reached the list", () => {
expect(added?.header).toBe("channels.cols.added");
const keys = cols.map((c) => c.key);
expect(keys.indexOf("added")).toBe(keys.indexOf("lastUpload") + 1);
expect(added?.sortable).toBe(true);
const early = ch({ added_at: "2026-06-10T08:00:00+00:00" });
const late = ch({ added_at: "2026-10-12T08:00:00+00:00" });
expect(added!.sortValue!(late) as number).toBeGreaterThan(added!.sortValue!(early) as number);
});
it("shows the day, not a relative time", () => {
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();
});
});