feat: Linear-style Task Board mit Drag&Drop
This commit is contained in:
@@ -19,7 +19,8 @@ public enum TaskState
|
||||
Backlog,
|
||||
InProgress,
|
||||
Blocked,
|
||||
Done
|
||||
Done,
|
||||
Review
|
||||
}
|
||||
|
||||
public static class TaskStateHelper
|
||||
@@ -29,7 +30,8 @@ public static class TaskStateHelper
|
||||
[TaskState.Backlog] = "Backlog",
|
||||
[TaskState.InProgress] = "In progress",
|
||||
[TaskState.Blocked] = "Blocked",
|
||||
[TaskState.Done] = "Done"
|
||||
[TaskState.Done] = "Done",
|
||||
[TaskState.Review] = "Review"
|
||||
};
|
||||
|
||||
private static readonly Dictionary<string, TaskState> StringToState = new(StringComparer.OrdinalIgnoreCase)
|
||||
@@ -37,11 +39,22 @@ public static class TaskStateHelper
|
||||
["Backlog"] = TaskState.Backlog,
|
||||
["In progress"] = TaskState.InProgress,
|
||||
["Blocked"] = TaskState.Blocked,
|
||||
["Done"] = TaskState.Done
|
||||
["Done"] = TaskState.Done,
|
||||
["Review"] = TaskState.Review
|
||||
};
|
||||
|
||||
/// <summary>Mapping from state string to display label.</summary>
|
||||
private static readonly Dictionary<string, string> DisplayLabels = new(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["Backlog"] = "Offen",
|
||||
["In progress"] = "In Bearbeitung",
|
||||
["Review"] = "Review",
|
||||
["Blocked"] = "Blockiert",
|
||||
["Done"] = "Erledigt"
|
||||
};
|
||||
|
||||
/// <summary>Valid task-state string values for API validation.</summary>
|
||||
public static readonly string[] AllStates = ["Backlog", "In progress", "Blocked", "Done"];
|
||||
public static readonly string[] AllStates = ["Backlog", "In progress", "Blocked", "Done", "Review"];
|
||||
|
||||
/// <summary>Convert a TaskState enum to its API string representation.</summary>
|
||||
public static string ToStateString(this TaskState state) => StateToString[state];
|
||||
@@ -54,6 +67,10 @@ public static class TaskStateHelper
|
||||
public static bool IsValidState(string? state) =>
|
||||
!string.IsNullOrWhiteSpace(state) && StringToState.ContainsKey(state);
|
||||
|
||||
/// <summary>Returns the German display label for a state string.</summary>
|
||||
public static string ToDisplayString(string? state) =>
|
||||
state is not null && DisplayLabels.TryGetValue(state, out var label) ? label : state ?? "";
|
||||
|
||||
public static bool IsInProgressOrBlocked(string? state) =>
|
||||
string.Equals(state, "In progress", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(state, "Blocked", StringComparison.OrdinalIgnoreCase);
|
||||
@@ -61,6 +78,38 @@ public static class TaskStateHelper
|
||||
public static bool IsDoneOrBacklog(string? state) =>
|
||||
string.Equals(state, "Done", StringComparison.OrdinalIgnoreCase)
|
||||
|| string.Equals(state, "Backlog", StringComparison.OrdinalIgnoreCase);
|
||||
|
||||
/// <summary>Group key for board responses (lowercased English state).</summary>
|
||||
public static string BoardGroupKey(string? state)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(state)) return "offen";
|
||||
var lower = state.ToLowerInvariant();
|
||||
return lower switch
|
||||
{
|
||||
"backlog" => "offen",
|
||||
"in progress" => "inProgress",
|
||||
"review" => "review",
|
||||
"blocked" => "blocked",
|
||||
"done" => "done",
|
||||
_ => "offen"
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>Map a board group key back to the canonical state string.</summary>
|
||||
public static string? BoardGroupToState(string? groupKey)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(groupKey)) return null;
|
||||
var lower = groupKey.ToLowerInvariant();
|
||||
return lower switch
|
||||
{
|
||||
"offen" => "Backlog",
|
||||
"inprogress" => "In progress",
|
||||
"review" => "Review",
|
||||
"blocked" => "Blocked",
|
||||
"done" => "Done",
|
||||
_ => null
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
public sealed class Project
|
||||
|
||||
Reference in New Issue
Block a user