summaryrefslogtreecommitdiff
path: root/Hutch/Views/Home/HomeViewModel.swift
diff options
context:
space:
mode:
authorChristian Cleberg <[email protected]>2026-04-12 22:06:16 -0500
committerChristian Cleberg <[email protected]>2026-04-12 22:06:16 -0500
commit86bcd9452d3107f68aca085e03e69b02667c0dbb (patch)
tree8b0adece5cb0f8ffb178eaab2cd12d025c9ebf0a /Hutch/Views/Home/HomeViewModel.swift
parent31cbca674957eea7ae2529012e20a9d95158e561 (diff)
downloadhutch-86bcd9452d3107f68aca085e03e69b02667c0dbb.tar.gz
hutch-86bcd9452d3107f68aca085e03e69b02667c0dbb.tar.bz2
hutch-86bcd9452d3107f68aca085e03e69b02667c0dbb.zip
feat: polish read-only project views and home integration
Refs: https://todo.sr.ht/~ccleberg/hutch/36 Refs: https://todo.sr.ht/~ccleberg/hutch/37 Refs: https://todo.sr.ht/~ccleberg/hutch/38
Diffstat (limited to 'Hutch/Views/Home/HomeViewModel.swift')
-rw-r--r--Hutch/Views/Home/HomeViewModel.swift11
1 files changed, 9 insertions, 2 deletions
diff --git a/Hutch/Views/Home/HomeViewModel.swift b/Hutch/Views/Home/HomeViewModel.swift
index e9f0f50..682c94d 100644
--- a/Hutch/Views/Home/HomeViewModel.swift
+++ b/Hutch/Views/Home/HomeViewModel.swift
@@ -185,6 +185,7 @@ final class HomeViewModel {
private(set) var isLoadingProjects = false
private(set) var isLoadingAssignedTickets = false
private(set) var isLoadingRecentBuilds = false
+ private(set) var projectsError: String?
private(set) var assignedTicketsError: String?
private(set) var recentBuildsError: String?
@@ -332,6 +333,7 @@ final class HomeViewModel {
isLoadingAssignedTickets = true
isLoadingRecentBuilds = true
isLoadingSystemStatus = true
+ projectsError = nil
assignedTicketsError = nil
recentBuildsError = nil
isShowingStaleSystemStatus = false
@@ -347,8 +349,9 @@ final class HomeViewModel {
switch projectsResult {
case .success(let projects):
self.projects = projects
- case .failure:
- self.projects = []
+ self.projectsError = nil
+ case .failure(let error):
+ self.projectsError = error.userFacingMessage
}
isLoadingProjects = false
@@ -407,6 +410,10 @@ final class HomeViewModel {
return pinnedIDs.compactMap { projectsByID[$0] }
}
+ var hasPinnedProjects: Bool {
+ !ProjectPinStore.loadPinnedProjectIDs(for: currentUserKey).isEmpty
+ }
+
var failedBuildCount: Int {
recentBuilds.filter {
switch $0.job.status {