Manual task reordering feature (#6)

This PR contains the work done to add support for manual todo task reordering in the *Task list* view

Reviewed-on: rock-n-code/todos-app#6
Co-authored-by: Javier Cicchelli <javier@rock-n-code.com>
Co-committed-by: Javier Cicchelli <javier@rock-n-code.com>
This commit was merged in pull request #6.
This commit is contained in:
2026-02-11 15:28:22 +00:00
committed by javier
parent cbf33302dd
commit ac0e0f6556
9 changed files with 298 additions and 101 deletions
+9 -14
View File
@@ -5,16 +5,6 @@ import SwiftUI
///
/// This enumeration provides a semantic grouping mechanism for organizing and filtering todo tasks throughout the application.
/// Each case represents a distinct category that helps users manage their tasks based on temporal relevance and completion state.
///
/// ## Features
/// - Provides localized titles and icons for each group
/// - Supports filtering of completed tasks within temporal groups
/// - Enables color-coded visual categorization
///
/// ## Groups
/// Groups are categorized into two types:
/// - **Temporal groups** (`.today`, `.upcoming`, `.overdue`): Time-based categorization that can optionally include completed tasks
/// - **Status group** (`.completed`): Contains all completed tasks regardless of due date
enum TodoGroup {
/// Tasks that have been marked as done, regardless of due date.
case completed
@@ -33,14 +23,19 @@ extension TodoGroup {
/// Indicates whether this group supports toggling the visibility of completed tasks.
///
/// This property determines if a show/hide completed tasks action should be available for the group.
///
/// - Returns: `true` for temporal groups (`.today`, `.upcoming`, `.overdue`) that can optionally
/// show or hide completed tasks. Returns `false` for the `.completed` group since it exclusively
/// displays completed tasks.
var canShowCompleted: Bool {
self != .completed
}
/// Indicates whether tasks in this group can be reordered through drag and drop.
///
/// This property determines if the user should be able to manually reorder tasks within the group.
/// Reordering is useful for temporal groups where users may want to prioritize certain tasks,
/// but is disabled for completed tasks since they are typically sorted by completion date.
var canReorder: Bool {
self != .completed
}
/// The color associated with the task group.
var color: Color {
switch self {