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:
@@ -171,7 +171,7 @@ export default function ChannelDiscovery({
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey={(c) => c.id}
|
rowKey={(c) => c.id}
|
||||||
persistKey={accountKey(LS.channelDiscoveryTable) ?? undefined}
|
persistKey={accountKey(LS.channelDiscoveryTable) ?? undefined}
|
||||||
controlsPosition="top"
|
controlsPosition="both"
|
||||||
controlsInBand
|
controlsInBand
|
||||||
controlsBandClassName="px-4 max-w-7xl mx-auto"
|
controlsBandClassName="px-4 max-w-7xl mx-auto"
|
||||||
emptyText={t("channels.discovery.empty")}
|
emptyText={t("channels.discovery.empty")}
|
||||||
|
|||||||
@@ -586,7 +586,7 @@ export default function Channels() {
|
|||||||
columns={columns}
|
columns={columns}
|
||||||
rowKey={(c) => c.id}
|
rowKey={(c) => c.id}
|
||||||
persistKey={accountKey(LS.channelsTable) ?? undefined}
|
persistKey={accountKey(LS.channelsTable) ?? undefined}
|
||||||
controlsPosition="top"
|
controlsPosition="both"
|
||||||
controlsLeading={statusChips}
|
controlsLeading={statusChips}
|
||||||
controlsInBand
|
controlsInBand
|
||||||
controlsBandClassName="px-4 max-w-7xl mx-auto"
|
controlsBandClassName="px-4 max-w-7xl mx-auto"
|
||||||
|
|||||||
@@ -288,10 +288,11 @@ export default function DataTable<T>({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
const controls =
|
// The pager + rows-per-page cluster on its own, so it can be rendered a second time at the bottom
|
||||||
controlsLeading != null || sorted.length > 0 ? (
|
// (controlsPosition "both") WITHOUT repeating the leading controls (e.g. the status chips) — those
|
||||||
<div className="flex items-center justify-between gap-3 my-3 text-sm flex-wrap">
|
// are header controls and belong only at the top.
|
||||||
<div className="flex items-center gap-3 flex-wrap">{controlsLeading}</div>
|
const pagerNode =
|
||||||
|
totalPages > 1 || sorted.length > 0 ? (
|
||||||
<div className="flex items-center gap-3 flex-wrap">
|
<div className="flex items-center gap-3 flex-wrap">
|
||||||
{totalPages > 1 && (
|
{totalPages > 1 && (
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
@@ -349,9 +350,21 @@ export default function DataTable<T>({
|
|||||||
</label>
|
</label>
|
||||||
)}
|
)}
|
||||||
</div>
|
</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>
|
</div>
|
||||||
) : null;
|
) : 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 =
|
const topControls =
|
||||||
controlsInBand && controls ? (
|
controlsInBand && controls ? (
|
||||||
<PageToolbar>
|
<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>
|
<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>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user