Skip to content

armgit / peel

Public Imported from GitHub
0

Uninstall Mac apps with every file they leave behind, and see why each belongs. Free up space, fine-tune macOS, and set up Terminal.

Show an extension's state with a colored symbol and secondary words

Țugui Dragoș33f4b108d273
diff --git a/Peel/Model/ExtensionLibrary.swift b/Peel/Model/ExtensionLibrary.swift
index 051963fc..b1d74754 100644
--- a/Peel/Model/ExtensionLibrary.swift
+++ b/Peel/Model/ExtensionLibrary.swift
@@ -79,8 +79,13 @@ extension AppExtension.Election {
}
}
- /// Waiting for approval is the only state the user can do something about.
- var needsAttention: Bool {
- self == .waitingForApproval
+ /// The symbol the list shows in the accent color beside a choice someone made, and beside waiting for approval,
+ /// the only state the user can do something about.
+ var mark: String? {
+ switch self {
+ case .on: "checkmark.circle"
+ case .waitingForApproval: "exclamationmark.circle"
+ default: nil
+ }
}
}
diff --git a/Peel/Views/Extensions/ExtensionList.swift b/Peel/Views/Extensions/ExtensionList.swift
index 6fea02d0..a5d768f6 100644
--- a/Peel/Views/Extensions/ExtensionList.swift
+++ b/Peel/Views/Extensions/ExtensionList.swift
@@ -104,14 +104,15 @@ private struct ExtensionRow: View {
}
} trailing: {
if item.election != .asItCame {
- HStack(spacing: 3) {
- if item.election.needsAttention {
- Image(systemName: "exclamationmark.circle")
+ Group {
+ if let mark = item.election.mark {
+ StatusLabel(title: Text(item.election.title), systemImage: mark, tint: .accentColor)
+ } else {
+ Text(item.election.title)
}
- Text(item.election.title)
}
.font(.caption)
- .rowTint(item.election == .on || item.election.needsAttention ? Color.accentColor : nil)
+ .foregroundStyle(.secondary)
}
}
}