RynthChat pins: review fixes

Drawer pin was unclickable: the row now allows overlap and the pin takes
the click (and the row menu/tooltip stay off the pin). Header layout is a
pure ChatPins.Layout: the overflow button is always drawn when pins do not
all fit and its width is reserved before search's 120 px. The pinned chip
uses a lighter fill on the current row. ChatPins.Add (idempotent) seeds the
server pin; ChatModel.Unpin (one way) backs the header Unpin menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-15 08:49:20 -08:00
commit 6e271c0955
4 changed files with 79 additions and 21 deletions

View file

@ -1639,5 +1639,29 @@ internal static class Program
Case("Visible_BaseTabsPinnable");
Check(ChatPins.Visible(ChatPins.Toggle(Array.Empty<string>(), "All"), new[] { "All", "Chat" }).SequenceEqual(new[] { "All" }), "All");
Check(ChatPins.Visible(ChatPins.Toggle(Array.Empty<string>(), "Chat"), new[] { "All", "Chat" }).SequenceEqual(new[] { "Chat" }), "Chat");
}
Case("Add_IsIdempotent");
string[] added = ChatPins.Add(new[] { "Chat" }, "Network");
Check(added.SequenceEqual(new[] { "Chat", "Network" }), "appended");
Check(ChatPins.Add(added, "network").SequenceEqual(added), "a pinned name (any case) adds nothing");
Check(ChatPins.Add(added, "").Length == 2 && ChatPins.Add(added, " ").Length == 2, "a blank name adds nothing");
Check(ChatPins.Add(Array.Empty<string>(), " Net ").SequenceEqual(new[] { "Net" }), "trimmed");
Case("Layout_ZeroPins");
Check(ChatPins.Layout(Array.Empty<float>(), 500, 22, 2) == (0, false), "nothing to draw, no overflow button");
Check(ChatPins.Layout(Array.Empty<float>(), -50, 22, 2) == (0, false), "also in no room");
Case("Layout_AllFit");
Check(ChatPins.Layout(new[] { 50f, 60f }, 114, 22, 2) == (2, false), "exactly full (50+2+60+2)");
Check(ChatPins.Layout(new[] { 50f, 60f }, 300, 22, 2) == (2, false), "room to spare");
Case("Layout_SomeFit");
// 50+2 fits in 114-22-2=90, then 52+60+2=114 > 90: one pin, the rest in overflow.
Check(ChatPins.Layout(new[] { 50f, 60f }, 113, 22, 2) == (1, true), "one fits, overflow button");
Check(ChatPins.Layout(new[] { 50f, 60f, 10f }, 113, 22, 2) == (1, true), "a later small pin does not jump the queue");
Case("Layout_NoneFit");
Check(ChatPins.Layout(new[] { 50f, 60f }, 60, 22, 2) == (0, true), "room for the overflow button only");
Check(ChatPins.Layout(new[] { 50f }, 10, 22, 2) == (0, true), "less than the overflow button: still wanted");
Check(ChatPins.Layout(new[] { 50f }, -30, 22, 2) == (0, true), "negative room: still wanted"); }
}