mirror of
https://github.com/writeas/writefreely-swiftui-multiplatform.git
synced 2024-11-15 01:11:02 +00:00
Ensure showAllPosts is false when navigating to a given blog
This commit is contained in:
parent
1acd25ad42
commit
3b6c7748e8
@ -18,15 +18,16 @@ struct CollectionListView: View {
|
|||||||
model.selectedCollection == nil && model.showAllPosts
|
model.selectedCollection == nil && model.showAllPosts
|
||||||
}, set: { newValue in
|
}, set: { newValue in
|
||||||
if newValue {
|
if newValue {
|
||||||
self.model.selectedCollection = nil
|
|
||||||
self.model.showAllPosts = true
|
self.model.showAllPosts = true
|
||||||
|
self.model.selectedCollection = nil
|
||||||
} else {
|
} else {
|
||||||
// No-op
|
// No-op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)) {
|
),
|
||||||
|
label: {
|
||||||
Text("All Posts")
|
Text("All Posts")
|
||||||
}
|
})
|
||||||
NavigationLink(
|
NavigationLink(
|
||||||
destination: PostListView(),
|
destination: PostListView(),
|
||||||
isActive: Binding<Bool>(
|
isActive: Binding<Bool>(
|
||||||
@ -34,27 +35,38 @@ struct CollectionListView: View {
|
|||||||
model.selectedCollection == nil && !model.showAllPosts
|
model.selectedCollection == nil && !model.showAllPosts
|
||||||
}, set: { newValue in
|
}, set: { newValue in
|
||||||
if newValue {
|
if newValue {
|
||||||
self.model.selectedCollection = nil
|
|
||||||
self.model.showAllPosts = false
|
self.model.showAllPosts = false
|
||||||
|
self.model.selectedCollection = nil
|
||||||
} else {
|
} else {
|
||||||
// No-op
|
// No-op
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
)) {
|
),
|
||||||
|
label: {
|
||||||
Text(model.account.server == "https://write.as" ? "Anonymous" : "Drafts")
|
Text(model.account.server == "https://write.as" ? "Anonymous" : "Drafts")
|
||||||
}
|
})
|
||||||
Section(header: Text("Your Blogs")) {
|
Section(header: Text("Your Blogs")) {
|
||||||
ForEach(collections, id: \.alias) { collection in
|
ForEach(collections, id: \.alias) { collection in
|
||||||
NavigationLink(
|
NavigationLink(
|
||||||
collection.title,
|
|
||||||
destination: PostListView(),
|
destination: PostListView(),
|
||||||
tag: collection,
|
isActive: Binding<Bool>(
|
||||||
selection: $model.selectedCollection
|
get: { () -> Bool in
|
||||||
|
model.selectedCollection == collection && !model.showAllPosts
|
||||||
|
}, set: { newValue in
|
||||||
|
if newValue {
|
||||||
|
self.model.showAllPosts = false
|
||||||
|
self.model.selectedCollection = collection
|
||||||
|
} else {
|
||||||
|
// No-op
|
||||||
|
}
|
||||||
|
}
|
||||||
|
),
|
||||||
|
label: { Text(collection.title) }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
NavigationLink(destination: PostListView(selectedCollection: nil, showAllPosts: false)) {
|
NavigationLink(destination: PostListView()) {
|
||||||
Text("Drafts")
|
Text("Drafts")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user