From 9cd99c3e1c7e2620c34bfd9e78931e3b2b63aa8a Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Sun, 12 Apr 2026 19:58:20 -0500 Subject: feat: add projects list, detail view, and home pinning Implements: https://todo.sr.ht/~ccleberg/hutch/26 Implements: https://todo.sr.ht/~ccleberg/hutch/27 Implements: https://todo.sr.ht/~ccleberg/hutch/28 --- Hutch/Views/Home/HomeViewModel.swift | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Hutch/Views/Home/HomeViewModel.swift') diff --git a/Hutch/Views/Home/HomeViewModel.swift b/Hutch/Views/Home/HomeViewModel.swift index ec2b324..e9f0f50 100644 --- a/Hutch/Views/Home/HomeViewModel.swift +++ b/Hutch/Views/Home/HomeViewModel.swift @@ -195,6 +195,10 @@ final class HomeViewModel { private let ticketFetchConcurrencyLimit = 6 private let inboxUnreadConcurrencyLimit = 4 + private var currentUserKey: String { + currentUser.canonicalName + } + private static let jobsQuery = """ query jobs { jobs { @@ -392,7 +396,15 @@ final class HomeViewModel { } var hasDashboardContent: Bool { - !projects.isEmpty || !assignedTickets.isEmpty || !recentBuilds.isEmpty || !unreadInboxThreads.isEmpty || systemStatusSnapshot != nil + !pinnedProjects.isEmpty || !assignedTickets.isEmpty || !recentBuilds.isEmpty || !unreadInboxThreads.isEmpty || systemStatusSnapshot != nil + } + + var pinnedProjects: [Project] { + let pinnedIDs = ProjectPinStore.loadPinnedProjectIDs(for: currentUserKey) + guard !pinnedIDs.isEmpty else { return [] } + + let projectsByID = Dictionary(uniqueKeysWithValues: projects.map { ($0.id, $0) }) + return pinnedIDs.compactMap { projectsByID[$0] } } var failedBuildCount: Int { -- cgit v1.2.3