Forge
csharpdeeb25a2
1using CascadeIDE.Contracts;
2using CascadeIDE.Models;
3
4namespace CascadeIDE.Features.Shell.Application;
5
6/// <summary>Видимость страниц вторичной оболочки Mfd при текущих флагах возможностей/доков (ADR 0021).</summary>
7[PresentationProjection]
8public static class MfdShellPageAllowanceProjection
9{
10 /// <summary>Порядок обхода при выборе первой доступной страницы (как в главном окне до выноса политики).</summary>
11 public static readonly MfdShellPage[] PageOrder =
12 [
13 MfdShellPage.WorkspaceHealth,
14 MfdShellPage.SolutionExplorer,
15 MfdShellPage.RelatedFiles,
16 MfdShellPage.Correspondence,
17 MfdShellPage.MarkdownPreview,
18 MfdShellPage.HybridIndex,
19 MfdShellPage.WebAiPortal,
20 MfdShellPage.Editor,
21 MfdShellPage.Chat,
22 MfdShellPage.AiChatSettings,
23 MfdShellPage.EnvironmentReadiness,
24 MfdShellPage.Terminal,
25 MfdShellPage.Build,
26 MfdShellPage.Problems,
27 MfdShellPage.Git,
28 MfdShellPage.Events,
29 MfdShellPage.Tests,
30 MfdShellPage.Hypotheses,
31 MfdShellPage.DebugStack,
32 ];
33
34 public readonly record struct Snapshot(
35 bool ShowIdeHealthMfdPage,
36 bool IsDockedMfdSolutionExplorerTree,
37 bool IsTerminalVisible,
38 bool IsBuildOutputVisible,
39 bool IsProblemsPanelVisible,
40 bool IsGitPanelVisible,
41 bool InstrumentationTabs,
42 bool HypothesesTab,
43 bool IsIntercomPrimaryWorkSurface);
44
45 public static bool IsAllowed(MfdShellPage page, Snapshot s) => page switch
46 {
47 MfdShellPage.WorkspaceHealth => s.ShowIdeHealthMfdPage,
48 MfdShellPage.SolutionExplorer => s.IsDockedMfdSolutionExplorerTree,
49 MfdShellPage.RelatedFiles => true,
50 MfdShellPage.Correspondence => true,
51 MfdShellPage.MarkdownPreview => true,
52 MfdShellPage.HybridIndex => true,
53 MfdShellPage.WebAiPortal => true,
54 MfdShellPage.Editor => s.IsIntercomPrimaryWorkSurface,
55 MfdShellPage.Chat => !s.IsIntercomPrimaryWorkSurface,
56 MfdShellPage.AiChatSettings => true,
57 MfdShellPage.EnvironmentReadiness => true,
58 MfdShellPage.Terminal => s.IsTerminalVisible,
59 MfdShellPage.Build => s.IsBuildOutputVisible,
60 MfdShellPage.Problems => s.IsProblemsPanelVisible,
61 MfdShellPage.Git => s.IsGitPanelVisible,
62 MfdShellPage.Events or MfdShellPage.Tests or MfdShellPage.DebugStack => s.InstrumentationTabs,
63 MfdShellPage.Hypotheses => s.HypothesesTab,
64 _ => false,
65 };
66
67 public static MfdShellPage FirstAllowedOrChat(Snapshot s)
68 {
69 foreach (var p in PageOrder)
70 {
71 if (IsAllowed(p, s))
72 return p;
73 }
74
75 return MfdShellPage.Chat;
76 }
77}
78
View only · write via MCP/CIDE