aboutsummaryrefslogtreecommitdiff
path: root/Sources/NorgUI/Extensions/TaskStatus+UI.swift
diff options
context:
space:
mode:
Diffstat (limited to 'Sources/NorgUI/Extensions/TaskStatus+UI.swift')
-rw-r--r--Sources/NorgUI/Extensions/TaskStatus+UI.swift24
1 files changed, 24 insertions, 0 deletions
diff --git a/Sources/NorgUI/Extensions/TaskStatus+UI.swift b/Sources/NorgUI/Extensions/TaskStatus+UI.swift
new file mode 100644
index 0000000..e54e511
--- /dev/null
+++ b/Sources/NorgUI/Extensions/TaskStatus+UI.swift
@@ -0,0 +1,24 @@
+import Foundation
+import NorgKit
+
+/// Adds UI rendering labels for TaskStatus.
+extension TaskStatus {
+
+ /// A localized, human-readable name for the status.
+ public var displayName: LocalizedStringResource {
+ switch self {
+ case .undone: return Self.label("Undone")
+ case .done: return Self.label("Done")
+ case .needsInput: return Self.label("Needs input")
+ case .urgent: return Self.label("Urgent")
+ case .recurring: return Self.label("Recurring")
+ case .pending: return Self.label("Pending")
+ case .onHold: return Self.label("On hold")
+ case .cancelled: return Self.label("Cancelled")
+ }
+ }
+
+ private static func label(_ value: String.LocalizationValue) -> LocalizedStringResource {
+ LocalizedStringResource(value, bundle: .atURL(Bundle.module.bundleURL))
+ }
+}