diff options
| author | Christian Cleberg <[email protected]> | 2026-04-13 13:09:57 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-13 13:09:57 -0500 |
| commit | f5f5757d0e1b78470429ae7cb9f742c95662849b (patch) | |
| tree | 758f67965a985f4f1f52a456d9b672f8256851de /Hutch/Views/Tickets/TicketListView.swift | |
| parent | 0e461a382257979037e8927e5f6b468635b0a7fe (diff) | |
| download | hutch-3.0.0.tar.gz hutch-3.0.0.tar.bz2 hutch-3.0.0.zip | |
release: v3.0.0 — navigation overhaul, Work view, and multi-pin supportv3.0.0
Reworks the app's core navigation and home screen for v3.0.0:
- Replace Inbox with Work view: unified dashboard showing unread threads
and assigned tickets, with All/Unread/Assigned scope picker
- Overhaul Home screen: redesigned with pinned items grid (trackers,
repos, mailing lists, users), recent activity section, and system
status banner; backed by HomePinStore supporting all resource types
- Simplify navigation bars across list screens: default toolbar shows
only the primary action (+) and an overflow menu (…); pin, share, and
select moved into the overflow menu; selection mode gets its own nav
bar with Cancel / "N Selected" / All
- Consolidate repo detail toolbars: pin and share moved into the
existing actions menu for both Git and Mercurial detail views
- Add recent activity tracking via RecentActivityStore
- Add work and inbox deep link aliases (hutch://work, hutch://inbox)
Implements: https://todo.sr.ht/~ccleberg/hutch/55
Diffstat (limited to 'Hutch/Views/Tickets/TicketListView.swift')
| -rw-r--r-- | Hutch/Views/Tickets/TicketListView.swift | 64 |
1 files changed, 49 insertions, 15 deletions
diff --git a/Hutch/Views/Tickets/TicketListView.swift b/Hutch/Views/Tickets/TicketListView.swift index f7529fb..8f7d348 100644 --- a/Hutch/Views/Tickets/TicketListView.swift +++ b/Hutch/Views/Tickets/TicketListView.swift @@ -23,12 +23,29 @@ struct TicketListView: View { @State private var showBulkCloseSheet = false @State private var showBulkAssignSheet = false @State private var bulkActionResult: TicketBulkActionResult? + @State private var pinChangeCount = 0 private var isOwnedByCurrentUser: Bool { guard let currentUser = appState.currentUser else { return false } return normalizedUsername(currentUser.username) == normalizedUsername(tracker.owner.canonicalName) } + private var currentUserKey: String? { + appState.currentUser?.canonicalName + } + + private var isPinnedToHome: Bool { + _ = pinChangeCount + guard let currentUserKey else { return false } + return HomePinStore.isPinned(.tracker(tracker), for: currentUserKey, defaults: appState.accountDefaults) + } + + private var navigationTitle: String { + guard let viewModel, viewModel.isSelectionMode else { return tracker.name } + let count = viewModel.selectedTicketCount + return count == 0 ? "Select Tickets" : "\(count) Selected" + } + init( tracker: TrackerSummary, onTrackerUpdated: @escaping (TrackerSummary) -> Void = { _ in /* no-op: default for callers that don't handle this event */ }, @@ -47,7 +64,7 @@ struct TicketListView: View { SRHTLoadingStateView(message: "Loading tickets…") } } - .navigationTitle(tracker.name) + .navigationTitle(navigationTitle) .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItem(placement: .topBarLeading) { @@ -66,16 +83,6 @@ struct TicketListView: View { } .disabled(viewModel.filteredTickets.isEmpty || viewModel.isPerformingAction) } else { - SRHTShareButton( - url: SRHTWebURL.tracker( - ownerUsername: String(tracker.owner.canonicalName.dropFirst()), - trackerName: tracker.name - ), - target: .tracker - ) { - Image(systemName: "square.and.arrow.up") - } - Button { showCreateTicketSheet = true } label: { @@ -83,10 +90,6 @@ struct TicketListView: View { } .accessibilityLabel("Create ticket") - Button("Select") { - viewModel?.setSelectionMode(true) - } - trackerActionsMenu } } @@ -242,6 +245,12 @@ struct TicketListView: View { } } + private func togglePinnedState() { + guard let currentUserKey else { return } + HomePinStore.togglePin(.tracker(tracker), for: currentUserKey, defaults: appState.accountDefaults) + pinChangeCount += 1 + } + @ViewBuilder private func listContent(_ viewModel: TicketListViewModel) -> some View { @Bindable var vm = viewModel @@ -429,6 +438,31 @@ struct TicketListView: View { private var trackerActionsMenu: some View { Menu { + Button { + viewModel?.setSelectionMode(true) + } label: { + Label("Select", systemImage: "checkmark.circle") + } + + if currentUserKey != nil { + Button { + togglePinnedState() + } label: { + Label( + isPinnedToHome ? "Unpin from Home" : "Pin to Home", + systemImage: isPinnedToHome ? "pin.slash" : "pin" + ) + } + } + + if let shareURL = SRHTWebURL.tracker(tracker) { + ShareLink(item: shareURL) { + Label("Share", systemImage: "square.and.arrow.up") + } + } + + Divider() + if let trackerURL = SRHTWebURL.tracker(tracker) { Button { openURL(trackerURL) |
