chore(ui): dedup last 3 jscpd clones → 0 (collapsed rail, video-card text block, subs column)
- 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.
This commit is contained in:
parent
1efd089749
commit
b59ad00fac
7 changed files with 86 additions and 98 deletions
18
frontend/src/components/channelColumns.tsx
Normal file
18
frontend/src/components/channelColumns.tsx
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
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>,
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue