feat(managers): bottom pager on the channel tables (E4 S1)

DataTable gains a working controlsPosition="both": the leading controls
(e.g. the status chips) stay ONLY at the top; the bottom row is pager-only
(no duplicated chips). The subscribed + discovery channel tables opt in, so
the 33-page list has a pager at the bottom too — no scroll back up.
This commit is contained in:
2026-07-19 15:45:09 +02:00
parent 97611be9c4
commit 83b60df112
3 changed files with 78 additions and 64 deletions
+1 -1
View File
@@ -171,7 +171,7 @@ export default function ChannelDiscovery({
columns={columns}
rowKey={(c) => c.id}
persistKey={accountKey(LS.channelDiscoveryTable) ?? undefined}
controlsPosition="top"
controlsPosition="both"
controlsInBand
controlsBandClassName="px-4 max-w-7xl mx-auto"
emptyText={t("channels.discovery.empty")}
+1 -1
View File
@@ -586,7 +586,7 @@ export default function Channels() {
columns={columns}
rowKey={(c) => c.id}
persistKey={accountKey(LS.channelsTable) ?? undefined}
controlsPosition="top"
controlsPosition="both"
controlsLeading={statusChips}
controlsInBand
controlsBandClassName="px-4 max-w-7xl mx-auto"
+19 -5
View File
@@ -288,10 +288,11 @@ export default function DataTable<T>({
);
}
const controls =
controlsLeading != null || sorted.length > 0 ? (
<div className="flex items-center justify-between gap-3 my-3 text-sm flex-wrap">
<div className="flex items-center gap-3 flex-wrap">{controlsLeading}</div>
// The pager + rows-per-page cluster on its own, so it can be rendered a second time at the bottom
// (controlsPosition "both") WITHOUT repeating the leading controls (e.g. the status chips) — those
// are header controls and belong only at the top.
const pagerNode =
totalPages > 1 || sorted.length > 0 ? (
<div className="flex items-center gap-3 flex-wrap">
{totalPages > 1 && (
<div className="flex items-center gap-2">
@@ -349,9 +350,21 @@ export default function DataTable<T>({
</label>
)}
</div>
) : null;
const controls =
controlsLeading != null || pagerNode ? (
<div className="flex items-center justify-between gap-3 my-3 text-sm flex-wrap">
<div className="flex items-center gap-3 flex-wrap">{controlsLeading}</div>
{pagerNode}
</div>
) : null;
// Bottom row for "both": just the pager, right-aligned (the leading controls stay at the top).
const bottomControls = pagerNode ? (
<div className="flex items-center justify-end gap-3 my-3 text-sm flex-wrap">{pagerNode}</div>
) : null;
const topControls =
controlsInBand && controls ? (
<PageToolbar>
@@ -476,7 +489,8 @@ export default function DataTable<T>({
<div className="text-muted py-8 text-center text-sm">{emptyText ?? t("datatable.empty")}</div>
)}
{(controlsPosition === "bottom" || controlsPosition === "both") && controls}
{controlsPosition === "bottom" && controls}
{controlsPosition === "both" && bottomControls}
</div>
);
}