mirror of
https://github.com/paperclipai/paperclip.git
synced 2026-10-23 17:33:51 +02:00
The list/org rows packed adapter + model + last-heartbeat + status + four action buttons into a shrink-0 trailing block. On typical laptop widths this squeezed the flex-1 min-w-0 title to zero, so agent names were invisible. - EntityRow: add optional titleClassName so callers can guarantee a min title width - Agents list + org rows: give the name a min-w-[7rem] floor; move the wide adapter (w-28) + model (w-36) columns to 2xl only, keeping last-heartbeat + status + actions at all widths. Names now always render; metadata reappears on wide screens. Co-Authored-By: Paperclip <noreply@paperclip.ing>
79 lines
1.9 KiB
TypeScript
79 lines
1.9 KiB
TypeScript
import { type ReactNode } from "react";
|
|
import { Link } from "@/lib/router";
|
|
import { cn } from "../lib/utils";
|
|
|
|
interface EntityRowProps {
|
|
leading?: ReactNode;
|
|
identifier?: string;
|
|
title: string;
|
|
subtitle?: string;
|
|
trailing?: ReactNode;
|
|
selected?: boolean;
|
|
to?: string;
|
|
onClick?: () => void;
|
|
className?: string;
|
|
titleClassName?: string;
|
|
reserveSubtitleSpace?: boolean;
|
|
}
|
|
|
|
export function EntityRow({
|
|
leading,
|
|
identifier,
|
|
title,
|
|
subtitle,
|
|
trailing,
|
|
selected,
|
|
to,
|
|
onClick,
|
|
className,
|
|
titleClassName,
|
|
reserveSubtitleSpace,
|
|
}: EntityRowProps) {
|
|
const isClickable = !!(to || onClick);
|
|
const classes = cn(
|
|
"flex items-center gap-3 px-4 py-2 text-sm border-b border-border last:border-b-0 transition-colors",
|
|
isClickable && "cursor-pointer hover:bg-accent/50",
|
|
selected && "bg-accent/30",
|
|
className
|
|
);
|
|
|
|
const content = (
|
|
<>
|
|
{leading && <div className="flex items-center gap-2 shrink-0">{leading}</div>}
|
|
<div className={cn("flex-1 min-w-0", titleClassName)}>
|
|
<div className="flex items-center gap-2">
|
|
{identifier && (
|
|
<span className="text-xs text-muted-foreground font-mono shrink-0 relative top-[1px]">
|
|
{identifier}
|
|
</span>
|
|
)}
|
|
<span className="truncate">{title}</span>
|
|
</div>
|
|
{(subtitle || reserveSubtitleSpace) && (
|
|
<p
|
|
className={cn("text-xs text-muted-foreground truncate mt-0.5 min-h-4", !subtitle && "invisible")}
|
|
aria-hidden={!subtitle}
|
|
>
|
|
{subtitle}
|
|
</p>
|
|
)}
|
|
</div>
|
|
{trailing && <div className="flex items-center gap-2 shrink-0">{trailing}</div>}
|
|
</>
|
|
);
|
|
|
|
if (to) {
|
|
return (
|
|
<Link to={to} className={cn("no-underline text-inherit", classes)} onClick={onClick}>
|
|
{content}
|
|
</Link>
|
|
);
|
|
}
|
|
|
|
return (
|
|
<div className={classes} onClick={onClick}>
|
|
{content}
|
|
</div>
|
|
);
|
|
}
|