mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
show title edit sheets from context menu taps
This commit is contained in:
parent
fc01a6b7db
commit
f7172f02b1
7 changed files with 37 additions and 5 deletions
|
|
@ -55,6 +55,9 @@ import Views
|
|||
.sheet(item: $viewModel.itemUnderLabelEdit) { item in
|
||||
ApplyLabelsView(mode: .item(item), onSave: nil)
|
||||
}
|
||||
.sheet(item: $viewModel.itemUnderTitleEdit) { item in
|
||||
LinkedItemTitleEditView(item: item)
|
||||
}
|
||||
.toolbar {
|
||||
ToolbarItem(placement: .barTrailing) {
|
||||
Button("", action: {})
|
||||
|
|
@ -231,7 +234,7 @@ import Views
|
|||
)
|
||||
.contextMenu {
|
||||
Button(
|
||||
action: { print("show edit modal") },
|
||||
action: { viewModel.itemUnderTitleEdit = item },
|
||||
label: { Label("Edit Title/Description", systemImage: "textbox") }
|
||||
)
|
||||
Button(
|
||||
|
|
@ -348,6 +351,8 @@ import Views
|
|||
confirmationShown = true
|
||||
case .editLabels:
|
||||
viewModel.itemUnderLabelEdit = item
|
||||
case .editTitle:
|
||||
viewModel.itemUnderTitleEdit = item
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -27,7 +27,7 @@ import Views
|
|||
)
|
||||
.contextMenu {
|
||||
Button(
|
||||
action: { print("show edit modal") },
|
||||
action: { viewModel.itemUnderTitleEdit = item },
|
||||
label: { Label("Edit Title/Description", systemImage: "textbox") }
|
||||
)
|
||||
Button(
|
||||
|
|
|
|||
|
|
@ -14,6 +14,7 @@ import Views
|
|||
@Published var isLoading = false
|
||||
@Published var showPushNotificationPrimer = false
|
||||
@Published var itemUnderLabelEdit: LinkedItem?
|
||||
@Published var itemUnderTitleEdit: LinkedItem?
|
||||
@Published var searchTerm = ""
|
||||
@Published var selectedLabels = [LinkedItemLabel]()
|
||||
@Published var negatedLabels = [LinkedItemLabel]()
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@ struct LinkItemDetailView: View {
|
|||
static let navBarHeight = 50.0
|
||||
@ObservedObject private var viewModel: LinkItemDetailViewModel
|
||||
@State private var showFontSizePopover = false
|
||||
@State private var showTitleEdit = false
|
||||
@State private var navBarVisibilityRatio = 1.0
|
||||
@State private var showDeleteConfirmation = false
|
||||
|
||||
|
|
@ -207,7 +208,7 @@ struct LinkItemDetailView: View {
|
|||
content: {
|
||||
Group {
|
||||
Button(
|
||||
action: { print("show edit modal") },
|
||||
action: { showTitleEdit = true },
|
||||
label: { Label("Edit Title/Description", systemImage: "textbox") }
|
||||
)
|
||||
Button(
|
||||
|
|
@ -244,6 +245,11 @@ struct LinkItemDetailView: View {
|
|||
}
|
||||
Button("Cancel", role: .cancel, action: {})
|
||||
}
|
||||
.sheet(isPresented: $showTitleEdit) {
|
||||
if let item = viewModel.item {
|
||||
LinkedItemTitleEditView(item: item)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#if os(iOS)
|
||||
|
|
|
|||
|
|
@ -0,0 +1,15 @@
|
|||
import Models
|
||||
import Services
|
||||
import SwiftUI
|
||||
|
||||
struct LinkedItemTitleEditView: View {
|
||||
@EnvironmentObject var dataService: DataService
|
||||
@Environment(\.presentationMode) private var presentationMode
|
||||
// @StateObject var viewModel = LabelsViewModel()
|
||||
|
||||
let item: LinkedItem
|
||||
|
||||
var body: some View {
|
||||
Text(item.title ?? "unknown item")
|
||||
}
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import WebKit
|
|||
|
||||
@State private var showPreferencesPopover = false
|
||||
@State private var showLabelsModal = false
|
||||
@State private var showTitleEdit = false
|
||||
@State var showHighlightAnnotationModal = false
|
||||
@State var safariWebLink: SafariWebLink?
|
||||
@State private var navBarVisibilityRatio = 1.0
|
||||
|
|
@ -83,7 +84,7 @@ import WebKit
|
|||
content: {
|
||||
Group {
|
||||
Button(
|
||||
action: { print("show edit modal") },
|
||||
action: { showTitleEdit = true },
|
||||
label: { Label("Edit Title/Description", systemImage: "textbox") }
|
||||
)
|
||||
Button(
|
||||
|
|
@ -134,6 +135,9 @@ import WebKit
|
|||
.sheet(isPresented: $showLabelsModal) {
|
||||
ApplyLabelsView(mode: .item(item), onSave: { _ in showLabelsModal = false })
|
||||
}
|
||||
.sheet(isPresented: $showTitleEdit) {
|
||||
LinkedItemTitleEditView(item: item)
|
||||
}
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ public enum GridCardAction {
|
|||
case toggleArchiveStatus
|
||||
case delete
|
||||
case editLabels
|
||||
case editTitle
|
||||
}
|
||||
|
||||
public struct GridCard: View {
|
||||
|
|
@ -44,7 +45,7 @@ public struct GridCard: View {
|
|||
var contextMenuView: some View {
|
||||
Group {
|
||||
Button(
|
||||
action: { print("show edit modal") },
|
||||
action: { menuActionHandler(.editTitle) },
|
||||
label: { Label("Edit Title/Description", systemImage: "textbox") }
|
||||
)
|
||||
Button(
|
||||
|
|
|
|||
Loading…
Reference in a new issue