diff options
| author | Ruben Beltran del Rio <jj@r.bdr.sh> | 2026-06-15 14:35:36 +0200 |
|---|---|---|
| committer | Ruben Beltran del Rio <jj@r.bdr.sh> | 2026-06-16 14:47:30 +0200 |
| commit | 657aa83a5ca24dc35572c040df64a0abb85e8612 (patch) | |
| tree | fe0b6fd425d8cad9dc6a28ada4ad8600e42b367e /Sources/NorgUI/Extensions/TaskStatus+UI.swift | |
Initial extraction from Norganize
Diffstat (limited to 'Sources/NorgUI/Extensions/TaskStatus+UI.swift')
| -rw-r--r-- | Sources/NorgUI/Extensions/TaskStatus+UI.swift | 24 |
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)) + } +} |