fix(sidebar): keep compact host addresses visible (#1524)

This commit is contained in:
ZacharyZcR authored and GitHub committed 2026-09-30 09:46:00 -05:00
1 parent 64b9b18fe6
commit 718717554d
4 files changed
+117 -16

No files matched your search

+5 -12
View File
@@ -1167,18 +1167,11 @@ export function HostItem({
</Tooltip>
</TooltipProvider>
)}
{isCompact &&
!selectionMode &&
!shouldUseClickTray &&
!actionsOnly && (
<span
className={`text-[11px] text-muted-foreground/70 truncate leading-none ml-auto shrink-0 ${hoverTrayOpen ? "hidden" : ""}`}
>
{host.ip}
</span>
)}
{isCompact && selectionMode && (
<span className="text-[11px] text-muted-foreground/70 truncate leading-none ml-auto shrink-0">
{isCompact && (
<span
className="text-[11px] text-muted-foreground/70 truncate leading-none ml-auto max-w-[50%] shrink-0"
title={host.ip}
>
{host.ip}
</span>
)}
@@ -187,6 +187,30 @@ describe("HostItem density parity", () => {
},
);
it.each(["hover", "click", "always", "actionsOnly"] as const)(
"keeps the compact host address visible with %s actions",
(trayTrigger) => {
const props = {
host: baseHost,
onOpenTab: noop,
onDelete: noop,
onDuplicate: noop,
density: "compact" as const,
trayTrigger,
};
const { rerender } = render(<HostItem {...props} />);
expect(screen.getByText(baseHost.ip).classList.contains("hidden")).toBe(
false,
);
rerender(<HostItem {...props} isHovered />);
expect(screen.getByText(baseHost.ip).classList.contains("hidden")).toBe(
false,
);
rerender(<HostItem {...props} isTrayOpen selectionMode />);
expect(screen.getAllByText(baseHost.ip)).toHaveLength(1);
},
);
it("shows tags in both densities when showTags is true", () => {
renderHostItem("comfortable");
expect(screen.getByText("prod")).toBeTruthy();