| 1 | namespace CascadeIDE.Features.Chat; |
| 2 | |
| 3 | /// <summary>UI-строки картотеки тем и overview (presentation).</summary> |
| 4 | public static class ChatThreadOverviewPresentation |
| 5 | { |
| 6 | public static string FormatCatalogHint(int topicCount) => |
| 7 | topicCount == 1 |
| 8 | ? "1 тема · Enter (ato) — открыть" |
| 9 | : $"{topicCount} тем · Enter (ato) — открыть"; |
| 10 | |
| 11 | public const string CatalogFooter = "atp/atn — выбор · atb — сюда"; |
| 12 | |
| 13 | public static string FormatTopicTitle(ChatThreadOverviewItem item) |
| 14 | { |
| 15 | var indent = item.Depth > 0 ? new string(' ', item.Depth * 2) : ""; |
| 16 | var prefix = item.IsMainThread ? "◆ " : ""; |
| 17 | return indent + prefix + item.Title; |
| 18 | } |
| 19 | |
| 20 | public static string? FormatTopicBadges(ChatThreadOverviewItem item) |
| 21 | { |
| 22 | var badges = new List<string>(); |
| 23 | if (item.IsMainThread) |
| 24 | badges.Add("основная"); |
| 25 | if (item.IsActive) |
| 26 | badges.Add("активная"); |
| 27 | if (item.ItemCount > 0) |
| 28 | badges.Add($"{item.ItemCount} в ленте"); |
| 29 | return badges.Count == 0 ? null : string.Join(" · ", badges); |
| 30 | } |
| 31 | |
| 32 | public static string FormatSideThreadRowTitle(ChatThreadOverviewItem item) |
| 33 | { |
| 34 | var prefix = item.Depth > 0 ? new string('>', item.Depth) + " " : ""; |
| 35 | return prefix + item.Title; |
| 36 | } |
| 37 | |
| 38 | public static string FormatSideThreadRowMeta(ChatThreadOverviewItem item) |
| 39 | { |
| 40 | var active = item.IsActive ? " · active" : ""; |
| 41 | var main = item.IsMainThread ? " · main" : ""; |
| 42 | return $"Сообщений: {item.ItemCount}{active}{main}"; |
| 43 | } |
| 44 | |
| 45 | public static string FormatThreadHeaderMeta(ChatThreadNode thread) |
| 46 | { |
| 47 | var meta = thread.IsMainThread ? "основная линия" : $"ветка depth {thread.Depth}"; |
| 48 | if (thread.IsActive) |
| 49 | meta += " | активная"; |
| 50 | return meta; |
| 51 | } |
| 52 | } |
| 53 | |