feat(ui): complete Avalonia UI port with 7 main pages, tool settings & top MenuBar
This commit is contained in:
@@ -0,0 +1,70 @@
|
||||
namespace ClawdDotNet.Core.Tasks;
|
||||
|
||||
/// <summary>
|
||||
/// Übersetzt die Aufzählungen in ihre menschenlesbare Form und zurück. Dieselbe
|
||||
/// Schreibweise wird im Frontmatter wie in der DB verwendet, damit beide Seiten sich
|
||||
/// nicht auseinanderentwickeln. Unbekannte Eingaben fallen auf einen sicheren Standard
|
||||
/// zurück, statt zu werfen — eine von Hand editierte Datei soll das Board nicht kippen.
|
||||
/// </summary>
|
||||
public static class TaskText
|
||||
{
|
||||
public static string Of(TaskItemStatus status) => status switch
|
||||
{
|
||||
TaskItemStatus.Backlog => "backlog",
|
||||
TaskItemStatus.Todo => "todo",
|
||||
TaskItemStatus.InProgress => "in_progress",
|
||||
TaskItemStatus.InReview => "in_review",
|
||||
TaskItemStatus.Done => "done",
|
||||
TaskItemStatus.Canceled => "canceled",
|
||||
TaskItemStatus.Blocked => "blocked",
|
||||
TaskItemStatus.Archived => "archived",
|
||||
_ => "todo"
|
||||
};
|
||||
|
||||
public static TaskItemStatus Status(string? value) => value?.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"backlog" => TaskItemStatus.Backlog,
|
||||
"todo" => TaskItemStatus.Todo,
|
||||
"in_progress" => TaskItemStatus.InProgress,
|
||||
"in_review" => TaskItemStatus.InReview,
|
||||
"done" => TaskItemStatus.Done,
|
||||
"canceled" or "cancelled" => TaskItemStatus.Canceled,
|
||||
"blocked" => TaskItemStatus.Blocked,
|
||||
"archived" => TaskItemStatus.Archived,
|
||||
_ => TaskItemStatus.Todo
|
||||
};
|
||||
|
||||
public static string Of(TaskItemType type) => type switch
|
||||
{
|
||||
TaskItemType.Work => "work",
|
||||
TaskItemType.Approval => "approval",
|
||||
TaskItemType.HumanInput => "human_input",
|
||||
TaskItemType.ToolJob => "tool_job",
|
||||
_ => "work"
|
||||
};
|
||||
|
||||
public static TaskItemType Type(string? value) => value?.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"approval" => TaskItemType.Approval,
|
||||
"human_input" => TaskItemType.HumanInput,
|
||||
"tool_job" => TaskItemType.ToolJob,
|
||||
_ => TaskItemType.Work
|
||||
};
|
||||
|
||||
public static string Of(TaskWhenKind kind) => kind switch
|
||||
{
|
||||
TaskWhenKind.At => "at",
|
||||
TaskWhenKind.Every => "every",
|
||||
TaskWhenKind.Cron => "cron",
|
||||
_ => "cron"
|
||||
};
|
||||
|
||||
/// <summary>Gibt <c>null</c> zurück, wenn die Angabe keine bekannte Terminart ist.</summary>
|
||||
public static TaskWhenKind? WhenKind(string? value) => value?.Trim().ToLowerInvariant() switch
|
||||
{
|
||||
"at" => TaskWhenKind.At,
|
||||
"every" => TaskWhenKind.Every,
|
||||
"cron" => TaskWhenKind.Cron,
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user