mirror of
https://github.com/maxgoedjen/secretive.git
synced 2026-05-07 16:08:58 +02:00
* Sketching out. * WIP * WIP * Dump * Apply stash * Merge + WIP * UI * More WIP * Agent config * UI cleanup * Restore dirty files * XPC * Edit/delete * UI fixes * Cleanup * Change id for OpenSSHCertificate to hex of md5 * Fix runtime warning for confirmation dialog * Mark strings as reviewed * Cleanup * Fix agent tests
43 lines
1.3 KiB
Swift
43 lines
1.3 KiB
Swift
import SwiftUI
|
|
import CertificateKit
|
|
import SSHProtocolKit
|
|
|
|
struct CertificateListItemView: View {
|
|
|
|
@Environment(\.certificateStore) private var store
|
|
|
|
var certificate: OpenSSHCertificate
|
|
|
|
@State var isDeleting: Bool = false
|
|
@State var isRenaming: Bool = false
|
|
|
|
var deletedCertificate: (OpenSSHCertificate) -> Void
|
|
var renamedCertificate: (OpenSSHCertificate) -> Void
|
|
|
|
var body: some View {
|
|
NavigationLink(value: certificate) {
|
|
Text(certificate.name)
|
|
}
|
|
.sheet(isPresented: $isRenaming, onDismiss: {
|
|
renamedCertificate(certificate)
|
|
}, content: {
|
|
EditCertificateView(store: store, certificate: certificate)
|
|
})
|
|
.showingDeleteConfirmation(isPresented: $isDeleting, certificate, store) { deleted in
|
|
if deleted {
|
|
deletedCertificate(certificate)
|
|
}
|
|
}
|
|
.contextMenu {
|
|
Button(action: { isRenaming = true }) {
|
|
Image(systemName: "pencil")
|
|
Text(.secretListEditButton)
|
|
}
|
|
Button(action: { isDeleting = true }) {
|
|
Image(systemName: "trash")
|
|
Text(.secretListDeleteButton)
|
|
}
|
|
}
|
|
}
|
|
}
|