diff --git a/src/TUI.Engine/Theme/Palette.cs b/src/TUI.Engine/Theme/Palette.cs index 8f9b7ea..1de7832 100644 --- a/src/TUI.Engine/Theme/Palette.cs +++ b/src/TUI.Engine/Theme/Palette.cs @@ -11,25 +11,25 @@ public static class Palette public const string ErrorColor = "CA3433"; public const string WarningColor = "EC9706"; public const string InfoColor = "25799F"; - + public static string Main(this string currentText, bool isFocused = true) => isFocused ? currentText.Pastel(PrimaryColor) : Hint(currentText); - + public static string Hint(this string currentText) => currentText.Pastel(HintColor); - + public static string Hint(this char currentText) => currentText.ToString().Pastel(HintColor); - + public static string Disable(this string currentText) => currentText.RemoveColors().Pastel(HintColor); - + public static string Warning(this string currentText) => currentText.Pastel(WarningColor); - + public static string Error(this string currentText) => currentText.Pastel(ErrorColor); - + public static string Info(this string currentText) => currentText.Pastel(InfoColor); - + public static string Info(this char currentText) => currentText.ToString().Pastel(InfoColor); - + public static string Info(this int currentText) => currentText.ToString().Pastel(InfoColor); } \ No newline at end of file diff --git a/src/TUI/Controls/Containers/DependenciesContainer.cs b/src/TUI/Controls/Containers/DependenciesContainer.cs index ecf373f..3d89fc7 100644 --- a/src/TUI/Controls/Containers/DependenciesContainer.cs +++ b/src/TUI/Controls/Containers/DependenciesContainer.cs @@ -15,45 +15,50 @@ namespace TUI.Controls.Containers; public class DependenciesContainer : ContainerBase { public readonly Project? Project; - + private const int VersionColumnWidth = 11; - + private const int TitleColumnWidth = 25; - + private readonly Nodes _dependencies = new(); - + public DependenciesContainer() { } - + public DependenciesContainer(Project project) { Project = project; } - + public void AddTitleStub() { var size = new Size(TitleColumnWidth, 1); var title = new StubComponent(size); title.SetPadding(Level.Normal); - + _dependencies.Add(title); } - + public void AddTitle(IComponent title) { title.SetPadding(Level.Normal); title.SetFixed(Orientation.Horizontal, TitleColumnWidth); title.SetAlignment(Horizontal.Left); - + if (Project is not null && Project.Legacy) { title.StyleContext = new StyleContext(Palette.DisableColor); } - + + if (Project is not null && Project.Freeze) + { + title.StyleContext = new StyleContext(Palette.InfoColor); + } + _dependencies.Add(title); } - + public void AddDependencyStub() { var size = new Size(VersionColumnWidth, 1); @@ -61,15 +66,20 @@ public class DependenciesContainer : ContainerBase stub.SetPadding(Level.Normal); stub.SetAlignment(Horizontal.Right); stub.SetFixed(Orientation.Horizontal, VersionColumnWidth); - + if (Project is not null && Project.Legacy) { stub.StyleContext = new StyleContext(Palette.DisableColor); } - + + if (Project is not null && Project.Freeze) + { + stub.StyleContext = new StyleContext(Palette.InfoColor); + } + _dependencies.Add(stub); } - + public void AddError() { var size = new Size(25, 1); @@ -77,29 +87,39 @@ public class DependenciesContainer : ContainerBase stub.SetPadding(Level.Normal); stub.SetAlignment(Horizontal.Right); stub.SetFixed(Orientation.Horizontal, 25); - + if (Project is not null && Project.Legacy) { stub.StyleContext = new StyleContext(Palette.DisableColor); } - + + if (Project is not null && Project.Freeze) + { + stub.StyleContext = new StyleContext(Palette.InfoColor); + } + _dependencies.Add(stub); } - + public void AddDependency(Dependency dependency, VersionStatus status = VersionStatus.BeNice) { var version = new VersionComponent(dependency.Version, dependency.Brand, status, dependency.Type); version.SetPadding(Level.Normal); version.SetAlignment(Horizontal.Right); version.SetFixed(Orientation.Horizontal, VersionColumnWidth); - + if (Project is not null && Project.Legacy) { version.StyleContext = new StyleContext(Palette.DisableColor); } - + + if (Project is not null && Project.Freeze) + { + version.StyleContext = new StyleContext(Palette.InfoColor); + } + _dependencies.Add(version); } - + public override Nodes GetNodes() => _dependencies; } \ No newline at end of file diff --git a/src/TUI/Domain/Project.cs b/src/TUI/Domain/Project.cs index c75be9f..2640821 100644 --- a/src/TUI/Domain/Project.cs +++ b/src/TUI/Domain/Project.cs @@ -3,12 +3,14 @@ namespace TUI.Domain; public record Project(int Id, string Name, IEnumerable Tags, Hub Hub) { private IEnumerable Dependencies => new List(); - + public bool IsPublicNetwork => Tags.Contains("public"); - + public bool HasAuth => Tags.Contains("auth"); - + public bool SeoDependent => Tags.Contains("seo"); - + public bool Legacy => Tags.Contains("legacy"); + + public bool Freeze => Tags.Contains("freeze"); } \ No newline at end of file