mirror of
https://github.com/dnwSilver/tld.git
synced 2025-01-19 09:22:08 +00:00
✨ Add freeze tag for project.
This commit is contained in:
parent
1bc1af71c9
commit
8e518ee19e
@ -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);
|
||||
}
|
@ -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;
|
||||
}
|
@ -3,12 +3,14 @@ namespace TUI.Domain;
|
||||
public record Project(int Id, string Name, IEnumerable<string> Tags, Hub Hub)
|
||||
{
|
||||
private IEnumerable<Dependency> Dependencies => new List<Dependency>();
|
||||
|
||||
|
||||
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");
|
||||
}
|
Loading…
Reference in New Issue
Block a user