From f5f5757d0e1b78470429ae7cb9f742c95662849b Mon Sep 17 00:00:00 2001 From: Christian Cleberg Date: Mon, 13 Apr 2026 13:09:57 -0500 Subject: release: v3.0.0 — navigation overhaul, Work view, and multi-pin support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- .../Repositories/HgRepositoryDetailView.swift | 63 ++++++++++++++++++---- 1 file changed, 52 insertions(+), 11 deletions(-) (limited to 'Hutch/Views/Repositories/HgRepositoryDetailView.swift') diff --git a/Hutch/Views/Repositories/HgRepositoryDetailView.swift b/Hutch/Views/Repositories/HgRepositoryDetailView.swift index 4a61c1d..ac7c04f 100644 --- a/Hutch/Views/Repositories/HgRepositoryDetailView.swift +++ b/Hutch/Views/Repositories/HgRepositoryDetailView.swift @@ -19,12 +19,23 @@ struct HgRepositoryDetailView: View { @State private var showShareUnavailableAlert = false @State private var didCopyFileContents = false @State private var copyResetTask: Task? + @State private var pinChangeCount = 0 private var canManageRepository: Bool { guard let currentUser = appState.currentUser else { return false } return normalizedUsername(currentUser.username) == normalizedUsername(repository.owner.canonicalName) } + private var currentUserKey: String? { + appState.currentUser?.canonicalName + } + + private var isPinnedToHome: Bool { + _ = pinChangeCount + guard let currentUserKey else { return false } + return HomePinStore.isPinned(.repository(repository), for: currentUserKey, defaults: appState.accountDefaults) + } + private var shareURL: URL? { guard let viewModel, let selectedFilePath = viewModel.selectedFilePath else { return nil } return SRHTWebURL.file( @@ -58,17 +69,7 @@ struct HgRepositoryDetailView: View { } } - SRHTShareButton(url: SRHTWebURL.repository(repository), target: .repository) { - Image(systemName: "square.and.arrow.up") - } - - if canManageRepository { - Button { - showSettings = true - } label: { - Image(systemName: "gear") - } - } + repositoryActionsMenu } } .sheet(isPresented: $showSettings) { @@ -106,6 +107,46 @@ struct HgRepositoryDetailView: View { return trimmed.hasPrefix("~") ? String(trimmed.dropFirst()) : trimmed } + private func togglePinnedState() { + guard let currentUserKey else { return } + HomePinStore.togglePin(.repository(repository), for: currentUserKey, defaults: appState.accountDefaults) + pinChangeCount += 1 + } + + private var repositoryActionsMenu: some View { + Menu { + if currentUserKey != nil { + Button { + togglePinnedState() + } label: { + Label( + isPinnedToHome ? "Unpin from Home" : "Pin to Home", + systemImage: isPinnedToHome ? "pin.slash" : "pin" + ) + } + } + + if let shareURL = SRHTWebURL.repository(repository) { + ShareLink(item: shareURL) { + Label("Share", systemImage: "square.and.arrow.up") + } + } + + if canManageRepository { + Divider() + + Button { + showSettings = true + } label: { + Label("Repository Settings", systemImage: "gear") + } + } + } label: { + Image(systemName: "ellipsis.circle") + } + .accessibilityLabel("Repository actions") + } + @ViewBuilder private func content(_ viewModel: HgRepositoryDetailViewModel) -> some View { VStack(spacing: 0) { -- cgit v1.2.3