diff options
| author | Christian Cleberg <[email protected]> | 2026-04-13 09:57:23 -0500 |
|---|---|---|
| committer | Christian Cleberg <[email protected]> | 2026-04-13 09:57:23 -0500 |
| commit | 0e461a382257979037e8927e5f6b468635b0a7fe (patch) | |
| tree | 0aa3a19f6f8f966b0e90f4874ed54359a7898107 /Hutch/Views/Repositories/RepositoryDetailView.swift | |
| parent | ee9f2904aa319231b7047fca3cb069f0c07019cd (diff) | |
| download | hutch-0e461a382257979037e8927e5f6b468635b0a7fe.tar.gz hutch-0e461a382257979037e8927e5f6b468635b0a7fe.tar.bz2 hutch-0e461a382257979037e8927e5f6b468635b0a7fe.zip | |
feat: add power user actions
Implements: https://todo.sr.ht/~ccleberg/hutch/52
Implements: https://todo.sr.ht/~ccleberg/hutch/53
Implements: https://todo.sr.ht/~ccleberg/hutch/54
Diffstat (limited to 'Hutch/Views/Repositories/RepositoryDetailView.swift')
| -rw-r--r-- | Hutch/Views/Repositories/RepositoryDetailView.swift | 75 |
1 files changed, 61 insertions, 14 deletions
diff --git a/Hutch/Views/Repositories/RepositoryDetailView.swift b/Hutch/Views/Repositories/RepositoryDetailView.swift index 0031e47..2715134 100644 --- a/Hutch/Views/Repositories/RepositoryDetailView.swift +++ b/Hutch/Views/Repositories/RepositoryDetailView.swift @@ -1,6 +1,8 @@ import SwiftUI struct RepositoryDetailView: View { + @Environment(\.openURL) private var openURL + let onRepositoryUpdated: ((RepositorySummary) -> Void)? var onDeleted: (() -> Void)? @@ -42,23 +44,11 @@ struct RepositoryDetailView: View { .navigationBarTitleDisplayMode(.inline) .toolbar { ToolbarItemGroup(placement: .topBarTrailing) { + repositoryActionsMenu + SRHTShareButton(url: SRHTWebURL.repository(currentRepository), target: .repository) { Image(systemName: "square.and.arrow.up") } - - if canManageRepository { - Button { - showACLs = true - } label: { - Image(systemName: "person.2") - } - - Button { - showSettings = true - } label: { - Image(systemName: "gear") - } - } } } .sheet(isPresented: $showSettings) { @@ -137,4 +127,61 @@ struct RepositoryDetailView: View { let trimmed = value.trimmingCharacters(in: .whitespacesAndNewlines) return trimmed.hasPrefix("~") ? String(trimmed.dropFirst()) : trimmed } + + private var repositoryActionsMenu: some View { + Menu { + if let repositoryURL = SRHTWebURL.repository(currentRepository) { + Button { + openURL(repositoryURL) + } label: { + Label("Open in Browser", systemImage: "safari") + } + + Button { + appState.copyToPasteboard(repositoryURL.absoluteString, label: "repository URL") + } label: { + Label("Copy URL", systemImage: "doc.on.doc") + } + } + + if let httpsURL = SRHTWebURL.httpsCloneURL(currentRepository) { + Button { + appState.copyToPasteboard(httpsURL, label: "HTTPS clone URL") + } label: { + Label("Copy HTTPS URL", systemImage: "doc.on.doc") + } + } + + Button { + appState.copyToPasteboard(SRHTWebURL.sshCloneURL(currentRepository), label: "SSH clone URL") + } label: { + Label("Copy SSH URL", systemImage: "terminal") + } + + Button { + appState.copyToPasteboard(currentRepository.rid, label: "repository RID") + } label: { + Label("Copy RID", systemImage: "number") + } + + if canManageRepository { + Divider() + + Button { + showACLs = true + } label: { + Label("Manage ACLs", systemImage: "person.2") + } + + Button { + showSettings = true + } label: { + Label("Repository Settings", systemImage: "gear") + } + } + } label: { + Image(systemName: "ellipsis.circle") + } + .accessibilityLabel("Repository actions") + } } |
