Cap rail bot and workspace lists at five with see-all summary

This commit is contained in:
2026-10-19 20:11:04 +01:00
parent b0c9c84b2b
commit b79cebf397
8 changed files with 146 additions and 21 deletions
@@ -1,26 +1,24 @@
import type { ReactNode } from "react";
import Button from "@moduletrace/twui/layout/Button";
import Row from "@moduletrace/twui/layout/Row";
import Span from "@moduletrace/twui/layout/Span";
import { Ellipsis } from "lucide-react";
import { AppData } from "@/src/data/app-data";
import type { BotWithLastMessage } from "@/src/types";
import RailSeeAllStone from "./rail-see-all-stone";
type Props = {
/**
* The bots the rail doesn't list.
* A few of the records the rail doesn't list, e.g. their stones.
*/
hidden: BotWithLastMessage[];
stones?: ReactNode;
label: string;
onOpen: () => void;
};
/**
* Under the listed bots: a few stones of the ones that aren't listed and
* "See all bots", which opens them all. An ellipsis when the rail
* Under the listed records: a few stones of the ones that aren't listed and
* "See all", which opens every one in a modal. An ellipsis when the rail
* collapses.
*/
export default function RailSeeAllRow({ hidden, label, onOpen }: Props) {
export default function RailSeeAllRow({ stones, label, onOpen }: Props) {
return (
<Button
title={label}
@@ -31,12 +29,10 @@ export default function RailSeeAllRow({ hidden, label, onOpen }: Props) {
className="flex shrink-0 h-10 w-full items-center justify-center @rail:justify-start gap-3! rounded-default px-1! @rail:px-3! text-ink-secondary dark:text-ink-secondary hover:text-ink hover:dark:text-ink hover:bg-sunken hover:dark:bg-sunken transition-colors duration-[var(--m-fast)] focus-visible:ring-2 focus-visible:ring-ink"
>
<Ellipsis size={18} aria-hidden className="@rail:hidden" />
<Row className="hidden @rail:flex shrink-0 gap-1! flex-nowrap items-center">
{hidden.slice(0, AppData.RailSeeAllStones).map((bot) => (
<RailSeeAllStone key={bot.id} bot={bot} />
))}
</Row>
<Span className="hidden @rail:inline text-[13px] font-bold leading-4">{label}</Span>
{stones ? (
<Row className="hidden @rail:flex shrink-0 gap-1! flex-nowrap items-center">{stones}</Row>
) : null}
<Span className="hidden @rail:inline text-[13px] font-bold leading-4 truncate">{label}</Span>
</Button>
);
}