- CollapsedFilterRail: the byte-identical 31-line collapsed sidebar rail was in both Sidebar (feed) and PlexSidebar → one shared component. - VideoCard: the title + channel-button + meta block was duplicated across the list-row and card layouts → a local `textBlock` element (only one layout branch renders, so reusing the element is safe). - subsColumn<T>(t): the identical 'subscribers' DataTable column in Channels + ChannelDiscovery → a generic factory in channelColumns.tsx. All behavior-neutral; jscpd now reports 0 clones (was 8 at Phase 0 baseline). tsc + knip green.
18 lines
756 B
TypeScript
18 lines
756 B
TypeScript
import type { TFunction } from "i18next";
|
|
import { formatCountOrDash } from "../lib/format";
|
|
import type { Column } from "./DataTable";
|
|
|
|
/** The shared "subscribers" DataTable column (right-aligned, sortable, em-dash for null) — identical
|
|
* in the Channels manager and the ChannelDiscovery table, which show subscriber counts on different
|
|
* channel row shapes. */
|
|
export function subsColumn<T extends { subscriber_count: number | null }>(t: TFunction): Column<T> {
|
|
return {
|
|
key: "subs",
|
|
header: t("channels.cols.subs"),
|
|
align: "right",
|
|
nowrap: true,
|
|
sortable: true,
|
|
sortValue: (c) => c.subscriber_count ?? -1,
|
|
render: (c) => <span className="text-muted tabular-nums">{formatCountOrDash(c.subscriber_count)}</span>,
|
|
};
|
|
}
|