diff options
| author | Christian Cleberg <[email protected]> | 2026-04-12 19:58:20 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-12 19:58:20 -0500 |
| commit | 9cd99c3e1c7e2620c34bfd9e78931e3b2b63aa8a (patch) | |
| tree | bf7a249bec3b9aba18176e6139d690c9bf384ab5 /Hutch/Views/Home/HomeViewModel.swift | |
| parent | 1354f2464180ece6d13296a543a964ddf6d2d393 (diff) | |
| download | hutch-9cd99c3e1c7e2620c34bfd9e78931e3b2b63aa8a.tar.gz hutch-9cd99c3e1c7e2620c34bfd9e78931e3b2b63aa8a.tar.bz2 hutch-9cd99c3e1c7e2620c34bfd9e78931e3b2b63aa8a.zip | |
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
Diffstat (limited to 'Hutch/Views/Home/HomeViewModel.swift')
| -rw-r--r-- | Hutch/Views/Home/HomeViewModel.swift | 14 |
1 files changed, 13 insertions, 1 deletions
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 { |
