Move toolbar from ContentView to PostLIstView

This commit is contained in:
Angelo Stavrow 2020-12-17 11:27:58 -05:00
parent c4e9089e76
commit 0b0fdd81a1
No known key found for this signature in database
GPG Key ID: 1A49C7064E060EEE
2 changed files with 19 additions and 19 deletions

View File

@ -53,25 +53,6 @@ struct ContentView: View {
#if os(macOS) #if os(macOS)
ZStack { ZStack {
PostListView(selectedCollection: nil, showAllPosts: model.account.isLoggedIn) PostListView(selectedCollection: nil, showAllPosts: model.account.isLoggedIn)
.toolbar {
ToolbarItemGroup(placement: .primaryAction) {
if let selectedPost = model.selectedPost {
ActivePostToolbarView(activePost: selectedPost)
.alert(isPresented: $model.isPresentingNetworkErrorAlert, content: {
Alert(
title: Text("Connection Error"),
message: Text("""
There is no internet connection at the moment. \
Please reconnect or try again later.
"""),
dismissButton: .default(Text("OK"), action: {
model.isPresentingNetworkErrorAlert = false
})
)
})
}
}
}
if model.isProcessingRequest { if model.isProcessingRequest {
ZStack { ZStack {
Color(NSColor.controlBackgroundColor).opacity(0.75) Color(NSColor.controlBackgroundColor).opacity(0.75)

View File

@ -84,6 +84,25 @@ struct PostListView: View {
showAllPosts: showAllPosts, showAllPosts: showAllPosts,
postCount: $postCount postCount: $postCount
) )
.toolbar {
ToolbarItemGroup(placement: .primaryAction) {
if let selectedPost = model.selectedPost {
ActivePostToolbarView(activePost: selectedPost)
.alert(isPresented: $model.isPresentingNetworkErrorAlert, content: {
Alert(
title: Text("Connection Error"),
message: Text("""
There is no internet connection at the moment. \
Please reconnect or try again later.
"""),
dismissButton: .default(Text("OK"), action: {
model.isPresentingNetworkErrorAlert = false
})
)
})
}
}
}
.onDisappear { .onDisappear {
DispatchQueue.main.async { DispatchQueue.main.async {
self.model.selectedCollection = nil self.model.selectedCollection = nil