mirror of
https://github.com/Ranchero-Software/NetNewsWire.git
synced 2024-12-27 18:12:30 +01:00
Tidy up
This commit is contained in:
parent
f4deab1361
commit
771fe21422
@ -14,7 +14,7 @@ import RSCore
|
|||||||
struct AddWebFeedView: View {
|
struct AddWebFeedView: View {
|
||||||
|
|
||||||
@Environment(\.presentationMode) private var presentationMode
|
@Environment(\.presentationMode) private var presentationMode
|
||||||
@ObservedObject private var viewModel = AddWebFeedModel()
|
@StateObject private var viewModel = AddWebFeedModel()
|
||||||
|
|
||||||
@ViewBuilder var body: some View {
|
@ViewBuilder var body: some View {
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
@ -27,14 +27,15 @@ struct AddWebFeedView: View {
|
|||||||
presentationMode.wrappedValue.dismiss()
|
presentationMode.wrappedValue.dismiss()
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
#else
|
#else
|
||||||
macForm
|
macForm
|
||||||
.onAppear {
|
.onAppear {
|
||||||
viewModel.pasteUrlFromPasteboard()
|
viewModel.pasteUrlFromPasteboard()
|
||||||
}.alert(isPresented: $viewModel.showError) {
|
}.alert(isPresented: $viewModel.showError) {
|
||||||
Alert(title: Text("Oops"), message: Text(viewModel.addFeedError!.localizedDescription), dismissButton: Alert.Button.cancel({
|
Alert(title: Text("Oops"),
|
||||||
viewModel.addFeedError = AddWebFeedError.none
|
message: Text(viewModel.addFeedError!.localizedDescription),
|
||||||
|
dismissButton: Alert.Button.cancel({
|
||||||
|
viewModel.addFeedError = AddWebFeedError.none
|
||||||
}))
|
}))
|
||||||
}.onReceive(viewModel.$shouldDismiss, perform: { dismiss in
|
}.onReceive(viewModel.$shouldDismiss, perform: { dismiss in
|
||||||
if dismiss == true {
|
if dismiss == true {
|
||||||
@ -59,7 +60,6 @@ struct AddWebFeedView: View {
|
|||||||
}.padding()
|
}.padding()
|
||||||
|
|
||||||
LazyVGrid(columns: [GridItem(.fixed(75), spacing: 10, alignment: .trailing),GridItem(.fixed(400), spacing: 0, alignment: .leading) ], alignment: .leading, spacing: 10, pinnedViews: [], content:{
|
LazyVGrid(columns: [GridItem(.fixed(75), spacing: 10, alignment: .trailing),GridItem(.fixed(400), spacing: 0, alignment: .leading) ], alignment: .leading, spacing: 10, pinnedViews: [], content:{
|
||||||
|
|
||||||
Text("URL:").bold()
|
Text("URL:").bold()
|
||||||
urlTextField
|
urlTextField
|
||||||
.textFieldStyle(RoundedBorderTextFieldStyle())
|
.textFieldStyle(RoundedBorderTextFieldStyle())
|
||||||
@ -134,16 +134,20 @@ struct AddWebFeedView: View {
|
|||||||
if viewModel.containers[index] is Folder {
|
if viewModel.containers[index] is Folder {
|
||||||
HStack(alignment: .top) {
|
HStack(alignment: .top) {
|
||||||
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
|
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
|
||||||
Image(rsImage: image).foregroundColor(.accentColor)
|
Image(rsImage: image)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
}
|
}
|
||||||
Text("\(containerName)").tag(index)
|
Text("\(containerName)")
|
||||||
|
.tag(index)
|
||||||
}.padding(.leading, 16)
|
}.padding(.leading, 16)
|
||||||
} else {
|
} else {
|
||||||
HStack(alignment: .top) {
|
HStack(alignment: .top) {
|
||||||
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
|
if let image = viewModel.smallIconImage(for: viewModel.containers[index]) {
|
||||||
Image(rsImage: image).foregroundColor(.accentColor)
|
Image(rsImage: image)
|
||||||
|
.foregroundColor(.accentColor)
|
||||||
}
|
}
|
||||||
Text(containerName).tag(index)
|
Text(containerName)
|
||||||
|
.tag(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -159,13 +163,18 @@ struct AddWebFeedView: View {
|
|||||||
Image(rsImage: image)
|
Image(rsImage: image)
|
||||||
}
|
}
|
||||||
Text("\(containerName)")
|
Text("\(containerName)")
|
||||||
}.padding(.leading, 2).tag(index)
|
}
|
||||||
|
.padding(.leading, 2)
|
||||||
|
.tag(index)
|
||||||
} else {
|
} else {
|
||||||
Text(containerName).padding(.leading, 2).tag(index)
|
Text(containerName)
|
||||||
|
.padding(.leading, 2)
|
||||||
|
.tag(index)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}).padding(.leading, -8)
|
})
|
||||||
|
.padding(.leading, -8)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -188,7 +197,8 @@ struct AddWebFeedView: View {
|
|||||||
})
|
})
|
||||||
.disabled(!viewModel.providedURL.mayBeURL)
|
.disabled(!viewModel.providedURL.mayBeURL)
|
||||||
.help("Add Feed")
|
.help("Add Feed")
|
||||||
}.padding(.trailing, 2)
|
}
|
||||||
|
.padding(.trailing, 2)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user